Package org.activiti.engine.impl.cfg

Examples of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl


    }
    return true;
  }
 
  private static ClassLoader getCustomClassLoader() {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if(processEngineConfiguration != null) {
      final ClassLoader classLoader = processEngineConfiguration.getClassLoader();
      if(classLoader != null) {
        return classLoader;
      }
    }
    return null;
View Full Code Here


    }
    return null;
  }

  private static Class loadClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    boolean useClassForName = processEngineConfiguration == null ||
        processEngineConfiguration.isUseClassForNameClassLoading();
    return useClassForName ? Class.forName(className, true, classLoader) : classLoader.loadClass(className);
  }
View Full Code Here

            .replace("-snapshot", "")
            .replace("5.", ""));
  }
 
  public static ProcessEngineConfigurationImpl createProcessEngineConfiguration(String database) throws Exception {
    ProcessEngineConfigurationImpl processEngineConfiguration;
    processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
            .createStandaloneProcessEngineConfiguration()
            .setDatabaseSchemaUpdate("true")
            .setHistory("full")
            .setJobExecutorActivate(false);
 
    // loading properties
    String propertiesFileName = System.getProperty("user.home")+System.getProperty("file.separator")+".activiti"+System.getProperty("file.separator")+"upgrade"+System.getProperty("file.separator")+"build."+database+".properties";
    Properties properties = new Properties();
    properties.load(new FileInputStream(propertiesFileName));
 
    // configure the jdbc parameters in the process engine configuration
    processEngineConfiguration.setJdbcDriver(properties.getProperty("jdbc.driver"));
    processEngineConfiguration.setJdbcUrl(properties.getProperty("jdbc.url"));
    processEngineConfiguration.setJdbcUsername(properties.getProperty("jdbc.username"));
    processEngineConfiguration.setJdbcPassword(properties.getProperty("jdbc.password"));

    return processEngineConfiguration;
  }
View Full Code Here

 
  static Logger log = Logger.getLogger(UpgradeDataGenerator.class.getName());
 
  public static void main(String[] args) {
   
    ProcessEngineConfigurationImpl processEngineConfiguration = null;
   
    try {

      LogUtil.readJavaUtilLoggingConfigFromClasspath();
     
      if (args==null || args.length!=2) {
        throw new RuntimeException("exactly 2 arguments expected: database and releaseVersion");
      }
     
      String database = args[0];
      String releaseVersion = args[1];
      log.fine("database: "+database);
      log.fine("releaseVersion: "+releaseVersion);
 
      processEngineConfiguration = UpgradeUtil.createProcessEngineConfiguration(database);

      // install the jdbc proxy driver
      log.fine("installing jdbc proxy driver delegating to "+processEngineConfiguration.getJdbcUrl());
      ProxyDriver.setUrl(processEngineConfiguration.getJdbcUrl());
      processEngineConfiguration.setJdbcUrl("proxy");
      DriverManager.registerDriver(new ProxyDriver());

      log.fine("building the process engine...");
      ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

     
      log.fine("### Running data generator "+ClassNameUtil.getClassNameWithoutPackage(CommonDataGenerator.class)+" in the old version");
      CommonDataGenerator commonDataGenerator = new CommonDataGenerator();
      commonDataGenerator.setProcessEngine(processEngine);
View Full Code Here

    }
  }

  public void execute() {
    try {
      ProcessEngineConfigurationImpl processEngineConfiguration = UpgradeUtil.createProcessEngineConfiguration("postgres");
      processEngineConfiguration.buildProcessEngine();
      CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
      commandExecutor.execute(new Command<Object>() {

        public Object execute(CommandContext commandContext) {
          try {
            Connection connection = commandContext.getSession(DbSqlSession.class).getSqlSession().getConnection();
View Full Code Here

    // existing process engines to make sure that the db is clean
    // and that there are no existing process engines involved.
    ProcessEngines.destroy();

    // Creating the DB schema (without building a process engine)
    ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
    processEngineConfiguration.setProcessEngineName("reboot-test-schema");
    processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000");
    ProcessEngine schemaProcessEngine = processEngineConfiguration.buildProcessEngine();
   
    // Create process engine and deploy test process
     ProcessEngine processEngine = new StandaloneProcessEngineConfiguration()
       .setProcessEngineName("reboot-test")
       .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
View Full Code Here

* @author Joram Barrez
*/
public class ConnectionPoolTest extends PvmTestCase {
 
  public void testMyBatisConnectionPoolProperlyConfigured() {
    ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResource("org/activiti/engine/test/db/connection-pool.activiti.cfg.xml");
   
    config.buildProcessEngine();
   
    // Expected values
    int maxActive = 25;
    int maxIdle = 10;
    int maxCheckoutTime = 30000;
    int maxWaitTime = 25000;
   
    assertEquals(maxActive, config.getJdbcMaxActiveConnections());
    assertEquals(maxIdle, config.getJdbcMaxIdleConnections());
    assertEquals(maxCheckoutTime, config.getJdbcMaxCheckoutTime());
    assertEquals(maxWaitTime, config.getJdbcMaxWaitTime());
   
    // Verify that these properties are correctly set in the MyBatis datasource
    DataSource datasource = config.getDbSqlSessionFactory().getSqlSessionFactory().getConfiguration().getEnvironment().getDataSource();
    assertTrue(datasource instanceof PooledDataSource);
   
    PooledDataSource pooledDataSource = (PooledDataSource) datasource;
    assertEquals(maxActive, pooledDataSource.getPoolMaximumActiveConnections());
    assertEquals(maxIdle, pooledDataSource.getPoolMaximumIdleConnections());
View Full Code Here

  private BlueprintELResolver blueprintELResolver;
  private BlueprintContextELResolver blueprintContextELResolver;

  @Override
  public void init() throws Exception {
    ProcessEngineConfigurationImpl configImpl = (ProcessEngineConfigurationImpl) getProcessEngineConfiguration();
    configImpl.setExpressionManager(new BlueprintExpressionManager());

    List<ResolverFactory> resolverFactories = configImpl.getResolverFactories();
    if (resolverFactories == null) {
      resolverFactories = new ArrayList<ResolverFactory>();
      resolverFactories.add(new VariableScopeResolverFactory());
      resolverFactories.add(new BeansResolverFactory());
    }

    configImpl.setScriptingEngines(new OsgiScriptingEngines(
        new ScriptBindingsFactory(resolverFactories)));
    super.init();
  }
View Full Code Here

     
      ClassLoader peCL = JenkowEngine.class.getClassLoader();
      ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(peCL);
      // set common cfg here.
      ProcessEngineConfigurationImpl peCfg = (ProcessEngineConfigurationImpl)cfg;
            peCfg.setIdentityService(new IdentityServiceImpl());
      peCfg.setBeans(ctxBeans);
      List<BpmnParseListener> preParseListeners = peCfg.getPreParseListeners();
      if (preParseListeners == null){
        preParseListeners = new ArrayList<BpmnParseListener>();
        peCfg.setPreParseListeners(preParseListeners);
      }
      preParseListeners.add(new JenkowBpmnParseListener());
      cfg.setClassLoader(peCL);
      // build engine
      engine = cfg.buildProcessEngine();
View Full Code Here

  protected void setSubject(Email email, String subject) {
    email.setSubject(subject != null ? subject : "");
  }

  protected void setMailServerProperties(Email email) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

    String host = processEngineConfiguration.getMailServerHost();
    if (host == null) {
      throw new ActivitiException("Could not send email: no SMTP host is configured");
    }
    email.setHostName(host);

    int port = processEngineConfiguration.getMailServerPort();
    email.setSmtpPort(port);

    email.setSSL(processEngineConfiguration.getMailServerUseSSL());
    email.setTLS(processEngineConfiguration.getMailServerUseTLS());

    String user = processEngineConfiguration.getMailServerUsername();
    String password = processEngineConfiguration.getMailServerPassword();
    if (user != null && password != null) {
      email.setAuthentication(user, password);
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.