Class EjbProcessApplication
- java.lang.Object
-
- org.camunda.bpm.application.AbstractProcessApplication
-
- org.camunda.bpm.application.impl.EjbProcessApplication
-
- All Implemented Interfaces:
ProcessApplicationInterface
- Direct Known Subclasses:
DefaultEjbProcessApplication
public class EjbProcessApplication extends AbstractProcessApplication
Common base class for writing EJB process applications.
An EJB Process Application exposes itself as a Session Bean Component inside the EJB container. This determines the invocation semantics when invoking code from the process application and the nature of the
ProcessApplicationReference
held by the process engine.Usage
In order to add a custom EJB process application to your application, extend this class and configure it as follows:
@ProcessApplication("my process application") @Singleton @Startup @ConcurrencyManagement(ConcurrencyManagementType.BEAN) @TransactionAttribute(TransactionAttributeType.REQUIRED) public class DefaultEjbProcessApplication extends EjbProcessApplication { @PostConstruct public void deploy() { super.deploy(); } @PreDestroy public void undeploy() { super.undeploy(); } }
(the same Metadata can of course be provided using an XML-based
ejb-jar.xml
deployment descriptorInvocation Semantics
This allows the process engine as well as other applications to invoke this EJB Process Application and get EJB invocation semantics for the invocation. For example, if your process application provides a
JavaDelegate
implementation, the process engine will call theEjbProcessApplication's
execute(java.util.concurrent.Callable)
Method and from that method invoke theJavaDelegate
. This makes sure that- the call is intercepted by the EJB container and "enters" the process application legally.
- the
JavaDelegate
may take advantage of theEjbProcessApplication
's invocation context and resolve resources from the component's Environment (such as ajava:comp/BeanManager
).
Big pile of EJB interceptors | | +--------------------+ | |Process Application | invoke v | | ProcessEngine ----------------OOOOO--> Java Delegate | | | | | +--------------------+
Process Application Reference
When the process application registers with a process engine (see
ManagementService.registerProcessApplication(String, ProcessApplicationReference)
, the process application passes a reference to itself to the process engine. This reference allows the process engine to reference the process application. TheEjbProcessApplication
takes advantage of the Ejb Containers naming context and passes a reference containing the EJBProcessApplication's Component Name to the process engine. Whenever the process engine needs access to process application, the actual component instance is looked up and invoked.- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
EJB_CONTEXT_PATH
protected static java.lang.String
JAVA_APP_APP_NAME_PATH
protected static java.lang.String
MODULE_NAME_PATH
-
Fields inherited from class org.camunda.bpm.application.AbstractProcessApplication
defaultDeployToEngineName, isDeployed, processApplicationBeanElResolver, processApplicationElResolver, processApplicationScriptEnvironment, variableSerializers
-
-
Constructor Summary
Constructors Constructor Description EjbProcessApplication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
autodetectProcessApplicationName()
Override this method to autodetect an application name in case theProcessApplication
annotation was used but without parameter.protected void
ensureInitialized()
<T> T
execute(java.util.concurrent.Callable<T> callable)
The default implementation simply modifies the ContextClassLoader
protected java.lang.Class<? extends ProcessApplicationInterface>
getBusinessInterface()
allows subclasses to provide a custom business interfaceProcessApplicationReference
getReference()
Returns a globally sharable reference to this process application.protected java.lang.String
lookupEeApplicationName()
determine the ee application name based on information obtained from JNDI.protected ProcessApplicationInterface
lookupSelfReference()
lookup a proxy object representing the invoked business view of this component.-
Methods inherited from class org.camunda.bpm.application.AbstractProcessApplication
createDeployment, deploy, execute, getBeanElResolver, getDefaultDeployToEngineName, getElResolver, getEnvironmentScripts, getExecutionListener, getName, getProcessApplicationClassloader, getProcessApplicationScriptEnvironment, getProperties, getRawObject, getScriptEngineForName, getTaskListener, getVariableSerializers, initProcessApplicationElResolver, setDefaultDeployToEngineName, setVariableSerializers, undeploy
-
-
-
-
Method Detail
-
getReference
public ProcessApplicationReference getReference()
Description copied from interface:ProcessApplicationInterface
Returns a globally sharable reference to this process application. This reference may be safely passed to the process engine. And other applications.
- Returns:
- a globally sharable reference to this process application.
-
autodetectProcessApplicationName
protected java.lang.String autodetectProcessApplicationName()
Description copied from class:AbstractProcessApplication
Override this method to autodetect an application name in case theProcessApplication
annotation was used but without parameter.- Specified by:
autodetectProcessApplicationName
in classAbstractProcessApplication
-
getBusinessInterface
protected java.lang.Class<? extends ProcessApplicationInterface> getBusinessInterface()
allows subclasses to provide a custom business interface
-
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
- Overrides:
execute
in classAbstractProcessApplication
- Parameters:
callable
- to be executed "within" the context of this process application.- Returns:
- the result of the callback
- Throws:
ProcessApplicationExecutionException
-
ensureInitialized
protected void ensureInitialized()
-
lookupSelfReference
protected ProcessApplicationInterface lookupSelfReference()
lookup a proxy object representing the invoked business view of this component.
-
lookupEeApplicationName
protected java.lang.String lookupEeApplicationName()
determine the ee application name based on information obtained from JNDI.
-
-