Search in sources :

Example 1 with BPMNMetaDataTableCreationException

use of org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException 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 BPMNMetaDataTableCreationException

use of org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException in project carbon-business-process by wso2.

the class Database method createActivitiMetaDataTable.

/**
 * during the start up of the server this method will create BPS_BPMN_DEPLOYMENT_METADATA table
 * if it doesn't exist in the activiti database.
 *
 * @throws org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException
 */
private void createActivitiMetaDataTable() throws BPMNMetaDataTableCreationException {
    BPMNDatabaseCreator bpmnDatabaseCreator = new BPMNDatabaseCreator(getDataSource());
    String bpmnDeploymentMetaDataQuery = "SELECT * FROM " + BPMNConstants.BPS_BPMN_DEPLOYMENT_METADATA_TABLE;
    if (!bpmnDatabaseCreator.isDatabaseStructureCreated(bpmnDeploymentMetaDataQuery)) {
        try {
            bpmnDatabaseCreator.createRegistryDatabase();
        } catch (Exception e) {
            String errMsg = "Error creating BPS_BPMN_DEPLOYMENT_METADATA table";
            throw new BPMNMetaDataTableCreationException(errMsg, e);
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("BPS_BPMN_DEPLOYMENT_METADATA table already exists. Using the old table.");
        }
    }
}
Also used : BPMNMetaDataTableCreationException(org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException) BPMNDatabaseCreator(org.wso2.carbon.bpmn.core.utils.BPMNDatabaseCreator) BPMNMetaDataTableCreationException(org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException) DatabaseConfigurationException(org.wso2.carbon.bpmn.core.exception.DatabaseConfigurationException) NamingException(javax.naming.NamingException)

Aggregations

NamingException (javax.naming.NamingException)1 BundleContext (org.osgi.framework.BundleContext)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 BPMNMetaDataTableCreationException (org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException)1 DatabaseConfigurationException (org.wso2.carbon.bpmn.core.exception.DatabaseConfigurationException)1 BPMNEngineServerStartupObserver (org.wso2.carbon.bpmn.core.integration.BPMNEngineServerStartupObserver)1 BPMNEngineWaitBeforeShutdownObserver (org.wso2.carbon.bpmn.core.integration.BPMNEngineWaitBeforeShutdownObserver)1 BPMNDatabaseCreator (org.wso2.carbon.bpmn.core.utils.BPMNDatabaseCreator)1 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)1