7 Replies Latest reply on Jun 18, 2008 1:59 PM by Alexey Loubyansky

    ClientContainer injection

    Alexey Loubyansky Master

      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:

       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.