Java Code Examples for org.jboss.as.server.deployment.DeploymentPhaseContext#getServiceTarget()
The following examples show how to use
org.jboss.as.server.deployment.DeploymentPhaseContext#getServiceTarget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VirtualSecurityDomainProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null || !isVirtualDomainRequired(deploymentUnit)) { return; // Only interested in installation if this is really the root deployment. } ServiceName virtualDomainName = virtualDomainName(deploymentUnit); ServiceTarget serviceTarget = phaseContext.getServiceTarget(); ServiceBuilder<?> serviceBuilder = serviceTarget.addService(virtualDomainName); final SecurityDomain virtualDomain = SecurityDomain.builder().build(); final Consumer<SecurityDomain> consumer = serviceBuilder.provides(virtualDomainName); serviceBuilder.setInstance(Service.newInstance(consumer, virtualDomain)); serviceBuilder.setInitialMode(Mode.ON_DEMAND); serviceBuilder.install(); }
Example 2
Source File: CamelEndpointDeploymentSchedulerProcessor.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); CamelDeploymentSettings depSettings = deploymentUnit.getAttachment(CamelDeploymentSettings.ATTACHMENT_KEY); if (!depSettings.isEnabled()) { return; } List<DeploymentUnit> subDeployments = deploymentUnit .getAttachmentList(org.jboss.as.server.deployment.Attachments.SUB_DEPLOYMENTS); if (subDeployments != null && !subDeployments.isEmpty()) { /* do not install CamelEndpointDeploymentSchedulerService for ears */ return; } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final ServiceController<CamelEndpointDeploymentSchedulerService> serviceController = CamelEndpointDeploymentSchedulerService .addService(deploymentUnit.getServiceName(), deploymentUnit.getName(), serviceTarget); phaseContext.addDeploymentDependency(serviceController.getName(), CamelConstants.CAMEL_ENDPOINT_DEPLOYMENT_SCHEDULER_REGISTRY_KEY); }
Example 3
Source File: CamelContextActivationProcessor.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit depUnit = phaseContext.getDeploymentUnit(); CamelDeploymentSettings depSettings = depUnit.getAttachment(CamelDeploymentSettings.ATTACHMENT_KEY); if (!depSettings.isEnabled()) { return; } String runtimeName = depUnit.getName(); ServiceTarget serviceTarget = phaseContext.getServiceTarget(); ServiceName camelActivationServiceName = depUnit.getServiceName().append(CAMEL_CONTEXT_ACTIVATION_SERVICE_NAME.append(runtimeName)); List<SpringCamelContextBootstrap> camelctxBootstrapList = depUnit.getAttachmentList(CamelConstants.CAMEL_CONTEXT_BOOTSTRAP_KEY); CamelContextActivationService activationService = new CamelContextActivationService(camelctxBootstrapList, runtimeName); ServiceBuilder builder = serviceTarget.addService(camelActivationServiceName, activationService); // Ensure all camel contexts in the deployment are started before constructing servlets etc depUnit.addToAttachmentList(Attachments.WEB_DEPENDENCIES, camelActivationServiceName); // Add JNDI binding dependencies to CamelContextActivationService for (SpringCamelContextBootstrap bootstrap : camelctxBootstrapList) { for (String jndiName : bootstrap.getJndiNames()) { if (jndiName.startsWith("${")) { // Don't add the binding if it appears to be a Spring property placeholder value // these can't be resolved before refresh() has been called on the ApplicationContext LOGGER.warn("Skipping JNDI binding dependency for property placeholder value: {}", jndiName); } else { LOGGER.debug("Add CamelContextActivationService JNDI binding dependency for {}", jndiName); installBindingDependency(builder, jndiName); } } } builder.install(); }
Example 4
Source File: KeycloakServerDeploymentProcessor.java From keycloak with Apache License 2.0 | 5 votes |
private void addInfinispanCaches(DeploymentPhaseContext context) { ServiceTarget st = context.getServiceTarget(); CapabilityServiceSupport support = context.getDeploymentUnit().getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); for (String c : CACHES) { ServiceName sn = support.getCapabilityServiceName("org.wildfly.clustering.infinispan.cache", "keycloak", c); st.addDependency(sn); } }
Example 5
Source File: KeycloakClusteredSsoDeploymentProcessor.java From keycloak with Apache License 2.0 | 4 votes |
private void addCacheDependency(DeploymentPhaseContext context, DeploymentUnit deploymentUnit, String cacheContainer, String cacheName) { ServiceName jbossAsCacheContainerService = ServiceName.of("jboss", "infinispan", cacheContainer); ServiceTarget st = context.getServiceTarget(); st.addDependency(jbossAsCacheContainerService.append(cacheName)); }
Example 6
Source File: ProcessEngineStartProcessor.java From camunda-bpm-platform with Apache License 2.0 | 3 votes |
protected void startProcessEngine(ProcessEngineXml processEngineXml, DeploymentPhaseContext phaseContext) { final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); // transform configuration ManagedProcessEngineMetadata configuration = transformConfiguration(processEngineXml); // validate the configuration configuration.validate(); // create service instance MscManagedProcessEngineController service = new MscManagedProcessEngineController(configuration); // get the service name for the process engine ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngineXml.getName()); // get service builder ServiceBuilder<ProcessEngine> serviceBuilder = serviceTarget.addService(serviceName, service); // make this service depend on the current phase -> makes sure it is removed with the phase service at undeployment serviceBuilder.addDependency(phaseContext.getPhaseServiceName()); // add Service dependencies MscManagedProcessEngineController.initializeServiceBuilder(configuration, service, serviceBuilder, processEngineXml.getJobAcquisitionName()); // make this start on demand serviceBuilder.setInitialMode(Mode.ACTIVE); // install the service serviceBuilder.install(); }
Example 7
Source File: ProcessEngineStartProcessor.java From camunda-bpm-platform with Apache License 2.0 | 3 votes |
protected void startProcessEngine(ProcessEngineXml processEngineXml, DeploymentPhaseContext phaseContext) { final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); // transform configuration ManagedProcessEngineMetadata configuration = transformConfiguration(processEngineXml); // validate the configuration configuration.validate(); // create service instance MscManagedProcessEngineController service = new MscManagedProcessEngineController(configuration); // get the service name for the process engine ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngineXml.getName()); // get service builder ServiceBuilder<ProcessEngine> serviceBuilder = serviceTarget.addService(serviceName, service); // make this service depend on the current phase -> makes sure it is removed with the phase service at undeployment serviceBuilder.addDependency(phaseContext.getPhaseServiceName()); // add Service dependencies MscManagedProcessEngineController.initializeServiceBuilder(configuration, service, serviceBuilder, processEngineXml.getJobAcquisitionName()); // install the service serviceBuilder.install(); }