ee/src/main/java/org/jboss/as/ee/component/NamespaceConfigurator.java
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
        final ComponentNamingMode namingMode = description.getNamingMode();
        final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector();
        final String applicationName = configuration.getApplicationName();
        final String moduleName = configuration.getModuleName();
        final String compName = configuration.getComponentName();
        final ServiceName appContextServiceName = ContextNames.contextServiceNameOfApplication(applicationName);
        final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(applicationName, moduleName);
        final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(applicationName, moduleName, compName);
        final Injector<NamingStore> appInjector = selector.getAppContextInjector();
        final Injector<NamingStore> moduleInjector = selector.getModuleContextInjector();
        final Injector<NamingStore> compInjector = selector.getCompContextInjector();
        final Injector<NamingStore> jbossInjector = selector.getJbossContextInjector();
        final Injector<NamingStore> globalInjector = selector.getGlobalContextInjector();
        final Injector<NamingStore> exportedInjector = selector.getExportedContextInjector();

        configuration.getStartDependencies().add(new DependencyConfigurator<ComponentStartService>() {
            public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) {
                serviceBuilder.addDependency(appContextServiceName, NamingStore.class, appInjector);
                serviceBuilder.addDependency(moduleContextServiceName, NamingStore.class, moduleInjector);
                if (namingMode == ComponentNamingMode.CREATE) {
                    serviceBuilder.addDependency(compContextServiceName, NamingStore.class, compInjector);
                } else if(namingMode == ComponentNamingMode.USE_MODULE) {
                    serviceBuilder.addDependency(moduleContextServiceName, NamingStore.class, compInjector);
                }
                serviceBuilder.addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, globalInjector);
                serviceBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, jbossInjector);
                serviceBuilder.addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, exportedInjector);
            }
        });
        final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new NamespaceContextInterceptor(selector, context.getDeploymentUnit().getServiceName()));
        configuration.addPostConstructInterceptor(interceptorFactory, InterceptorOrder.ComponentPostConstruct.JNDI_NAMESPACE_INTERCEPTOR);
        configuration.addPreDestroyInterceptor(interceptorFactory, InterceptorOrder.ComponentPreDestroy.JNDI_NAMESPACE_INTERCEPTOR);
        if(description.isPassivationApplicable()) {
            configuration.addPrePassivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
            configuration.addPostActivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
        }

        configuration.setNamespaceContextInterceptorFactory(interceptorFactory);
        configuration.setNamespaceContextSelector(selector);
    }
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
        final ComponentNamingMode namingMode = description.getNamingMode();
        final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector();
        final String applicationName = configuration.getApplicationName();
        final String moduleName = configuration.getModuleName();
        final String compName = configuration.getComponentName();
        final ServiceName appContextServiceName = ContextNames.contextServiceNameOfApplication(applicationName);
        final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(applicationName, moduleName);
        final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(applicationName, moduleName, compName);
        final Injector<NamingStore> appInjector = selector.getAppContextInjector();
        final Injector<NamingStore> moduleInjector = selector.getModuleContextInjector();
        final Injector<NamingStore> compInjector = selector.getCompContextInjector();
        final Injector<NamingStore> jbossInjector = selector.getJbossContextInjector();
        final Injector<NamingStore> globalInjector = selector.getGlobalContextInjector();
        final Injector<NamingStore> exportedInjector = selector.getExportedContextInjector();

        configuration.getStartDependencies().add(new DependencyConfigurator<ComponentStartService>() {
            public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) {
                serviceBuilder.addDependency(appContextServiceName, NamingStore.class, appInjector);
                serviceBuilder.addDependency(moduleContextServiceName, NamingStore.class, moduleInjector);
                if (namingMode == ComponentNamingMode.CREATE) {
                    serviceBuilder.addDependency(compContextServiceName, NamingStore.class, compInjector);
                } else if(namingMode == ComponentNamingMode.USE_MODULE) {
                    serviceBuilder.addDependency(moduleContextServiceName, NamingStore.class, compInjector);
                }
                serviceBuilder.addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, globalInjector);
                serviceBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, jbossInjector);
                serviceBuilder.addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, exportedInjector);
            }
        });
        final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new NamespaceContextInterceptor(selector, context.getDeploymentUnit().getServiceName()));
        configuration.addPostConstructInterceptor(interceptorFactory, InterceptorOrder.ComponentPostConstruct.JNDI_NAMESPACE_INTERCEPTOR);
        configuration.addPreDestroyInterceptor(interceptorFactory, InterceptorOrder.ComponentPreDestroy.JNDI_NAMESPACE_INTERCEPTOR);
        if(description.isPassivationApplicable()) {
            configuration.addPrePassivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
            configuration.addPostActivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
        }

        configuration.setNamespaceContextInterceptorFactory(interceptorFactory);
        configuration.setNamespaceContextSelector(selector);
    }
public void configure ( final DeploymentPhaseContext context , final ComponentDescription description , final ComponentConfiguration configuration ) throws DeploymentUnitProcessingException { final ComponentNamingMode namingMode = description . getNamingMode ( ) ; final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector ( ) ; final String applicationName = configuration . getApplicationName ( ) ; final String moduleName = configuration . getModuleName ( ) ; final String compName = configuration . getComponentName ( ) ; final ServiceName appContextServiceName = ContextNames . contextServiceNameOfApplication ( applicationName ) ; final ServiceName moduleContextServiceName = ContextNames . contextServiceNameOfModule ( applicationName , moduleName ) ; final ServiceName compContextServiceName = ContextNames . contextServiceNameOfComponent ( applicationName , moduleName , compName ) ; final Injector < NamingStore > appInjector = selector . getAppContextInjector ( ) ; final Injector < NamingStore > moduleInjector = selector . getModuleContextInjector ( ) ; final Injector < NamingStore > compInjector = selector . getCompContextInjector ( ) ; final Injector < NamingStore > jbossInjector = selector . getJbossContextInjector ( ) ; final Injector < NamingStore > globalInjector = selector . getGlobalContextInjector ( ) ; final Injector < NamingStore > exportedInjector = selector . getExportedContextInjector ( ) ; configuration . getStartDependencies ( ) . add ( new DependencyConfigurator < ComponentStartService > ( ) { public void configureDependency ( final ServiceBuilder < ? > serviceBuilder , ComponentStartService service ) { serviceBuilder . addDependency ( appContextServiceName , NamingStore . class , appInjector ) ; serviceBuilder . addDependency ( moduleContextServiceName , NamingStore . class , moduleInjector ) ; if ( namingMode == ComponentNamingMode . CREATE ) { serviceBuilder . addDependency ( compContextServiceName , NamingStore . class , compInjector ) ; } else if ( namingMode == ComponentNamingMode . USE_MODULE ) { serviceBuilder . addDependency ( moduleContextServiceName , NamingStore . class , compInjector ) ; } serviceBuilder . addDependency ( ContextNames . GLOBAL_CONTEXT_SERVICE_NAME , NamingStore . class , globalInjector ) ; serviceBuilder . addDependency ( ContextNames . JBOSS_CONTEXT_SERVICE_NAME , NamingStore . class , jbossInjector ) ; serviceBuilder . addDependency ( ContextNames . EXPORTED_CONTEXT_SERVICE_NAME , NamingStore . class , exportedInjector ) ; } } ) ; final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory ( new NamespaceContextInterceptor ( selector , context . getDeploymentUnit ( ) . getServiceName ( ) ) ) ; configuration . addPostConstructInterceptor ( interceptorFactory , InterceptorOrder . ComponentPostConstruct . JNDI_NAMESPACE_INTERCEPTOR ) ; configuration . addPreDestroyInterceptor ( interceptorFactory , InterceptorOrder . ComponentPreDestroy . JNDI_NAMESPACE_INTERCEPTOR ) ; if ( description . isPassivationApplicable ( ) ) { configuration . addPrePassivateInterceptor ( interceptorFactory , InterceptorOrder . ComponentPassivation . JNDI_NAMESPACE_INTERCEPTOR ) ; configuration . addPostActivateInterceptor ( interceptorFactory , InterceptorOrder . ComponentPassivation . JNDI_NAMESPACE_INTERCEPTOR ) ; } configuration . setNamespaceContextInterceptorFactory ( interceptorFactory ) ; configuration . setNamespaceContextSelector ( selector ) ; }
{@inheritDoc}
{