Class AbstractProcessApplication
- java.lang.Object
-
- org.camunda.bpm.application.AbstractProcessApplication
-
- All Implemented Interfaces:
ProcessApplicationInterface
- Direct Known Subclasses:
EjbProcessApplication
,EmbeddedProcessApplication
,ServletProcessApplication
,SpringProcessApplication
public abstract class AbstractProcessApplication extends java.lang.Object implements ProcessApplicationInterface
- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
defaultDeployToEngineName
protected boolean
isDeployed
protected BeanELResolver
processApplicationBeanElResolver
protected ELResolver
processApplicationElResolver
protected ProcessApplicationScriptEnvironment
processApplicationScriptEnvironment
protected VariableSerializers
variableSerializers
-
Constructor Summary
Constructors Constructor Description AbstractProcessApplication()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.String
autodetectProcessApplicationName()
Override this method to autodetect an application name in case theProcessApplication
annotation was used but without parameter.void
createDeployment(java.lang.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(java.util.concurrent.Callable<T> callable)
The default implementation simply modifies the ContextClassLoader
<T> T
execute(java.util.concurrent.Callable<T> callable, InvocationContext invocationContext)
Is invoked instead ofProcessApplicationInterface.execute(Callable)
if a context is available.BeanELResolver
getBeanElResolver()
Returns an instance ofBeanELResolver
that a process application caches.java.lang.String
getDefaultDeployToEngineName()
Provides the default Process Engine name to deploy to, if no Process Engine was defined inprocesses.xml
.ELResolver
getElResolver()
This allows the process application to provide a custom ElResolver to the process engine.java.util.Map<java.lang.String,java.util.List<ExecutableScript>>
getEnvironmentScripts()
ExecutionListener
getExecutionListener()
Allows the process application to provide anExecutionListener
which is notified about all execution events in all of the process instances deployed by this process application.java.lang.String
getName()
java.lang.ClassLoader
getProcessApplicationClassloader()
Override this method to provide an environment-specificClassLoader
to be used by the process engine for loading resources from the process applicationprotected ProcessApplicationScriptEnvironment
getProcessApplicationScriptEnvironment()
java.util.Map<java.lang.String,java.lang.String>
getProperties()
override this method in order to provide a map of properties.ProcessApplicationInterface
getRawObject()
SinceProcessApplicationInterface.getReference()
may return a proxy object, this method returs the actual, unproxied object and is meant to be called from theProcessApplicationInterface.execute(Callable)
method.javax.script.ScriptEngine
getScriptEngineForName(java.lang.String name, boolean cache)
TaskListener
getTaskListener()
Allows the process application to provide aTaskListener
which is notified about all Task events in all of the process instances deployed by this process application.VariableSerializers
getVariableSerializers()
protected ELResolver
initProcessApplicationElResolver()
Initializes the process application provided ElResolver.protected void
setDefaultDeployToEngineName(java.lang.String defaultDeployToEngineName)
Programmatically set the name of the Process Engine to deploy to if no Process Engine is defined inprocesses.xml
.void
setVariableSerializers(VariableSerializers variableSerializers)
void
undeploy()
Undeploy this process application from the runtime container.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.application.ProcessApplicationInterface
getReference
-
-
-
-
Field Detail
-
processApplicationElResolver
protected ELResolver processApplicationElResolver
-
processApplicationBeanElResolver
protected BeanELResolver processApplicationBeanElResolver
-
processApplicationScriptEnvironment
protected ProcessApplicationScriptEnvironment processApplicationScriptEnvironment
-
variableSerializers
protected VariableSerializers variableSerializers
-
isDeployed
protected boolean isDeployed
-
defaultDeployToEngineName
protected java.lang.String defaultDeployToEngineName
-
-
Method Detail
-
deploy
public void deploy()
Description copied from interface:ProcessApplicationInterface
Deploy this process application into the runtime container.
NOTE: on some containers (like WildFly) 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.- Specified by:
deploy
in interfaceProcessApplicationInterface
-
undeploy
public void undeploy()
Description copied from interface:ProcessApplicationInterface
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.- Specified by:
undeploy
in interfaceProcessApplicationInterface
-
createDeployment
public void createDeployment(java.lang.String processArchiveName, DeploymentBuilder deploymentBuilder)
Description copied from interface:ProcessApplicationInterface
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.- Specified by:
createDeployment
in interfaceProcessApplicationInterface
- Parameters:
processArchiveName
- the name of the processArchive which is currently being deployed.deploymentBuilder
- theDeploymentBuilder
used to construct the deployment.
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceProcessApplicationInterface
- Returns:
- the name of this process application
-
autodetectProcessApplicationName
protected abstract java.lang.String autodetectProcessApplicationName()
Override this method to autodetect an application name in case theProcessApplication
annotation was used but without parameter.
-
execute
public <T> T execute(java.util.concurrent.Callable<T> callable) throws ProcessApplicationExecutionException
Description copied from interface:ProcessApplicationInterface
The default implementation simply modifies the ContextClassLoader
- Specified by:
execute
in interfaceProcessApplicationInterface
- Parameters:
callable
- to be executed "within" the context of this process application.- Returns:
- the result of the callback
- Throws:
ProcessApplicationExecutionException
-
execute
public <T> T execute(java.util.concurrent.Callable<T> callable, InvocationContext invocationContext) throws ProcessApplicationExecutionException
Description copied from interface:ProcessApplicationInterface
Is invoked instead ofProcessApplicationInterface.execute(Callable)
if a context is available. The default implementation simply forward the call toProcessApplicationInterface.execute(Callable)
. A custom implementation can override the method to hook into the invocation.- Specified by:
execute
in interfaceProcessApplicationInterface
- Parameters:
callable
- to be executed "within" the context of this process application.invocationContext
- of the current invocation, can benull
- Returns:
- the result of the callback
- Throws:
ProcessApplicationExecutionException
-
getProcessApplicationClassloader
public java.lang.ClassLoader getProcessApplicationClassloader()
Description copied from interface:ProcessApplicationInterface
Override this method to provide an environment-specific
ClassLoader
to be used by the process engine for loading resources from the process applicationNOTE: the process engine must never cache any references to this
ClassLoader
or to classes obtained through thisClassLoader
.- Specified by:
getProcessApplicationClassloader
in interfaceProcessApplicationInterface
- Returns:
- the
ClassLoader
that can be used to load classes and resources from this process application.
-
getRawObject
public ProcessApplicationInterface getRawObject()
Description copied from interface:ProcessApplicationInterface
SinceProcessApplicationInterface.getReference()
may return a proxy object, this method returs the actual, unproxied object and is meant to be called from theProcessApplicationInterface.execute(Callable)
method. (ie. from a Callable implementation passed to the method.).- Specified by:
getRawObject
in interfaceProcessApplicationInterface
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface:ProcessApplicationInterface
override this method in order to provide a map of properties.
The properties are made available globally through the
ProcessApplicationService
- Specified by:
getProperties
in interfaceProcessApplicationInterface
- See Also:
ProcessApplicationService
,ProcessApplicationInfo.getProperties()
-
getElResolver
public ELResolver getElResolver()
Description copied from interface:ProcessApplicationInterface
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
ProcessApplicationInterface.execute(Callable)
- Specified by:
getElResolver
in interfaceProcessApplicationInterface
-
getBeanElResolver
public BeanELResolver getBeanElResolver()
Description copied from interface:ProcessApplicationInterface
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.- Specified by:
getBeanElResolver
in interfaceProcessApplicationInterface
-
initProcessApplicationElResolver
protected ELResolver initProcessApplicationElResolver()
Initializes the process application provided ElResolver. This implementation uses the Java SE
ServiceLoader
facilities for resolving implementations ofProcessApplicationElResolver
.If you want to provide a custom implementation in your application, place a file named
META-INF/org.camunda.bpm.application.ProcessApplicationElResolver
inside your application which contains the fully qualified classname of your implementation. Or simply override this method.- Returns:
- the process application ElResolver.
-
getExecutionListener
public ExecutionListener getExecutionListener()
Description copied from interface:ProcessApplicationInterface
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.
- Specified by:
getExecutionListener
in interfaceProcessApplicationInterface
- Returns:
- an
ExecutionListener
or null.
-
getTaskListener
public TaskListener getTaskListener()
Description copied from interface:ProcessApplicationInterface
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.
- Specified by:
getTaskListener
in interfaceProcessApplicationInterface
- Returns:
- a
TaskListener
or null.
-
getScriptEngineForName
public javax.script.ScriptEngine getScriptEngineForName(java.lang.String name, boolean cache)
-
getEnvironmentScripts
public java.util.Map<java.lang.String,java.util.List<ExecutableScript>> getEnvironmentScripts()
-
getProcessApplicationScriptEnvironment
protected ProcessApplicationScriptEnvironment getProcessApplicationScriptEnvironment()
-
getVariableSerializers
public VariableSerializers getVariableSerializers()
-
setVariableSerializers
public void setVariableSerializers(VariableSerializers variableSerializers)
-
getDefaultDeployToEngineName
public java.lang.String getDefaultDeployToEngineName()
Provides the default Process Engine name to deploy to, if no Process Engine was defined in
processes.xml
.- Returns:
- the default deploy-to Process Engine name. The default value is "default".
-
setDefaultDeployToEngineName
protected void setDefaultDeployToEngineName(java.lang.String defaultDeployToEngineName)
Programmatically set the name of the Process Engine to deploy to if no Process Engine is defined in
processes.xml
. This allows to circumvent the "default" Process Engine name and set a custom one.- Parameters:
defaultDeployToEngineName
-
-
-