use of org.camunda.bpm.application.ProcessApplicationDeploymentInfo 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.ProcessApplicationDeploymentInfo 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.ProcessApplicationDeploymentInfo in project camunda-bpm-platform by camunda.
the class InjectionUtil method getProcessEngines.
public static List<ProcessEngine> getProcessEngines(DeploymentOperation operationContext) {
final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
final ProcessApplicationInfo processApplicationInfo = getProcessApplicationInfo(operationContext);
List<ProcessEngine> processEngines = new ArrayList<ProcessEngine>();
for (ProcessApplicationDeploymentInfo deploymentInfo : processApplicationInfo.getDeploymentInfo()) {
String processEngineName = deploymentInfo.getProcessEngineName();
processEngines.add((ProcessEngine) serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName));
}
return processEngines;
}
use of org.camunda.bpm.application.ProcessApplicationDeploymentInfo in project camunda-bpm-platform by camunda.
the class TestWarDeploymentResumePrevious method testDeployProcessArchive.
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
Assert.assertEquals(2, count);
// validate registrations:
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
boolean resumedRegistrationFound = false;
for (String paName : processApplicationNames) {
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
if (deploymentInfo.size() == 2) {
if (resumedRegistrationFound) {
Assert.fail("Cannot have two registrations");
}
resumedRegistrationFound = true;
}
}
Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);
}
use of org.camunda.bpm.application.ProcessApplicationDeploymentInfo in project camunda-bpm-platform by camunda.
the class TestWarDeploymentIsDeployChangedOnly method testDeployProcessArchive.
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
Assert.assertEquals(1, count);
// validate registrations:
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
boolean resumedRegistrationFound = false;
for (String paName : processApplicationNames) {
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
if (deploymentInfo.size() == 2) {
if (resumedRegistrationFound) {
Assert.fail("Cannot have two registrations");
}
resumedRegistrationFound = true;
}
}
Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);
}
Aggregations