use of org.camunda.bpm.container.impl.jboss.service.ProcessApplicationModuleService 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();
}
Aggregations