/** * Get the context service name. * * @return the context service name */ public ServiceName getContextServiceName() { if (contextServiceName != null) return contextServiceName; if (getNamingMode() == ComponentNamingMode.CREATE) { return ContextNames.contextServiceNameOfComponent(getApplicationName(), getModuleName(), getComponentName()); } else if (getNamingMode() == ComponentNamingMode.USE_MODULE) { return ContextNames.contextServiceNameOfModule(getApplicationName(), getModuleName()); } else { throw new IllegalStateException(); } }
protected void processComponentConfig(final ComponentDescription componentDescription) throws DeploymentUnitProcessingException { if (!(componentDescription instanceof EJBComponentDescription)) { return; // Only process EJBs } // if the EJB is packaged in a .war, then we need to bind the java:comp/EJBContext only once for the entire module if (componentDescription.getNamingMode() != ComponentNamingMode.CREATE) { // get the module description final EEModuleDescription moduleDescription = componentDescription.getModuleDescription(); // the java:module/EJBContext binding configuration // Note that we bind to java:module/EJBContext since it's a .war. End users can still lookup java:comp/EJBContext // and that will internally get translated to java:module/EJBContext for .war, since java:comp == java:module in // a web ENC. So binding to java:module/EJBContext is OK. final BindingConfiguration ejbContextBinding = new BindingConfiguration("java:module/EJBContext", directEjbContextReferenceSource); moduleDescription.getBindingConfigurations().add(ejbContextBinding); } else { // EJB packaged outside of a .war. So process normally. // add the binding configuration to the component description final BindingConfiguration ejbContextBinding = new BindingConfiguration("java:comp/EJBContext", directEjbContextReferenceSource); componentDescription.getBindingConfigurations().add(ejbContextBinding); } }
private void addBinding(String source, String compTarget, String moduleTarget, EEModuleDescription moduleDescription, DeploymentUnit deploymentUnit) { final LookupInjectionSource injectionSource = new LookupInjectionSource(source); if (DeploymentTypeMarker.isType(WAR, deploymentUnit)) { moduleDescription.getBindingConfigurations().add(new BindingConfiguration(moduleTarget, injectionSource)); } else { if (DeploymentTypeMarker.isType(APPLICATION_CLIENT, deploymentUnit)) { moduleDescription.getBindingConfigurations().add(new BindingConfiguration(compTarget, injectionSource)); } for(ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) { if(componentDescription.getNamingMode() == ComponentNamingMode.CREATE) { componentDescription.getBindingConfigurations().add(new BindingConfiguration(compTarget, injectionSource)); } } } }
@Override protected void processComponentConfig(DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, CompositeIndex index, ComponentDescription componentDescription) throws DeploymentUnitProcessingException { if (!(componentDescription instanceof EJBComponentDescription)) { return; // Only process EJBs } // if the EJB is packaged in a .war, then we need to bind the java:comp/TimerService only once for the entire module if (componentDescription.getNamingMode() != ComponentNamingMode.CREATE) { // get the module description final EEModuleDescription moduleDescription = componentDescription.getModuleDescription(); // the java:module/TimerService binding configuration // Note that we bind to java:module/TimerService since it's a .war. End users can still lookup java:comp/TimerService // and that will internally get translated to java:module/TimerService for .war, since java:comp == java:module in // a web ENC. So binding to java:module/TimerService is OK. final BindingConfiguration timerServiceBinding = new BindingConfiguration("java:module/TimerService", new TimerServiceBindingSource()); moduleDescription.getBindingConfigurations().add(timerServiceBinding); } else { // EJB packaged outside of a .war. So process normally. // add the binding configuration to the component description final BindingConfiguration timerServiceBinding = new BindingConfiguration("java:comp/TimerService", new TimerServiceBindingSource()); componentDescription.getBindingConfigurations().add(timerServiceBinding); } } }
public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException { InjectionSource.ResolutionContext resolutionContext = new InjectionSource.ResolutionContext( configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.USE_MODULE, configuration.getComponentName(), configuration.getModuleName(), configuration.getApplicationName() ); injectionConfiguration.getSource().getResourceValue(resolutionContext, serviceBuilder, context, managedReferenceFactoryValue); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if(eeModuleDescription == null) { return; } processModuleDescription(eeModuleDescription, deploymentUnit, phaseContext); final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions(); if (componentDescriptions == null) { return; } for (ComponentDescription componentDescription : componentDescriptions) { if (componentDescription.getNamingMode() == ComponentNamingMode.NONE) { // skip components without namespace continue; } processComponentDescription(componentDescription); } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (DeploymentTypeMarker.isType(EAR, deploymentUnit)) { return; } final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if(moduleDescription == null) { return; } final String defaultDataSource = moduleDescription.getDefaultResourceJndiNames().getDataSource(); if(defaultDataSource == null) { return; } final LookupInjectionSource injectionSource = new LookupInjectionSource(defaultDataSource); if (DeploymentTypeMarker.isType(WAR, deploymentUnit)) { moduleDescription.getBindingConfigurations().add(new BindingConfiguration(MODULE_DEFAULT_DATASOURCE_JNDI_NAME, injectionSource)); } else { if (DeploymentTypeMarker.isType(APPLICATION_CLIENT, deploymentUnit)) { moduleDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_DATASOURCE_JNDI_NAME, injectionSource)); } for(ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) { if(componentDescription.getNamingMode() == ComponentNamingMode.CREATE) { componentDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_DATASOURCE_JNDI_NAME, injectionSource)); } } } }
if (bindingConfiguration.getName().startsWith("java:comp") || !bindingConfiguration.getName().startsWith("java:")) { final String bindingName = bindingConfiguration.getName().startsWith("java:comp") ? bindingConfiguration.getName() : "java:comp/env/" + bindingConfiguration.getName(); final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(configuration.getApplicationName(), configuration.getModuleName(), configuration.getComponentName(), configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.CREATE, bindingName); if (bound.contains(bindInfo.getBinderServiceName())) { continue;
final String bindingName = binding.getName(); final boolean compBinding = bindingName.startsWith("java:comp") || !bindingName.startsWith("java:"); if (componentConfiguration.getComponentDescription().getNamingMode() == ComponentNamingMode.CREATE && compBinding) { processClassConfigurations(phaseContext, applicationClasses, moduleConfiguration, deploymentDescriptorBindings, handledClasses, componentConfiguration.getComponentDescription().getNamingMode(), classConfigurations, componentConfiguration.getComponentName(), dependencies);
final ServiceName contextServiceName; if (configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.CREATE) { final NamingStoreService contextService = new NamingStoreService(true); serviceTarget.addService(configuration.getComponentDescription().getContextServiceName(), contextService).install(); configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.USE_MODULE, configuration.getComponentName(), configuration.getModuleName(), if (configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.CREATE) {
private void bindFactoryToJndi(LazyValidatorFactory factory, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext,EEModuleDescription moduleDescription) { if(moduleDescription == null) { return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); //if this is a war we need to bind to the modules comp namespace if(DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName()); bindServices(factory, serviceTarget, moduleDescription, moduleDescription.getModuleName(), moduleContextServiceName); } for(ComponentDescription component : moduleDescription.getComponentDescriptions()) { if(component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(),moduleDescription.getModuleName(),component.getComponentName()); bindServices(factory, serviceTarget, moduleDescription, component.getComponentName(), compContextServiceName); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if(moduleDescription == null) { return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); //if this is a war we need to bind to the modules comp namespace if(DeploymentTypeMarker.isType(DeploymentType.WAR,deploymentUnit)) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(),moduleDescription.getModuleName()); bindServices(deploymentUnit, serviceTarget, moduleContextServiceName); } for(ComponentDescription component : moduleDescription.getComponentDescriptions()) { if(component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(),moduleDescription.getModuleName(),component.getComponentName()); bindServices(deploymentUnit, serviceTarget, compContextServiceName); } } }
if (component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName()); bindBeanManager(serviceTarget, beanManagerServiceName, compContextServiceName, dependencies, phaseContext.getServiceRegistry());
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if(moduleDescription == null) { return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); //if this is a war we need to bind to the modules comp namespace if(DeploymentTypeMarker.isType(DeploymentType.WAR,deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(),moduleDescription.getModuleName()); bindServices(deploymentUnit, serviceTarget, moduleContextServiceName); } for(ComponentDescription component : moduleDescription.getComponentDescriptions()) { if(component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(),moduleDescription.getModuleName(),component.getComponentName()); bindServices(deploymentUnit, serviceTarget, compContextServiceName); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if(moduleDescription == null) { return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); //if this is a war we need to bind to the modules comp namespace if(DeploymentTypeMarker.isType(DeploymentType.WAR,deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(),moduleDescription.getModuleName()); bindServices(deploymentUnit, serviceTarget, moduleContextServiceName); } for(ComponentDescription component : moduleDescription.getComponentDescriptions()) { if(component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(),moduleDescription.getModuleName(),component.getComponentName()); bindServices(deploymentUnit, serviceTarget, compContextServiceName); } } }
if (description.getNamingMode() == ComponentNamingMode.CREATE) { description.getBindingConfigurations().add(new BindingConfiguration("java:comp/env", new ContextInjectionSource("env", "java:comp/env")));
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); if (moduleDescription == null) { return; } //do not bind if jacORB not present if (!IIOPDeploymentMarker.isIIOPDeployment(deploymentUnit)) { return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); //if this is a war we need to bind to the modules comp namespace if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName()); bindService(serviceTarget, moduleContextServiceName, module); } for (ComponentDescription component : moduleDescription.getComponentDescriptions()) { if (component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName()); bindService(serviceTarget, compContextServiceName, module); } } }
final ComponentNamingMode namingMode = description.getNamingMode(); final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector(); final String applicationName = configuration.getApplicationName();
public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException { InjectionSource.ResolutionContext resolutionContext = new InjectionSource.ResolutionContext( configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.USE_MODULE, configuration.getComponentName(), configuration.getModuleName(), configuration.getApplicationName() ); injectionConfiguration.getSource().getResourceValue(resolutionContext, serviceBuilder, context, managedReferenceFactoryValue); } }
public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException { InjectionSource.ResolutionContext resolutionContext = new InjectionSource.ResolutionContext( configuration.getComponentDescription().getNamingMode() == ComponentNamingMode.USE_MODULE, configuration.getComponentName(), configuration.getModuleName(), configuration.getApplicationName() ); injectionConfiguration.getSource().getResourceValue(resolutionContext, serviceBuilder, context, managedReferenceFactoryValue); }