use of org.jboss.as.server.deployment.DeploymentUnit in project camunda-bpm-platform by camunda.
the class ModuleDependencyProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getParent() == null) {
// The deployment unit has no parent so it is a simple war or an ear.
ModuleLoader moduleLoader = Module.getBootModuleLoader();
// If it is a simpleWar and marked with process application we have to add the dependency
boolean isProcessApplicationWarOrEar = ProcessApplicationAttachments.isProcessApplication(deploymentUnit);
AttachmentList<DeploymentUnit> subdeployments = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
// In cases of war files we have nothing todo.
if (subdeployments != null) {
// The deployment unit contains sub deployments which means the deployment unit is an ear.
// We have to check whether sub deployments are process applications or not.
boolean subDeploymentIsProcessApplication = false;
for (DeploymentUnit subDeploymentUnit : subdeployments) {
if (ProcessApplicationAttachments.isProcessApplication(subDeploymentUnit)) {
subDeploymentIsProcessApplication = true;
break;
}
}
// Also we have to add the dependency to the current deployment unit which is an ear
if (subDeploymentIsProcessApplication) {
for (DeploymentUnit subDeploymentUnit : subdeployments) {
final ModuleSpecification moduleSpecification = subDeploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
addSystemDependencies(moduleLoader, moduleSpecification);
}
// An ear is not marked as process application but also needs the dependency
isProcessApplicationWarOrEar = true;
}
}
if (isProcessApplicationWarOrEar) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
addSystemDependencies(moduleLoader, moduleSpecification);
}
}
// install the pa-module service
ModuleIdentifier identifyer = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER);
String moduleName = identifyer.toString();
ProcessApplicationModuleService processApplicationModuleService = new ProcessApplicationModuleService();
ServiceName serviceName = ServiceNames.forProcessApplicationModuleService(moduleName);
phaseContext.getServiceTarget().addService(serviceName, processApplicationModuleService).addDependency(phaseContext.getPhaseServiceName()).setInitialMode(Mode.ACTIVE).install();
}
use of org.jboss.as.server.deployment.DeploymentUnit in project camunda-bpm-platform by camunda.
the class ProcessApplicationDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit)) {
return;
}
final ComponentDescription paComponent = getProcessApplicationComponent(deploymentUnit);
final ServiceName paViewServiceName = getProcessApplicationViewServiceName(paComponent);
Module module = deploymentUnit.getAttachment(Attachments.MODULE);
final String moduleName = module.getIdentifier().toString();
final ServiceName paStartServiceName = ServiceNames.forProcessApplicationStartService(moduleName);
final ServiceName paStopServiceName = ServiceNames.forProcessApplicationStopService(moduleName);
final ServiceName noViewStartService = ServiceNames.forNoViewProcessApplicationStartService(moduleName);
List<ServiceName> deploymentServiceNames = new ArrayList<ServiceName>();
ProcessApplicationStopService paStopService = new ProcessApplicationStopService();
ServiceBuilder<ProcessApplicationStopService> stopServiceBuilder = phaseContext.getServiceTarget().addService(paStopServiceName, paStopService).addDependency(phaseContext.getPhaseServiceName()).addDependency(ServiceNames.forBpmPlatformPlugins(), BpmPlatformPlugins.class, paStopService.getPlatformPluginsInjector()).setInitialMode(Mode.ACTIVE);
if (paViewServiceName != null) {
stopServiceBuilder.addDependency(paViewServiceName, ComponentView.class, paStopService.getPaComponentViewInjector());
} else {
stopServiceBuilder.addDependency(noViewStartService, ProcessApplicationInterface.class, paStopService.getNoViewProcessApplication());
}
stopServiceBuilder.install();
// deploy all process archives
List<ProcessesXmlWrapper> processesXmlWrappers = ProcessApplicationAttachments.getProcessesXmls(deploymentUnit);
for (ProcessesXmlWrapper processesXmlWrapper : processesXmlWrappers) {
ProcessesXml processesXml = processesXmlWrapper.getProcessesXml();
for (ProcessArchiveXml processArchive : processesXml.getProcessArchives()) {
ServiceName processEngineServiceName = getProcessEngineServiceName(processArchive);
Map<String, byte[]> deploymentResources = getDeploymentResources(processArchive, deploymentUnit, processesXmlWrapper.getProcessesXmlFile());
// add the deployment service for each process archive we deploy.
ProcessApplicationDeploymentService deploymentService = new ProcessApplicationDeploymentService(deploymentResources, processArchive, module);
String processArachiveName = processArchive.getName();
if (processArachiveName == null) {
// use random name for deployment service if name is null (we cannot ask the process application yet since the component might not be up.
processArachiveName = UUID.randomUUID().toString();
}
ServiceName deploymentServiceName = ServiceNames.forProcessApplicationDeploymentService(deploymentUnit.getName(), processArachiveName);
ServiceBuilder<ProcessApplicationDeploymentService> serviceBuilder = phaseContext.getServiceTarget().addService(deploymentServiceName, deploymentService).addDependency(phaseContext.getPhaseServiceName()).addDependency(paStopServiceName).addDependency(processEngineServiceName, ProcessEngine.class, deploymentService.getProcessEngineInjector()).setInitialMode(Mode.ACTIVE);
if (paViewServiceName != null) {
// add a dependency on the component start service to make sure we are started after the pa-component (Singleton EJB) has started
serviceBuilder.addDependency(paComponent.getStartServiceName());
serviceBuilder.addDependency(paViewServiceName, ComponentView.class, deploymentService.getPaComponentViewInjector());
} else {
serviceBuilder.addDependency(noViewStartService, ProcessApplicationInterface.class, deploymentService.getNoViewProcessApplication());
}
JBossCompatibilityExtension.addServerExecutorDependency(serviceBuilder, deploymentService.getExecutorInjector(), false);
serviceBuilder.install();
deploymentServiceNames.add(deploymentServiceName);
}
}
AnnotationInstance postDeploy = ProcessApplicationAttachments.getPostDeployDescription(deploymentUnit);
AnnotationInstance preUndeploy = ProcessApplicationAttachments.getPreUndeployDescription(deploymentUnit);
// register the managed process application start service
ProcessApplicationStartService paStartService = new ProcessApplicationStartService(deploymentServiceNames, postDeploy, preUndeploy, module);
ServiceBuilder<ProcessApplicationStartService> serviceBuilder = phaseContext.getServiceTarget().addService(paStartServiceName, paStartService).addDependency(phaseContext.getPhaseServiceName()).addDependency(ServiceNames.forDefaultProcessEngine(), ProcessEngine.class, paStartService.getDefaultProcessEngineInjector()).addDependency(ServiceNames.forBpmPlatformPlugins(), BpmPlatformPlugins.class, paStartService.getPlatformPluginsInjector()).addDependencies(deploymentServiceNames).setInitialMode(Mode.ACTIVE);
if (paViewServiceName != null) {
serviceBuilder.addDependency(paViewServiceName, ComponentView.class, paStartService.getPaComponentViewInjector());
} else {
serviceBuilder.addDependency(noViewStartService, ProcessApplicationInterface.class, paStartService.getNoViewProcessApplication());
}
serviceBuilder.install();
}
use of org.jboss.as.server.deployment.DeploymentUnit in project camunda-bpm-platform by camunda.
the class ProcessApplicationProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
// must be EE Module
if (eeModuleDescription == null) {
return;
}
// discover user-provided component
ComponentDescription paComponent = detectExistingComponent(deploymentUnit);
if (paComponent != null) {
log.log(Level.INFO, "Detected user-provided @" + ProcessApplication.class.getSimpleName() + " component with name '" + paComponent.getComponentName() + "'.");
// mark this to be a process application
ProcessApplicationAttachments.attachProcessApplicationComponent(deploymentUnit, paComponent);
ProcessApplicationAttachments.mark(deploymentUnit);
ProcessApplicationAttachments.markPartOfProcessApplication(deploymentUnit);
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class EESecurityDependencyProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent();
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("javax.security.enterprise.api"), false, false, true, false));
Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT);
if (securityPresent != null && securityPresent) {
moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false));
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class EESecurityAnnotationProcessor method markAsEESecurity.
private void markAsEESecurity(DeploymentUnit deploymentUnit) {
DeploymentUnit top = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
top.putAttachment(SECURITY_PRESENT, true);
}
Aggregations