@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); } }
/** * Add the <code>puServiceName</code> as a dependency on each of the passed <code>components</code> * * @param components The components to which the PU service is added as a dependency * @param holder The persistence units */ private static void addPUServiceDependencyToComponents(final Collection<ComponentDescription> components, final PersistenceUnitMetadataHolder holder) { if (components == null || components.isEmpty() || holder == null) { return; } for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { String jpaContainerManaged = pu.getProperties().getProperty(Configuration.JPA_CONTAINER_MANAGED); boolean deployPU = (jpaContainerManaged == null? true : Boolean.parseBoolean(jpaContainerManaged)); if (deployPU) { final ServiceName puServiceName = PersistenceUnitServiceImpl.getPUServiceName(pu); for (final ComponentDescription component : components) { ROOT_LOGGER.debugf("Adding dependency on PU service %s for component %s", puServiceName, component.getComponentClassName()); component.addDependency(puServiceName); } } } }
/** * Add the <code>puServiceName</code> as a dependency on each of the passed <code>components</code> * * @param components The components to which the PU service is added as a dependency * @param holder The persistence units */ private static void addPUServiceDependencyToComponents(final Collection<ComponentDescription> components, final PersistenceUnitMetadataHolder holder) { if (components == null || components.isEmpty() || holder == null) { return; } for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { String jpaContainerManaged = pu.getProperties().getProperty(Configuration.JPA_CONTAINER_MANAGED); boolean deployPU = (jpaContainerManaged == null? true : Boolean.parseBoolean(jpaContainerManaged)); if (deployPU) { final ServiceName puServiceName = PersistenceUnitServiceImpl.getPUServiceName(pu); for (final ComponentDescription component : components) { ROOT_LOGGER.debugf("Adding dependency on PU service %s for component %s", puServiceName, component.getComponentClassName()); component.addDependency(puServiceName); } } } }
private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) { final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName(); final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment(); // configure JAXWS EJB3 handler to be able to see EJB3 environment jaxwsHandlerDescription.setContextServiceName(ejbContextServiceName); jaxwsHandlerDescription.setDeploymentDescriptorEnvironment(ejbEnv); jaxwsHandlerDescription.addDependency(ejbContextServiceName); }
private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) { final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName(); final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment(); // configure JAXWS EJB3 handler to be able to see EJB3 environment jaxwsHandlerDescription.setContextServiceName(ejbContextServiceName); jaxwsHandlerDescription.setDeploymentDescriptorEnvironment(ejbEnv); jaxwsHandlerDescription.addDependency(ejbContextServiceName); }
private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) { final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName(); final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment(); // configure JAXWS EJB3 handler to be able to see EJB3 environment jaxwsHandlerDescription.setContextServiceName(ejbContextServiceName); jaxwsHandlerDescription.setDeploymentDescriptorEnvironment(ejbEnv); jaxwsHandlerDescription.addDependency(ejbContextServiceName, ServiceBuilder.DependencyType.REQUIRED); }
static ComponentDescription createComponentDescription(final DeploymentUnit unit, final String componentName, final String componentClassName, final String dependsOnEndpointClassName) { final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION); // JBoss WEB processors may install fake components for WS endpoints - removing them forcibly moduleDescription.removeComponent(componentName, componentClassName); // register WS component ComponentDescription componentDescription = new WSComponentDescription(componentName, componentClassName, moduleDescription, unit.getServiceName()); moduleDescription.addComponent(componentDescription); // register WS dependency final ServiceName endpointServiceName = EndpointService.getServiceName(unit, dependsOnEndpointClassName); componentDescription.addDependency(endpointServiceName); return componentDescription; }
static ComponentDescription createComponentDescription(final DeploymentUnit unit, final String componentName, final String componentClassName, final String dependsOnEndpointClassName) { final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION); // JBoss WEB processors may install fake components for WS endpoints - removing them forcibly moduleDescription.removeComponent(componentName, componentClassName); // register WS component ComponentDescription componentDescription = new WSComponentDescription(componentName, componentClassName, moduleDescription, unit.getServiceName()); moduleDescription.addComponent(componentDescription); // register WS dependency final ServiceName endpointServiceName = EndpointService.getServiceName(unit, dependsOnEndpointClassName); componentDescription.addDependency(endpointServiceName); return componentDescription; }
static ComponentDescription createComponentDescription(final DeploymentUnit unit, final String componentName, final String componentClassName, final String dependsOnEndpointClassName) { final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION); // JBoss WEB processors may install fake components for WS endpoints - removing them forcibly moduleDescription.removeComponent(componentName, componentClassName); // register WS component ComponentDescription componentDescription = new WSComponentDescription(componentName, componentClassName, moduleDescription, unit.getServiceName()); moduleDescription.addComponent(componentDescription); // register WS dependency final ServiceName endpointServiceName = EndpointService.getServiceName(unit, dependsOnEndpointClassName); componentDescription.addDependency(endpointServiceName, ServiceBuilder.DependencyType.REQUIRED); return componentDescription; }
@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; } final EJBClientContext ejbClientContext = this.getEJBClientContext(phaseContext); final ServiceController<TCCLEJBClientContextSelectorService> tcclEJBClientContextSelectorServiceController = (ServiceController<TCCLEJBClientContextSelectorService>) phaseContext.getServiceRegistry().getService(TCCLEJBClientContextSelectorService.TCCL_BASED_EJB_CLIENT_CONTEXT_SELECTOR_SERVICE_NAME); if (tcclEJBClientContextSelectorServiceController != null) { final TCCLEJBClientContextSelectorService tcclBasedEJBClientContextSelector = tcclEJBClientContextSelectorServiceController.getValue(); // associate the EJB client context with the deployment classloader logger.debug("Registering EJB client context " + ejbClientContext + " for classloader " + module.getClassLoader()); tcclBasedEJBClientContextSelector.registerEJBClientContext(ejbClientContext, module.getClassLoader()); } 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 final ServiceName clientContextService = getEJBClientContextServiceName(phaseContext); for(final ComponentDescription component : moduleDescription.getComponentDescriptions()) { component.addDependency(clientContextService, ServiceBuilder.DependencyType.REQUIRED); } }