Search in sources :

Example 1 with BPSGroupManagerFactory

use of org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory in project carbon-business-process by wso2.

the class BPMNOSGIService method getGroupIdentityManager.

public static BPSGroupIdentityManager getGroupIdentityManager() {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) getBPMNEngineService().getProcessEngine();
    ProcessEngineConfigurationImpl processEngineConfigurationImpl = null;
    if (processEngine != null) {
        processEngineConfigurationImpl = processEngine.getProcessEngineConfiguration();
        if (processEngineConfigurationImpl != null) {
            BPSGroupIdentityManager bpsGroupIdentityManager = null;
            if (processEngineConfigurationImpl.getSessionFactories() != null) {
                BPSGroupManagerFactory bpsGroupManagerFactory = (BPSGroupManagerFactory) processEngineConfigurationImpl.getSessionFactories().get(GroupIdentityManager.class);
                return (BPSGroupIdentityManager) bpsGroupManagerFactory.openSession();
            }
        }
    }
    throw new BPMNOSGIServiceException("Business Process Server Group manager couldn't be identified");
}
Also used : BPSGroupManagerFactory(org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory) BPMNOSGIServiceException(org.wso2.carbon.bpmn.rest.common.exception.BPMNOSGIServiceException) GroupIdentityManager(org.activiti.engine.impl.persistence.entity.GroupIdentityManager) BPSGroupIdentityManager(org.wso2.carbon.bpmn.core.integration.BPSGroupIdentityManager) BPSGroupIdentityManager(org.wso2.carbon.bpmn.core.integration.BPSGroupIdentityManager) ProcessEngineConfigurationImpl(org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.activiti.engine.impl.ProcessEngineImpl)

Example 2 with BPSGroupManagerFactory

use of org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory 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;
}
Also used : BPSGroupManagerFactory(org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory) BPSUserManagerFactory(org.wso2.carbon.bpmn.core.integration.BPSUserManagerFactory) FileNotFoundException(java.io.FileNotFoundException) File(java.io.File) ProcessEngineConfigurationImpl(org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) FileInputStream(java.io.FileInputStream)

Aggregations

ProcessEngineConfigurationImpl (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl)2 BPSGroupManagerFactory (org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 ProcessEngineImpl (org.activiti.engine.impl.ProcessEngineImpl)1 GroupIdentityManager (org.activiti.engine.impl.persistence.entity.GroupIdentityManager)1 BPSGroupIdentityManager (org.wso2.carbon.bpmn.core.integration.BPSGroupIdentityManager)1 BPSUserManagerFactory (org.wso2.carbon.bpmn.core.integration.BPSUserManagerFactory)1 BPMNOSGIServiceException (org.wso2.carbon.bpmn.rest.common.exception.BPMNOSGIServiceException)1