Package org.jbpm.persistence.db

Examples of org.jbpm.persistence.db.DbPersistenceServiceFactory


  public void execute() throws BuildException {
    Connection connection = null;
    JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(null);
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      SessionFactoryImpl sessionFactory = (SessionFactoryImpl) dbPersistenceServiceFactory.getSessionFactory();
      ConnectionProvider connectionProvider = sessionFactory.getConnectionProvider();
      connection = connectionProvider.getConnection();
      Statement statement = connection.createStatement();
      log("shutting down database");
      statement.executeUpdate("SHUTDOWN");
View Full Code Here


    if (jbpmCfg!=null) {
      log("using jbpm configuration "+jbpmCfg);
      JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(jbpmCfg);
      JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
      try {
        DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
        configuration = dbPersistenceServiceFactory.getConfiguration();
      } finally {
        jbpmContext.close();
      }
     
    // if there is no jbpm.cfg.xml specified, check if there is a hibernate.cfg.xml specified
View Full Code Here

 
  public void createSchema(String jbpmContextName) {
    JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
    try {
      Services services = jbpmContext.getServices();
      DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      persistenceServiceFactory.createSchema();
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

 
  public void dropSchema(String jbpmContextName) {
    JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
    try {
      Services services = jbpmContext.getServices();
      DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      persistenceServiceFactory.dropSchema();
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see it.eng.spago.init.InitializerIFace#init(it.eng.spago.base.SourceBean)
   */
  public void init(SourceBean config) {
    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
    DbPersistenceServiceFactory dbpsf = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
    try{
      SessionFactory sessionFactHib = dbpsf.getSessionFactory();
      Session sessionHib = sessionFactHib.openSession();
      Query hibQuery = sessionHib.createQuery(" from ProcessDefinition");
      List hibList = hibQuery.list();     
    } catch (HibernateException he) {
      jbpmConfiguration.createSchema();
View Full Code Here

      log.debug( "created seam managed jBPM context");
   }

   private void assertNoTransactionManagement()
   {
      DbPersistenceServiceFactory dpsf = (DbPersistenceServiceFactory) jbpmContext.getJbpmConfiguration()
            .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      if ( dpsf.isTransactionEnabled() )
      {
         throw new IllegalStateException("jBPM transaction management is enabled, disable in jbpm.cfg.xml");
      }
   }
View Full Code Here

         {
            throw new IllegalArgumentException("JbpmConfiguration not found in JNDI", ne);
         }
      }

      DbPersistenceServiceFactory dbpsf = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
      if (Naming.getInitialContextProperties()!=null)
      {
         // Prefix regular JNDI properties for Hibernate
         Hashtable<String, String> hash = Naming.getInitialContextProperties();
         Properties prefixed = new Properties();
         for (Map.Entry<String, String> entry: hash.entrySet() )
         {
            prefixed.setProperty( Environment.JNDI_PREFIX + "." + entry.getKey(), entry.getValue() );
         }
        
         try
         {
            dbpsf.getConfiguration().getProperties().putAll(prefixed);
         }
         catch (HibernateException he)
         {
            log.info("could not set JNDI properties for jBPM persistence: " + he.getMessage());
         }
View Full Code Here

 
  public void createSchema(String jbpmContextName) {
    JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
    try {
      Services services = jbpmContext.getServices();
      DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      persistenceServiceFactory.createSchema();
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

 
  public void dropSchema(String jbpmContextName) {
    JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
    try {
      Services services = jbpmContext.getServices();
      DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
      persistenceServiceFactory.dropSchema();
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

         {
            throw new IllegalArgumentException("JbpmConfiguration not found in JNDI", ne);
         }
      }

      DbPersistenceServiceFactory dbpsf = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
      if (Naming.getInitialContextProperties()!=null)
      {
         // Prefix regular JNDI properties for Hibernate
         Hashtable<String, String> hash = Naming.getInitialContextProperties();
         Properties prefixed = new Properties();
         for (Map.Entry<String, String> entry: hash.entrySet() )
         {
            prefixed.setProperty( Environment.JNDI_PREFIX + "." + entry.getKey(), entry.getValue() );
         }
        
         try
         {
            dbpsf.getConfiguration().getProperties().putAll(prefixed);
         }
         catch (HibernateException he)
         {
            log.warn("could not set JNDI properties for jBPM persistence: " + he.getMessage());
         }
View Full Code Here

TOP

Related Classes of org.jbpm.persistence.db.DbPersistenceServiceFactory

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.