Search in sources :

Example 1 with DatabaseConfigurationException

use of org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException in project carbon-business-process by wso2.

the class BPMNServiceComponent method activate.

protected void activate(ComponentContext ctxt) {
    log.info("Initializing the BPMN core component...");
    try {
        BundleContext bundleContext = ctxt.getBundleContext();
        BPMNServerHolder holder = BPMNServerHolder.getInstance();
        ActivitiEngineBuilder activitiEngineBuilder = new ActivitiEngineBuilder();
        holder.setEngine(activitiEngineBuilder.buildEngine());
        holder.setTenantManager(new TenantManager());
        /*BPMNRestExtensionHolder restHolder = BPMNRestExtensionHolder.getInstance();

            restHolder.setRestInvoker(new RESTInvoker());*/
        BPMNEngineServiceImpl bpmnEngineService = new BPMNEngineServiceImpl();
        bpmnEngineService.setProcessEngine(ActivitiEngineBuilder.getProcessEngine());
        bundleContext.registerService(BPMNEngineService.class, bpmnEngineService, null);
        bundleContext.registerService(ServerStartupObserver.class.getName(), new BPMNEngineServerStartupObserver(), null);
        bundleContext.registerService(WaitBeforeShutdownObserver.class, new BPMNEngineWaitBeforeShutdownObserver(), null);
    // DataSourceHandler dataSourceHandler = new DataSourceHandler();
    // dataSourceHandler.initDataSource(activitiEngineBuilder.getDataSourceJndiName());
    // dataSourceHandler.closeDataSource();
    // } catch (BPMNMetaDataTableCreationException e) {
    // log.error("Could not create BPMN checksum table", e);
    // } catch (DatabaseConfigurationException e) {
    // log.error("Could not create BPMN checksum table", e);
    } catch (Throwable e) {
        log.error("Failed to initialize the BPMN core component.", e);
    }
}
Also used : BPMNEngineServerStartupObserver(org.wso2.carbon.bpmn.core.integration.BPMNEngineServerStartupObserver) ServerStartupObserver(org.wso2.carbon.core.ServerStartupObserver) ActivitiEngineBuilder(org.wso2.carbon.bpmn.core.ActivitiEngineBuilder) BPMNServerHolder(org.wso2.carbon.bpmn.core.BPMNServerHolder) BPMNEngineWaitBeforeShutdownObserver(org.wso2.carbon.bpmn.core.integration.BPMNEngineWaitBeforeShutdownObserver) TenantManager(org.wso2.carbon.bpmn.core.deployment.TenantManager) BPMNEngineServerStartupObserver(org.wso2.carbon.bpmn.core.integration.BPMNEngineServerStartupObserver) BundleContext(org.osgi.framework.BundleContext)

Example 2 with DatabaseConfigurationException

use of org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException in project carbon-business-process by wso2.

the class Database method createDAOConnectionFactory.

/**
 * Creates the DAO connection factory.
 * @return : the connection factory.
 * @throws DatabaseConfigurationException : If the provided config factory cannot be instantiated.
 */
public HumanTaskDAOConnectionFactoryJDBC createDAOConnectionFactory() throws DatabaseConfigurationException {
    String connectionFactoryClassName = serverConfiguration.getDaoConnectionFactoryClass();
    if (log.isDebugEnabled()) {
        log.debug("Using DAO connection factory class: " + connectionFactoryClassName);
    }
    HumanTaskDAOConnectionFactoryJDBC humanTaskDAOConnectionFactoryJDBC;
    try {
        humanTaskDAOConnectionFactoryJDBC = (HumanTaskDAOConnectionFactoryJDBC) Class.forName(connectionFactoryClassName).newInstance();
    } catch (Exception ex) {
        String errMsg = "Human Task DAO Connection Factory instantiation failed!";
        log.error(errMsg);
        throw new DatabaseConfigurationException(errMsg, ex);
    }
    humanTaskDAOConnectionFactoryJDBC.setDataSource(getDataSource());
    humanTaskDAOConnectionFactoryJDBC.setTransactionManager(getTnxManager());
    humanTaskDAOConnectionFactoryJDBC.setDAOConnectionFactoryProperties(getGenericDAOFactoryProperties());
    humanTaskDAOConnectionFactoryJDBC.init();
    return humanTaskDAOConnectionFactoryJDBC;
}
Also used : HumanTaskDAOConnectionFactoryJDBC(org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnectionFactoryJDBC) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException)

Example 3 with DatabaseConfigurationException

use of org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException in project carbon-business-process by wso2.

the class DatabaseUtil method createDAOConnectionFactory.

public HTCoordinationDAOConnectionFactoryJDBC createDAOConnectionFactory() throws DatabaseConfigurationException {
    String daoConnectionFactoryClassName = CoordinationConfiguration.getInstance().getDaoConnectionFactoryClass();
    if (log.isDebugEnabled()) {
        log.debug("Using DAO connection factory class for B4P module:" + daoConnectionFactoryClassName);
    }
    HTCoordinationDAOConnectionFactoryJDBC htCoordinationDAOConnectionFactoryJDBC;
    try {
        htCoordinationDAOConnectionFactoryJDBC = (HTCoordinationDAOConnectionFactoryJDBC) Class.forName(daoConnectionFactoryClassName).newInstance();
    } catch (Exception ex) {
        String errMsg = "B4P module DAO Connection Factory instantiation failed!";
        log.error(errMsg);
        throw new DatabaseConfigurationException(errMsg, ex);
    }
    htCoordinationDAOConnectionFactoryJDBC.setDataSource(getDataSource());
    htCoordinationDAOConnectionFactoryJDBC.setTransactionManager(getTnxManager());
    htCoordinationDAOConnectionFactoryJDBC.setDAOConnectionFactoryProperties(getGenericDAOFactoryProperties());
    htCoordinationDAOConnectionFactoryJDBC.init();
    return htCoordinationDAOConnectionFactoryJDBC;
}
Also used : HTCoordinationDAOConnectionFactoryJDBC(org.wso2.carbon.bpel.b4p.coordination.dao.HTCoordinationDAOConnectionFactoryJDBC)

Example 4 with DatabaseConfigurationException

use of org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException in project carbon-business-process by wso2.

the class CoordinationController method initDataSource.

/**
 * Initialize Database util class.
 *
 * @throws B4PCoordinationException
 */
private void initDataSource() throws B4PCoordinationException {
    if (log.isDebugEnabled()) {
        log.debug("Initialising B4P Coordination database");
    }
    dbUtil = new DatabaseUtil();
    dbUtil.setTransactionManager(tnxManager);
    try {
        dbUtil.start();
    } catch (DatabaseConfigurationException e) {
        String errMsg = "B4P Coordination Database Initialization failed.";
        log.error(errMsg);
        throw new B4PCoordinationException(errMsg, e);
    }
}
Also used : DatabaseConfigurationException(org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException) DatabaseUtil(org.wso2.carbon.bpel.b4p.coordination.db.DatabaseUtil)

Aggregations

BundleContext (org.osgi.framework.BundleContext)1 HTCoordinationDAOConnectionFactoryJDBC (org.wso2.carbon.bpel.b4p.coordination.dao.HTCoordinationDAOConnectionFactoryJDBC)1 DatabaseConfigurationException (org.wso2.carbon.bpel.b4p.coordination.db.DatabaseConfigurationException)1 DatabaseUtil (org.wso2.carbon.bpel.b4p.coordination.db.DatabaseUtil)1 ActivitiEngineBuilder (org.wso2.carbon.bpmn.core.ActivitiEngineBuilder)1 BPMNServerHolder (org.wso2.carbon.bpmn.core.BPMNServerHolder)1 TenantManager (org.wso2.carbon.bpmn.core.deployment.TenantManager)1 BPMNEngineServerStartupObserver (org.wso2.carbon.bpmn.core.integration.BPMNEngineServerStartupObserver)1 BPMNEngineWaitBeforeShutdownObserver (org.wso2.carbon.bpmn.core.integration.BPMNEngineWaitBeforeShutdownObserver)1 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)1 HumanTaskDAOConnectionFactoryJDBC (org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnectionFactoryJDBC)1 HumanTaskServerException (org.wso2.carbon.humantask.core.engine.HumanTaskServerException)1