Search in sources :

Example 1 with ContextException

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

the class ProcessConfigurationImpl method getBpelDocument.

public String getBpelDocument() {
    DeploymentUnitDir.CBPInfo cbpInfo = du.getCBPInfo(getType());
    if (cbpInfo == null) {
        throw new ContextException("CBP record not found for type " + getType());
    }
    try {
        String relative = getRelativePath(du.getDeployDir(), cbpInfo.getCbp()).replaceAll("\\\\", "/");
        if (!relative.endsWith(BPELConstants.BPEL_COMPILED_FILE_EXTENSION)) {
            throw new ContextException("CBP file must end with " + BPELConstants.BPEL_COMPILED_FILE_EXTENSION + " suffix: " + cbpInfo.getCbp());
        }
        relative = relative.replace(BPELConstants.BPEL_COMPILED_FILE_EXTENSION, BPELConstants.BPEL_FILE_EXTENSION);
        File bpelFile = new File(du.getDeployDir(), relative);
        if (!bpelFile.exists()) {
            log.warn("BPEL file does not exist: " + bpelFile);
        }
        return relative;
    } catch (IOException e) {
        throw new ContextException("IOException in getBpelRelativePath: " + cbpInfo.getCbp(), e);
    }
}
Also used : DeploymentUnitDir(org.apache.ode.store.DeploymentUnitDir) IOException(java.io.IOException) File(java.io.File) ContextException(org.apache.ode.bpel.iapi.ContextException)

Example 2 with ContextException

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

the class ProcessStoreImpl method setProperty.

public void setProperty(final QName pid, final QName propName, final String value) {
    if (log.isDebugEnabled()) {
        log.debug("Setting property " + propName + " on process " + propName);
    }
    if (processes.indexOf(pid) == -1) {
        String errMsg = "Process " + pid + " not found.";
        log.error(errMsg);
        throw new ContextException(errMsg);
    }
    final String duName = getDeploymentUnitForProcess(pid);
    if (duName == null) {
        // This cannot happen if every thing in process store is in sync
        String errMsg = "Deployment unit for process " + pid + " not found.";
        log.error(errMsg);
        throw new ContextException(errMsg);
    }
    exec(new Callable<Object>() {

        public Object call(ConfStoreConnection conn) {
            DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
            if (duDao == null) {
                return null;
            }
            ProcessConfDAO pConfDao = duDao.getProcess(pid);
            if (pConfDao == null) {
                return null;
            }
            pConfDao.setProperty(propName, value);
            return null;
        }
    });
    fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.PROPERTY_CHANGED, pid, duName));
}
Also used : DeploymentUnitDAO(org.apache.ode.store.DeploymentUnitDAO) ConfStoreConnection(org.apache.ode.store.ConfStoreConnection) ProcessConfDAO(org.apache.ode.store.ProcessConfDAO) ProcessStoreEvent(org.apache.ode.bpel.iapi.ProcessStoreEvent) ContextException(org.apache.ode.bpel.iapi.ContextException)

Example 3 with ContextException

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

the class BPELBindingContextImpl method createPartnerService.

private PartnerService createPartnerService(ProcessConf pConf, QName serviceName, String portName) throws ContextException {
    PartnerService partnerService;
    Definition def = pConf.getDefinitionForService(serviceName);
    try {
        if (log.isDebugEnabled()) {
            log.debug("Creating external service " + serviceName);
        }
        partnerService = new PartnerService(def, serviceName, portName, getConfigurationContextFromProcessConfiguration(pConf), pConf, bpelServer.getHttpConnectionManager());
    } catch (Exception ex) {
        throw new ContextException("Error creating external service! name:" + serviceName + ", port:" + portName, ex);
    }
    // if not SOAP nor HTTP binding
    if (partnerService == null) {
        throw new ContextException("Only SOAP and HTTP binding supported!");
    }
    if (log.isDebugEnabled()) {
        log.debug("Created external service " + serviceName);
    }
    return partnerService;
}
Also used : Definition(javax.wsdl.Definition) DeploymentException(org.apache.axis2.deployment.DeploymentException) ContextException(org.apache.ode.bpel.iapi.ContextException) ContextException(org.apache.ode.bpel.iapi.ContextException)

Example 4 with ContextException

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

the class BPELBindingContextImpl method createPartnerRoleChannel.

public PartnerRoleChannel createPartnerRoleChannel(QName processId, PortType portType, Endpoint initialPartnerEndpoint) {
    ProcessConf processConfiguration = ((ProcessStore) bpelServer.getMultiTenantProcessStore()).getProcessConfiguration(processId);
    Definition wsdl = processConfiguration.getDefinitionForService(initialPartnerEndpoint.serviceName);
    if (wsdl == null) {
        throw new ContextException("Cannot find definition for service " + initialPartnerEndpoint.serviceName + " in the context of process " + processId);
    }
    return createPartnerService(processConfiguration, initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName);
}
Also used : TenantProcessStore(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore) ProcessStore(org.apache.ode.bpel.iapi.ProcessStore) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) Definition(javax.wsdl.Definition) ContextException(org.apache.ode.bpel.iapi.ContextException)

Example 5 with ContextException

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

the class BPELBindingContextImpl method activateMyRoleEndpoint.

public EndpointReference activateMyRoleEndpoint(QName processId, Endpoint myRoleEndpoint) {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Activating MyRole endpoint for process: " + processId + " endpoint: " + myRoleEndpoint);
        }
        ProcessConf processConfiguration = ((ProcessStore) bpelServer.getMultiTenantProcessStore()).getProcessConfiguration(processId);
        BPELProcessProxy processProxy = publishAxisService(processConfiguration, myRoleEndpoint.serviceName, myRoleEndpoint.portName);
        serviceEprMap.put(processProxy, processProxy.getServiceReference());
        updateServiceList(getTenantId(processId), myRoleEndpoint, STATE.ADD);
        return processProxy.getServiceReference();
    } catch (AxisFault af) {
        final String errMsg = "Could not activate endpoint for service " + myRoleEndpoint.serviceName + " and port " + myRoleEndpoint.portName;
        log.error(errMsg, af);
        throw new ContextException(errMsg, af);
    }
}
Also used : TenantProcessStore(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore) ProcessStore(org.apache.ode.bpel.iapi.ProcessStore) AxisFault(org.apache.axis2.AxisFault) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) ContextException(org.apache.ode.bpel.iapi.ContextException)

Aggregations

ContextException (org.apache.ode.bpel.iapi.ContextException)8 Definition (javax.wsdl.Definition)3 File (java.io.File)2 QName (javax.xml.namespace.QName)2 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)2 ProcessStore (org.apache.ode.bpel.iapi.ProcessStore)2 ConfStoreConnection (org.apache.ode.store.ConfStoreConnection)2 DeploymentUnitDAO (org.apache.ode.store.DeploymentUnitDAO)2 DeploymentUnitDir (org.apache.ode.store.DeploymentUnitDir)2 ProcessConfDAO (org.apache.ode.store.ProcessConfDAO)2 TenantProcessStore (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Service (javax.wsdl.Service)1 AxisFault (org.apache.axis2.AxisFault)1 DeploymentException (org.apache.axis2.deployment.DeploymentException)1 CompilationException (org.apache.ode.bpel.compiler.api.CompilationException)1 DeployDocument (org.apache.ode.bpel.dd.DeployDocument)1 TDeployment (org.apache.ode.bpel.dd.TDeployment)1