Allon Mureinik has submitted this change and it was merged. Change subject: engine: VdcActionUtils: Remove reflection ......................................................................
engine: VdcActionUtils: Remove reflection Improved VdcActionUtils performance and readability by removing the logic implemented by reflection and instead depend on proper Java interfaces. This patch includes: 1. A new interface, BusinessEntityWithStatus<?, ?> which could be applied to any BusinessEntity<?> which has a notion of a status. 2. Applying the BusinessEntityWithStatus interface to VM, VmTemplate, VDS and StorageDoamin, which are used by VdcActionUtils. 3. Applying the BusinessEntityWithStatus interface to StoragePool, which is not used by VdcActionUtils, as a negative test case. 4. Updating the test case accordingly. Benefits of this approach: 1. Less programmer errors - some of the validations are done in compile time instead of runtime (i.e., you cannot pass any object to VdcActionUtils.canExecute, only classes that implement BusinessEntityWithStatus. 2. Better performance - no usage of reflection, which is known to have a performance penalty. 3. The code is more straight forward, and easier to understand. Change-Id: I4b1c3857e1237bef9fc1af96e96043677b2debd4 Signed-off-by: Allon Mureinik <amure...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcActionUtils.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntityWithStatus.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomain.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StoragePool.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java M backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/VdcActionUtilsTest.java M frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml 9 files changed, 42 insertions(+), 39 deletions(-) Approvals: Allon Mureinik: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/18855 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4b1c3857e1237bef9fc1af96e96043677b2debd4 Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Alissa Bonas <abo...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches