public interface ProcessApplicationInterface
A Process Application is an ordinary Java Application that uses the camunda process engine for BPM and Worklow functionality. Most such applications will start their own process engine (or use a process engine provided by the runtime container), deploy some BPMN 2.0 process definitions and interact with process instances derived from these process definitions. Since most process applications perform very similar bootstrapping, deployment and runtime tasks, we generalized this functionality. The concept is similar to the javax.ws.rs.core.Application class in JAX-RS: adding the process application class allows you to bootstrap and configure the provided services.
Adding a ProcessApplication class to your Java Application provides your applications with the following services:
Transforming an existing Java Application into a Process Application is easy and non-intrusive. You simply have to add:
ServletProcessApplication
: To be used for Process Applications is a Servlet Container like Apache Tomcat.EjbProcessApplication
: To be used in a Java EE application server like JBoss, Glassfish or WebSphere Application Server.EmbeddedProcessApplication
: To be used when embedding the process engine is an ordinary Java SE application.Modifier and Type | Method and Description |
---|---|
void |
createDeployment(String processArchiveName,
DeploymentBuilder deploymentBuilder)
Override this method in order to programmatically add resources to the
deployment created by this process application.
|
void |
deploy()
Deploy this process application into the runtime container.
|
<T> T |
execute(Callable<T> callable)
The default implementation simply modifies the Context
ClassLoader |
<T> T |
execute(Callable<T> callable,
InvocationContext context)
Is invoked instead of
execute(Callable) if a context is available. |
BeanELResolver |
getBeanElResolver()
Returns an instance of
BeanELResolver that a process application caches. |
ELResolver |
getElResolver()
This allows the process application to provide a custom ElResolver to the process engine.
|
ExecutionListener |
getExecutionListener()
Allows the process application to provide an
ExecutionListener which is notified about
all execution events in all of the process instances deployed by this process application. |
String |
getName() |
ClassLoader |
getProcessApplicationClassloader()
Override this method to provide an environment-specific
ClassLoader to be used by the process
engine for loading resources from the process application |
Map<String,String> |
getProperties()
override this method in order to provide a map of properties.
|
ProcessApplicationInterface |
getRawObject()
Since
getReference() may return a proxy object, this method returs the actual, unproxied object and is
meant to be called from the execute(Callable) method. |
ProcessApplicationReference |
getReference()
Returns a globally sharable reference to this process application.
|
TaskListener |
getTaskListener()
Allows the process application to provide a
TaskListener which is notified about
all Task events in all of the process instances deployed by this process application. |
void |
undeploy()
Undeploy this process application from the runtime container.
|
void deploy()
Deploy this process application into the runtime container.
NOTE: on some containers (like JBoss AS 7) the deployment of the process application is performed asynchronously and via introspection at deployment time. This means that there is no guarantee that the process application is fully deployed after this method returns.If you need a post deployment hook, use the @PostDeploy
annotation.
void undeploy()
Undeploy this process application from the runtime container.
If your application needs to be notified of the undeployment,
add a @PreUndeploy
method to your subclass.
String getName()
ProcessApplicationReference getReference()
Returns a globally sharable reference to this process application. This reference may be safely passed to the process engine. And other applications.
ProcessApplicationInterface getRawObject()
getReference()
may return a proxy object, this method returs the actual, unproxied object and is
meant to be called from the execute(Callable)
method. (ie. from a Callable implementation passed to
the method.).<T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException
ClassLoader
callable
- to be executed "within" the context of this process application.ProcessApplicationExecutionException
<T> T execute(Callable<T> callable, InvocationContext context) throws ProcessApplicationExecutionException
execute(Callable)
if a context is available.
The default implementation simply forward the call to
execute(Callable)
. A custom implementation can override the method
to hook into the invocation.callable
- to be executed "within" the context of this process application.context
- of the current invocation, can be null
ProcessApplicationExecutionException
ClassLoader getProcessApplicationClassloader()
Override this method to provide an environment-specific ClassLoader
to be used by the process
engine for loading resources from the process application
NOTE: the process engine must never cache any references to this ClassLoader
or to classes obtained through this ClassLoader
.
ClassLoader
that can be used to load classes and resources from this process application.Map<String,String> getProperties()
override this method in order to provide a map of properties.
The properties are made available globally through the ProcessApplicationService
ELResolver getElResolver()
This allows the process application to provide a custom ElResolver to the process engine.
The process engine will use this ElResolver whenever it is executing a process in the context of this process application.
The process engine must only call this method from Callable implementations passed
to execute(Callable)
BeanELResolver getBeanElResolver()
Returns an instance of BeanELResolver
that a process application caches.
Has to be managed by the process application since BeanELResolver
keeps
hard references to classes in a cache.
void createDeployment(String processArchiveName, DeploymentBuilder deploymentBuilder)
Override this method in order to programmatically add resources to the deployment created by this process application.
This method is invoked at deployment time once for each process archive deployed by this process application.
NOTE: this method must NOT call the DeploymentBuilder.deploy()
method.
deploymentBuilder
- the DeploymentBuilder
used to construct the deployment.processArchiveName
- the name of the processArchive which is currently being deployed.ExecutionListener getExecutionListener()
Allows the process application to provide an ExecutionListener
which is notified about
all execution events in all of the process instances deployed by this process application.
If this method returns 'null', the process application is not notified about execution events.
ExecutionListener
or null.TaskListener getTaskListener()
Allows the process application to provide a TaskListener
which is notified about
all Task events in all of the process instances deployed by this process application.
If this method returns 'null', the process application is not notified about Task events.
TaskListener
or null.Copyright © 2017. All rights reserved.