use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method fillPartnerLinks.
// private java.lang.String[] getServiceLocationForProcess(QName processId)
// throws ProcessManagementException {
// AxisConfiguration axisConf = getConfigContext().getAxisConfiguration();
// Map<String, AxisService> services = axisConf.getServices();
// ArrayList<String> serviceEPRs = new ArrayList<String>();
//
// for (AxisService service : services.values()) {
// Parameter pIdParam = service.getParameter(BPELConstants.PROCESS_ID);
// if (pIdParam != null) {
// if (pIdParam.getValue().equals(processId)) {
// serviceEPRs.addAll(Arrays.asList(service.getEPRs()));
// }
// }
// }
//
// if (serviceEPRs.size() > 0) {
// return serviceEPRs.toArray(new String[serviceEPRs.size()]);
// }
//
// String errMsg = "Cannot find service for process: " + processId;
// log.error(errMsg);
// throw new ProcessManagementException(errMsg);
// }
private void fillPartnerLinks(ProcessInfoType pInfo, TDeployment.Process processInfo) throws ProcessManagementException {
if (processInfo.getProvideList() != null) {
EndpointReferencesType eprsType = new EndpointReferencesType();
for (TProvide provide : processInfo.getProvideList()) {
String plinkName = provide.getPartnerLink();
TService service = provide.getService();
/* NOTE:Service cannot be null for provider partner link*/
if (service == null) {
String errorMsg = "Error in <provide> element for process " + processInfo.getName() + " partnerlink" + plinkName + " did not identify an endpoint";
log.error(errorMsg);
throw new ProcessManagementException(errorMsg);
}
if (log.isDebugEnabled()) {
log.debug("Processing <provide> element for process " + processInfo.getName() + ": partnerlink " + plinkName + " --> " + service.getName() + " : " + service.getPort());
}
QName serviceName = service.getName();
EndpointRef_type0 eprType = new EndpointRef_type0();
eprType.setPartnerLink(plinkName);
eprType.setService(serviceName);
ServiceLocation sLocation = new ServiceLocation();
try {
String url = Utils.getTryitURL(serviceName.getLocalPart(), getConfigContext());
sLocation.addServiceLocation(url);
String[] wsdls = Utils.getWsdlInformation(serviceName.getLocalPart(), getConfigContext().getAxisConfiguration());
if (wsdls.length == 2) {
if (wsdls[0].endsWith("?wsdl")) {
sLocation.addServiceLocation(wsdls[0]);
} else {
sLocation.addServiceLocation(wsdls[1]);
}
}
} catch (AxisFault axisFault) {
String errMsg = "Error while getting try-it url for the service: " + serviceName;
log.error(errMsg, axisFault);
throw new ProcessManagementException(errMsg, axisFault);
}
eprType.setServiceLocations(sLocation);
eprsType.addEndpointRef(eprType);
}
pInfo.setEndpoints(eprsType);
}
// if (processInfo.getInvokeList() != null) {
// for (TInvoke invoke : processInfo.getInvokeList()) {
// String plinkName = invoke.getPartnerLink();
// TService service = invoke.getService();
// /* NOTE:Service can be null for partner links*/
// if (service == null) {
// continue;
// }
// if (log.isDebugEnabled()) {
// log.debug("Processing <invoke> element for process " + processInfo.getName() + ": partnerlink" +
// plinkName + " -->" + service);
// }
//
// QName serviceName = service.getName();
// }
// }
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method fillProcessInfo.
/**
* Fill in the <code>ProcessInfo</code> element of the transfer object.
*
* @param info destination XMLBean
* @param pconf process configuration object (from store)
* @param custom used to customize the quantity of information produced in the
* info
* @param tenantProcessStore Tenant's Process store
* @throws ProcessManagementException If an error occurred while filling process information
*/
private void fillProcessInfo(ProcessInfoType info, ProcessConf pconf, ProcessInfoCustomizer custom, TenantProcessStoreImpl tenantProcessStore) throws ProcessManagementException {
if (pconf == null) {
String errMsg = "Process configuration cannot be null.";
log.error(errMsg);
throw new ProcessManagementException(errMsg);
}
info.setPid(pconf.getProcessId().toString());
// Active process may be retired at the same time
if (pconf.getState() == ProcessState.RETIRED) {
info.setStatus(ProcessStatus.RETIRED);
info.setOlderVersion(AdminServiceUtils.isOlderVersion(pconf, tenantProcessStore));
} else if (pconf.getState() == ProcessState.DISABLED) {
info.setStatus(ProcessStatus.DISABLED);
info.setOlderVersion(0);
} else {
info.setStatus(ProcessStatus.ACTIVE);
info.setOlderVersion(0);
}
info.setVersion(pconf.getVersion());
DefinitionInfo defInfo = new DefinitionInfo();
defInfo.setProcessName(pconf.getType());
BpelDefinition bpelDefinition = new BpelDefinition();
bpelDefinition.setExtraElement(getProcessDefinition(pconf));
defInfo.setDefinition(bpelDefinition);
info.setDefinitionInfo(defInfo);
DeploymentInfo depInfo = new DeploymentInfo();
depInfo.setPackageName(pconf.getPackage());
depInfo.setDocument(pconf.getBpelDocument());
depInfo.setDeployDate(AdminServiceUtils.toCalendar(pconf.getDeployDate()));
// TODO: Need to fix this by adding info to process conf.
depInfo.setDeployer(org.wso2.carbon.bpel.core.BPELConstants.BPEL_DEPLOYER_NAME);
info.setDeploymentInfo(depInfo);
if (custom.includeInstanceSummary()) {
InstanceSummary instanceSummary = new InstanceSummary();
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.ACTIVE);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.COMPLETED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.FAILED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.SUSPENDED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.TERMINATED);
addFailuresToInstanceSummary(instanceSummary, pconf);
info.setInstanceSummary(instanceSummary);
}
if (custom.includeProcessProperties()) {
ProcessProperties processProps = new ProcessProperties();
for (Map.Entry<QName, Node> propEntry : pconf.getProcessProperties().entrySet()) {
QName key = propEntry.getKey();
if (key != null) {
Property_type0 prop = new Property_type0();
prop.setName(new QName(key.getNamespaceURI(), key.getLocalPart()));
OMFactory omFac = OMAbstractFactory.getOMFactory();
OMElement propEle = omFac.createOMElement("PropertyValue", null);
propEle.setText(propEntry.getValue().getNodeValue());
prop.addExtraElement(propEle);
processProps.addProperty(prop);
}
}
info.setProperties(processProps);
}
fillPartnerLinks(info, ((ProcessConfigurationImpl) pconf).getProcessDeploymentInfo());
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType in project carbon-business-process by wso2.
the class BpelUIUtil method getEndpointReferences.
public static Map<String, EndpointRef_type0> getEndpointReferences(ProcessInfoType info) {
EndpointRef_type0[] endpoints = info.getEndpoints().getEndpointRef();
Map<String, EndpointRef_type0> pLinkEprMap = new TreeMap<String, EndpointRef_type0>();
for (EndpointRef_type0 eprRef : endpoints) {
pLinkEprMap.put(eprRef.getPartnerLink(), eprRef);
}
return pLinkEprMap;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType in project carbon-business-process by wso2.
the class BpelUIUtil method getEndpointRefsMap.
public static Map<String, QName> getEndpointRefsMap(ProcessInfoType info) {
EndpointRef_type0[] endpoints = info.getEndpoints().getEndpointRef();
Map<String, QName> pLinkServiceMap = new TreeMap<String, QName>();
for (EndpointRef_type0 ref : endpoints) {
pLinkServiceMap.put(ref.getPartnerLink(), ref.getService());
}
return pLinkServiceMap;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method getProcessInfo.
public ProcessInfoType getProcessInfo(QName pid) throws ProcessManagementException {
ProcessInfoType processInfoType = new ProcessInfoType();
TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
fillProcessInfo(processInfoType, processConf, ProcessInfoCustomizer.ALL, tenantProcessStore);
return processInfoType;
}
Aggregations