Search in sources :

Example 1 with ProcessApplicationInfoImpl

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();
        }
    }
}
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 ProcessApplicationInfoImpl

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;
}
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 ProcessApplicationInfoImpl

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);
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) DeployedProcessArchive(org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive) ProcessesXml(org.camunda.bpm.application.impl.metadata.spi.ProcessesXml) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ProcessApplicationInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationInfoImpl) JmxManagedProcessApplication(org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication) URL(java.net.URL)

Aggregations

ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)3 ArrayList (java.util.ArrayList)2 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)2 ProcessApplicationDeploymentInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl)2 DeployedProcessArchive (org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive)2 URL (java.net.URL)1 AbstractProcessApplication (org.camunda.bpm.application.AbstractProcessApplication)1 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)1 ProcessesXml (org.camunda.bpm.application.impl.metadata.spi.ProcessesXml)1 JmxManagedProcessApplication (org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)1 PlatformServiceContainer (org.camunda.bpm.container.impl.spi.PlatformServiceContainer)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)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