private List<ServiceName> getComponentStartServiceNames(DeploymentUnit deploymentUnit) { List<ServiceName> serviceNames = new ArrayList<>(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if (eeModuleDescription == null) { return serviceNames; } for (ComponentDescription component : eeModuleDescription.getComponentDescriptions()) { serviceNames.add(component.getStartServiceName()); } return serviceNames; } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if (eeModuleDescription == null) { return; } final ComponentConfigurator componentConfigurator = new ComponentConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final TransactionLeakContextHandleFactory transactionLeakContextHandleFactory = new TransactionLeakContextHandleFactory(); context.addDependency(TransactionManagerService.INTERNAL_SERVICE_NAME, TransactionManager.class, transactionLeakContextHandleFactory); configuration.getConcurrentContext().addFactory(transactionLeakContextHandleFactory); } }; for (ComponentDescription componentDescription : eeModuleDescription.getComponentDescriptions()) { componentDescription.getConfigurators().add(componentConfigurator); } }
@Override public void deploy(final DeploymentPhaseContext context) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = context.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); for (ComponentDescription component : moduleDescription.getComponentDescriptions()) { if (component instanceof EJBComponentDescription) { component.getConfigurators().add(new ComponentConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) { StartupCountdown countdown = context.getDeploymentUnit().getAttachment(Attachments.STARTUP_COUNTDOWN); for (ViewConfiguration view : configuration.getViews()) { EJBViewConfiguration ejbView = (EJBViewConfiguration) view; if (INTFS.contains(ejbView.getMethodIntf())) { ejbView.addViewInterceptor(new ImmediateInterceptorFactory(new StartupAwaitInterceptor(countdown)), InterceptorOrder.View.STARTUP_AWAIT_INTERCEPTOR); } } } }); } } }
/** * {@inheritDoc} * */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions(); if (componentConfigurations == null || componentConfigurations.isEmpty()) { return; } for (ComponentDescription componentConfiguration : componentConfigurations) { final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX); if (index != null) { processComponentConfig(deploymentUnit, phaseContext, index, componentConfiguration); } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); if (module == null) { return; } RegistrationService registrationService = new RegistrationService(module); ServiceName registrationServiceName = deploymentUnit.getServiceName().append("ejb3","client-context","registration-service"); final ServiceName profileServiceName = getProfileServiceName(phaseContext); final ServiceBuilder<Void> builder = phaseContext.getServiceTarget().addService(registrationServiceName, registrationService) .addDependency(getEJBClientContextServiceName(phaseContext), EJBClientContextService.class, registrationService.ejbClientContextInjectedValue) .addDependency(getDiscoveryServiceName(phaseContext), Discovery.class, registrationService.discoveryInjector); if (profileServiceName != null) { builder.addDependency(profileServiceName, RemotingProfileService.class, registrationService.profileServiceInjectedValue); } builder.install(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if (moduleDescription == null) { return; } //we need to make sure all our components have a dependency on the EJB client context registration, which in turn implies a dependency on the context for(final ComponentDescription component : moduleDescription.getComponentDescriptions()) { component.addDependency(registrationServiceName); } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions(); final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); if (componentConfigurations == null || componentConfigurations.isEmpty()) { return; } for (ComponentDescription componentConfiguration : componentConfigurations) { if (typeParam.isAssignableFrom(componentConfiguration.getClass())) { try { processComponentConfig(deploymentUnit, applicationClasses, module, deploymentReflectionIndex, (T) componentConfiguration); } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failToMergeData(componentConfiguration.getComponentName(), e); } } } }
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 public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions(); final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) { return; } if (componentConfigurations == null || componentConfigurations.isEmpty()) { return; } for (final ComponentDescription description : componentConfigurations) { processComponentConfig(applicationClasses, deploymentReflectionIndex, description, deploymentUnit); } }
@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(); // Only process EJB deployments if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit)) { return; } final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions(); if (componentDescriptions != null) { for (ComponentDescription componentDescription : componentDescriptions) { // process only EJB session beans if (componentDescription instanceof SessionBeanComponentDescription) { this.setupJNDIBindings((EJBComponentDescription) componentDescription, deploymentUnit); } } } if (appclient) { for (final ComponentDescription component : deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) { this.setupJNDIBindings((EJBComponentDescription) component, deploymentUnit); } } }
@Override public final void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentDescriptorEnvironment environment = deploymentUnit.getAttachment(Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT); final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); final EEModuleDescription description = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if (module == null || description == null) { return; } if (environment != null) { final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, environment, description, null, module.getClassLoader(), deploymentReflectionIndex, applicationClasses); description.getBindingConfigurations().addAll(bindings); } for (final ComponentDescription componentDescription : description.getComponentDescriptions()) { if (componentDescription.getDeploymentDescriptorEnvironment() != null) { final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, componentDescription.getDeploymentDescriptorEnvironment(), componentDescription, componentDescription, module.getClassLoader(), deploymentReflectionIndex, applicationClasses); componentDescription.getBindingConfigurations().addAll(bindings); } } for(final InterceptorEnvironment interceptorEnv : description.getInterceptorEnvironment().values()) { final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, interceptorEnv.getDeploymentDescriptorEnvironment(), interceptorEnv, null, module.getClassLoader(), deploymentReflectionIndex, applicationClasses); interceptorEnv.getBindingConfigurations().addAll(bindings); } }
@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)); } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (eeModuleDescription != null) { for (final ComponentDescription component : eeModuleDescription.getComponentDescriptions()) { if (component instanceof EJBComponentDescription) { try { if (component instanceof SessionBeanComponentDescription || component instanceof MessageDrivenComponentDescription) handleSessionBean((EJBComponentDescription) component, module, reflectionIndex); if (component instanceof StatelessComponentDescription || component instanceof MessageDrivenComponentDescription) { handleStatelessSessionBean((EJBComponentDescription) component, module, reflectionIndex); } } catch (ClassNotFoundException e) { throw EjbLogger.ROOT_LOGGER.failToLoadComponentClass(e, component.getComponentName()); } } } } }
/** * {@inheritDoc} * */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEResourceReferenceProcessorRegistry registry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); //setup ejb context jndi handlers registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EJBContext.class)); registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(SessionContext.class)); registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EntityContext.class)); registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(MessageDrivenContext.class)); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions(); if (componentConfigurations == null || componentConfigurations.isEmpty()) { return; } for (ComponentDescription componentConfiguration : componentConfigurations) { final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX); if (index != null) { processComponentConfig(componentConfiguration); } } }
final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
@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); } } }
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) || 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); } } }
@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); } } }