Version 4

    This document outlines the jboss-reloaded-naming and jboss-reloaded-naming-deployers components which are responsible for providing a runtime with the standardized name space java:comp, java:module and java:app.


    A work-in-progress.



    NameSpaces Bean

    Although not part of the naming deployers themselves, the NameSpaces bean is an integral part to attain the JavaEE naming functionality. It sets up the ObjectFactory objects associated with the java:app, java:module and java:comp usage with JNDI.


    Normally it is instanciated after the Naming Server itself and part of its (/ JNDI) configuration.


    The API of the object factories installed by NameSpaces is CurrentComponent. By pushing the correct JavaEEComponent into CurrentComponent, the three scoped name spaces will be tied to the correct context.


    For most JavaEE components this is done during the invocation on a method with said component. The container could use AbstractNamingInterceptor to intercept such an invocation and thus have the interceptor manage the association with CurrentComponent.

    The Naming Deployers

    The naming deployers are responsible to fire up MC beans that can be used with CurrentComponent. The beans themselves are called: java:app, java:module and java:comp in direct relation with the real Context they represent. To counter overlap the beans are installed in scoped kernels, where the scope is determined by @ApplicationScope, @DeploymentScope and @InstanceScope.

    Obtaining a naming bean

    The following code shows how a container deployer obtains a reference to the java:comp naming bean.

    Scoping is broken in MC, following code is no longer valid.

       private org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer informer;
       public void deploy(DeploymentUnit unit, DummyMetaData deployment) throws DeploymentException
          String appName = informer.getApplicationName(unit);
          String moduleName = informer.getModulePath(unit);
          String componentName = informer.getComponentName(unit);
          // create dummy container bean
          String name = "jboss.dummy:";
          if(appName != null)
             name += "application=" + appName + ",";
          name += "module=" + moduleName + ",component=" + componentName;
          BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, DummyContainer.class.getName())
             .addAnnotation(annotation(DeploymentScope.class, moduleName))
             .addAnnotation(annotation(InstanceScope.class, componentName))
          if(appName != null)
             builder.addAnnotation(annotation(ApplicationScope.class, appName));
          AbstractInjectionValueMetaData javaComponent = new AbstractInjectionValueMetaData("java:comp");
          builder.addConstructorParameter(JavaEEComponent.class.getName(), javaComponent);
          unit.getParent().addAttachment(BeanMetaData.class.getName() + "." + name, builder.getBeanMetaData());
          //unit.addAttachment(BeanMetaData.class, builder.getBeanMetaData());

    TODO: Note that the usage of JavaEEInformer is still under scrutiny.


    The informer is going to replaced by direct metadata consumption that's going to be published by the ModuleNameDeployer. EE Module Names (JBAS-7644)

    Injection Environment

    TODO: this whole chapter is going to be moved as injection is outside the scope

    TODO: In similar vain as the current EncInjector the java:comp (, java:module and java:app) contexts are filled up.


    public interface Injector
       void inject(JavaEEComponent component);

    TODO: the actual invocation of injectors.