Package org.jbpm

Examples of org.jbpm.JbpmConfiguration$Configs


    if (cfg==null) {
      throw new BuildException("a hibernate.cfg.xml must be specified in the cfg attribute");
    }
    try {
      // get the JbpmConfiguration
      JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(cfg,properties);
     
      // if attribute process is set, deploy that process file
      if (process!=null) {
        log( "deploying par "+process+" ..." );
        File file = new File(process);
View Full Code Here


    return configuration;
  }

  public static JbpmConfiguration getJbpmConfiguration(String cfg, String properties) {
    Object key = getKey(cfg,properties);
    JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) jbpmConfigurations.get(key);
    if (jbpmConfiguration==null) {
      jbpmConfiguration = JbpmConfiguration.parseXmlString(
        "<jbpm-configuration>" +
        " <jbpm-context>" +
        "  <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
        " </jbpm-context>" +
        " <string name='resource.business.calendar' value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
        " <string name='resource.default.modules' value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
        " <string name='resource.converter' value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
        " <string name='resource.action.types' value='org/jbpm/graph/action/action.types.xml' />" +
        " <string name='resource.node.types' value='org/jbpm/graph/node/node.types.xml' />" +
        " <string name='resource.parsers' value='org/jbpm/jpdl/par/jbpm.parsers.xml' />" +
        " <string name='resource.varmapping' value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
        "</jbpm-configuration>"
      );

      Configuration configuration = getConfiguration(cfg, properties);
      DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      dbPersistenceServiceFactory.setConfiguration(configuration);

      jbpmConfigurations.put(key, jbpmConfiguration);
    }
    return jbpmConfiguration;
View Full Code Here

import org.jbpm.JbpmContext;

public class PersistenceConfigurationDbTest extends TestCase {

  public void testDisableHibernateTransactions() {
    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
      "<jbpm-configuration>" +
      "  <jbpm-context>" +
      "    <service name='persistence'>" +
      "      <factory>" +
      "        <bean class='org.jbpm.persistence.db.DbPersistenceServiceFactory'>" +
      "          <field name='isTransactionEnabled'><false /></field>" +
      "        </bean>" +
      "      </factory>" +
      "    </service>" +
      "  </jbpm-context>" +
      "</jbpm-configuration>"
    );
   
    DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
    assertFalse(dbPersistenceServiceFactory.isTransactionEnabled());
    JbpmContext jbpmContext = (JbpmContext) jbpmConfiguration.createJbpmContext();
    try {
      DbPersistenceService dbPersistenceService = (DbPersistenceService) jbpmContext.getServices().getPersistenceService();
      assertFalse(dbPersistenceService.isTransactionEnabled());
      assertNull(dbPersistenceService.getTransaction());
    } finally {
View Full Code Here

      jbpmContext.close();
    }
  }

  public void testDifferentHibernateCfgFile() {
    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
      "<jbpm-configuration>" +
      "  <jbpm-context>" +
      "    <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
      "  </jbpm-context>" +
      "  <string name='resource.hibernate.cfg.xml' value='org/jbpm/persistence/db/custom.hibernate.cfg.xml' />" +
      "  <string name='resource.hibernate.properties' value='org/jbpm/persistence/db/custom.hibernate.properties' />" +
      "</jbpm-configuration>"
    );
   
    DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
    JbpmContext jbpmContext = (JbpmContext) jbpmConfiguration.createJbpmContext();
    try {
      DbPersistenceService dbPersistenceService = (DbPersistenceService) jbpmContext.getServices().getPersistenceService();
      assertEquals(0, dbPersistenceService.getSessionFactory().getAllClassMetadata().size());
      assertEquals("org.hibernate.dialect.PostgreSQLDialect", dbPersistenceServiceFactory.configuration.getProperty("hibernate.dialect"));
    } finally {
View Full Code Here

  String jbpmCfgResource = null;
  String jbpmContextName = null;
 
  protected void startService() throws Exception {
    log.debug("starting jbpm service...");
    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfgResource);
    bind(jbpmConfiguration, jndiName);
  }
View Full Code Here

{
    @Override
    protected void startService()
        throws Exception
    {
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor() ;
        if (jobExecutor != null)
        {
            jobExecutor.start() ;
        }
        final JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext() ;
        jbpmContext.close() ;
        super.startService();
    }
View Full Code Here

    @Override
    protected void stopService()
        throws Exception
    {
        super.stopService();
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor() ;
        if (jobExecutor != null)
        {
            jobExecutor.stopAndJoin() ;
        }
        jbpmConfiguration.close() ;
    }
View Full Code Here

{
    private static final String PROCESS_DEFINITION = "/jbpmLocalTest.xml" ;
   
    public synchronized void startProcess()
    {
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext() ;
       
        // Create process definition
        final InputStream is = ClassUtil.getResourceAsStream(PROCESS_DEFINITION, getClass()) ;
        final ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(is) ;
        jbpmContext.deployProcessDefinition(processDefinition) ;
View Full Code Here

   
    private long processInstanceId ;
   
    public synchronized void startProcess()
    {
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext() ;
       
        // Create process definition
        final InputStream is = ClassUtil.getResourceAsStream(PROCESS_DEFINITION, getClass()) ;
        final ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(is) ;
        jbpmContext.deployProcessDefinition(processDefinition) ;
View Full Code Here

   
    public synchronized void suspendProcessInstance()
    {
        if (suspendProcess)
        {
            final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
            final JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext() ;
           
            final ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId) ;
            processInstance.suspend() ;
           
            jbpmContext.close() ;
View Full Code Here

TOP

Related Classes of org.jbpm.JbpmConfiguration$Configs

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.