Roy Golan has posted comments on this change.

Change subject: WIP: working CDI solution for backend
......................................................................


Patch Set 6: (4 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
Line 98:     private DateTime _startedAt;
Line 99:     private static boolean firstInitialization = true;
Line 100:     private String poolMonitoringJobId;
Line 101: 
Line 102:     public Backend() {
I add it later. this would make Backend a managed bean and we could inject 
dependecies to it i.e we would inject Commands to the business methods

will remove for now. I'll make this change gradual
Line 103:     }
Line 104: 
Line 105:     public static BackendInternal getInstance() {
Line 106:         return EjbUtils.findBean(BeanType.BACKEND, 
BeanProxyType.LOCAL);


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java
Line 47:         try {
Line 48:             Constructor<CommandBase<? extends 
VdcActionParametersBase>> constructor =
Line 49:                     
findCommandConstructor(getCommandClass(action.name(), CommandSuffix), 
parameters.getClass());
Line 50: 
Line 51:             CommandBase<P> cmd = (CommandBase<P>) 
constructor.newInstance(new Object[] { parameters });
will add
Line 52:             injector.inject(cmd);
Line 53:             return cmd;
Line 54:         }
Line 55: 


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Injector.java
Line 10:     private BeanManager manager;
Line 11: 
Line 12:     public Injector() {
Line 13:         try {
Line 14:             this.manager = (BeanManager) new 
InitialContext().lookup("java:comp/BeanManager");
1.we would no longer need EJBUtils strategy once we had CDI.  - remember that 
in 
test enviornment we would inject different mocked versions of our beans.

2. Once Backend will be a CDI bean and not EJB we could inject the BeanManager 
directly and avoid the JNDI lookup

 @Inject
 BeanManager manager
Line 15:         } catch (NamingException e) {
Line 16:             // if the bean manager couldn't be fetched then we 
couldn't inject dependencies to non-bean objects
Line 17:             throw new RuntimeException("Couldn't locate a BeanManager 
instance due to " + e.getMessage()
Line 18:                     + " Actions will fail to perform due to runtime 
missing dependencies");


Line 12:     public Injector() {
Line 13:         try {
Line 14:             this.manager = (BeanManager) new 
InitialContext().lookup("java:comp/BeanManager");
Line 15:         } catch (NamingException e) {
Line 16:             // if the bean manager couldn't be fetched then we 
couldn't inject dependencies to non-bean objects
will do
Line 17:             throw new RuntimeException("Couldn't locate a BeanManager 
instance due to " + e.getMessage()
Line 18:                     + " Actions will fail to perform due to runtime 
missing dependencies");
Line 19:         }
Line 20:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7f604ff91847b698efe84a09f724ba0492a672c1
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Asaf Shakarchi <a...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Laszlo Hornyak <lhorn...@redhat.com>
Gerrit-Reviewer: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@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

Reply via email to