use of org.camunda.bpm.application.impl.ProcessApplicationInfoImpl in project camunda-bpm-platform by camunda.
the class ProcessApplicationStartService method start.
@Override
public void start(StartContext context) throws StartException {
ManagedReference reference = null;
try {
// get the process application component
ProcessApplicationInterface processApplication = null;
ComponentView componentView = paComponentViewInjector.getOptionalValue();
if (componentView != null) {
reference = componentView.createInstance();
processApplication = (ProcessApplicationInterface) reference.getInstance();
} else {
processApplication = noViewProcessApplication.getValue();
}
// create & populate the process application info object
processApplicationInfo = new ProcessApplicationInfoImpl();
processApplicationInfo.setName(processApplication.getName());
processApplicationInfo.setProperties(processApplication.getProperties());
referencedProcessEngines = new HashSet<ProcessEngine>();
List<ProcessApplicationDeploymentInfo> deploymentInfos = new ArrayList<ProcessApplicationDeploymentInfo>();
for (ServiceName deploymentServiceName : deploymentServiceNames) {
ProcessApplicationDeploymentService value = getDeploymentService(context, deploymentServiceName);
referencedProcessEngines.add(value.getProcessEngineInjector().getValue());
ProcessApplicationDeployment deployment = value.getDeployment();
if (deployment != null) {
for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) {
ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
deploymentInfo.setDeploymentId(deploymentId);
deploymentInfo.setProcessEngineName(value.getProcessEngineName());
deploymentInfos.add(deploymentInfo);
}
}
}
processApplicationInfo.setDeploymentInfo(deploymentInfos);
notifyBpmPlatformPlugins(platformPluginsInjector.getValue(), processApplication);
if (postDeployDescription != null) {
invokePostDeploy(processApplication);
}
// install the ManagedProcessApplication Service as a child to this service
// if this service stops (at undeployment) the ManagedProcessApplication service is removed as well.
ServiceName serviceName = ServiceNames.forManagedProcessApplication(processApplicationInfo.getName());
MscManagedProcessApplication managedProcessApplication = new MscManagedProcessApplication(processApplicationInfo, processApplication.getReference());
context.getChildTarget().addService(serviceName, managedProcessApplication).install();
} catch (StartException e) {
throw e;
} catch (Exception e) {
throw new StartException(e);
} finally {
if (reference != null) {
reference.release();
}
}
}
use of org.camunda.bpm.application.impl.ProcessApplicationInfoImpl in project camunda-bpm-platform by camunda.
the class StartProcessApplicationServiceStep method createProcessApplicationInfo.
protected ProcessApplicationInfoImpl createProcessApplicationInfo(final AbstractProcessApplication processApplication, final Map<String, DeployedProcessArchive> processArchiveDeploymentMap) {
// populate process application info
ProcessApplicationInfoImpl processApplicationInfo = new ProcessApplicationInfoImpl();
processApplicationInfo.setName(processApplication.getName());
processApplicationInfo.setProperties(processApplication.getProperties());
// create deployment infos
List<ProcessApplicationDeploymentInfo> deploymentInfoList = new ArrayList<ProcessApplicationDeploymentInfo>();
if (processArchiveDeploymentMap != null) {
for (Entry<String, DeployedProcessArchive> deployment : processArchiveDeploymentMap.entrySet()) {
final DeployedProcessArchive deployedProcessArchive = deployment.getValue();
for (String deploymentId : deployedProcessArchive.getAllDeploymentIds()) {
ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
deploymentInfo.setDeploymentId(deploymentId);
deploymentInfo.setProcessEngineName(deployedProcessArchive.getProcessEngineName());
deploymentInfoList.add(deploymentInfo);
}
}
}
processApplicationInfo.setDeploymentInfo(deploymentInfoList);
return processApplicationInfo;
}
use of org.camunda.bpm.application.impl.ProcessApplicationInfoImpl in project camunda-bpm-platform by camunda.
the class StartProcessApplicationServiceStep method performOperationStep.
public void performOperationStep(DeploymentOperation operationContext) {
final AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
final Map<URL, ProcessesXml> processesXmls = operationContext.getAttachment(PROCESSES_XML_RESOURCES);
final Map<String, DeployedProcessArchive> processArchiveDeploymentMap = operationContext.getAttachment(PROCESS_ARCHIVE_DEPLOYMENT_MAP);
final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
ProcessApplicationInfoImpl processApplicationInfo = createProcessApplicationInfo(processApplication, processArchiveDeploymentMap);
// create service
JmxManagedProcessApplication mbean = new JmxManagedProcessApplication(processApplicationInfo, processApplication.getReference());
mbean.setProcessesXmls(new ArrayList<ProcessesXml>(processesXmls.values()));
mbean.setDeploymentMap(processArchiveDeploymentMap);
// start service
serviceContainer.startService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName(), mbean);
notifyBpmPlatformPlugins(serviceContainer, processApplication);
}
Aggregations