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);
}
}
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));
}
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;
}
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);
}
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);
}
}
Aggregations