Search in sources :

Example 1 with ProcessApplicationDeploymentInfo

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();
        }
    }
}
Also used : ProcessApplicationDeploymentInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl) ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationInfoImpl) ArrayList(java.util.ArrayList) ManagedReference(org.jboss.as.naming.ManagedReference) ProcessApplicationInterface(org.camunda.bpm.application.ProcessApplicationInterface) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) StartException(org.jboss.msc.service.StartException) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ComponentView(org.jboss.as.ee.component.ComponentView) ServiceName(org.jboss.msc.service.ServiceName) StartException(org.jboss.msc.service.StartException) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 2 with ProcessApplicationDeploymentInfo

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;
}
Also used : ProcessApplicationDeploymentInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl) DeployedProcessArchive(org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive) ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationInfoImpl) ArrayList(java.util.ArrayList)

Example 3 with ProcessApplicationDeploymentInfo

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;
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ArrayList(java.util.ArrayList) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 4 with ProcessApplicationDeploymentInfo

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);
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationService(org.camunda.bpm.ProcessApplicationService) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) RepositoryService(org.camunda.bpm.engine.RepositoryService) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 5 with ProcessApplicationDeploymentInfo

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);
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationService(org.camunda.bpm.ProcessApplicationService) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) RepositoryService(org.camunda.bpm.engine.RepositoryService) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Aggregations

ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)9 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)7 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)6 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)6 Test (org.junit.Test)6 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)5 RepositoryService (org.camunda.bpm.engine.RepositoryService)5 ArrayList (java.util.ArrayList)3 ProcessApplicationDeploymentInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl)2 ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)1 DeployedProcessArchive (org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive)1 PlatformServiceContainer (org.camunda.bpm.container.impl.spi.PlatformServiceContainer)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)1 ComponentView (org.jboss.as.ee.component.ComponentView)1 ManagedReference (org.jboss.as.naming.ManagedReference)1 ServiceName (org.jboss.msc.service.ServiceName)1 StartException (org.jboss.msc.service.StartException)1