Search in sources :

Example 11 with ProcessConf

use of org.apache.ode.bpel.iapi.ProcessConf 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)

Example 12 with ProcessConf

use of org.apache.ode.bpel.iapi.ProcessConf in project carbon-business-process by wso2.

the class ProcessStoreImpl method onBPELPackageReload.

public void onBPELPackageReload(Integer tenantId, String duName, List<ProcessConfigurationImpl> pConfs) {
    CopyOnWriteArrayList<QName> pids = new CopyOnWriteArrayList<QName>();
    for (ProcessConf pConf : pConfs) {
        pids.add(pConf.getProcessId());
    }
    updateProcessAndDUMaps(tenantId, duName, pids, true);
    Collections.sort(pConfs, BY_DEPLOYEDDATE);
    for (ProcessConfigurationImpl processConfiguration : pConfs) {
        try {
            if (log.isDebugEnabled()) {
                log.debug("Firing state change event --" + processConfiguration.getState() + "--  for process conf " + processConfiguration.getPackage() + "located at " + processConfiguration.getAbsolutePathForBpelArchive());
            }
            fireStateChange(processConfiguration.getProcessId(), processConfiguration.getState(), duName);
        } catch (Exception e) {
            log.error("Error while firing state change event for process " + processConfiguration.getProcessId() + " in deployment unit " + duName + ".");
        }
    }
}
Also used : QName(javax.xml.namespace.QName) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) SQLException(java.sql.SQLException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) ContextException(org.apache.ode.bpel.iapi.ContextException) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)12 QName (javax.xml.namespace.QName)7 ContextException (org.apache.ode.bpel.iapi.ContextException)4 Definition (javax.wsdl.Definition)3 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)3 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2 SQLException (java.sql.SQLException)2 Map (java.util.Map)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 AxisService (org.apache.axis2.description.AxisService)2 WSDL11ToAxisServiceBuilder (org.apache.axis2.description.WSDL11ToAxisServiceBuilder)2 ProcessStore (org.apache.ode.bpel.iapi.ProcessStore)2 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)2 TenantProcessStore (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore)2 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1