Search in sources :

Example 1 with BPELServer

use of org.wso2.carbon.bpel.core.ode.integration.BPELServer 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 BPELServer

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

the class BPELDeployer method init.

public void init(ConfigurationContext configurationContext) {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    log.info("Initializing BPEL Deployer for tenant " + tenantId + ".");
    File bpelRepo = null;
    try {
        BPELDeployerServiceComponent.getTenantRegistryLoader().loadTenantRegistry(tenantId);
        bpelRepo = createBPELRepository(configurationContext);
    } catch (DeploymentException e) {
        log.warn("BPEL repository creation failed.", e);
    } catch (RegistryException e) {
        log.warn("Initialization of tenant process store failed for tenant: " + tenantId + " This can cause issues in deployment of BPEL packages.", e);
    }
    BPELServer bpsServer = BPELDeployerServiceComponent.getBPELServer();
    tenantProcessStore = bpsServer.getMultiTenantProcessStore().createProcessStoreForTenant(configurationContext);
    tenantProcessStore.setBpelArchiveRepo(bpelRepo);
    configurationContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, bpsServer.getHttpConnectionManager());
    try {
        tenantProcessStore.init();
    } catch (Exception re) {
        log.warn("Initialization of tenant process store failed for tenant: " + tenantId + " This can cause issues in deployment of BPEL packages.", re);
    }
}
Also used : DeploymentException(org.apache.axis2.deployment.DeploymentException) BPELServer(org.wso2.carbon.bpel.core.ode.integration.BPELServer) File(java.io.File) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 3 with BPELServer

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

the class BPELBindingContextImpl method publishAxisService.

private BPELProcessProxy publishAxisService(ProcessConf processConfiguration, QName serviceName, String portName) throws AxisFault {
    // TODO: Need to fix this to suite multi-tenant environment
    // TODO: There is a problem in this, in this manner we can't have two axis services with
    // same QName
    BPELProcessProxy processProxy = new BPELProcessProxy(processConfiguration, bpelServer, serviceName, portName);
    ConfigurationContext tenantConfigCtx = getConfigurationContextFromProcessConfiguration(processConfiguration);
    AxisService axisService;
    try {
        axisService = AxisServiceUtils.createAxisService(tenantConfigCtx.getAxisConfiguration(), processProxy);
        EndpointConfiguration endpointConfig = ((ProcessConfigurationImpl) processConfiguration).getEndpointConfiguration(new WSDL11Endpoint(serviceName, portName));
        ServiceConfigurationUtil.configureService(axisService, endpointConfig, tenantConfigCtx);
    } catch (AxisFault e) {
        log.error("Error occurred creating the axis service " + serviceName.toString());
        throw new DeploymentException("BPEL Package deployment failed.", e);
    }
    processProxy.setAxisService(axisService);
    removeBPELProcessProxyAndAxisService(processConfiguration.getDeployer(), serviceName, portName);
    services.put(processConfiguration.getDeployer(), serviceName, portName, processProxy);
    ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
    serviceList.add(axisService);
    DeploymentEngine.addServiceGroup(createServiceGroupForService(axisService), serviceList, null, null, tenantConfigCtx.getAxisConfiguration());
    // 
    if (log.isDebugEnabled()) {
        log.debug("BPELProcessProxy created for process " + processConfiguration.getProcessId());
        log.debug("AxisService " + serviceName + " created for BPEL process " + processConfiguration.getProcessId());
    }
    return processProxy;
}
Also used : WSDL11Endpoint(org.apache.ode.bpel.epr.WSDL11Endpoint) AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisService(org.apache.axis2.description.AxisService) ArrayList(java.util.ArrayList) DeploymentException(org.apache.axis2.deployment.DeploymentException) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)

Example 4 with BPELServer

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

the class Processes method getProcessStates.

public String[] getProcessStates() {
    BPELServer bpelServer = BPELServiceComponent.getBPELServer();
    processStore = bpelServer.getMultiTenantProcessStore();
    int processCount = ((ProcessStoreImpl) processStore).getProcesses().size();
    String[] processStates = new String[processCount];
    if (processCount != 0) {
        for (int i = 0; i < processCount; i++) {
            StringBuffer buffer = new StringBuffer();
            buffer.append(((ProcessStoreImpl) processStore).getProcesses().get(i).getLocalPart().toString());
            buffer.append(" State-");
            buffer.append(((ProcessStoreImpl) processStore).getProcessConfiguration(((ProcessStoreImpl) processStore).getProcesses().get(i)).getState().toString());
            processStates[i] = buffer.toString();
        }
    }
    return processStates;
}
Also used : ProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessStoreImpl) BPELServer(org.wso2.carbon.bpel.core.ode.integration.BPELServer)

Example 5 with BPELServer

use of org.wso2.carbon.bpel.core.ode.integration.BPELServer 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)

Aggregations

DeploymentException (org.apache.axis2.deployment.DeploymentException)2 BPELServer (org.wso2.carbon.bpel.core.ode.integration.BPELServer)2 BPELServerImpl (org.wso2.carbon.bpel.core.ode.integration.BPELServerImpl)2 File (java.io.File)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 AxisFault (org.apache.axis2.AxisFault)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 AxisService (org.apache.axis2.description.AxisService)1 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)1 WSDL11Endpoint (org.apache.ode.bpel.epr.WSDL11Endpoint)1 ManagementException (org.apache.ode.bpel.pmapi.ManagementException)1 EndpointConfiguration (org.wso2.carbon.bpel.common.config.EndpointConfiguration)1 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)1 ProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessStoreImpl)1 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)1 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)1