Search in sources :

Example 11 with ProcessConfigurationImpl

use of org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl 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 12 with ProcessConfigurationImpl

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

the class BPELPackageRepository method readPropertiesOfUpdatedDeploymentInfo.

/**
 * Reads the updated properties from registry and sets the process configuration fields
 *
 * @param processConfiguration - Process's configuration details after updated
 * @param bpelPackageName      - the relevant bpel package
 * @throws RegistryException          on registry rollback error case, we'll init the cause to the
 *                                    original exception we got when accessing registry
 * @throws ProcessManagementException
 */
public void readPropertiesOfUpdatedDeploymentInfo(ProcessConfigurationImpl processConfiguration, String bpelPackageName) throws RegistryException, ProcessManagementException {
    String versionlessPackageName = BPELPackageRepositoryUtils.getVersionlessPackageName(bpelPackageName);
    String packageLocation = BPELPackageRepositoryUtils.getResourcePathForDeployInfoUpdatedBPELPackage(processConfiguration.getPackage(), versionlessPackageName);
    Resource bpelPackage = configRegistry.get(packageLocation);
    String stateInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_STATE + processConfiguration.getProcessId());
    String inMemoryInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_INMEMORY + processConfiguration.getProcessId());
    String processEventsInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENTS + processConfiguration.getProcessId());
    String generateTypeString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENT_GENERATE + processConfiguration.getProcessId());
    String successCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_SUCCESS + processConfiguration.getProcessId());
    String failureCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_FAILURE + processConfiguration.getProcessId());
    // editor has been updated, read the updated fields
    if (stateInString != null) {
        ProcessState state = BPELPackageRepositoryUtils.getProcessState(stateInString);
        processConfiguration.setState(state);
        processConfiguration.setIsTransient(Boolean.parseBoolean(inMemoryInString));
        ProcessEventsListType processEventsList = new ProcessEventsListType();
        EnableEventListType enabledEventList = BPELPackageRepositoryUtils.getEnabledEventsListFromString(processEventsInString);
        processEventsList.setEnableEventsList(enabledEventList);
        Generate_type1 generateType = BPELPackageRepositoryUtils.getProcessGenerateTypeFromString(generateTypeString);
        processEventsList.setGenerate(generateType);
        ScopeEventListType scopeEventList = new ScopeEventListType();
        int j = 0;
        while (bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()) != null) {
            ScopeEventType scopeEvent = BPELPackageRepositoryUtils.getScopeEventFromString(bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()));
            scopeEventList.addScopeEvent(scopeEvent);
            j++;
        }
        processEventsList.setScopeEventsList(scopeEventList);
        processConfiguration.setProcessEventsList(processEventsList);
        CleanUpListType cleanUpList = new CleanUpListType();
        CleanUpType successCleanUp = BPELPackageRepositoryUtils.getSuccessCleanUpType(successCleanupsInString);
        cleanUpList.addCleanUp(successCleanUp);
        CleanUpType failureCleanUp = BPELPackageRepositoryUtils.getFailureCleanUpType(failureCleanupsInString);
        cleanUpList.addCleanUp(failureCleanUp);
        processConfiguration.setProcessCleanupConfImpl(cleanUpList);
    }
}
Also used : ProcessState(org.apache.ode.bpel.iapi.ProcessState) ProcessEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType) EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) Generate_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) Resource(org.wso2.carbon.registry.core.Resource) CleanUpListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType) CleanUpType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)

Example 13 with ProcessConfigurationImpl

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

the class PartnerService method initUEP.

private void initUEP() throws AxisFault {
    EndpointConfiguration endpointConf = ((ProcessConfigurationImpl) processConfiguration).getEndpointConfiguration(new WSDL11Endpoint(this.serviceName, portName));
    if (endpointConf == null) {
        uep = new UnifiedEndpoint();
        uep.setUepId(this.serviceName.getLocalPart());
        uep.setAddressingEnabled(true);
        uep.setAddressingVersion(UnifiedEndpointConstants.ADDRESSING_VERSION_FINAL);
    } else {
        uep = endpointConf.getUnifiedEndpoint();
    }
}
Also used : WSDL11Endpoint(org.apache.ode.bpel.epr.WSDL11Endpoint) UnifiedEndpoint(org.wso2.carbon.unifiedendpoint.core.UnifiedEndpoint) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)

Example 14 with ProcessConfigurationImpl

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

Example 15 with ProcessConfigurationImpl

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

the class ProcessStoreImpl method onBPELPackageDeployment.

public void onBPELPackageDeployment(Integer tenantId, final String duName, final String duLocation, final List<ProcessConfigurationImpl> processConfs) {
    boolean status = exec(new Callable<Boolean>() {

        @Override
        public Boolean call(ConfStoreConnection conn) {
            DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
            if (duDao != null) {
                /*
                    This is for clustering scenario. update/deployment
                     */
                return true;
            }
            duDao = conn.createDeploymentUnit(duName);
            duDao.setDeploymentUnitDir(duLocation);
            for (ProcessConf pConf : processConfs) {
                try {
                    ProcessConfDAO processConfDao = duDao.createProcess(pConf.getProcessId(), pConf.getType(), pConf.getVersion());
                    processConfDao.setState(pConf.getState());
                    for (Map.Entry<QName, Node> prop : pConf.getProcessProperties().entrySet()) {
                        processConfDao.setProperty(prop.getKey(), DOMUtils.domToString(prop.getValue()));
                    }
                    conn.setVersion(pConf.getVersion());
                } catch (Exception e) {
                    String errmsg = "Error persisting deployment record for " + pConf.getProcessId() + "; process will not be available after restart!";
                    log.error(errmsg, e);
                    return false;
                }
            }
            return true;
        }
    });
    if (status) {
        CopyOnWriteArrayList<QName> pids = new CopyOnWriteArrayList<QName>();
        for (ProcessConf pConf : processConfs) {
            pids.add(pConf.getProcessId());
        }
        updateProcessAndDUMaps(tenantId, duName, pids, true);
        for (ProcessConfigurationImpl processConf : processConfs) {
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, processConf.getProcessId(), duName));
            fireStateChange(processConf.getProcessId(), processConf.getState(), duName);
        }
    }
}
Also used : DeploymentUnitDAO(org.apache.ode.store.DeploymentUnitDAO) QName(javax.xml.namespace.QName) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) ConfStoreConnection(org.apache.ode.store.ConfStoreConnection) ProcessStoreEvent(org.apache.ode.bpel.iapi.ProcessStoreEvent) SQLException(java.sql.SQLException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) ContextException(org.apache.ode.bpel.iapi.ContextException) ProcessConfDAO(org.apache.ode.store.ProcessConfDAO) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)9 QName (javax.xml.namespace.QName)8 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)5 WSDL11Endpoint (org.apache.ode.bpel.epr.WSDL11Endpoint)4 Map (java.util.Map)3 EndpointConfiguration (org.wso2.carbon.bpel.common.config.EndpointConfiguration)3 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)3 UnifiedEndpoint (org.wso2.carbon.unifiedendpoint.core.UnifiedEndpoint)3 File (java.io.File)2 SQLException (java.sql.SQLException)2 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 Set (java.util.Set)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 AxisFault (org.apache.axis2.AxisFault)2 AxisService (org.apache.axis2.description.AxisService)2 ContextException (org.apache.ode.bpel.iapi.ContextException)2 ProcessManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException)2 CleanUpListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType)2 CleanUpType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)2