Change in ovirt-engine[master]: core: [CDI] Introduce CDI for Commands dependencies

rgolan at redhat.com rgolan at redhat.com
Mon Jun 23 11:44:45 UTC 2014


Roy Golan has submitted this change and it was merged.

Change subject: core: [CDI] Introduce CDI for Commands dependencies
......................................................................


core: [CDI] Introduce CDI for Commands dependencies

introducing the use of the powerfull yet light weld framework for
injecting dependencies to our Command objects.

command object are not EJBs and they have no reason to be ones.

Yet they carry lots of dependencies although they are a cardinal part of
the system they are hard to test.

using weld's tools we can inject dependencies programmaticly, letting
weld figure out how to fulfill all annotated fields.

this means the CommandFactory is responsible for instantiating a new
instance and dependency injection (as long as commands are not CDI
beans)

@See

InjectionHelper
a helper with a refrence to weld's bean manager which
we fullfuill dependecies programmatically with

jboss-deplpoyment-structure.xml
The mechanism jboss uses to define additional mofules/dependencies that
help discover beans inside modules. nessecary for cross-module
resolution (e.g inject a utils/Logger to bll/CommandBase

META-INF/beans.xml
a marker file to signal the deployment scanner to start bean discovery
on the jar/war/ear   (for war file it should be under WEB-INF/beans.xml)

FUTURE (following patches)
* All singletons will move to be @ApplicationScopped beans
* Commands will never use dependecies inside the constructre. all init
goes into @postConstruct method
* No JNDI usage - all can be injected instead
* No EJB beans - unless out use-case is relevant
* create empty META-INF/beans.xml file.
* create default empty consturctor for Backend

Change-Id: I7f604ff91847b698efe84a09f724ba0492a672c1
Signed-off-by: Roy Golan <rgolan at redhat.com>
---
M backend/manager/modules/bll/pom.xml
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java
A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/BllCDIAdapter.java
A backend/manager/modules/bll/src/main/resources/META-INF/beans.xml
M backend/manager/modules/common/pom.xml
A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/Injector.java
M backend/manager/modules/common/src/main/modules/org/ovirt/engine/core/common/main/module.xml
A backend/manager/modules/common/src/main/resources/META-INF/beans.xml
M backend/manager/modules/pom.xml
M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/log/LogFactory.java
A ear/src/main/application/META-INF/jboss-deployment-structure.xml
M packaging/services/ovirt-engine/ovirt-engine.xml.in
M pom.xml
14 files changed, 193 insertions(+), 4 deletions(-)

Approvals:
  Roy Golan: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/5575
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f604ff91847b698efe84a09f724ba0492a672c1
Gerrit-PatchSet: 16
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Alexander Wels <awels at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Asaf Shakarchi <asaf at redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck at redhat.com>
Gerrit-Reviewer: Einav Cohen <ecohen at redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika at redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik at redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Liran Zelkha <lzelkha at redhat.com>
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Mike Kolesnik <mkolesni at redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs at redhat.com>
Gerrit-Reviewer: Yevgeny Zaspitsky <yzaspits at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: mooli tayer <mtayer at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list