Search in sources :

Example 1 with BPELServerImpl

use of org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method getTenantProcessStore.

private TenantProcessStoreImpl getTenantProcessStore() {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    BPELServerImpl bpelServer = BPELServerImpl.getInstance();
    return (TenantProcessStoreImpl) bpelServer.getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
}
Also used : BPELServerImpl(org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)

Example 2 with BPELServerImpl

use of org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl in project carbon-business-process by wso2.

the class Utils method dbexec.

/**
 * Execute a database transaction, unwrapping nested
 * {@link org.apache.ode.bpel.pmapi.ManagementException}s.
 *
 * @param callable action to run
 * @return object of type T
 * @throws org.apache.ode.bpel.pmapi.ManagementException if exception occurred during transaction
 */
private static <T> T dbexec(BpelDatabase.Callable<T> callable) throws ManagementException {
    try {
        BPELServerImpl bpelServer = (BPELServerImpl) BPELServiceComponent.getBPELServer();
        BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
        return bpelDb.exec(callable);
    } catch (ManagementException me) {
        // Passthrough.
        throw me;
    } catch (Exception ex) {
        log.error("Exception during database operation", ex);
        throw new ManagementException("Exception during database operation", ex);
    }
}
Also used : ManagementException(org.apache.ode.bpel.pmapi.ManagementException) BPELServerImpl(org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) ManagementException(org.apache.ode.bpel.pmapi.ManagementException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 3 with BPELServerImpl

use of org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl in project carbon-business-process by wso2.

the class TenantProcessStoreImpl method handleUndeployOnSlaveNode.

/**
 * Undeployment scenario in a worker node( Slave ) in the clustered setup
 * When the BPELDeployer get called for undeploying the bpel package, following has already taken place.
 * The package information stored in the registry as well as the zip archive is deleted
 * Process, Instance information have been removed from the ODE database
 * However, on the slave node, the bpel process and the web services associated with the bpel process
 * is still in memory. We need to unload the bpel process and the associated web services
 *
 * @param bpelPackageName bpel package name
 * @return
 */
private int handleUndeployOnSlaveNode(String bpelPackageName) {
    List<String> packageList = findMatchingProcessByPackageName(bpelPackageName);
    if (packageList.size() < 1) {
        log.debug("Handling un-deploy operation on salve (worker) node : package list is empty");
        return -1;
    }
    for (String packageName : packageList) {
        // location for extracted BPEL package
        String bpelPackageLocation = parentProcessStore.getLocalDeploymentUnitRepo().getAbsolutePath() + File.separator + tenantId + File.separator + packageName;
        File bpelPackage = new File(bpelPackageLocation);
        // removing extracted bpel package at repository/bpel/tenantID/
        deleteBpelPackageFromRepo(bpelPackage);
        for (QName pid : getProcessesInPackage(packageName)) {
            ProcessConfigurationImpl processConf = (ProcessConfigurationImpl) getProcessConfiguration(pid);
            // This property is read when we removing the axis service for this process.
            // So that we can decide whether we should persist service QOS configs
            processConf.setUndeploying(true);
        }
    }
    Collection<QName> undeployedProcesses = new ArrayList<QName>();
    for (String nameWithVersion : packageList) {
        undeploySpecificVersionOfBPELPackage(nameWithVersion, undeployedProcesses);
    }
    BPELServerImpl instance = BPELServerImpl.getInstance();
    BpelServerImpl odeBpelServer = instance.getODEBPELServer();
    for (QName pid : undeployedProcesses) {
        odeBpelServer.unregister(pid);
        ProcessConf pConf = parentProcessStore.getProcessConfiguration(pid);
        if (pConf != null) {
            if (log.isDebugEnabled()) {
                log.debug("Cancelling all cron scheduled jobs for process " + pid);
            }
            odeBpelServer.getContexts().cronScheduler.cancelProcessCronJobs(pid, true);
        }
        log.info("Process " + pid + " un-deployed.");
    }
    parentProcessStore.updateProcessAndDUMapsForSalve(tenantId, bpelPackageName, undeployedProcesses);
    return 0;
}
Also used : BpelServerImpl(org.apache.ode.bpel.engine.BpelServerImpl) QName(javax.xml.namespace.QName) BPELServerImpl(org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

BPELServerImpl (org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl)3 File (java.io.File)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)1 BpelServerImpl (org.apache.ode.bpel.engine.BpelServerImpl)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 ManagementException (org.apache.ode.bpel.pmapi.ManagementException)1 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)1