Roy Golan has uploaded a new change for review. Change subject: core: programatically inject backend into Commands ......................................................................
core: programatically inject backend into Commands Commands, specially storage commands must have backend instance in the constructor. - example CloneVmCommand constructor is running internalQuery This contradicts with DI as dependincies can be injected only after you have and instance in hand. So we're still can't use proper Injection of dependencies into commands. the real fix is to move parts that need dependencies into @PostConstruct methods. Change-Id: I38d2aa7f14f13cb71a00f9080e3ec97d8884eea3 Bug-Url: https://bugzilla.redhat.com/?????? Signed-off-by: Roy Golan <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java 1 file changed, 12 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/35741/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java index 486dac2..ecd7383 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java @@ -43,6 +43,7 @@ import org.ovirt.engine.core.bll.tasks.interfaces.Command; import org.ovirt.engine.core.bll.tasks.interfaces.CommandCallBack; import org.ovirt.engine.core.bll.tasks.interfaces.SPMTask; +import org.ovirt.engine.core.bll.utils.Injector; import org.ovirt.engine.core.bll.utils.PermissionSubject; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.VdcObjectType; @@ -110,9 +111,6 @@ @Inject private Instance<BackendCommandObjectsHandler> commandObjectsHandlerProvider; - - @Inject - private BackendInternal backend; /* Multiplier used to convert GB to bytes or vice versa. */ protected static final long BYTES_IN_GB = 1024 * 1024 * 1024; @@ -246,7 +244,7 @@ } protected BackendInternal getBackend() { - return backend; + return Injector.get(BackendInternal.class); } /** @@ -913,7 +911,8 @@ // Deny otherwise: if (log.isDebugEnabled()) { - log.debug("No permission found for user when running action '{}', on object '{}' for action group '{}' with id '{}'.", + log.debug( + "No permission found for user when running action '{}', on object '{}' for action group '{}' with id '{}'.", getActionType(), type.getVdcObjectTranslation(), actionGroup, @@ -955,7 +954,12 @@ type.name()); } final Guid permId = - getPermissionDAO().getEntityPermissionsForUserAndGroups(userId, StringUtils.join(groupIds, ","), actionGroup, object, type, ignoreEveryone); + getPermissionDAO().getEntityPermissionsForUserAndGroups(userId, + StringUtils.join(groupIds, ","), + actionGroup, + object, + type, + ignoreEveryone); if (permId != null) { if (log.isDebugEnabled()) { log.debug("Found permission '{}' for user when running '{}', on '{}' with id '{}'", @@ -969,7 +973,8 @@ // Deny otherwise: if (log.isDebugEnabled()) { - log.debug("No permission found for user when running action '{}', on object '{}' for action group '{}' with id '{}'.", + log.debug( + "No permission found for user when running action '{}', on object '{}' for action group '{}' with id '{}'.", getActionType(), type.getVdcObjectTranslation(), actionGroup, -- To view, visit http://gerrit.ovirt.org/35741 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I38d2aa7f14f13cb71a00f9080e3ec97d8884eea3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
