[jboss-dev-forums] [Design of EJB 3.0] - ClientContainer injection

alex.loubyansky@jboss.com do-not-reply at jboss.com
Tue Jun 17 17:13:40 EDT 2008


Looks very confusing to me. This is what I see:

this is what happens in the ctor of ClientContainer: first it calls processMetaData() which populates the list of injectors and then inject() is called on each injector:
...
  |       processMetadata(null);
  | 
  |       for(Injector injector : injectors)
  |       {
  |          log.debug("injector: " + injector);
  |          injector.inject((Object) null);
  |       }
  | ...

How can anything be injected into null? (except static)

processMetaData does the following:
      handlers.add(new ClientEJBHandler<RemoteEnvironment>());
  |       handlers.add(new DependsHandler<RemoteEnvironment>());
  |       handlers.add(new JndiInjectHandler<RemoteEnvironment>());
  |       handlers.add(new PersistenceUnitHandler<RemoteEnvironment>());
  |       handlers.add(new ClientResourceHandler<RemoteEnvironment>(this.mainClass));
  |       handlers.add(new WebServiceRefHandler<RemoteEnvironment>());
  |       
  |       for (InjectionHandler<RemoteEnvironment> handler : handlers)
  |          handler.loadXml(xml, this);
  | 

In loadXml(), a handler adds itself to the ClientContainer's list of handlers (so, later it gets inject call, see above). But this is true only for the handlers that are in the jbossas/trunk, i.e. ClientEJBHandler and ClientResourceHandle. Other handlers (in the ejb3 project) add injectors to ClientContainer's encInjections which I don't see being used after that.
Map<String, Map<AccessibleObject, Injector>> getEncInjections()

Further, the following handlers in their loadXml() call ClientContainer.getEncInjectors() which is
   public Map<String, EncInjector> getEncInjectors()
  |    {
  |       throw new IllegalStateException("ENC setup happens on the server");
  |    }
- JndiInjectHandler
- PersistenceUnitHandler

So, these are not going to work.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158831#4158831

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158831



More information about the jboss-dev-forums mailing list