org.camunda.bpm.application.AbstractProcessApplication Java Examples
The following examples show how to use
org.camunda.bpm.application.AbstractProcessApplication.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OSGiRuntimeContainerDelegate.java From camunda-bpm-platform-osgi with Apache License 2.0 | 6 votes |
@Override public void deployProcessApplication(AbstractProcessApplication processApplication) { if(processApplication == null) { throw new ProcessEngineException("Process application cannot be null"); } final String operationName = "Deployment of Process Application "+processApplication.getName(); getServiceContainer().createDeploymentOperation(operationName) .addAttachment(Attachments.PROCESS_APPLICATION, processApplication) .addStep(new OSGiParseProcessesXmlStep()) .addStep(new OSGiProcessesXmlStartProcessEnginesStep(context)) .addStep(new OSGiDeployProcessArchivesStep()) .addStep(new StartProcessApplicationServiceStep()) .addStep(new PostDeployInvocationStep()) .execute(); LOGGER.info("Process Application "+processApplication.getName()+" successfully deployed."); }
Example #2
Source File: SpringProcessApplicationElResolver.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public ELResolver getElResolver(AbstractProcessApplication processApplication) { if (processApplication instanceof SpringProcessApplication) { SpringProcessApplication springProcessApplication = (SpringProcessApplication) processApplication; return new ApplicationContextElResolver(springProcessApplication.getApplicationContext()); } else if (processApplication instanceof ServletProcessApplication) { ServletProcessApplication servletProcessApplication = (ServletProcessApplication) processApplication; if(!ClassUtils.isPresent("org.springframework.web.context.support.WebApplicationContextUtils", processApplication.getProcessApplicationClassloader())) { LOGGER.log(Level.FINE, "WebApplicationContextUtils must be present for SpringProcessApplicationElResolver to work"); return null; } ServletContext servletContext = servletProcessApplication.getServletContext(); WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); if(applicationContext != null) { return new ApplicationContextElResolver(applicationContext); } } LOGGER.log(Level.FINE, "Process application class {0} unsupported by SpringProcessApplicationElResolver", processApplication); return null; }
Example #3
Source File: RuntimeContainerDelegateImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void undeployProcessApplication(AbstractProcessApplication processApplication) { ensureNotNull("Process application", processApplication); final String processAppName = processApplication.getName(); // if the process application is not deployed, ignore the request. if (serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processAppName) == null) { return; } final String operationName = "Undeployment of Process Application " + processAppName; // perform the undeployment serviceContainer.createUndeploymentOperation(operationName) .addAttachment(Attachments.PROCESS_APPLICATION, processApplication) .addSteps(getUndeploymentSteps()) .execute(); LOG.paUndeployed(processApplication.getName()); }
Example #4
Source File: DeployProcessArchiveStep.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void cancelOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); ProcessEngine processEngine = getProcessEngine(serviceContainer, processApplication.getDefaultDeployToEngineName()); // if a registration was performed, remove it. if (deployment != null && deployment.getProcessApplicationRegistration() != null) { processEngine.getManagementService().unregisterProcessApplication(deployment.getProcessApplicationRegistration().getDeploymentIds(), true); } // delete deployment if we were able to create one AND if // isDeleteUponUndeploy is set. if (deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { if (processEngine != null) { processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true); } } }
Example #5
Source File: UndeployProcessArchivesStep.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void performOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); final JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName()); ensureNotNull("Cannot find process application with name " + processApplication.getName(), "deployedProcessApplication", deployedProcessApplication); Map<String, DeployedProcessArchive> deploymentMap = deployedProcessApplication.getProcessArchiveDeploymentMap(); if (deploymentMap != null) { List<ProcessesXml> processesXmls = deployedProcessApplication.getProcessesXmls(); for (ProcessesXml processesXml : processesXmls) { for (ProcessArchiveXml parsedProcessArchive : processesXml.getProcessArchives()) { DeployedProcessArchive deployedProcessArchive = deploymentMap.get(parsedProcessArchive.getName()); if (deployedProcessArchive != null) { operationContext.addStep(new UndeployProcessArchiveStep(deployedProcessApplication, parsedProcessArchive, deployedProcessArchive.getProcessEngineName())); } } } } }
Example #6
Source File: ParseProcessesXmlStep.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected List<URL> getProcessesXmlUrls(String[] deploymentDescriptors, AbstractProcessApplication processApplication) { ClassLoader processApplicationClassloader = processApplication.getProcessApplicationClassloader(); List<URL> result = new ArrayList<URL>(); // load all deployment descriptor files using the classloader of the process application for (String deploymentDescriptor : deploymentDescriptors) { Enumeration<URL> processesXmlFileLocations = null; try { processesXmlFileLocations = processApplicationClassloader.getResources(deploymentDescriptor); } catch (IOException e) { throw LOG.exceptionWhileReadingProcessesXml(deploymentDescriptor, e); } while (processesXmlFileLocations.hasMoreElements()) { result.add(processesXmlFileLocations.nextElement()); } } return result; }
Example #7
Source File: StartProcessApplicationServiceStep.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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); }
Example #8
Source File: TypedValueField.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected static VariableSerializers getCurrentPaSerializers() { if (Context.getCurrentProcessApplication() != null) { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplicationInterface = processApplicationReference.getProcessApplication(); ProcessApplicationInterface rawPa = processApplicationInterface.getRawObject(); if (rawPa instanceof AbstractProcessApplication) { return ((AbstractProcessApplication) rawPa).getVariableSerializers(); } else { return null; } } catch (ProcessApplicationUnavailableException e) { throw LOG.cannotDeterminePaDataformats(e); } } else { return null; } }
Example #9
Source File: OSGiParseProcessesXmlStep.java From camunda-bpm-platform-osgi with Apache License 2.0 | 6 votes |
@Override protected List<URL> getProcessesXmlUrls(String[] deploymentDescriptors, AbstractProcessApplication processApplication) { OSGiProcessApplication osgiProcessApplication = (OSGiProcessApplication) processApplication; List<URL> urls = new ArrayList<URL>(); for (String descriptorName : deploymentDescriptors) { Enumeration<URL> foundDescriptors; try { foundDescriptors = osgiProcessApplication.getBundle().getResources(descriptorName); while (foundDescriptors.hasMoreElements()) { urls.add(foundDescriptors.nextElement()); } } catch (IOException e) { e.printStackTrace(); } } return urls; }
Example #10
Source File: OSGiRuntimeContainerDelegateTest.java From camunda-bpm-platform-osgi with Apache License 2.0 | 6 votes |
@Test public void deployProcessApplication() { AbstractProcessApplication app = mock(AbstractProcessApplication.class); new TestOSGiRuntimeContainerDelegate(null).deployProcessApplication(app); Map<String, Object> attachments = builder.getAttachments(); Set<Entry<String, Object>> entrySet = attachments.entrySet(); assertThat(entrySet.size(), is(1)); Entry<String, Object> entry = entrySet.iterator().next(); assertThat(entry.getKey(), is(Attachments.PROCESS_APPLICATION)); assertThat((AbstractProcessApplication) entry.getValue(), is(theInstance(app))); List<DeploymentOperationStep> steps = builder.getSteps(); for (DeploymentOperationStep step : steps) { assertThat( step, is(anyOf(instanceOf(OSGiParseProcessesXmlStep.class), instanceOf(OSGiProcessesXmlStartProcessEnginesStep.class), instanceOf(DeployProcessArchivesStep.class), instanceOf(StartProcessApplicationServiceStep.class), instanceOf(PostDeployInvocationStep.class)))); } }
Example #11
Source File: SpinBpmPlatformPlugin.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public void postProcessApplicationDeploy(ProcessApplicationInterface processApplication) { ProcessApplicationInterface rawPa = processApplication.getRawObject(); if (rawPa instanceof AbstractProcessApplication) { initializeVariableSerializers((AbstractProcessApplication) rawPa); } else { LOG.logNoDataFormatsInitiailized("process application data formats", "process application is not a sub class of " + AbstractProcessApplication.class.getName()); } }
Example #12
Source File: RuntimeContainerDelegateImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public void deployProcessApplication(AbstractProcessApplication processApplication) { ensureNotNull("Process application", processApplication); final String operationName = "Deployment of Process Application " + processApplication.getName(); serviceContainer.createDeploymentOperation(operationName) .addAttachment(Attachments.PROCESS_APPLICATION, processApplication) .addSteps(getDeploymentSteps()) .execute(); LOG.paDeployed(processApplication.getName()); }
Example #13
Source File: NotifyPostProcessApplicationUndeployedStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public void performOperationStep(DeploymentOperation operationContext) { final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final JmxManagedBpmPlatformPlugins plugins = serviceContainer.getService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_PLATFORM_PLUGINS); if (plugins != null) { for (BpmPlatformPlugin plugin : plugins.getValue().getPlugins()) { plugin.postProcessApplicationUndeploy(processApplication); } } }
Example #14
Source File: StopProcessApplicationServiceStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void performOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); // remove the service serviceContainer.stopService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName()); }
Example #15
Source File: InjectionUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static ProcessApplicationInfo getProcessApplicationInfo(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); JmxManagedProcessApplication managedPa = serviceContainer.getServiceValue(ServiceTypes.PROCESS_APPLICATION, processApplication.getName()); return managedPa.getProcessApplicationInfo(); }
Example #16
Source File: StartJobAcquisitionStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void performOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION); ClassLoader configurationClassloader = null; if(processApplication != null) { configurationClassloader = processApplication.getProcessApplicationClassloader(); } else { configurationClassloader = ProcessEngineConfiguration.class.getClassLoader(); } String configurationClassName = jobAcquisitionXml.getJobExecutorClassName(); if(configurationClassName == null || configurationClassName.isEmpty()) { configurationClassName = RuntimeContainerJobExecutor.class.getName(); } // create & instantiate the job executor class Class<? extends JobExecutor> jobExecutorClass = loadJobExecutorClass(configurationClassloader, configurationClassName); JobExecutor jobExecutor = instantiateJobExecutor(jobExecutorClass); // apply properties Map<String, String> properties = jobAcquisitionXml.getProperties(); PropertyHelper.applyProperties(jobExecutor, properties); // construct service for job executor JmxManagedJobExecutor jmxManagedJobExecutor = new JmxManagedJobExecutor(jobExecutor); // deploy the job executor service into the container serviceContainer.startService(ServiceTypes.JOB_EXECUTOR, jobAcquisitionXml.getName(), jmxManagedJobExecutor); }
Example #17
Source File: ParseProcessesXmlStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected String[] getDeploymentDescriptorLocations(AbstractProcessApplication processApplication) { ProcessApplication annotation = processApplication.getClass().getAnnotation(ProcessApplication.class); if(annotation == null) { return new String[] {ProcessApplication.DEFAULT_META_INF_PROCESSES_XML}; } else { return annotation.deploymentDescriptors(); } }
Example #18
Source File: SpinBpmPlatformPlugin.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeVariableSerializers(AbstractProcessApplication abstractProcessApplication) { VariableSerializers paVariableSerializers = abstractProcessApplication.getVariableSerializers(); if (paVariableSerializers == null) { paVariableSerializers = new DefaultVariableSerializers(); abstractProcessApplication.setVariableSerializers(paVariableSerializers); } for (TypedValueSerializer<?> serializer : lookupSpinSerializers(abstractProcessApplication.getProcessApplicationClassloader())) { paVariableSerializers.addSerializer(serializer); } }
Example #19
Source File: ParseProcessesXmlStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Map<URL, ProcessesXml> parseProcessesXmlFiles(final AbstractProcessApplication processApplication) { String[] deploymentDescriptors = getDeploymentDescriptorLocations(processApplication); List<URL> processesXmlUrls = getProcessesXmlUrls(deploymentDescriptors, processApplication); Map<URL, ProcessesXml> parsedFiles = new HashMap<URL, ProcessesXml>(); // perform parsing for (URL url : processesXmlUrls) { LOG.foundProcessesXmlFile(url.toString()); if(isEmptyFile(url)) { parsedFiles.put(url, ProcessesXml.EMPTY_PROCESSES_XML); LOG.emptyProcessesXml(); } else { parsedFiles.put(url, parseProcessesXml(url)); } } if(parsedFiles.isEmpty()) { LOG.noProcessesXmlForPa(processApplication.getName()); } return parsedFiles; }
Example #20
Source File: ProcessesXmlStopProcessEnginesStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void performOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION); final JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName()); ensureNotNull("Cannot find process application with name " + processApplication.getName(), "deployedProcessApplication", deployedProcessApplication); List<ProcessesXml> processesXmls = deployedProcessApplication.getProcessesXmls(); for (ProcessesXml processesXml : processesXmls) { stopProcessEngines(processesXml.getProcessEngines(), operationContext); } }
Example #21
Source File: StartProcessApplicationServiceStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void notifyBpmPlatformPlugins(PlatformServiceContainer serviceContainer, AbstractProcessApplication processApplication) { JmxManagedBpmPlatformPlugins plugins = serviceContainer.getService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_PLATFORM_PLUGINS); if (plugins != null) { for (BpmPlatformPlugin plugin : plugins.getValue().getPlugins()) { plugin.postProcessApplicationDeploy(processApplication); } } }
Example #22
Source File: StartProcessApplicationServiceStep.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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; }
Example #23
Source File: DefaultElResolverLookup.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public final static ELResolver lookupResolver(AbstractProcessApplication processApplication) { ServiceLoader<ProcessApplicationElResolver> providers = ServiceLoader.load(ProcessApplicationElResolver.class); List<ProcessApplicationElResolver> sortedProviders = new ArrayList<ProcessApplicationElResolver>(); for (ProcessApplicationElResolver provider : providers) { sortedProviders.add(provider); } if(sortedProviders.isEmpty()) { return null; } else { // sort providers first Collections.sort(sortedProviders, new ProcessApplicationElResolver.ProcessApplicationElResolverSorter()); // add all providers to a composite resolver CompositeELResolver compositeResolver = new CompositeELResolver(); StringBuilder summary = new StringBuilder(); summary.append(String.format("ElResolvers found for Process Application %s", processApplication.getName())); for (ProcessApplicationElResolver processApplicationElResolver : sortedProviders) { ELResolver elResolver = processApplicationElResolver.getElResolver(processApplication); if (elResolver != null) { compositeResolver.add(elResolver); summary.append(String.format("Class %s", processApplicationElResolver.getClass().getName())); } else { LOG.noElResolverProvided(processApplication.getName(), processApplicationElResolver.getClass().getName()); } } LOG.paElResolversDiscovered(summary.toString()); return compositeResolver; } }
Example #24
Source File: ScriptingEnvironment.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Map<String, List<ExecutableScript>> getPaEnvScripts(ProcessApplicationReference pa) { try { ProcessApplicationInterface processApplication = pa.getProcessApplication(); ProcessApplicationInterface rawObject = processApplication.getRawObject(); if (rawObject instanceof AbstractProcessApplication) { AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication) rawObject; return abstractProcessApplication.getEnvironmentScripts(); } return null; } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Process Application is unavailable.", e); } }
Example #25
Source File: ScriptingEngines.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected ScriptEngine getPaScriptEngine(String language, ProcessApplicationReference pa) { try { ProcessApplicationInterface processApplication = pa.getProcessApplication(); ProcessApplicationInterface rawObject = processApplication.getRawObject(); if (rawObject instanceof AbstractProcessApplication) { AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication) rawObject; return abstractProcessApplication.getScriptEngineForName(language, enableScriptEngineCaching); } return null; } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Process Application is unavailable.", e); } }
Example #26
Source File: ProcessApplicationReferenceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public AbstractProcessApplication getProcessApplication() throws ProcessApplicationUnavailableException { AbstractProcessApplication application = processApplication.get(); if (application == null) { throw LOG.processApplicationUnavailableException(name); } else { return application; } }
Example #27
Source File: ProcessApplicationReferenceImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public ProcessApplicationReferenceImpl(AbstractProcessApplication processApplication) { this.processApplication = new WeakReference<AbstractProcessApplication>(processApplication); this.name = processApplication.getName(); }
Example #28
Source File: NullELResolver.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public ELResolver getElResolver(AbstractProcessApplication processApplication) { return null; }
Example #29
Source File: PaLocalScriptEngineDisabledCacheTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldNotCacheScriptEngine() { AbstractProcessApplication processApplication = (AbstractProcessApplication) getProcessApplication(); assertNotEquals(processApplication.getScriptEngineForName(SCRIPT_FORMAT, false), processApplication.getScriptEngineForName(SCRIPT_FORMAT, false)); }
Example #30
Source File: PaLocalScriptEngineEnabledCacheTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldCacheScriptEngine() { AbstractProcessApplication processApplication = (AbstractProcessApplication) getProcessApplication(); assertEquals(processApplication.getScriptEngineForName(SCRIPT_FORMAT, true), processApplication.getScriptEngineForName(SCRIPT_FORMAT, true)); }