use of org.wso2.carbon.bpmn.core.integration.BPSUserManagerFactory in project carbon-business-process by wso2.
the class ActivitiEngineBuilder method buildEngine.
/* Instantiates the engine. Builds the state of the engine
*
* @return ProcessEngineImpl object
* @throws BPSFault Throws in the event of failure of ProcessEngine
*/
public ProcessEngine buildEngine() throws BPSFault {
try {
String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath();
String activitiConfigPath = carbonConfigDirPath + File.separator + BPMNConstants.ACTIVITI_CONFIGURATION_FILE_NAME;
File activitiConfigFile = new File(activitiConfigPath);
ProcessEngineConfigurationImpl processEngineConfigurationImpl = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(new FileInputStream(activitiConfigFile));
// Add script engine resolvers
setResolverFactories(processEngineConfigurationImpl);
// Add supported variable types
setSupportedVariableTypes(processEngineConfigurationImpl);
// we have to build the process engine first to initialize session factories.
processEngine = processEngineConfigurationImpl.buildProcessEngine();
processEngineConfigurationImpl.getSessionFactories().put(UserIdentityManager.class, new BPSUserManagerFactory());
processEngineConfigurationImpl.getSessionFactories().put(GroupIdentityManager.class, new BPSGroupManagerFactory());
dataSourceJndiName = processEngineConfigurationImpl.getProcessEngineConfiguration().getDataSourceJndiName();
} catch (FileNotFoundException e) {
String msg = "Failed to create an Activiti engine. Activiti configuration file not found";
throw new BPSFault(msg, e);
}
return processEngine;
}
Aggregations