Search in sources :

Example 1 with EndpointConfiguration

use of org.wso2.carbon.bpel.common.config.EndpointConfiguration in project carbon-business-process by wso2.

the class ProcessConfigurationImpl method readPackageConfiguration.

private void readPackageConfiguration() {
    File depDir = du.getDeployDir();
    /*
        Read Endpoint Config for invokes
         */
    List<TDeployment.Process> processList = du.getDeploymentDescriptor().getDeploy().getProcessList();
    for (TDeployment.Process process : processList) {
        List<TInvoke> tInvokeList = process.getInvokeList();
        for (TInvoke tInvoke : tInvokeList) {
            OMElement serviceEle;
            if (tInvoke.getService() == null) {
                String errMsg = "Service element missing for the invoke element in deploy.xml";
                log.error(errMsg);
                throw new BPELDeploymentException(errMsg);
            }
            try {
                serviceEle = AXIOMUtil.stringToOM(tInvoke.getService().toString());
                OMElement endpointEle = serviceEle.getFirstElement();
                if (endpointEle == null || !endpointEle.getQName().equals(new QName(BusinessProcessConstants.BPEL_PKG_ENDPOINT_CONFIG_NS, BusinessProcessConstants.ENDPOINT))) {
                    continue;
                }
                EndpointConfiguration epConf = EndpointConfigBuilder.buildEndpointConfiguration(endpointEle, depDir.getAbsolutePath());
                epConf.setServiceName(tInvoke.getService().getName().getLocalPart());
                epConf.setServiceNS(tInvoke.getService().getName().getNamespaceURI());
                epConf.setServicePort(tInvoke.getService().getPort());
                bpelPackageConfiguration.addEndpoint(epConf);
            } catch (XMLStreamException e) {
                log.warn("Error occurred while reading endpoint configuration. " + "Endpoint config will not be applied to: " + tInvoke.getService());
            }
        }
        List<TProvide> tProvideList = process.getProvideList();
        for (TProvide tProvide : tProvideList) {
            OMElement serviceEle;
            if (tProvide.getService() == null) {
                String errMsg = "Service element missing for the provide element in deploy.xml";
                log.error(errMsg);
                throw new BPELDeploymentException(errMsg);
            }
            try {
                serviceEle = AXIOMUtil.stringToOM(tProvide.getService().toString());
                OMElement endpointEle = serviceEle.getFirstElement();
                if (endpointEle == null || !endpointEle.getQName().equals(new QName(BusinessProcessConstants.BPEL_PKG_ENDPOINT_CONFIG_NS, BusinessProcessConstants.ENDPOINT))) {
                    continue;
                }
                EndpointConfiguration epConf = EndpointConfigBuilder.buildEndpointConfiguration(endpointEle, depDir.getAbsolutePath());
                epConf.setServiceName(tProvide.getService().getName().getLocalPart());
                epConf.setServiceNS(tProvide.getService().getName().getNamespaceURI());
                epConf.setServicePort(tProvide.getService().getPort());
                bpelPackageConfiguration.addEndpoint(epConf);
            } catch (XMLStreamException e) {
                log.warn("Error occured while reading endpoint configuration. " + "Endpoint config will not be applied to: " + tProvide.getService());
            }
        }
    }
}
Also used : QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) TDeployment(org.apache.ode.bpel.dd.TDeployment) TInvoke(org.apache.ode.bpel.dd.TInvoke) XMLStreamException(javax.xml.stream.XMLStreamException) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) TProvide(org.apache.ode.bpel.dd.TProvide) File(java.io.File)

Example 2 with EndpointConfiguration

use of org.wso2.carbon.bpel.common.config.EndpointConfiguration in project carbon-business-process by wso2.

the class HumanTaskStore method createCallBackService.

private void createCallBackService(TaskConfiguration taskConf) throws HumanTaskDeploymentException {
    EndpointConfiguration endpointConfig = taskConf.getEndpointConfiguration(taskConf.getCallbackServiceName().getLocalPart(), taskConf.getCallbackPortName());
    CallBackServiceImpl callbackService = new CallBackServiceImpl(tenantId, taskConf.getCallbackServiceName(), taskConf.getCallbackPortName(), taskConf.getName(), taskConf.getResponseWSDL(), taskConf.getResponseOperation(), endpointConfig);
    taskConf.setCallBackService(callbackService);
}
Also used : EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) CallBackServiceImpl(org.wso2.carbon.humantask.core.integration.CallBackServiceImpl)

Example 3 with EndpointConfiguration

use of org.wso2.carbon.bpel.common.config.EndpointConfiguration in project carbon-business-process by wso2.

the class NotificationConfiguration method initEndpointConfigs.

private void initEndpointConfigs() throws HumanTaskDeploymentException {
    TPublish.Service service = notificationDeploymentConfiguration.getPublish().getService();
    OMElement serviceEle;
    serviceEle = HumanTaskStoreUtils.getOMElement(service.toString());
    EndpointConfiguration endpointConfig = HumanTaskStoreUtils.getEndpointConfig(serviceEle);
    if (endpointConfig != null) {
        endpointConfig.setServiceName(service.getName().getLocalPart());
        endpointConfig.setServicePort(service.getPort());
        endpointConfig.setServiceNS(service.getName().getNamespaceURI());
        endpointConfig.setBasePath(getHumanTaskDefinitionFile().getParentFile().getAbsolutePath());
        endpointConfig.setServiceDescriptionLocation(service.getServiceDescriptionReference());
        addEndpointConfiguration(endpointConfig);
    }
}
Also used : TPublish(org.wso2.carbon.humantask.core.deployment.config.TPublish) OMElement(org.apache.axiom.om.OMElement) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration)

Example 4 with EndpointConfiguration

use of org.wso2.carbon.bpel.common.config.EndpointConfiguration in project carbon-business-process by wso2.

the class HumanTaskStoreUtils method getEndpointConfig.

public static EndpointConfiguration getEndpointConfig(OMElement serviceEle) {
    String serviceDescLocation = serviceEle.getAttributeValue(new QName(null, BusinessProcessConstants.SERVICE_DESC_LOCATION));
    if (StringUtils.isNotEmpty(serviceDescLocation)) {
        EndpointConfiguration endpointConfig = new EndpointConfiguration();
        endpointConfig.setServiceDescriptionAvailable(true);
        endpointConfig.setServiceDescriptionLocation(serviceDescLocation.trim());
        return endpointConfig;
    }
    String endpointRef = serviceEle.getAttributeValue(new QName(null, BusinessProcessConstants.ENDPOINTREF));
    if (StringUtils.isNotEmpty(endpointRef)) {
        EndpointConfiguration endpointConfig = new EndpointConfiguration();
        endpointConfig.setUnifiedEndPointReference(endpointRef.trim());
        return endpointConfig;
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration)

Example 5 with EndpointConfiguration

use of org.wso2.carbon.bpel.common.config.EndpointConfiguration in project carbon-business-process by wso2.

the class PeopleActivity method getUnifiedEndpoint.

public UnifiedEndpoint getUnifiedEndpoint() throws FaultException {
    int tenantId = B4PServiceComponent.getBPELServer().getMultiTenantProcessStore().getTenantId(processId);
    ProcessConfigurationImpl processConf = (ProcessConfigurationImpl) B4PServiceComponent.getBPELServer().getMultiTenantProcessStore().getTenantsProcessStore(tenantId).getProcessConfiguration(processId);
    EndpointConfiguration epConf = processConf.getEndpointConfiguration(new WSDL11Endpoint(serviceName, servicePort));
    try {
        return epConf.getUnifiedEndpoint();
    } catch (AxisFault axisFault) {
        throw new FaultException(BPEL4PeopleConstants.B4P_FAULT, "Error occurred while reading UnifiedEndpoint for service " + serviceName, axisFault);
    }
}
Also used : WSDL11Endpoint(org.apache.ode.bpel.epr.WSDL11Endpoint) AxisFault(org.apache.axis2.AxisFault) FaultException(org.apache.ode.bpel.common.FaultException) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) WSDL11Endpoint(org.apache.ode.bpel.epr.WSDL11Endpoint) UnifiedEndpoint(org.wso2.carbon.unifiedendpoint.core.UnifiedEndpoint)

Aggregations

EndpointConfiguration (org.wso2.carbon.bpel.common.config.EndpointConfiguration)11 QName (javax.xml.namespace.QName)5 OMElement (org.apache.axiom.om.OMElement)3 WSDL11Endpoint (org.apache.ode.bpel.epr.WSDL11Endpoint)3 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)3 UnifiedEndpoint (org.wso2.carbon.unifiedendpoint.core.UnifiedEndpoint)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AxisFault (org.apache.axis2.AxisFault)2 MultiKeyMap (org.apache.commons.collections.map.MultiKeyMap)2 TPublish (org.wso2.carbon.humantask.core.deployment.config.TPublish)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 DeploymentException (org.apache.axis2.deployment.DeploymentException)1 AxisService (org.apache.axis2.description.AxisService)1 FaultException (org.apache.ode.bpel.common.FaultException)1 TDeployment (org.apache.ode.bpel.dd.TDeployment)1 TInvoke (org.apache.ode.bpel.dd.TInvoke)1