/**
* Initializes process engine by creating <code>RuntimeEngine</code> instance will all assets deployed.
*/
public void init() {
if (runtimeManager == null) {
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefault()
.entityManagerFactory(Persistence.createEntityManagerFactory("org.jbpm.sample"))
.userGroupCallback(new JBossUserGroupCallbackImpl("classpath:/usergroup.properties"))
.addAsset(ResourceFactory.newClassPathResource("customtask.bpmn"), ResourceType.BPMN2)
.addAsset(ResourceFactory.newClassPathResource("humanTask.bpmn"), ResourceType.BPMN2)
.get();
// this way you can add mode work item handlers to the default registerable items factory
// Alternatively you can add your own implementation of RegisterableItemsFactory
((SimpleRegisterableItemsFactory)environment.getRegisterableItemsFactory()).addWorkItemHandler("Log", SystemOutWorkItemHandler.class);
runtimeManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
}
}