diff --git a/modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngineConfiguration.java b/modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngineConfiguration.java index 08045df1fe644febc8232928beeb6bcbc713753b..8c7e7d3e60b94c1856ebeef0c16ce63637d8496b 100644 --- a/modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngineConfiguration.java +++ b/modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngineConfiguration.java @@ -1,9 +1,9 @@ /* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,44 +23,44 @@ import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration; /** Configuration information from which a process engine can be build. - * + * *

Most common is to create a process engine based on the default configuration file: *

ProcessEngine processEngine = ProcessEngineConfiguration
  *   .createProcessEngineConfigurationFromResourceDefault()
  *   .buildProcessEngine();
  * 
*

- * - *

To create a process engine programatic, without a configuration file, + * + *

To create a process engine programatic, without a configuration file, * the first option is {@link #createStandaloneProcessEngineConfiguration()} *

ProcessEngine processEngine = ProcessEngineConfiguration
  *   .createStandaloneProcessEngineConfiguration()
  *   .buildProcessEngine();
  * 
- * This creates a new process engine with all the defaults to connect to - * a remote h2 database (jdbc:h2:tcp://localhost/activiti) in standalone - * mode. Standalone mode means that Activiti will manage the transactions - * on the JDBC connections that it creates. One transaction per + * This creates a new process engine with all the defaults to connect to + * a remote h2 database (jdbc:h2:tcp://localhost/activiti) in standalone + * mode. Standalone mode means that Activiti will manage the transactions + * on the JDBC connections that it creates. One transaction per * service method. - * For a description of how to write the configuration files, see the + * For a description of how to write the configuration files, see the * userguide. *

- * + * *

The second option is great for testing: {@link #createStandalonInMemeProcessEngineConfiguration()} *

ProcessEngine processEngine = ProcessEngineConfiguration
  *   .createStandaloneInMemProcessEngineConfiguration()
  *   .buildProcessEngine();
  * 
- * This creates a new process engine with all the defaults to connect to - * an memory h2 database (jdbc:h2:tcp://localhost/activiti) in standalone - * mode. The DB schema strategy default is in this case create-drop. - * Standalone mode means that Activiti will manage the transactions - * on the JDBC connections that it creates. One transaction per + * This creates a new process engine with all the defaults to connect to + * an memory h2 database (jdbc:h2:tcp://localhost/activiti) in standalone + * mode. The DB schema strategy default is in this case create-drop. + * Standalone mode means that Activiti will manage the transactions + * on the JDBC connections that it creates. One transaction per * service method. *

- * - *

On all forms of creating a process engine, you can first customize the configuration - * before calling the {@link #buildProcessEngine()} method by calling any of the + * + *

On all forms of creating a process engine, you can first customize the configuration + * before calling the {@link #buildProcessEngine()} method by calling any of the * setters like this: *

ProcessEngine processEngine = ProcessEngineConfiguration
  *   .createProcessEngineConfigurationFromResourceDefault()
@@ -70,45 +70,45 @@ import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration;
  *   .buildProcessEngine();
  * 
*

- * - * @see ProcessEngines + * + * @see ProcessEngines * @author Tom Baeyens */ public abstract class ProcessEngineConfiguration { - - /** Checks the version of the DB schema against the library when + + /** Checks the version of the DB schema against the library when * the process engine is being created and throws an exception * if the versions don't match. */ public static final String DB_SCHEMA_UPDATE_FALSE = "false"; - - /** Creates the schema when the process engine is being created and + + /** Creates the schema when the process engine is being created and * drops the schema when the process engine is being closed. */ public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop"; - /** Upon building of the process engine, a check is performed and + /** Upon building of the process engine, a check is performed and * an update of the schema is performed if it is necessary. */ public static final String DB_SCHEMA_UPDATE_TRUE = "true"; /** Value for {@link #setHistory(String)} to ensure that no history is being recorded. */ public static final String HISTORY_NONE = "none"; - /** Value for {@link #setHistory(String)} to ensure that only historic process instances and - * historic activity instances are being recorded. + /** Value for {@link #setHistory(String)} to ensure that only historic process instances and + * historic activity instances are being recorded. * This means no details for those entities. */ public static final String HISTORY_ACTIVITY = "activity"; - /** Value for {@link #setHistory(String)} to ensure that only historic process instances, - * historic activity instances and submitted form property values are being recorded. */ + /** Value for {@link #setHistory(String)} to ensure that only historic process instances, + * historic activity instances and submitted form property values are being recorded. */ public static final String HISTORY_AUDIT = "audit"; - /** Value for {@link #setHistory(String)} to ensure that all historic information is - * being recorded, including the variable updates. */ + /** Value for {@link #setHistory(String)} to ensure that all historic information is + * being recorded, including the variable updates. */ public static final String HISTORY_FULL = "full"; - + protected String processEngineName = ProcessEngines.NAME_DEFAULT; protected int idBlockSize = 100; protected String history = HISTORY_AUDIT; protected boolean jobExecutorActivate; protected String mailServerHost = "localhost"; - protected String mailServerUsername; // by default no name and password are provided, which + protected String mailServerUsername; // by default no name and password are provided, which protected String mailServerPassword; // means no authentication for mail server protected int mailServerPort = 25; protected String mailServerDefaultFrom = "activiti@localhost"; @@ -129,12 +129,12 @@ public abstract class ProcessEngineConfiguration { protected int jdbcPingConnectionNotUsedFor; protected DataSource dataSource; protected boolean transactionsExternallyManaged = false; - + protected String jpaPersistenceUnitName; protected Object jpaEntityManagerFactory; protected boolean jpaHandleTransaction; protected boolean jpaCloseEntityManager; - + protected ClassLoader classLoader; /** use one of the static createXxxx methods instead */ @@ -142,7 +142,7 @@ public abstract class ProcessEngineConfiguration { } public abstract ProcessEngine buildProcessEngine(); - + public static ProcessEngineConfiguration createProcessEngineConfigurationFromResourceDefault() { return createProcessEngineConfigurationFromResource("activiti.cfg.xml", "processEngineConfiguration"); } @@ -154,7 +154,7 @@ public abstract class ProcessEngineConfiguration { public static ProcessEngineConfiguration createProcessEngineConfigurationFromResource(String resource, String beanName) { return BeansConfigurationHelper.parseProcessEngineConfigurationFromResource(resource, beanName); } - + public static ProcessEngineConfiguration createProcessEngineConfigurationFromInputStream(InputStream inputStream) { return createProcessEngineConfigurationFromInputStream(inputStream, "processEngineConfiguration"); } @@ -175,10 +175,10 @@ public abstract class ProcessEngineConfiguration { // public static ProcessEngineConfiguration createJtaProcessEngineConfiguration() { // return new JtaProcessEngineConfiguration(); // } - + // getters and setters ////////////////////////////////////////////////////// - + public String getProcessEngineName() { return processEngineName; } @@ -188,217 +188,216 @@ public abstract class ProcessEngineConfiguration { return this; } - + public int getIdBlockSize() { return idBlockSize; } - + public ProcessEngineConfiguration setIdBlockSize(int idBlockSize) { this.idBlockSize = idBlockSize; return this; } - + public String getHistory() { return history; } - + public ProcessEngineConfiguration setHistory(String history) { this.history = history; return this; } - + public String getMailServerHost() { return mailServerHost; } - + public ProcessEngineConfiguration setMailServerHost(String mailServerHost) { this.mailServerHost = mailServerHost; return this; } - + public String getMailServerUsername() { return mailServerUsername; } - + public ProcessEngineConfiguration setMailServerUsername(String mailServerUsername) { this.mailServerUsername = mailServerUsername; return this; } - + public String getMailServerPassword() { return mailServerPassword; } - + public ProcessEngineConfiguration setMailServerPassword(String mailServerPassword) { this.mailServerPassword = mailServerPassword; return this; } - + public int getMailServerPort() { return mailServerPort; } - + public ProcessEngineConfiguration setMailServerPort(int mailServerPort) { this.mailServerPort = mailServerPort; return this; } - + public String getMailServerDefaultFrom() { return mailServerDefaultFrom; } - + public ProcessEngineConfiguration setMailServerDefaultFrom(String mailServerDefaultFrom) { this.mailServerDefaultFrom = mailServerDefaultFrom; return this; } - + public String getDatabaseType() { return databaseType; } - + public ProcessEngineConfiguration setDatabaseType(String databaseType) { this.databaseType = databaseType; return this; } - + public String getDatabaseSchemaUpdate() { return databaseSchemaUpdate; } - + public ProcessEngineConfiguration setDatabaseSchemaUpdate(String databaseSchemaUpdate) { this.databaseSchemaUpdate = databaseSchemaUpdate; return this; } - + public DataSource getDataSource() { return dataSource; } - + public ProcessEngineConfiguration setDataSource(DataSource dataSource) { this.dataSource = dataSource; return this; } - + public String getJdbcDriver() { return jdbcDriver; } - + public ProcessEngineConfiguration setJdbcDriver(String jdbcDriver) { this.jdbcDriver = jdbcDriver; return this; } - + public String getJdbcUrl() { return jdbcUrl; } - + public ProcessEngineConfiguration setJdbcUrl(String jdbcUrl) { this.jdbcUrl = jdbcUrl; return this; } - + public String getJdbcUsername() { return jdbcUsername; } - + public ProcessEngineConfiguration setJdbcUsername(String jdbcUsername) { this.jdbcUsername = jdbcUsername; return this; } - + public String getJdbcPassword() { return jdbcPassword; } - + public ProcessEngineConfiguration setJdbcPassword(String jdbcPassword) { this.jdbcPassword = jdbcPassword; return this; } - + public boolean isTransactionsExternallyManaged() { return transactionsExternallyManaged; } - + public ProcessEngineConfiguration setTransactionsExternallyManaged(boolean transactionsExternallyManaged) { this.transactionsExternallyManaged = transactionsExternallyManaged; return this; } - + public int getJdbcMaxActiveConnections() { return jdbcMaxActiveConnections; } - + public ProcessEngineConfiguration setJdbcMaxActiveConnections(int jdbcMaxActiveConnections) { this.jdbcMaxActiveConnections = jdbcMaxActiveConnections; return this; } - + public int getJdbcMaxIdleConnections() { return jdbcMaxIdleConnections; } - + public ProcessEngineConfiguration setJdbcMaxIdleConnections(int jdbcMaxIdleConnections) { this.jdbcMaxIdleConnections = jdbcMaxIdleConnections; return this; } - + public int getJdbcMaxCheckoutTime() { return jdbcMaxCheckoutTime; } - + public ProcessEngineConfiguration setJdbcMaxCheckoutTime(int jdbcMaxCheckoutTime) { this.jdbcMaxCheckoutTime = jdbcMaxCheckoutTime; return this; } - + public int getJdbcMaxWaitTime() { return jdbcMaxWaitTime; } - - + public ProcessEngineConfiguration setJdbcMaxWaitTime(int jdbcMaxWaitTime) { this.jdbcMaxWaitTime = jdbcMaxWaitTime; return this; } - - public boolean getJdbcPingEnabled() { - return jdbcPingEnabled; + + public boolean isJdbcPingEnabled() { + return jdbcPingEnabled; } public ProcessEngineConfiguration setJdbcPingEnabled(boolean jdbcPingEnabled) { @@ -407,69 +406,70 @@ public abstract class ProcessEngineConfiguration { } public String getJdbcPingQuery() { - return jdbcPingQuery; + return jdbcPingQuery; } public ProcessEngineConfiguration setJdbcPingQuery(String jdbcPingQuery) { - this.jdbcPingQuery = jdbcPingQuery; - return this; + this.jdbcPingQuery = jdbcPingQuery; + return this; } public int getJdbcPingConnectionNotUsedFor() { - return jdbcPingConnectionNotUsedFor; + return jdbcPingConnectionNotUsedFor; } public ProcessEngineConfiguration setJdbcPingConnectionNotUsedFor(int jdbcPingNotUsedFor) { - this.jdbcPingConnectionNotUsedFor = jdbcPingNotUsedFor; - return this; + this.jdbcPingConnectionNotUsedFor = jdbcPingNotUsedFor; + return this; } public boolean isJobExecutorActivate() { return jobExecutorActivate; } + public ProcessEngineConfiguration setJobExecutorActivate(boolean jobExecutorActivate) { this.jobExecutorActivate = jobExecutorActivate; return this; } - + public ClassLoader getClassLoader() { return classLoader; } - + public ProcessEngineConfiguration setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; return this; } - + public Object getJpaEntityManagerFactory() { return jpaEntityManagerFactory; } - + public ProcessEngineConfiguration setJpaEntityManagerFactory(Object jpaEntityManagerFactory) { this.jpaEntityManagerFactory = jpaEntityManagerFactory; return this; } - + public boolean isJpaHandleTransaction() { return jpaHandleTransaction; } - + public ProcessEngineConfiguration setJpaHandleTransaction(boolean jpaHandleTransaction) { this.jpaHandleTransaction = jpaHandleTransaction; return this; } - + public boolean isJpaCloseEntityManager() { return jpaCloseEntityManager; } - + public ProcessEngineConfiguration setJpaCloseEntityManager(boolean jpaCloseEntityManager) { this.jpaCloseEntityManager = jpaCloseEntityManager; return this; diff --git a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java index 0f5d18e348d99561c7ff843c87f82c82a8d7bfdc..b6a6860862c27de9aea68b0e23e3499a7a965b04 100644 --- a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java +++ b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java @@ -1,9 +1,9 @@ /* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -141,1455 +141,1334 @@ import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; import org.apache.ibatis.transaction.managed.ManagedTransactionFactory; import org.apache.ibatis.type.JdbcType; + /** * @author Tom Baeyens */ -public abstract class ProcessEngineConfigurationImpl extends - ProcessEngineConfiguration { - - private static Logger log = Logger - .getLogger(ProcessEngineConfigurationImpl.class.getName()); - - public static final String DB_SCHEMA_UPDATE_CREATE = "create"; - public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create"; - - public static final int HISTORYLEVEL_NONE = 0; - public static final int HISTORYLEVEL_ACTIVITY = 1; - public static final int HISTORYLEVEL_AUDIT = 2; - public static final int HISTORYLEVEL_FULL = 3; - - public static final String DEFAULT_WS_SYNC_FACTORY = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; - - // SERVICES - // ///////////////////////////////////////////////////////////////// - - protected RepositoryService repositoryService = new RepositoryServiceImpl(); - protected RuntimeService runtimeService = new RuntimeServiceImpl(); - protected HistoryService historyService = new HistoryServiceImpl(); - protected IdentityService identityService = new IdentityServiceImpl(); - protected TaskService taskService = new TaskServiceImpl(); - protected FormService formService = new FormServiceImpl(); - protected ManagementService managementService = new ManagementServiceImpl(); - - // COMMAND EXECUTORS - // //////////////////////////////////////////////////////// - - // Command executor and interceptor stack - /** - * the configurable list which will be - * {@link #initInterceptorChain(java.util.List) processed} to build the - * {@link #commandExecutorTxRequired} - */ - protected List customPreCommandInterceptorsTxRequired; - protected List customPostCommandInterceptorsTxRequired; - - protected List commandInterceptorsTxRequired; - - /** this will be initialized during the configurationComplete() */ - protected CommandExecutor commandExecutorTxRequired; - - /** - * the configurable list which will be {@link #initInterceptorChain(List) - * processed} to build the {@link #commandExecutorTxRequiresNew} - */ - protected List customPreCommandInterceptorsTxRequiresNew; - protected List customPostCommandInterceptorsTxRequiresNew; - - protected List commandInterceptorsTxRequiresNew; - - /** this will be initialized during the configurationComplete() */ - protected CommandExecutor commandExecutorTxRequiresNew; - - // SESSION FACTORIES - // //////////////////////////////////////////////////////// - - protected List customSessionFactories; - protected DbSqlSessionFactory dbSqlSessionFactory; - protected Map, SessionFactory> sessionFactories; - - // DEPLOYERS - // //////////////////////////////////////////////////////////////// - - protected List customPreDeployers; - protected List customPostDeployers; - protected List deployers; - protected DeploymentCache deploymentCache; - - // JOB EXECUTOR - // ///////////////////////////////////////////////////////////// - - protected List customJobHandlers; - protected Map jobHandlers; - protected JobExecutor jobExecutor; +public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfiguration { + + private static Logger log = Logger.getLogger(ProcessEngineConfigurationImpl.class.getName()); + + public static final String DB_SCHEMA_UPDATE_CREATE = "create"; + public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create"; + + public static final int HISTORYLEVEL_NONE = 0; + public static final int HISTORYLEVEL_ACTIVITY = 1; + public static final int HISTORYLEVEL_AUDIT = 2; + public static final int HISTORYLEVEL_FULL = 3; + + public static final String DEFAULT_WS_SYNC_FACTORY = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; + + // SERVICES ///////////////////////////////////////////////////////////////// + + protected RepositoryService repositoryService = new RepositoryServiceImpl(); + protected RuntimeService runtimeService = new RuntimeServiceImpl(); + protected HistoryService historyService = new HistoryServiceImpl(); + protected IdentityService identityService = new IdentityServiceImpl(); + protected TaskService taskService = new TaskServiceImpl(); + protected FormService formService = new FormServiceImpl(); + protected ManagementService managementService = new ManagementServiceImpl(); + + // COMMAND EXECUTORS //////////////////////////////////////////////////////// + + // Command executor and interceptor stack + /** the configurable list which will be {@link #initInterceptorChain(java.util.List) processed} to build the {@link #commandExecutorTxRequired} */ + protected List customPreCommandInterceptorsTxRequired; + protected List customPostCommandInterceptorsTxRequired; + + protected List commandInterceptorsTxRequired; + + /** this will be initialized during the configurationComplete() */ + protected CommandExecutor commandExecutorTxRequired; + + /** the configurable list which will be {@link #initInterceptorChain(List) processed} to build the {@link #commandExecutorTxRequiresNew} */ + protected List customPreCommandInterceptorsTxRequiresNew; + protected List customPostCommandInterceptorsTxRequiresNew; + + protected List commandInterceptorsTxRequiresNew; + + /** this will be initialized during the configurationComplete() */ + protected CommandExecutor commandExecutorTxRequiresNew; + + // SESSION FACTORIES //////////////////////////////////////////////////////// + + protected List customSessionFactories; + protected DbSqlSessionFactory dbSqlSessionFactory; + protected Map, SessionFactory> sessionFactories; + + // DEPLOYERS //////////////////////////////////////////////////////////////// + + protected List customPreDeployers; + protected List customPostDeployers; + protected List deployers; + protected DeploymentCache deploymentCache; + + // JOB EXECUTOR ///////////////////////////////////////////////////////////// + + protected List customJobHandlers; + protected Map jobHandlers; + protected JobExecutor jobExecutor; + + // MAIL SCANNER ///////////////////////////////////////////////////////////// + + protected MailScanner mailScanner; + + // MYBATIS SQL SESSION FACTORY ////////////////////////////////////////////// + + protected SqlSessionFactory sqlSessionFactory; + protected TransactionFactory transactionFactory; + + + // ID GENERATOR ///////////////////////////////////////////////////////////// + protected IdGenerator idGenerator; + + // OTHER //////////////////////////////////////////////////////////////////// + protected List customFormEngines; + protected Map formEngines; + + protected List customFormTypes; + protected FormTypes formTypes; + + protected List customPreVariableTypes; + protected List customPostVariableTypes; + protected VariableTypes variableTypes; + + protected ExpressionManager expressionManager; + protected List customScriptingEngineClasses; + protected ScriptingEngines scriptingEngines; + protected List resolverFactories; + + protected BusinessCalendarManager businessCalendarManager; + + protected String wsSyncFactoryClassName = DEFAULT_WS_SYNC_FACTORY; + + protected CommandContextFactory commandContextFactory; + protected TransactionContextFactory transactionContextFactory; + + protected int historyLevel; + + protected List preParseListeners; + protected List postParseListeners; + + protected Map beans; + + protected boolean isDbIdentityUsed = true; + protected boolean isDbHistoryUsed = true; + protected boolean isDbCycleUsed = false; + + // buildProcessEngine /////////////////////////////////////////////////////// + + public ProcessEngine buildProcessEngine() { + init(); + return new ProcessEngineImpl(this); + } + + // init ///////////////////////////////////////////////////////////////////// + + protected void init() { + initHistoryLevel(); + initExpressionManager(); + initVariableTypes(); + initBeans(); + initFormEngines(); + initFormTypes(); + initScriptingEngines(); + initBusinessCalendarManager(); + initCommandContextFactory(); + initTransactionContextFactory(); + initCommandExecutors(); + initServices(); + initIdGenerator(); + initDeployers(); + initJobExecutor(); + initMailScanner(); + initDataSource(); + initTransactionFactory(); + initSqlSessionFactory(); + initSessionFactories(); + initJpa(); + } + + // command executors //////////////////////////////////////////////////////// + + protected abstract Collection< ? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired(); + protected abstract Collection< ? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequiresNew(); + + protected void initCommandExecutors() { + initCommandInterceptorsTxRequired(); + initCommandExecutorTxRequired(); + initCommandInterceptorsTxRequiresNew(); + initCommandExecutorTxRequiresNew(); + } + + protected void initCommandInterceptorsTxRequired() { + if (commandInterceptorsTxRequired==null) { + if (customPreCommandInterceptorsTxRequired!=null) { + commandInterceptorsTxRequired = new ArrayList(customPreCommandInterceptorsTxRequired); + } else { + commandInterceptorsTxRequired = new ArrayList(); + } + commandInterceptorsTxRequired.addAll(getDefaultCommandInterceptorsTxRequired()); + if (customPostCommandInterceptorsTxRequired!=null) { + commandInterceptorsTxRequired.addAll(customPostCommandInterceptorsTxRequired); + } + } + } + + protected void initCommandInterceptorsTxRequiresNew() { + if (commandInterceptorsTxRequiresNew==null) { + if (customPreCommandInterceptorsTxRequiresNew!=null) { + commandInterceptorsTxRequiresNew = new ArrayList(customPreCommandInterceptorsTxRequiresNew); + } else { + commandInterceptorsTxRequiresNew = new ArrayList(); + } + commandInterceptorsTxRequiresNew.addAll(getDefaultCommandInterceptorsTxRequiresNew()); + if (customPostCommandInterceptorsTxRequiresNew!=null) { + commandInterceptorsTxRequiresNew.addAll(customPostCommandInterceptorsTxRequiresNew); + } + } + } + + protected void initCommandExecutorTxRequired() { + if (commandExecutorTxRequired==null) { + commandExecutorTxRequired = initInterceptorChain(commandInterceptorsTxRequired); + } + } + + protected void initCommandExecutorTxRequiresNew() { + if (commandExecutorTxRequiresNew==null) { + commandExecutorTxRequiresNew = initInterceptorChain(commandInterceptorsTxRequiresNew); + } + } + + protected CommandInterceptor initInterceptorChain(List chain) { + if (chain==null || chain.isEmpty()) { + throw new ActivitiException("invalid command interceptor chain configuration: "+chain); + } + for (int i = 0; i < chain.size()-1; i++) { + chain.get(i).setNext( chain.get(i+1) ); + } + return chain.get(0); + } + + // services ///////////////////////////////////////////////////////////////// + + protected void initServices() { + initService(repositoryService); + initService(runtimeService); + initService(historyService); + initService(identityService); + initService(taskService); + initService(formService); + initService(managementService); + } + + protected void initService(Object service) { + if (service instanceof ServiceImpl) { + ((ServiceImpl)service).setCommandExecutor(commandExecutorTxRequired); + } + } + + // DataSource /////////////////////////////////////////////////////////////// + + protected void initDataSource() { + if (dataSource==null) { + if (dataSourceJndiName!=null) { + try { + dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName); + } catch (Exception e) { + throw new ActivitiException("couldn't lookup datasource from "+dataSourceJndiName+": "+e.getMessage(), e); + } + + } else if (jdbcUrl!=null) { + if ( (jdbcDriver==null) || (jdbcUrl==null) || (jdbcUsername==null) ) { + throw new ActivitiException("DataSource or JDBC properties have to be specified in a process engine configuration"); + } + + log.fine("initializing datasource to db: "+jdbcUrl); + + PooledDataSource pooledDataSource = + new PooledDataSource(ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword ); + + if (jdbcMaxActiveConnections > 0) { + pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections); + } + if (jdbcMaxIdleConnections > 0) { + pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections); + } + if (jdbcMaxCheckoutTime > 0) { + pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime); + } + if (jdbcMaxWaitTime > 0) { + pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime); + } + if (jdbcPingEnabled == true) { + pooledDataSource.setPoolPingEnabled(true); + if (jdbcPingQuery != null) { + pooledDataSource.setPoolPingQuery(jdbcPingQuery); + } + pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor); + } + dataSource = pooledDataSource; + } + + if (dataSource instanceof PooledDataSource) { + // ACT-233: connection pool of Ibatis is not properely initialized if this is not called! + ((PooledDataSource)dataSource).forceCloseAll(); + } + } + + if (databaseType == null) { + initDatabaseType(); + } + } + + protected static Properties databaseTypeMappings = getDefaultDatabaseTypeMappings(); + + protected static Properties getDefaultDatabaseTypeMappings() { + Properties databaseTypeMappings = new Properties(); + databaseTypeMappings.setProperty("H2","h2"); + databaseTypeMappings.setProperty("MySQL","mysql"); + databaseTypeMappings.setProperty("Oracle","oracle"); + databaseTypeMappings.setProperty("PostgreSQL","postgres"); + databaseTypeMappings.setProperty("Microsoft SQL Server","mssql"); + databaseTypeMappings.setProperty("DB2","db2"); + databaseTypeMappings.setProperty("DB2","db2"); + databaseTypeMappings.setProperty("DB2/NT","db2"); + databaseTypeMappings.setProperty("DB2/NT64","db2"); + databaseTypeMappings.setProperty("DB2 UDP","db2"); + databaseTypeMappings.setProperty("DB2/LINUX","db2"); + databaseTypeMappings.setProperty("DB2/LINUX390","db2"); + databaseTypeMappings.setProperty("DB2/LINUXZ64","db2"); + databaseTypeMappings.setProperty("DB2/400 SQL","db2"); + databaseTypeMappings.setProperty("DB2/6000","db2"); + databaseTypeMappings.setProperty("DB2 UDB iSeries","db2"); + databaseTypeMappings.setProperty("DB2/AIX64","db2"); + databaseTypeMappings.setProperty("DB2/HPUX","db2"); + databaseTypeMappings.setProperty("DB2/HP64","db2"); + databaseTypeMappings.setProperty("DB2/SUN","db2"); + databaseTypeMappings.setProperty("DB2/SUN64","db2"); + databaseTypeMappings.setProperty("DB2/PTX","db2"); + databaseTypeMappings.setProperty("DB2/2","db2"); + return databaseTypeMappings; + } + + public void initDatabaseType() { + Connection connection = null; + try { + connection = dataSource.getConnection(); + DatabaseMetaData databaseMetaData = connection.getMetaData(); + String databaseProductName = databaseMetaData.getDatabaseProductName(); + log.fine("database product name: '"+databaseProductName+"'"); + databaseType = databaseTypeMappings.getProperty(databaseProductName); + if (databaseType==null) { + throw new ActivitiException("couldn't deduct database type from database product name '"+databaseProductName+"'"); + } + log.fine("using database type: "+databaseType); + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + try { + if (connection!=null) { + connection.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + // myBatis SqlSessionFactory //////////////////////////////////////////////// + + protected void initTransactionFactory() { + if (transactionFactory==null) { + if (transactionsExternallyManaged) { + transactionFactory = new ManagedTransactionFactory(); + } else { + transactionFactory = new JdbcTransactionFactory(); + } + } + } + + protected void initSqlSessionFactory() { + if (sqlSessionFactory==null) { + InputStream inputStream = null; + try { + inputStream = ReflectUtil.getResourceAsStream("org/activiti/db/mapping/mappings.xml"); + + // update the jdbc parameters to the configured ones... + Environment environment = new Environment("default", transactionFactory, dataSource); + Reader reader = new InputStreamReader(inputStream); + XMLConfigBuilder parser = new XMLConfigBuilder(reader); + Configuration configuration = parser.getConfiguration(); + configuration.setEnvironment(environment); + configuration.getTypeHandlerRegistry().register(VariableType.class, JdbcType.VARCHAR, new IbatisVariableTypeHandler()); + configuration = parser.parse(); + + sqlSessionFactory = new DefaultSqlSessionFactory(configuration); + + } catch (Exception e) { + throw new ActivitiException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e); + } finally { + IoUtil.closeSilently(inputStream); + } + } + } + + // session factories //////////////////////////////////////////////////////// + + protected void initSessionFactories() { + if (sessionFactories==null) { + sessionFactories = new HashMap, SessionFactory>(); + + dbSqlSessionFactory = new DbSqlSessionFactory(); + dbSqlSessionFactory.setDatabaseType(databaseType); + dbSqlSessionFactory.setIdGenerator(idGenerator); + dbSqlSessionFactory.setSqlSessionFactory(sqlSessionFactory); + dbSqlSessionFactory.setDbIdentityUsed(isDbIdentityUsed); + dbSqlSessionFactory.setDbHistoryUsed(isDbHistoryUsed); + dbSqlSessionFactory.setDbCycleUsed(isDbCycleUsed); + addSessionFactory(dbSqlSessionFactory); + + addSessionFactory(new GenericManagerFactory(AttachmentManager.class)); + addSessionFactory(new GenericManagerFactory(CommentManager.class)); + addSessionFactory(new GenericManagerFactory(DeploymentManager.class)); + addSessionFactory(new GenericManagerFactory(ExecutionManager.class)); + addSessionFactory(new GenericManagerFactory(HistoricActivityInstanceManager.class)); + addSessionFactory(new GenericManagerFactory(HistoricDetailManager.class)); + addSessionFactory(new GenericManagerFactory(HistoricProcessInstanceManager.class)); + addSessionFactory(new GenericManagerFactory(HistoricTaskInstanceManager.class)); + addSessionFactory(new GenericManagerFactory(IdentityInfoManager.class)); + addSessionFactory(new GenericManagerFactory(IdentityLinkManager.class)); + addSessionFactory(new GenericManagerFactory(JobManager.class)); + addSessionFactory(new GenericManagerFactory(GroupManager.class)); + addSessionFactory(new GenericManagerFactory(MembershipManager.class)); + addSessionFactory(new GenericManagerFactory(ProcessDefinitionManager.class)); + addSessionFactory(new GenericManagerFactory(PropertyManager.class)); + addSessionFactory(new GenericManagerFactory(ResourceManager.class)); + addSessionFactory(new GenericManagerFactory(TableDataManager.class)); + addSessionFactory(new GenericManagerFactory(TaskManager.class)); + addSessionFactory(new GenericManagerFactory(UserManager.class)); + addSessionFactory(new GenericManagerFactory(VariableInstanceManager.class)); + } + if (customSessionFactories!=null) { + for (SessionFactory sessionFactory: customSessionFactories) { + addSessionFactory(sessionFactory); + } + } + } + + protected void addSessionFactory(SessionFactory sessionFactory) { + sessionFactories.put(sessionFactory.getSessionType(), sessionFactory); + } + + // deployers //////////////////////////////////////////////////////////////// + + protected void initDeployers() { + if (this.deployers==null) { + this.deployers = new ArrayList(); + if (customPreDeployers!=null) { + this.deployers.addAll(customPreDeployers); + } + this.deployers.addAll(getDefaultDeployers()); + if (customPostDeployers!=null) { + this.deployers.addAll(customPostDeployers); + } + } + if (deploymentCache==null) { + List deployers = new ArrayList(); + if (customPreDeployers!=null) { + deployers.addAll(customPreDeployers); + } + deployers.addAll(getDefaultDeployers()); + if (customPostDeployers!=null) { + deployers.addAll(customPostDeployers); + } + + deploymentCache = new DeploymentCache(); + deploymentCache.setDeployers(deployers); + } + } + + protected Collection< ? extends Deployer> getDefaultDeployers() { + List defaultDeployers = new ArrayList(); + + BpmnDeployer bpmnDeployer = new BpmnDeployer(); + bpmnDeployer.setExpressionManager(expressionManager); + bpmnDeployer.setIdGenerator(idGenerator); + BpmnParser bpmnParser = new BpmnParser(expressionManager); + + if(preParseListeners != null) { + bpmnParser.getParseListeners().addAll(preParseListeners); + } + bpmnParser.getParseListeners().addAll(getDefaultBPMNParseListeners()); + if(postParseListeners != null) { + bpmnParser.getParseListeners().addAll(postParseListeners); + } + + bpmnDeployer.setBpmnParser(bpmnParser); + + defaultDeployers.add(bpmnDeployer); + return defaultDeployers; + } + + protected List getDefaultBPMNParseListeners() { + List defaultListeners = new ArrayList(); + if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { + defaultListeners.add(new HistoryParseListener(historyLevel)); + } + return defaultListeners; + } + + // job executor ///////////////////////////////////////////////////////////// + + protected void initJobExecutor() { + if (jobExecutor==null) { + jobExecutor = new JobExecutor(); + } + + jobHandlers = new HashMap(); + TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler(); + jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler); + + TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler(); + jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent); + + TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler(); + jobHandlers.put(timerStartEvent.getType(), timerStartEvent); + + // if we have custom job handlers, register them + if (getCustomJobHandlers()!=null) { + for (JobHandler customJobHandler : getCustomJobHandlers()) { + jobHandlers.put(customJobHandler.getType(), customJobHandler); + } + } + + jobExecutor.setCommandExecutor(commandExecutorTxRequired); + jobExecutor.setAutoActivate(jobExecutorActivate); + } + + protected void initMailScanner() { + if (mailScanner==null) { + mailScanner = new MailScanner(); + } + mailScanner.setCommandExecutor(commandExecutorTxRequired); + } + + // history ////////////////////////////////////////////////////////////////// + + public void initHistoryLevel() { + if (HISTORY_NONE.equalsIgnoreCase(history)) { + historyLevel = 0; + } else if (HISTORY_ACTIVITY.equalsIgnoreCase(history)) { + historyLevel = 1; + } else if (HISTORY_AUDIT.equalsIgnoreCase(history)) { + historyLevel = 2; + } else if (HISTORY_FULL.equalsIgnoreCase(history)) { + historyLevel = 3; + } else { + throw new ActivitiException("invalid history level: "+history); + } + } + + // id generator ///////////////////////////////////////////////////////////// + + protected void initIdGenerator() { + if (idGenerator==null) { + DbIdGenerator dbIdGenerator = new DbIdGenerator(); + dbIdGenerator.setIdBlockSize(idBlockSize); + dbIdGenerator.setCommandExecutor(commandExecutorTxRequiresNew); + idGenerator = dbIdGenerator; + } + } + + // OTHER //////////////////////////////////////////////////////////////////// + + protected void initCommandContextFactory() { + if (commandContextFactory==null) { + commandContextFactory = new CommandContextFactory(); + commandContextFactory.setProcessEngineConfiguration(this); + } + } + + protected void initTransactionContextFactory() { + if (transactionContextFactory==null) { + transactionContextFactory = new StandaloneMybatisTransactionContextFactory(); + } + } + + protected void initVariableTypes() { + if (variableTypes==null) { + variableTypes = new DefaultVariableTypes(); + if (customPreVariableTypes!=null) { + for (VariableType customVariableType: customPreVariableTypes) { + variableTypes.addType(customVariableType); + } + } + variableTypes.addType(new NullType()); + variableTypes.addType(new StringType()); + variableTypes.addType(new BooleanType()); + variableTypes.addType(new ShortType()); + variableTypes.addType(new IntegerType()); + variableTypes.addType(new LongType()); + variableTypes.addType(new DateType()); + variableTypes.addType(new DoubleType()); + variableTypes.addType(new ByteArrayType()); + variableTypes.addType(new SerializableType()); + variableTypes.addType(new CustomObjectType("item", ItemInstance.class)); + variableTypes.addType(new CustomObjectType("message", MessageInstance.class)); + if (customPostVariableTypes!=null) { + for (VariableType customVariableType: customPostVariableTypes) { + variableTypes.addType(customVariableType); + } + } + } + } + + protected void initFormEngines() { + if (formEngines==null) { + formEngines = new HashMap(); + FormEngine defaultFormEngine = new JuelFormEngine(); + formEngines.put(null, defaultFormEngine); // default form engine is looked up with null + formEngines.put(defaultFormEngine.getName(), defaultFormEngine); + } + if (customFormEngines!=null) { + for (FormEngine formEngine: customFormEngines) { + formEngines.put(formEngine.getName(), formEngine); + } + } + } + + protected void initFormTypes() { + if (formTypes==null) { + formTypes = new FormTypes(); + formTypes.addFormType(new StringFormType()); + formTypes.addFormType(new LongFormType()); + formTypes.addFormType(new DateFormType("dd/MM/yyyy")); + formTypes.addFormType(new BooleanFormType()); + } + if (customFormTypes!=null) { + for (AbstractFormType customFormType: customFormTypes) { + formTypes.addFormType(customFormType); + } + } + } + + protected void initScriptingEngines() { + if (resolverFactories==null) { + resolverFactories = new ArrayList(); + resolverFactories.add(new VariableScopeResolverFactory()); + resolverFactories.add(new BeansResolverFactory()); + } + if (scriptingEngines==null) { + scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(resolverFactories)); + } + } + + protected void initExpressionManager() { + if (expressionManager==null) { + expressionManager = new ExpressionManager(); + } + } + + protected void initBusinessCalendarManager() { + if (businessCalendarManager==null) { + MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager(); + mapBusinessCalendarManager.addBusinessCalendar(DurationBusinessCalendar.NAME, new DurationBusinessCalendar()); + mapBusinessCalendarManager.addBusinessCalendar(DueDateBusinessCalendar.NAME, new DueDateBusinessCalendar()); + mapBusinessCalendarManager.addBusinessCalendar(CycleBusinessCalendar.NAME, new CycleBusinessCalendar()); + + businessCalendarManager = mapBusinessCalendarManager; + } + } + + // JPA ////////////////////////////////////////////////////////////////////// + + protected void initJpa() { + if(jpaPersistenceUnitName!=null) { + jpaEntityManagerFactory = JpaHelper.createEntityManagerFactory(jpaPersistenceUnitName); + } + if(jpaEntityManagerFactory!=null) { + sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager)); + VariableType jpaType = variableTypes.getVariableType(JPAEntityVariableType.TYPE_NAME); + // Add JPA-type + if(jpaType == null) { + // We try adding the variable right before SerializableType, if available + int serializableIndex = variableTypes.getTypeIndex(SerializableType.TYPE_NAME); + if(serializableIndex > -1) { + variableTypes.addType(new JPAEntityVariableType(), serializableIndex); + } else { + variableTypes.addType(new JPAEntityVariableType()); + } + } + } + } + + protected void initBeans() { + if (beans == null) { + beans = new HashMap(); + } + } + + // getters and setters ////////////////////////////////////////////////////// + + public String getProcessEngineName() { + return processEngineName; + } + + public int getHistoryLevel() { + return historyLevel; + } + + public void setHistoryLevel(int historyLevel) { + this.historyLevel = historyLevel; + } + + public ProcessEngineConfigurationImpl setProcessEngineName(String processEngineName) { + this.processEngineName = processEngineName; + return this; + } + + public List getCustomPreCommandInterceptorsTxRequired() { + return customPreCommandInterceptorsTxRequired; + } + + public ProcessEngineConfigurationImpl setCustomPreCommandInterceptorsTxRequired(List customPreCommandInterceptorsTxRequired) { + this.customPreCommandInterceptorsTxRequired = customPreCommandInterceptorsTxRequired; + return this; + } + + public List getCustomPostCommandInterceptorsTxRequired() { + return customPostCommandInterceptorsTxRequired; + } + + public ProcessEngineConfigurationImpl setCustomPostCommandInterceptorsTxRequired(List customPostCommandInterceptorsTxRequired) { + this.customPostCommandInterceptorsTxRequired = customPostCommandInterceptorsTxRequired; + return this; + } + + public List getCommandInterceptorsTxRequired() { + return commandInterceptorsTxRequired; + } + + public ProcessEngineConfigurationImpl setCommandInterceptorsTxRequired(List commandInterceptorsTxRequired) { + this.commandInterceptorsTxRequired = commandInterceptorsTxRequired; + return this; + } + + public CommandExecutor getCommandExecutorTxRequired() { + return commandExecutorTxRequired; + } + + public ProcessEngineConfigurationImpl setCommandExecutorTxRequired(CommandExecutor commandExecutorTxRequired) { + this.commandExecutorTxRequired = commandExecutorTxRequired; + return this; + } + + public List getCustomPreCommandInterceptorsTxRequiresNew() { + return customPreCommandInterceptorsTxRequiresNew; + } + + public ProcessEngineConfigurationImpl setCustomPreCommandInterceptorsTxRequiresNew(List customPreCommandInterceptorsTxRequiresNew) { + this.customPreCommandInterceptorsTxRequiresNew = customPreCommandInterceptorsTxRequiresNew; + return this; + } + + public List getCustomPostCommandInterceptorsTxRequiresNew() { + return customPostCommandInterceptorsTxRequiresNew; + } + + public ProcessEngineConfigurationImpl setCustomPostCommandInterceptorsTxRequiresNew(List customPostCommandInterceptorsTxRequiresNew) { + this.customPostCommandInterceptorsTxRequiresNew = customPostCommandInterceptorsTxRequiresNew; + return this; + } + + public List getCommandInterceptorsTxRequiresNew() { + return commandInterceptorsTxRequiresNew; + } + + public ProcessEngineConfigurationImpl setCommandInterceptorsTxRequiresNew(List commandInterceptorsTxRequiresNew) { + this.commandInterceptorsTxRequiresNew = commandInterceptorsTxRequiresNew; + return this; + } + + public CommandExecutor getCommandExecutorTxRequiresNew() { + return commandExecutorTxRequiresNew; + } + + public ProcessEngineConfigurationImpl setCommandExecutorTxRequiresNew(CommandExecutor commandExecutorTxRequiresNew) { + this.commandExecutorTxRequiresNew = commandExecutorTxRequiresNew; + return this; + } + + public RepositoryService getRepositoryService() { + return repositoryService; + } + + public ProcessEngineConfigurationImpl setRepositoryService(RepositoryService repositoryService) { + this.repositoryService = repositoryService; + return this; + } + + public RuntimeService getRuntimeService() { + return runtimeService; + } + + public ProcessEngineConfigurationImpl setRuntimeService(RuntimeService runtimeService) { + this.runtimeService = runtimeService; + return this; + } + + public HistoryService getHistoryService() { + return historyService; + } + + public ProcessEngineConfigurationImpl setHistoryService(HistoryService historyService) { + this.historyService = historyService; + return this; + } + + public IdentityService getIdentityService() { + return identityService; + } + + public ProcessEngineConfigurationImpl setIdentityService(IdentityService identityService) { + this.identityService = identityService; + return this; + } + + public TaskService getTaskService() { + return taskService; + } + + public ProcessEngineConfigurationImpl setTaskService(TaskService taskService) { + this.taskService = taskService; + return this; + } + + public FormService getFormService() { + return formService; + } + + public ProcessEngineConfigurationImpl setFormService(FormService formService) { + this.formService = formService; + return this; + } + + public ManagementService getManagementService() { + return managementService; + } + + public ProcessEngineConfigurationImpl setManagementService(ManagementService managementService) { + this.managementService = managementService; + return this; + } + + public Map, SessionFactory> getSessionFactories() { + return sessionFactories; + } + + public ProcessEngineConfigurationImpl setSessionFactories(Map, SessionFactory> sessionFactories) { + this.sessionFactories = sessionFactories; + return this; + } + + public List getDeployers() { + return deployers; + } + + public ProcessEngineConfigurationImpl setDeployers(List deployers) { + this.deployers = deployers; + return this; + } + + public JobExecutor getJobExecutor() { + return jobExecutor; + } + + public ProcessEngineConfigurationImpl setJobExecutor(JobExecutor jobExecutor) { + this.jobExecutor = jobExecutor; + return this; + } + + public IdGenerator getIdGenerator() { + return idGenerator; + } + + public ProcessEngineConfigurationImpl setIdGenerator(IdGenerator idGenerator) { + this.idGenerator = idGenerator; + return this; + } + + public String getWsSyncFactoryClassName() { + return wsSyncFactoryClassName; + } + + public ProcessEngineConfigurationImpl setWsSyncFactoryClassName(String wsSyncFactoryClassName) { + this.wsSyncFactoryClassName = wsSyncFactoryClassName; + return this; + } + + public Map getFormEngines() { + return formEngines; + } + + public ProcessEngineConfigurationImpl setFormEngines(Map formEngines) { + this.formEngines = formEngines; + return this; + } + + public FormTypes getFormTypes() { + return formTypes; + } + + public ProcessEngineConfigurationImpl setFormTypes(FormTypes formTypes) { + this.formTypes = formTypes; + return this; + } + + public ScriptingEngines getScriptingEngines() { + return scriptingEngines; + } + + public ProcessEngineConfigurationImpl setScriptingEngines(ScriptingEngines scriptingEngines) { + this.scriptingEngines = scriptingEngines; + return this; + } + + public VariableTypes getVariableTypes() { + return variableTypes; + } + + public ProcessEngineConfigurationImpl setVariableTypes(VariableTypes variableTypes) { + this.variableTypes = variableTypes; + return this; + } + + public ExpressionManager getExpressionManager() { + return expressionManager; + } + + public ProcessEngineConfigurationImpl setExpressionManager(ExpressionManager expressionManager) { + this.expressionManager = expressionManager; + return this; + } + + public BusinessCalendarManager getBusinessCalendarManager() { + return businessCalendarManager; + } + + public ProcessEngineConfigurationImpl setBusinessCalendarManager(BusinessCalendarManager businessCalendarManager) { + this.businessCalendarManager = businessCalendarManager; + return this; + } + + public CommandContextFactory getCommandContextFactory() { + return commandContextFactory; + } + + public ProcessEngineConfigurationImpl setCommandContextFactory(CommandContextFactory commandContextFactory) { + this.commandContextFactory = commandContextFactory; + return this; + } + + public TransactionContextFactory getTransactionContextFactory() { + return transactionContextFactory; + } + + public ProcessEngineConfigurationImpl setTransactionContextFactory(TransactionContextFactory transactionContextFactory) { + this.transactionContextFactory = transactionContextFactory; + return this; + } + + + public List getCustomPreDeployers() { + return customPreDeployers; + } + + + public ProcessEngineConfigurationImpl setCustomPreDeployers(List customPreDeployers) { + this.customPreDeployers = customPreDeployers; + return this; + } + + + public List getCustomPostDeployers() { + return customPostDeployers; + } + + + public ProcessEngineConfigurationImpl setCustomPostDeployers(List customPostDeployers) { + this.customPostDeployers = customPostDeployers; + return this; + } + + + public Map getJobHandlers() { + return jobHandlers; + } + + + public ProcessEngineConfigurationImpl setJobHandlers(Map jobHandlers) { + this.jobHandlers = jobHandlers; + return this; + } + + + public SqlSessionFactory getSqlSessionFactory() { + return sqlSessionFactory; + } + + + public ProcessEngineConfigurationImpl setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { + this.sqlSessionFactory = sqlSessionFactory; + return this; + } + + + public DbSqlSessionFactory getDbSqlSessionFactory() { + return dbSqlSessionFactory; + } + + public ProcessEngineConfigurationImpl setDbSqlSessionFactory(DbSqlSessionFactory dbSqlSessionFactory) { + this.dbSqlSessionFactory = dbSqlSessionFactory; + return this; + } + + public TransactionFactory getTransactionFactory() { + return transactionFactory; + } + + public ProcessEngineConfigurationImpl setTransactionFactory(TransactionFactory transactionFactory) { + this.transactionFactory = transactionFactory; + return this; + } + + public List getCustomSessionFactories() { + return customSessionFactories; + } + + public ProcessEngineConfigurationImpl setCustomSessionFactories(List customSessionFactories) { + this.customSessionFactories = customSessionFactories; + return this; + } + + public List getCustomJobHandlers() { + return customJobHandlers; + } + + public ProcessEngineConfigurationImpl setCustomJobHandlers(List customJobHandlers) { + this.customJobHandlers = customJobHandlers; + return this; + } + + public List getCustomFormEngines() { + return customFormEngines; + } + + public ProcessEngineConfigurationImpl setCustomFormEngines(List customFormEngines) { + this.customFormEngines = customFormEngines; + return this; + } + + public List getCustomFormTypes() { + return customFormTypes; + } + + + public ProcessEngineConfigurationImpl setCustomFormTypes(List customFormTypes) { + this.customFormTypes = customFormTypes; + return this; + } + + + public List getCustomScriptingEngineClasses() { + return customScriptingEngineClasses; + } + + + public ProcessEngineConfigurationImpl setCustomScriptingEngineClasses(List customScriptingEngineClasses) { + this.customScriptingEngineClasses = customScriptingEngineClasses; + return this; + } + + public List getCustomPreVariableTypes() { + return customPreVariableTypes; + } + + + public ProcessEngineConfigurationImpl setCustomPreVariableTypes(List customPreVariableTypes) { + this.customPreVariableTypes = customPreVariableTypes; + return this; + } + + + public List getCustomPostVariableTypes() { + return customPostVariableTypes; + } + + + public ProcessEngineConfigurationImpl setCustomPostVariableTypes(List customPostVariableTypes) { + this.customPostVariableTypes = customPostVariableTypes; + return this; + } + + public List getCustomPreBPMNParseListeners() { + return preParseListeners; + } + + public void setCustomPreBPMNParseListeners(List preParseListeners) { + this.preParseListeners = preParseListeners; + } + + public List getCustomPostBPMNParseListeners() { + return postParseListeners; + } + + public void setCustomPostBPMNParseListeners(List postParseListeners) { + this.postParseListeners = postParseListeners; + } + + public List getPreParseListeners() { + return preParseListeners; + } + + public void setPreParseListeners(List preParseListeners) { + this.preParseListeners = preParseListeners; + } + + public List getPostParseListeners() { + return postParseListeners; + } + + public void setPostParseListeners(List postParseListeners) { + this.postParseListeners = postParseListeners; + } + + public Map getBeans() { + return beans; + } + + public void setBeans(Map beans) { + this.beans = beans; + } + + @Override + public ProcessEngineConfigurationImpl setClassLoader(ClassLoader classLoader) { + super.setClassLoader(classLoader); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setDatabaseType(String databaseType) { + super.setDatabaseType(databaseType); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setDataSource(DataSource dataSource) { + super.setDataSource(dataSource); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setDatabaseSchemaUpdate(String databaseSchemaUpdate) { + super.setDatabaseSchemaUpdate(databaseSchemaUpdate); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setHistory(String history) { + super.setHistory(history); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setIdBlockSize(int idBlockSize) { + super.setIdBlockSize(idBlockSize); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcDriver(String jdbcDriver) { + super.setJdbcDriver(jdbcDriver); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcPassword(String jdbcPassword) { + super.setJdbcPassword(jdbcPassword); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcUrl(String jdbcUrl) { + super.setJdbcUrl(jdbcUrl); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcUsername(String jdbcUsername) { + super.setJdbcUsername(jdbcUsername); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJobExecutorActivate(boolean jobExecutorActivate) { + super.setJobExecutorActivate(jobExecutorActivate); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setMailServerDefaultFrom(String mailServerDefaultFrom) { + super.setMailServerDefaultFrom(mailServerDefaultFrom); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setMailServerHost(String mailServerHost) { + super.setMailServerHost(mailServerHost); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setMailServerPassword(String mailServerPassword) { + super.setMailServerPassword(mailServerPassword); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setMailServerPort(int mailServerPort) { + super.setMailServerPort(mailServerPort); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setMailServerUsername(String mailServerUsername) { + super.setMailServerUsername(mailServerUsername); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcMaxActiveConnections(int jdbcMaxActiveConnections) { + super.setJdbcMaxActiveConnections(jdbcMaxActiveConnections); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcMaxCheckoutTime(int jdbcMaxCheckoutTime) { + super.setJdbcMaxCheckoutTime(jdbcMaxCheckoutTime); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcMaxIdleConnections(int jdbcMaxIdleConnections) { + super.setJdbcMaxIdleConnections(jdbcMaxIdleConnections); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcMaxWaitTime(int jdbcMaxWaitTime) { + super.setJdbcMaxWaitTime(jdbcMaxWaitTime); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setTransactionsExternallyManaged(boolean transactionsExternallyManaged) { + super.setTransactionsExternallyManaged(transactionsExternallyManaged); + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJpaEntityManagerFactory(Object jpaEntityManagerFactory) { + this.jpaEntityManagerFactory = jpaEntityManagerFactory; + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJpaHandleTransaction(boolean jpaHandleTransaction) { + this.jpaHandleTransaction = jpaHandleTransaction; + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJpaCloseEntityManager(boolean jpaCloseEntityManager) { + this.jpaCloseEntityManager = jpaCloseEntityManager; + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcPingEnabled(boolean jdbcPingEnabled) { + this.jdbcPingEnabled = jdbcPingEnabled; + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcPingQuery(String jdbcPingQuery) { + this.jdbcPingQuery = jdbcPingQuery; + return this; + } + + @Override + public ProcessEngineConfigurationImpl setJdbcPingConnectionNotUsedFor(int jdbcPingNotUsedFor) { + this.jdbcPingConnectionNotUsedFor = jdbcPingNotUsedFor; + return this; + } + + public boolean isDbIdentityUsed() { + return isDbIdentityUsed; + } + + + public void setDbIdentityUsed(boolean isDbIdentityUsed) { + this.isDbIdentityUsed = isDbIdentityUsed; + } + + + public boolean isDbHistoryUsed() { + return isDbHistoryUsed; + } + + + public void setDbHistoryUsed(boolean isDbHistoryUsed) { + this.isDbHistoryUsed = isDbHistoryUsed; + } + + + public boolean isDbCycleUsed() { + return isDbCycleUsed; + } + + + public void setDbCycleUsed(boolean isDbCycleUsed) { + this.isDbCycleUsed = isDbCycleUsed; + } + + + public List getResolverFactories() { + return resolverFactories; + } + + + public void setResolverFactories(List resolverFactories) { + this.resolverFactories = resolverFactories; + } + + public MailScanner getMailScanner() { + return mailScanner; + } + + public void setMailScanner(MailScanner mailScanner) { + this.mailScanner = mailScanner; + } + + public DeploymentCache getDeploymentCache() { + return deploymentCache; + } + + public void setDeploymentCache(DeploymentCache deploymentCache) { + this.deploymentCache = deploymentCache; + } - // MAIL SCANNER - // ///////////////////////////////////////////////////////////// - - protected MailScanner mailScanner; - - // MYBATIS SQL SESSION FACTORY - // ////////////////////////////////////////////// - - protected SqlSessionFactory sqlSessionFactory; - protected TransactionFactory transactionFactory; - - // ID GENERATOR - // ///////////////////////////////////////////////////////////// - protected IdGenerator idGenerator; - - // OTHER - // //////////////////////////////////////////////////////////////////// - protected List customFormEngines; - protected Map formEngines; - - protected List customFormTypes; - protected FormTypes formTypes; - - protected List customPreVariableTypes; - protected List customPostVariableTypes; - protected VariableTypes variableTypes; - - protected ExpressionManager expressionManager; - protected List customScriptingEngineClasses; - protected ScriptingEngines scriptingEngines; - protected List resolverFactories; - - protected BusinessCalendarManager businessCalendarManager; - - protected String wsSyncFactoryClassName = DEFAULT_WS_SYNC_FACTORY; - - protected CommandContextFactory commandContextFactory; - protected TransactionContextFactory transactionContextFactory; - - protected int historyLevel; - - protected List preParseListeners; - protected List postParseListeners; - - protected Map beans; - - protected boolean isDbIdentityUsed = true; - protected boolean isDbHistoryUsed = true; - protected boolean isDbCycleUsed = false; - - // buildProcessEngine - // /////////////////////////////////////////////////////// - - public ProcessEngine buildProcessEngine() { - init(); - return new ProcessEngineImpl(this); - } - - // init - // ///////////////////////////////////////////////////////////////////// - - protected void init() { - initHistoryLevel(); - initExpressionManager(); - initVariableTypes(); - initBeans(); - initFormEngines(); - initFormTypes(); - initScriptingEngines(); - initBusinessCalendarManager(); - initCommandContextFactory(); - initTransactionContextFactory(); - initCommandExecutors(); - initServices(); - initIdGenerator(); - initDeployers(); - initJobExecutor(); - initMailScanner(); - initDataSource(); - initTransactionFactory(); - initSqlSessionFactory(); - initSessionFactories(); - initJpa(); - } - - // command executors - // //////////////////////////////////////////////////////// - - protected abstract Collection getDefaultCommandInterceptorsTxRequired(); - - protected abstract Collection getDefaultCommandInterceptorsTxRequiresNew(); - - protected void initCommandExecutors() { - initCommandInterceptorsTxRequired(); - initCommandExecutorTxRequired(); - initCommandInterceptorsTxRequiresNew(); - initCommandExecutorTxRequiresNew(); - } - - protected void initCommandInterceptorsTxRequired() { - if (commandInterceptorsTxRequired == null) { - if (customPreCommandInterceptorsTxRequired != null) { - commandInterceptorsTxRequired = new ArrayList( - customPreCommandInterceptorsTxRequired); - } else { - commandInterceptorsTxRequired = new ArrayList(); - } - commandInterceptorsTxRequired - .addAll(getDefaultCommandInterceptorsTxRequired()); - if (customPostCommandInterceptorsTxRequired != null) { - commandInterceptorsTxRequired - .addAll(customPostCommandInterceptorsTxRequired); - } - } - } - - protected void initCommandInterceptorsTxRequiresNew() { - if (commandInterceptorsTxRequiresNew == null) { - if (customPreCommandInterceptorsTxRequiresNew != null) { - commandInterceptorsTxRequiresNew = new ArrayList( - customPreCommandInterceptorsTxRequiresNew); - } else { - commandInterceptorsTxRequiresNew = new ArrayList(); - } - commandInterceptorsTxRequiresNew - .addAll(getDefaultCommandInterceptorsTxRequiresNew()); - if (customPostCommandInterceptorsTxRequiresNew != null) { - commandInterceptorsTxRequiresNew - .addAll(customPostCommandInterceptorsTxRequiresNew); - } - } - } - - protected void initCommandExecutorTxRequired() { - if (commandExecutorTxRequired == null) { - commandExecutorTxRequired = initInterceptorChain(commandInterceptorsTxRequired); - } - } - - protected void initCommandExecutorTxRequiresNew() { - if (commandExecutorTxRequiresNew == null) { - commandExecutorTxRequiresNew = initInterceptorChain(commandInterceptorsTxRequiresNew); - } - } - - protected CommandInterceptor initInterceptorChain( - List chain) { - if (chain == null || chain.isEmpty()) { - throw new ActivitiException( - "invalid command interceptor chain configuration: " + chain); - } - for (int i = 0; i < chain.size() - 1; i++) { - chain.get(i).setNext(chain.get(i + 1)); - } - return chain.get(0); - } - - // services - // ///////////////////////////////////////////////////////////////// - - protected void initServices() { - initService(repositoryService); - initService(runtimeService); - initService(historyService); - initService(identityService); - initService(taskService); - initService(formService); - initService(managementService); - } - - protected void initService(Object service) { - if (service instanceof ServiceImpl) { - ((ServiceImpl) service) - .setCommandExecutor(commandExecutorTxRequired); - } - } - - // DataSource - // /////////////////////////////////////////////////////////////// - - protected void initDataSource() { - if (dataSource == null) { - if (dataSourceJndiName != null) { - try { - dataSource = (DataSource) new InitialContext() - .lookup(dataSourceJndiName); - } catch (Exception e) { - throw new ActivitiException( - "couldn't lookup datasource from " - + dataSourceJndiName + ": " - + e.getMessage(), e); - } - - } else if (jdbcUrl != null) { - if ((jdbcDriver == null) || (jdbcUrl == null) - || (jdbcUsername == null)) { - throw new ActivitiException( - "DataSource or JDBC properties have to be specified in a process engine configuration"); - } - - log.fine("initializing datasource to db: " + jdbcUrl); - - PooledDataSource pooledDataSource = new PooledDataSource( - ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, - jdbcUsername, jdbcPassword); - - if (jdbcMaxActiveConnections > 0) { - pooledDataSource - .setPoolMaximumActiveConnections(jdbcMaxActiveConnections); - } - if (jdbcMaxIdleConnections > 0) { - pooledDataSource - .setPoolMaximumIdleConnections(jdbcMaxIdleConnections); - } - if (jdbcMaxCheckoutTime > 0) { - pooledDataSource - .setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime); - } - if (jdbcMaxWaitTime > 0) { - pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime); - } - - // to avoid - // com.mysql.jdbc.exceptions.jdbc4.CommunicationsException - // when mysql wait_timeout limit has been exceeded (default 8hrs) - // for connections pooled by mybatis and therefore already have been closed by mysql. - if(jdbcPingEnabled == true) - { - pooledDataSource.setPoolPingEnabled(true); - - if(jdbcPingQuery != null) - pooledDataSource.setPoolPingQuery(jdbcPingQuery); - pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor); - } - dataSource = pooledDataSource; - } - - if (dataSource instanceof PooledDataSource) { - // ACT-233: connection pool of Ibatis is not properely - // initialized if this is not called! - ((PooledDataSource) dataSource).forceCloseAll(); - } - } - - if (databaseType == null) { - initDatabaseType(); - } - } - - protected static Properties databaseTypeMappings = getDefaultDatabaseTypeMappings(); - - protected static Properties getDefaultDatabaseTypeMappings() { - Properties databaseTypeMappings = new Properties(); - databaseTypeMappings.setProperty("H2", "h2"); - databaseTypeMappings.setProperty("MySQL", "mysql"); - databaseTypeMappings.setProperty("Oracle", "oracle"); - databaseTypeMappings.setProperty("PostgreSQL", "postgres"); - databaseTypeMappings.setProperty("Microsoft SQL Server", "mssql"); - databaseTypeMappings.setProperty("DB2", "db2"); - databaseTypeMappings.setProperty("DB2", "db2"); - databaseTypeMappings.setProperty("DB2/NT", "db2"); - databaseTypeMappings.setProperty("DB2/NT64", "db2"); - databaseTypeMappings.setProperty("DB2 UDP", "db2"); - databaseTypeMappings.setProperty("DB2/LINUX", "db2"); - databaseTypeMappings.setProperty("DB2/LINUX390", "db2"); - databaseTypeMappings.setProperty("DB2/LINUXZ64", "db2"); - databaseTypeMappings.setProperty("DB2/400 SQL", "db2"); - databaseTypeMappings.setProperty("DB2/6000", "db2"); - databaseTypeMappings.setProperty("DB2 UDB iSeries", "db2"); - databaseTypeMappings.setProperty("DB2/AIX64", "db2"); - databaseTypeMappings.setProperty("DB2/HPUX", "db2"); - databaseTypeMappings.setProperty("DB2/HP64", "db2"); - databaseTypeMappings.setProperty("DB2/SUN", "db2"); - databaseTypeMappings.setProperty("DB2/SUN64", "db2"); - databaseTypeMappings.setProperty("DB2/PTX", "db2"); - databaseTypeMappings.setProperty("DB2/2", "db2"); - return databaseTypeMappings; - } - - public void initDatabaseType() { - Connection connection = null; - try { - connection = dataSource.getConnection(); - DatabaseMetaData databaseMetaData = connection.getMetaData(); - String databaseProductName = databaseMetaData - .getDatabaseProductName(); - log.fine("database product name: '" + databaseProductName + "'"); - databaseType = databaseTypeMappings - .getProperty(databaseProductName); - if (databaseType == null) { - throw new ActivitiException( - "couldn't deduct database type from database product name '" - + databaseProductName + "'"); - } - log.fine("using database type: " + databaseType); - - } catch (SQLException e) { - e.printStackTrace(); - } finally { - try { - if (connection != null) { - connection.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - // myBatis SqlSessionFactory - // //////////////////////////////////////////////// - - protected void initTransactionFactory() { - if (transactionFactory == null) { - if (transactionsExternallyManaged) { - transactionFactory = new ManagedTransactionFactory(); - } else { - transactionFactory = new JdbcTransactionFactory(); - } - } - } - - protected void initSqlSessionFactory() { - if (sqlSessionFactory == null) { - InputStream inputStream = null; - try { - inputStream = ReflectUtil - .getResourceAsStream("org/activiti/db/mapping/mappings.xml"); - - // update the jdbc parameters to the configured ones... - Environment environment = new Environment("default", - transactionFactory, dataSource); - Reader reader = new InputStreamReader(inputStream); - XMLConfigBuilder parser = new XMLConfigBuilder(reader); - Configuration configuration = parser.getConfiguration(); - configuration.setEnvironment(environment); - configuration.getTypeHandlerRegistry().register( - VariableType.class, JdbcType.VARCHAR, - new IbatisVariableTypeHandler()); - configuration = parser.parse(); - - sqlSessionFactory = new DefaultSqlSessionFactory(configuration); - - } catch (Exception e) { - throw new ActivitiException( - "Error while building ibatis SqlSessionFactory: " - + e.getMessage(), e); - } finally { - IoUtil.closeSilently(inputStream); - } - } - } - - // session factories - // //////////////////////////////////////////////////////// - - protected void initSessionFactories() { - if (sessionFactories == null) { - sessionFactories = new HashMap, SessionFactory>(); - - dbSqlSessionFactory = new DbSqlSessionFactory(); - dbSqlSessionFactory.setDatabaseType(databaseType); - dbSqlSessionFactory.setIdGenerator(idGenerator); - dbSqlSessionFactory.setSqlSessionFactory(sqlSessionFactory); - dbSqlSessionFactory.setDbIdentityUsed(isDbIdentityUsed); - dbSqlSessionFactory.setDbHistoryUsed(isDbHistoryUsed); - dbSqlSessionFactory.setDbCycleUsed(isDbCycleUsed); - addSessionFactory(dbSqlSessionFactory); - - addSessionFactory(new GenericManagerFactory(AttachmentManager.class)); - addSessionFactory(new GenericManagerFactory(CommentManager.class)); - addSessionFactory(new GenericManagerFactory(DeploymentManager.class)); - addSessionFactory(new GenericManagerFactory(ExecutionManager.class)); - addSessionFactory(new GenericManagerFactory( - HistoricActivityInstanceManager.class)); - addSessionFactory(new GenericManagerFactory( - HistoricDetailManager.class)); - addSessionFactory(new GenericManagerFactory( - HistoricProcessInstanceManager.class)); - addSessionFactory(new GenericManagerFactory( - HistoricTaskInstanceManager.class)); - addSessionFactory(new GenericManagerFactory( - IdentityInfoManager.class)); - addSessionFactory(new GenericManagerFactory( - IdentityLinkManager.class)); - addSessionFactory(new GenericManagerFactory(JobManager.class)); - addSessionFactory(new GenericManagerFactory(GroupManager.class)); - addSessionFactory(new GenericManagerFactory(MembershipManager.class)); - addSessionFactory(new GenericManagerFactory( - ProcessDefinitionManager.class)); - addSessionFactory(new GenericManagerFactory(PropertyManager.class)); - addSessionFactory(new GenericManagerFactory(ResourceManager.class)); - addSessionFactory(new GenericManagerFactory(TableDataManager.class)); - addSessionFactory(new GenericManagerFactory(TaskManager.class)); - addSessionFactory(new GenericManagerFactory(UserManager.class)); - addSessionFactory(new GenericManagerFactory( - VariableInstanceManager.class)); - } - if (customSessionFactories != null) { - for (SessionFactory sessionFactory : customSessionFactories) { - addSessionFactory(sessionFactory); - } - } - } - - protected void addSessionFactory(SessionFactory sessionFactory) { - sessionFactories.put(sessionFactory.getSessionType(), sessionFactory); - } - - // deployers - // //////////////////////////////////////////////////////////////// - - protected void initDeployers() { - if (this.deployers == null) { - this.deployers = new ArrayList(); - if (customPreDeployers != null) { - this.deployers.addAll(customPreDeployers); - } - this.deployers.addAll(getDefaultDeployers()); - if (customPostDeployers != null) { - this.deployers.addAll(customPostDeployers); - } - } - if (deploymentCache == null) { - List deployers = new ArrayList(); - if (customPreDeployers != null) { - deployers.addAll(customPreDeployers); - } - deployers.addAll(getDefaultDeployers()); - if (customPostDeployers != null) { - deployers.addAll(customPostDeployers); - } - - deploymentCache = new DeploymentCache(); - deploymentCache.setDeployers(deployers); - } - } - - protected Collection getDefaultDeployers() { - List defaultDeployers = new ArrayList(); - - BpmnDeployer bpmnDeployer = new BpmnDeployer(); - bpmnDeployer.setExpressionManager(expressionManager); - bpmnDeployer.setIdGenerator(idGenerator); - BpmnParser bpmnParser = new BpmnParser(expressionManager); - - if (preParseListeners != null) { - bpmnParser.getParseListeners().addAll(preParseListeners); - } - bpmnParser.getParseListeners().addAll(getDefaultBPMNParseListeners()); - if (postParseListeners != null) { - bpmnParser.getParseListeners().addAll(postParseListeners); - } - - bpmnDeployer.setBpmnParser(bpmnParser); - - defaultDeployers.add(bpmnDeployer); - return defaultDeployers; - } - - protected List getDefaultBPMNParseListeners() { - List defaultListeners = new ArrayList(); - if (historyLevel >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { - defaultListeners.add(new HistoryParseListener(historyLevel)); - } - return defaultListeners; - } - - // job executor - // ///////////////////////////////////////////////////////////// - - protected void initJobExecutor() { - if (jobExecutor == null) { - jobExecutor = new JobExecutor(); - } - - jobHandlers = new HashMap(); - TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler(); - jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), - timerExecuteNestedActivityJobHandler); - - TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler(); - jobHandlers.put(timerCatchIntermediateEvent.getType(), - timerCatchIntermediateEvent); - - TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler(); - jobHandlers.put(timerStartEvent.getType(), timerStartEvent); - - // if we have custom job handlers, register them - if (getCustomJobHandlers() != null) { - for (JobHandler customJobHandler : getCustomJobHandlers()) { - jobHandlers.put(customJobHandler.getType(), customJobHandler); - } - } - - jobExecutor.setCommandExecutor(commandExecutorTxRequired); - jobExecutor.setAutoActivate(jobExecutorActivate); - } - - protected void initMailScanner() { - if (mailScanner == null) { - mailScanner = new MailScanner(); - } - mailScanner.setCommandExecutor(commandExecutorTxRequired); - } - - // history - // ////////////////////////////////////////////////////////////////// - - public void initHistoryLevel() { - if (HISTORY_NONE.equalsIgnoreCase(history)) { - historyLevel = 0; - } else if (HISTORY_ACTIVITY.equalsIgnoreCase(history)) { - historyLevel = 1; - } else if (HISTORY_AUDIT.equalsIgnoreCase(history)) { - historyLevel = 2; - } else if (HISTORY_FULL.equalsIgnoreCase(history)) { - historyLevel = 3; - } else { - throw new ActivitiException("invalid history level: " + history); - } - } - - // id generator - // ///////////////////////////////////////////////////////////// - - protected void initIdGenerator() { - if (idGenerator == null) { - DbIdGenerator dbIdGenerator = new DbIdGenerator(); - dbIdGenerator.setIdBlockSize(idBlockSize); - dbIdGenerator.setCommandExecutor(commandExecutorTxRequiresNew); - idGenerator = dbIdGenerator; - } - } - - // OTHER - // //////////////////////////////////////////////////////////////////// - - protected void initCommandContextFactory() { - if (commandContextFactory == null) { - commandContextFactory = new CommandContextFactory(); - commandContextFactory.setProcessEngineConfiguration(this); - } - } - - protected void initTransactionContextFactory() { - if (transactionContextFactory == null) { - transactionContextFactory = new StandaloneMybatisTransactionContextFactory(); - } - } - - protected void initVariableTypes() { - if (variableTypes == null) { - variableTypes = new DefaultVariableTypes(); - if (customPreVariableTypes != null) { - for (VariableType customVariableType : customPreVariableTypes) { - variableTypes.addType(customVariableType); - } - } - variableTypes.addType(new NullType()); - variableTypes.addType(new StringType()); - variableTypes.addType(new BooleanType()); - variableTypes.addType(new ShortType()); - variableTypes.addType(new IntegerType()); - variableTypes.addType(new LongType()); - variableTypes.addType(new DateType()); - variableTypes.addType(new DoubleType()); - variableTypes.addType(new ByteArrayType()); - variableTypes.addType(new SerializableType()); - variableTypes.addType(new CustomObjectType("item", - ItemInstance.class)); - variableTypes.addType(new CustomObjectType("message", - MessageInstance.class)); - if (customPostVariableTypes != null) { - for (VariableType customVariableType : customPostVariableTypes) { - variableTypes.addType(customVariableType); - } - } - } - } - - protected void initFormEngines() { - if (formEngines == null) { - formEngines = new HashMap(); - FormEngine defaultFormEngine = new JuelFormEngine(); - formEngines.put(null, defaultFormEngine); // default form engine is - // looked up with null - formEngines.put(defaultFormEngine.getName(), defaultFormEngine); - } - if (customFormEngines != null) { - for (FormEngine formEngine : customFormEngines) { - formEngines.put(formEngine.getName(), formEngine); - } - } - } - - protected void initFormTypes() { - if (formTypes == null) { - formTypes = new FormTypes(); - formTypes.addFormType(new StringFormType()); - formTypes.addFormType(new LongFormType()); - formTypes.addFormType(new DateFormType("dd/MM/yyyy")); - formTypes.addFormType(new BooleanFormType()); - } - if (customFormTypes != null) { - for (AbstractFormType customFormType : customFormTypes) { - formTypes.addFormType(customFormType); - } - } - } - - protected void initScriptingEngines() { - if (resolverFactories == null) { - resolverFactories = new ArrayList(); - resolverFactories.add(new VariableScopeResolverFactory()); - resolverFactories.add(new BeansResolverFactory()); - } - if (scriptingEngines == null) { - scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory( - resolverFactories)); - } - } - - protected void initExpressionManager() { - if (expressionManager == null) { - expressionManager = new ExpressionManager(); - } - } - - protected void initBusinessCalendarManager() { - if (businessCalendarManager == null) { - MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager(); - mapBusinessCalendarManager.addBusinessCalendar( - DurationBusinessCalendar.NAME, - new DurationBusinessCalendar()); - mapBusinessCalendarManager - .addBusinessCalendar(DueDateBusinessCalendar.NAME, - new DueDateBusinessCalendar()); - mapBusinessCalendarManager.addBusinessCalendar( - CycleBusinessCalendar.NAME, new CycleBusinessCalendar()); - - businessCalendarManager = mapBusinessCalendarManager; - } - } - - // JPA - // ////////////////////////////////////////////////////////////////////// - - protected void initJpa() { - if (jpaPersistenceUnitName != null) { - jpaEntityManagerFactory = JpaHelper - .createEntityManagerFactory(jpaPersistenceUnitName); - } - if (jpaEntityManagerFactory != null) { - sessionFactories.put(EntityManagerSession.class, - new EntityManagerSessionFactory(jpaEntityManagerFactory, - jpaHandleTransaction, jpaCloseEntityManager)); - VariableType jpaType = variableTypes - .getVariableType(JPAEntityVariableType.TYPE_NAME); - // Add JPA-type - if (jpaType == null) { - // We try adding the variable right before SerializableType, if - // available - int serializableIndex = variableTypes - .getTypeIndex(SerializableType.TYPE_NAME); - if (serializableIndex > -1) { - variableTypes.addType(new JPAEntityVariableType(), - serializableIndex); - } else { - variableTypes.addType(new JPAEntityVariableType()); - } - } - } - } - - protected void initBeans() { - if (beans == null) { - beans = new HashMap(); - } - } - - // getters and setters - // ////////////////////////////////////////////////////// - - public String getProcessEngineName() { - return processEngineName; - } - - public int getHistoryLevel() { - return historyLevel; - } - - public void setHistoryLevel(int historyLevel) { - this.historyLevel = historyLevel; - } - - public ProcessEngineConfigurationImpl setProcessEngineName( - String processEngineName) { - this.processEngineName = processEngineName; - return this; - } - - public List getCustomPreCommandInterceptorsTxRequired() { - return customPreCommandInterceptorsTxRequired; - } - - public ProcessEngineConfigurationImpl setCustomPreCommandInterceptorsTxRequired( - List customPreCommandInterceptorsTxRequired) { - this.customPreCommandInterceptorsTxRequired = customPreCommandInterceptorsTxRequired; - return this; - } - - public List getCustomPostCommandInterceptorsTxRequired() { - return customPostCommandInterceptorsTxRequired; - } - - public ProcessEngineConfigurationImpl setCustomPostCommandInterceptorsTxRequired( - List customPostCommandInterceptorsTxRequired) { - this.customPostCommandInterceptorsTxRequired = customPostCommandInterceptorsTxRequired; - return this; - } - - public List getCommandInterceptorsTxRequired() { - return commandInterceptorsTxRequired; - } - - public ProcessEngineConfigurationImpl setCommandInterceptorsTxRequired( - List commandInterceptorsTxRequired) { - this.commandInterceptorsTxRequired = commandInterceptorsTxRequired; - return this; - } - - public CommandExecutor getCommandExecutorTxRequired() { - return commandExecutorTxRequired; - } - - public ProcessEngineConfigurationImpl setCommandExecutorTxRequired( - CommandExecutor commandExecutorTxRequired) { - this.commandExecutorTxRequired = commandExecutorTxRequired; - return this; - } - - public List getCustomPreCommandInterceptorsTxRequiresNew() { - return customPreCommandInterceptorsTxRequiresNew; - } - - public ProcessEngineConfigurationImpl setCustomPreCommandInterceptorsTxRequiresNew( - List customPreCommandInterceptorsTxRequiresNew) { - this.customPreCommandInterceptorsTxRequiresNew = customPreCommandInterceptorsTxRequiresNew; - return this; - } - - public List getCustomPostCommandInterceptorsTxRequiresNew() { - return customPostCommandInterceptorsTxRequiresNew; - } - - public ProcessEngineConfigurationImpl setCustomPostCommandInterceptorsTxRequiresNew( - List customPostCommandInterceptorsTxRequiresNew) { - this.customPostCommandInterceptorsTxRequiresNew = customPostCommandInterceptorsTxRequiresNew; - return this; - } - - public List getCommandInterceptorsTxRequiresNew() { - return commandInterceptorsTxRequiresNew; - } - - public ProcessEngineConfigurationImpl setCommandInterceptorsTxRequiresNew( - List commandInterceptorsTxRequiresNew) { - this.commandInterceptorsTxRequiresNew = commandInterceptorsTxRequiresNew; - return this; - } - - public CommandExecutor getCommandExecutorTxRequiresNew() { - return commandExecutorTxRequiresNew; - } - - public ProcessEngineConfigurationImpl setCommandExecutorTxRequiresNew( - CommandExecutor commandExecutorTxRequiresNew) { - this.commandExecutorTxRequiresNew = commandExecutorTxRequiresNew; - return this; - } - - public RepositoryService getRepositoryService() { - return repositoryService; - } - - public ProcessEngineConfigurationImpl setRepositoryService( - RepositoryService repositoryService) { - this.repositoryService = repositoryService; - return this; - } - - public RuntimeService getRuntimeService() { - return runtimeService; - } - - public ProcessEngineConfigurationImpl setRuntimeService( - RuntimeService runtimeService) { - this.runtimeService = runtimeService; - return this; - } - - public HistoryService getHistoryService() { - return historyService; - } - - public ProcessEngineConfigurationImpl setHistoryService( - HistoryService historyService) { - this.historyService = historyService; - return this; - } - - public IdentityService getIdentityService() { - return identityService; - } - - public ProcessEngineConfigurationImpl setIdentityService( - IdentityService identityService) { - this.identityService = identityService; - return this; - } - - public TaskService getTaskService() { - return taskService; - } - - public ProcessEngineConfigurationImpl setTaskService(TaskService taskService) { - this.taskService = taskService; - return this; - } - - public FormService getFormService() { - return formService; - } - - public ProcessEngineConfigurationImpl setFormService(FormService formService) { - this.formService = formService; - return this; - } - - public ManagementService getManagementService() { - return managementService; - } - - public ProcessEngineConfigurationImpl setManagementService( - ManagementService managementService) { - this.managementService = managementService; - return this; - } - - public Map, SessionFactory> getSessionFactories() { - return sessionFactories; - } - - public ProcessEngineConfigurationImpl setSessionFactories( - Map, SessionFactory> sessionFactories) { - this.sessionFactories = sessionFactories; - return this; - } - - public List getDeployers() { - return deployers; - } - - public ProcessEngineConfigurationImpl setDeployers(List deployers) { - this.deployers = deployers; - return this; - } - - public JobExecutor getJobExecutor() { - return jobExecutor; - } - - public ProcessEngineConfigurationImpl setJobExecutor(JobExecutor jobExecutor) { - this.jobExecutor = jobExecutor; - return this; - } - - public IdGenerator getIdGenerator() { - return idGenerator; - } - - public ProcessEngineConfigurationImpl setIdGenerator(IdGenerator idGenerator) { - this.idGenerator = idGenerator; - return this; - } - - public String getWsSyncFactoryClassName() { - return wsSyncFactoryClassName; - } - - public ProcessEngineConfigurationImpl setWsSyncFactoryClassName( - String wsSyncFactoryClassName) { - this.wsSyncFactoryClassName = wsSyncFactoryClassName; - return this; - } - - public Map getFormEngines() { - return formEngines; - } - - public ProcessEngineConfigurationImpl setFormEngines( - Map formEngines) { - this.formEngines = formEngines; - return this; - } - - public FormTypes getFormTypes() { - return formTypes; - } - - public ProcessEngineConfigurationImpl setFormTypes(FormTypes formTypes) { - this.formTypes = formTypes; - return this; - } - - public ScriptingEngines getScriptingEngines() { - return scriptingEngines; - } - - public ProcessEngineConfigurationImpl setScriptingEngines( - ScriptingEngines scriptingEngines) { - this.scriptingEngines = scriptingEngines; - return this; - } - - public VariableTypes getVariableTypes() { - return variableTypes; - } - - public ProcessEngineConfigurationImpl setVariableTypes( - VariableTypes variableTypes) { - this.variableTypes = variableTypes; - return this; - } - - public ExpressionManager getExpressionManager() { - return expressionManager; - } - - public ProcessEngineConfigurationImpl setExpressionManager( - ExpressionManager expressionManager) { - this.expressionManager = expressionManager; - return this; - } - - public BusinessCalendarManager getBusinessCalendarManager() { - return businessCalendarManager; - } - - public ProcessEngineConfigurationImpl setBusinessCalendarManager( - BusinessCalendarManager businessCalendarManager) { - this.businessCalendarManager = businessCalendarManager; - return this; - } - - public CommandContextFactory getCommandContextFactory() { - return commandContextFactory; - } - - public ProcessEngineConfigurationImpl setCommandContextFactory( - CommandContextFactory commandContextFactory) { - this.commandContextFactory = commandContextFactory; - return this; - } - - public TransactionContextFactory getTransactionContextFactory() { - return transactionContextFactory; - } - - public ProcessEngineConfigurationImpl setTransactionContextFactory( - TransactionContextFactory transactionContextFactory) { - this.transactionContextFactory = transactionContextFactory; - return this; - } - - public List getCustomPreDeployers() { - return customPreDeployers; - } - - public ProcessEngineConfigurationImpl setCustomPreDeployers( - List customPreDeployers) { - this.customPreDeployers = customPreDeployers; - return this; - } - - public List getCustomPostDeployers() { - return customPostDeployers; - } - - public ProcessEngineConfigurationImpl setCustomPostDeployers( - List customPostDeployers) { - this.customPostDeployers = customPostDeployers; - return this; - } - - public Map getJobHandlers() { - return jobHandlers; - } - - public ProcessEngineConfigurationImpl setJobHandlers( - Map jobHandlers) { - this.jobHandlers = jobHandlers; - return this; - } - - public SqlSessionFactory getSqlSessionFactory() { - return sqlSessionFactory; - } - - public ProcessEngineConfigurationImpl setSqlSessionFactory( - SqlSessionFactory sqlSessionFactory) { - this.sqlSessionFactory = sqlSessionFactory; - return this; - } - - public DbSqlSessionFactory getDbSqlSessionFactory() { - return dbSqlSessionFactory; - } - - public ProcessEngineConfigurationImpl setDbSqlSessionFactory( - DbSqlSessionFactory dbSqlSessionFactory) { - this.dbSqlSessionFactory = dbSqlSessionFactory; - return this; - } - - public TransactionFactory getTransactionFactory() { - return transactionFactory; - } - - public ProcessEngineConfigurationImpl setTransactionFactory( - TransactionFactory transactionFactory) { - this.transactionFactory = transactionFactory; - return this; - } - - public List getCustomSessionFactories() { - return customSessionFactories; - } - - public ProcessEngineConfigurationImpl setCustomSessionFactories( - List customSessionFactories) { - this.customSessionFactories = customSessionFactories; - return this; - } - - public List getCustomJobHandlers() { - return customJobHandlers; - } - - public ProcessEngineConfigurationImpl setCustomJobHandlers( - List customJobHandlers) { - this.customJobHandlers = customJobHandlers; - return this; - } - - public List getCustomFormEngines() { - return customFormEngines; - } - - public ProcessEngineConfigurationImpl setCustomFormEngines( - List customFormEngines) { - this.customFormEngines = customFormEngines; - return this; - } - - public List getCustomFormTypes() { - return customFormTypes; - } - - public ProcessEngineConfigurationImpl setCustomFormTypes( - List customFormTypes) { - this.customFormTypes = customFormTypes; - return this; - } - - public List getCustomScriptingEngineClasses() { - return customScriptingEngineClasses; - } - - public ProcessEngineConfigurationImpl setCustomScriptingEngineClasses( - List customScriptingEngineClasses) { - this.customScriptingEngineClasses = customScriptingEngineClasses; - return this; - } - - public List getCustomPreVariableTypes() { - return customPreVariableTypes; - } - - public ProcessEngineConfigurationImpl setCustomPreVariableTypes( - List customPreVariableTypes) { - this.customPreVariableTypes = customPreVariableTypes; - return this; - } - - public List getCustomPostVariableTypes() { - return customPostVariableTypes; - } - - public ProcessEngineConfigurationImpl setCustomPostVariableTypes( - List customPostVariableTypes) { - this.customPostVariableTypes = customPostVariableTypes; - return this; - } - - public List getCustomPreBPMNParseListeners() { - return preParseListeners; - } - - public void setCustomPreBPMNParseListeners( - List preParseListeners) { - this.preParseListeners = preParseListeners; - } - - public List getCustomPostBPMNParseListeners() { - return postParseListeners; - } - - public void setCustomPostBPMNParseListeners( - List postParseListeners) { - this.postParseListeners = postParseListeners; - } - - public List getPreParseListeners() { - return preParseListeners; - } - - public void setPreParseListeners(List preParseListeners) { - this.preParseListeners = preParseListeners; - } - - public List getPostParseListeners() { - return postParseListeners; - } - - public void setPostParseListeners(List postParseListeners) { - this.postParseListeners = postParseListeners; - } - - public Map getBeans() { - return beans; - } - - public void setBeans(Map beans) { - this.beans = beans; - } - - @Override - public ProcessEngineConfigurationImpl setClassLoader(ClassLoader classLoader) { - super.setClassLoader(classLoader); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setDatabaseType(String databaseType) { - super.setDatabaseType(databaseType); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setDataSource(DataSource dataSource) { - super.setDataSource(dataSource); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setDatabaseSchemaUpdate( - String databaseSchemaUpdate) { - super.setDatabaseSchemaUpdate(databaseSchemaUpdate); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setHistory(String history) { - super.setHistory(history); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setIdBlockSize(int idBlockSize) { - super.setIdBlockSize(idBlockSize); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcDriver(String jdbcDriver) { - super.setJdbcDriver(jdbcDriver); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcPassword(String jdbcPassword) { - super.setJdbcPassword(jdbcPassword); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcUrl(String jdbcUrl) { - super.setJdbcUrl(jdbcUrl); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcUsername(String jdbcUsername) { - super.setJdbcUsername(jdbcUsername); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJobExecutorActivate( - boolean jobExecutorActivate) { - super.setJobExecutorActivate(jobExecutorActivate); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setMailServerDefaultFrom( - String mailServerDefaultFrom) { - super.setMailServerDefaultFrom(mailServerDefaultFrom); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setMailServerHost( - String mailServerHost) { - super.setMailServerHost(mailServerHost); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setMailServerPassword( - String mailServerPassword) { - super.setMailServerPassword(mailServerPassword); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setMailServerPort(int mailServerPort) { - super.setMailServerPort(mailServerPort); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setMailServerUsername( - String mailServerUsername) { - super.setMailServerUsername(mailServerUsername); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcMaxActiveConnections( - int jdbcMaxActiveConnections) { - super.setJdbcMaxActiveConnections(jdbcMaxActiveConnections); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcMaxCheckoutTime( - int jdbcMaxCheckoutTime) { - super.setJdbcMaxCheckoutTime(jdbcMaxCheckoutTime); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcMaxIdleConnections( - int jdbcMaxIdleConnections) { - super.setJdbcMaxIdleConnections(jdbcMaxIdleConnections); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJdbcMaxWaitTime(int jdbcMaxWaitTime) { - super.setJdbcMaxWaitTime(jdbcMaxWaitTime); - return this; - } - - @Override - public ProcessEngineConfiguration setJdbcPingEnabled(boolean jdbcPingEnabled) { - super.setJdbcPingEnabled(jdbcPingEnabled); - return this; - } - - @Override - public ProcessEngineConfiguration setJdbcPingQuery(String jdbcPingQuery) { - super.setJdbcPingQuery(jdbcPingQuery); - return this; - } - - @Override - public ProcessEngineConfiguration setJdbcPingConnectionNotUsedFor(int jdbcPingConnectionNotUsedFor) { - super.setJdbcPingConnectionNotUsedFor(jdbcPingConnectionNotUsedFor); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setTransactionsExternallyManaged( - boolean transactionsExternallyManaged) { - super.setTransactionsExternallyManaged(transactionsExternallyManaged); - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJpaEntityManagerFactory( - Object jpaEntityManagerFactory) { - this.jpaEntityManagerFactory = jpaEntityManagerFactory; - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJpaHandleTransaction( - boolean jpaHandleTransaction) { - this.jpaHandleTransaction = jpaHandleTransaction; - return this; - } - - @Override - public ProcessEngineConfigurationImpl setJpaCloseEntityManager( - boolean jpaCloseEntityManager) { - this.jpaCloseEntityManager = jpaCloseEntityManager; - return this; - } - - public boolean isDbIdentityUsed() { - return isDbIdentityUsed; - } - - public void setDbIdentityUsed(boolean isDbIdentityUsed) { - this.isDbIdentityUsed = isDbIdentityUsed; - } - - public boolean isDbHistoryUsed() { - return isDbHistoryUsed; - } - - public void setDbHistoryUsed(boolean isDbHistoryUsed) { - this.isDbHistoryUsed = isDbHistoryUsed; - } - - public boolean isDbCycleUsed() { - return isDbCycleUsed; - } - - public void setDbCycleUsed(boolean isDbCycleUsed) { - this.isDbCycleUsed = isDbCycleUsed; - } - - public List getResolverFactories() { - return resolverFactories; - } - - public void setResolverFactories(List resolverFactories) { - this.resolverFactories = resolverFactories; - } - - public MailScanner getMailScanner() { - return mailScanner; - } - - public void setMailScanner(MailScanner mailScanner) { - this.mailScanner = mailScanner; - } - - public DeploymentCache getDeploymentCache() { - return deploymentCache; - } - - public void setDeploymentCache(DeploymentCache deploymentCache) { - this.deploymentCache = deploymentCache; - } } \ No newline at end of file