Package org.operaton.bpm.engine
Class ProcessEngines
java.lang.Object
org.operaton.bpm.engine.ProcessEngines
Helper for initializing and closing process engines in server environments.
All created
The activiti-webapp-init webapp will call the
Please note that there is no lazy initialization of process engines, so make sure the context-listener is configured or
The
All created
ProcessEngines will be registered with this class.
The activiti-webapp-init webapp will call the
init() method when the webapp is deployed and it will call the
destroy() method when the webapp is destroyed, using a context-listener
(org.operaton.bpm.engine.test.impl.servlet.listener.ProcessEnginesServletContextListener). That way,
all applications can just use the getProcessEngines() to
obtain pre-initialized and cached process engines. Please note that there is no lazy initialization of process engines, so make sure the context-listener is configured or
ProcessEngines are already created so they were registered
on this class.The
init() method will try to build one ProcessEngine for
each operaton.cfg.xml file found on the classpath. If you have more than one,
make sure you specify different process.engine.name values.- Author:
- Tom Baeyens, Joram Barrez
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddestroy()closes all process engines.static ProcessEnginestatic ProcessEnginegetDefaultProcessEngine(boolean forceCreate) static ProcessEnginegetProcessEngine(String processEngineName) static ProcessEnginegetProcessEngine(String processEngineName, boolean forceCreate) obtain a process engine by name.static ProcessEngineInfogetProcessEngineInfo(String processEngineName) Get initialization results.static List<ProcessEngineInfo> Get initialization results.static Map<String, ProcessEngine> provides access to process engine to application clients in a managed server environment.static voidinit()static voidinit(boolean forceCreate) Initializes all process engines that can be found on the classpath for resourcesoperaton.cfg.xml(plain Activiti style configuration) and for resourcesactiviti-context.xml(Spring style configuration).protected static voidinitProcessEngineFromSpringResource(URL resource) static booleanisRegisteredProcessEngine(String processEngineName) Check if the given process engine with that name is already registered.static voidregisterProcessEngine(ProcessEngine processEngine) Registers the given process engine.static ProcessEngineInforetries to initialize a process engine that previously failed.static voidunregister(ProcessEngine processEngine) Unregisters the given process engine.
-
Field Details
-
NAME_DEFAULT
- See Also:
-
-
Method Details
-
init
public static void init() -
init
public static void init(boolean forceCreate) Initializes all process engines that can be found on the classpath for resourcesoperaton.cfg.xml(plain Activiti style configuration) and for resourcesactiviti-context.xml(Spring style configuration). -
initProcessEngineFromSpringResource
-
registerProcessEngine
Registers the given process engine. NoProcessEngineInfowill be available for this process engine. An engine that is registered will be closed when thedestroy()is called. -
unregister
Unregisters the given process engine. -
isRegisteredProcessEngine
Check if the given process engine with that name is already registered. -
getProcessEngineInfos
Get initialization results. -
getProcessEngineInfo
Get initialization results. Only info will be available for process engines which were added in theinit(). NoProcessEngineInfois available for engines which were registered programmatically. -
getDefaultProcessEngine
-
getDefaultProcessEngine
-
getProcessEngine
-
getProcessEngine
obtain a process engine by name.- Parameters:
processEngineName- is the name of the process engine or null for the default process engine.
-
retry
retries to initialize a process engine that previously failed. -
getProcessEngines
provides access to process engine to application clients in a managed server environment. -
destroy
public static void destroy()closes all process engines. This method should be called when the server shuts down.
-