Daniel Erez has submitted this change and it was merged.
Change subject: core: CommandsBase: refactor task creation
......................................................................
core: CommandsBase: refactor task creation
In order to create async tasks, CommandBase expects inheriting classes
to override the ConcreteCreateTask method. For classes that do not
overwrite it, an UnsupportedOperationException is thrown.
However, most places that override this method contain the exact same
code, where the only difference is the type of the task created.
This patch suggests a new mechanism so that each inheriting class will
just need to specify what type of task it requires. For commands that do
not specify the type, an UnsupportedOperationException will still be
thrown.
This patch contains the refactoring in CommandBase, the first usecase
for this mechanism as an example (using CreateSnapshotCommand) and a
test case that proves that the behavior has not changed.
If this patch is approved, subsequent patches will apply the new
mechanism to further commands.
Change-Id: I5a4c77067d43ba5c2dbaf46ff855ac14d29de2ff
Signed-off-by: Allon Mureinik <amureini(a)redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateSnapshotCommand.java
A
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/BackwardCompatibilityTaskCreationTest.java
3 files changed, 142 insertions(+), 20 deletions(-)
Approvals:
Daniel Erez: Verified; Looks good to me, approved
--
To view, visit
http://gerrit.ovirt.org/7792
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5a4c77067d43ba5c2dbaf46ff855ac14d29de2ff
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Daniel Erez <derez(a)redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika(a)redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: Vered Volansky <vvolansk(a)redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs(a)redhat.com>