Package org.apache.ode.bpel.common

Examples of org.apache.ode.bpel.common.FaultException


        if (inputNode.getNodeType() == Node.ELEMENT_NODE) {
            return (Element)inputNode;
        } else {
            log.error("The node type of the variable is not ELEMENT");
            throw new FaultException(new QName(B4PExtensionBundle.NS, "Unsupported variable type"));
        }
    }
View Full Code Here


        return du.getDefinitionForService(callbackServiceName);
    }
   
    private void init() throws FaultException {
        if (!element.getLocalName().equals("peopleActivity") || !element.getNamespaceURI().equals(B4PExtensionBundle.NS)) {
            throw new FaultException(new QName(B4PExtensionBundle.NS, "no peopleActivity found"));
        }

        name = element.getAttribute("name");
        inputVarName = element.getAttribute("inputVariable");
        outputVarName = element.getAttribute("outputVariable");
        isSkipable = element.getAttribute("isSkipable").equalsIgnoreCase("yes");

        NodeList taskList = element.getChildNodes();

        Node task = null;
        int elementNodeCount = 0;
        for (int i = 0; i < taskList.getLength(); i++) {
            if (taskList.item(i).getNodeType() == Node.ELEMENT_NODE) {
                elementNodeCount++;
                if (elementNodeCount > 1) {
                    break;
                }
                task = taskList.item(i);
            }
        }

        if (elementNodeCount != 1 || task == null) {
            log.error("Invalid peopleActivity definition");
            throw new FaultException(new QName(B4PExtensionBundle.NS, "Invalid peopleActivity definition"));
        }

        /*TODO this only checks for b4p namespace, we need to check for <htd:task>...</htd:task> and
         <htd:notification>...</htd:notification> which r in ht namespace*/
        if (!task.getNamespaceURI().equals(B4PExtensionBundle.NS)) {
            throw new FaultException(new QName(B4PExtensionBundle.NS, "Invalid namespace uri for the task. " +
                    "The valid namespace: " + B4PExtensionBundle.NS));
        }
        //TODO is it required to read through the element per task type? cant we jst do it once? what about null elements
        if (task.getLocalName().equals("remoteTask")) {
            activityType = InteractionType.TASK;
View Full Code Here

                break;
            }
        }

        if (hiProcess == null) {
            throw new FaultException(new QName(B4PExtensionBundle.NS, "related process not found"));
        }

        List<TInvoke> tInvokeList = hiProcess.getInvokeList();
        for (TInvoke tInvoke : tInvokeList) {
            if (tInvoke.getPartnerLink().equals(partnerLinkName)) {
                serviceName = tInvoke.getService().getName();
                servicePort = tInvoke.getService().getPort();
                break;
            }
        }

        if (serviceName == null || servicePort == null) {
            log.error("service and port for human interaction is not found in the deploy.xml");
            throw new FaultException(new QName(B4PExtensionBundle.NS,
                    "service and port for human interaction is not found in the deploy.xml"));
        }

        //get the callback information for the TASK
        if (activityType.equals(InteractionType.TASK)) {
            List<TProvide> tProvideList = hiProcess.getProvideList();
            for (TProvide tProvide : tProvideList) {
                if (tProvide.getPartnerLink().equals(partnerLinkName)) {
                    callbackServiceName = tProvide.getService().getName();
                    callbackServicePort = tProvide.getService().getPort();
                    break;
                }
            }
            if (callbackServiceName == null || callbackServicePort == null) {
                throw new FaultException(new QName(B4PExtensionBundle.NS,
                        "service and port for human task callback is not found in the deploy.xml"));
            }
        }

        hiWSDL = du.getDefinitionForService(serviceName);

        Service service = hiWSDL.getService(serviceName);
        Port port = service.getPort(servicePort);
        List extList = port.getExtensibilityElements();
        for (Object extEle : extList) {
             if (extEle instanceof SOAPAddressImpl) {
                 SOAPAddressImpl soapAddress = (SOAPAddressImpl)extEle;
                 serviceURI = soapAddress.getLocationURI();
                 break;
             }
        }

        if (serviceURI == null) {
            throw new FaultException(new QName(B4PExtensionBundle.NS, "Service URI is not available"));
        }
    }
View Full Code Here

        try {
            humanService = new HumanService(peopleActivity, B4PServiceComponent.getClientConfigurationContext(),
                    B4PServiceComponent.getHttpConnectionManager());
        } catch (AxisFault axisFault) {
            log.error("Error while initializing Human Service: " + peopleActivity.getServiceName(), axisFault);
            throw new FaultException(new QName(B4PExtensionBundle.NS, axisFault.getMessage()), axisFault);
        }

        //org.apache.ode.bpel.iapi.Message response = humanService.invoke();
        if (peopleActivity.getActivityType().equals(InteractionType.TASK)) {
            taskID = humanService.invoke();
            if (taskID == null) {
                log.error("Task ID not found for the Human Task invoked.");
                throw new FaultException(new QName(B4PExtensionBundle.NS, "Task ID not found for the Human Task invoked."));
            }
            if (log.isDebugEnabled()) {
                log.debug(taskID + ": FeedBack Received");
            }
            CountDownLatch cdl = new CountDownLatch(1);
            //countDownLatch = cdl;
            countDownLatches.put(taskID, cdl);

            AxisService callbackService = null;
            try {
                callbackService = CallbackServiceFactory.getCallbackService(peopleActivity.getCallbackServiceName(),
                        peopleActivity.getCallbackServicePort(),
                        B4PServiceComponent.getConfigurationContext().getAxisConfiguration(),
                        peopleActivity.getCallbackWSDL(), peopleActivity.getCallbackOperation());
            } catch (AxisFault axisFault) {
                log.error("The callback service not found for the service: " + peopleActivity.getCallbackServiceName(),
                        axisFault);
                throw new FaultException(new QName(B4PExtensionBundle.NS, axisFault.getMessage()), axisFault);
            }

            if (callbackService == null) {
                log.error("The callback service not found for the service: " + peopleActivity.getCallbackServiceName());
                throw new FaultException(new QName(B4PExtensionBundle.NS, "The callback service not found for the service: "
                        + peopleActivity.getCallbackServiceName()));
            }

            try {
                if (log.isDebugEnabled()) {
                    log.debug(taskID + ": Waiting For the response");
                }
                cdl.await();
                if (log.isDebugEnabled()) {
                    log.debug(taskID + ": Latch is continueing");
                }
            } catch (InterruptedException e) {
                log.error("The thread is interrupted. TaskID: " + taskID, e);
                throw new FaultException(new QName(B4PExtensionBundle.NS, e.getMessage()), e);
            }

            writeOutputVariable();
        } else {
            humanService.invoke();
View Full Code Here

                if (answer.isSetFault()) {
                    MessageDAO response = mexDao.createMessage(new QName("replayer", "replayer"));
                    try {
                        assign(response, answer.getFault());
                    } catch (Exception e) {
                        throw new FaultException(new QName("replayer", "replayer"), e);
                    }
                    mexDao.setResponse(response);
                    mexDao.setFault(answer.getFault().getType());
                    mexDao.setFaultExplanation(answer.getFault().getExplanation());
                    mexDao.setStatus(Status.FAULT.toString());

                } else if (answer.isSetOut()) {
                    MessageDAO response = mexDao.createMessage(new QName("replayer", "replayer"));
                    try {
                        assign(response, answer.getOut());
                    } catch (Exception e) {
                        throw new FaultException(new QName("replayer", "replayer"), e);
                    }
                    mexDao.setResponse(response);
                    mexDao.setStatus(Status.RESPONSE.toString());
                } else if (answer.isSetFailure()) {
                    mexDao.setFaultExplanation(answer.getFailure().getExplanation());
View Full Code Here

    @Override
    public void reply(PartnerLinkInstance plinkInstnace, String opName, String mexId, Element msg, QName fault) throws FaultException {
        String mexRef = _imaManager.release(plinkInstnace, opName, mexId);

        if (mexRef == null) {
            throw new FaultException(_bpelProcess.getOProcess().constants.qnMissingRequest);
        }

        MessageExchangeDAO mex = _dao.getConnection().getMessageExchange(mexRef);

        String pipedId = mex.getPipedMessageExchangeId();
View Full Code Here

                CorrelationKey key = null;

                if(!getBpelRuntimeContext().isCorrelationInitialized(
                    _scopeFrame.resolve(cset))) {
                    if (!_opick.createInstanceFlag) {
                        throw new FaultException(_opick.getOwner().constants.qnCorrelationViolation,
                        "Correlation not initialized.");
                    }
                } else {
                    key = getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset));
                    assert key != null;
View Full Code Here

            // variable, instead we need to go the external variable subsystems.
            Element reference = (Element) fetchVariableData(brc, resolve(variable.declaration.extVar.related), false);
            try {
                Node ret = brc.readExtVar(variable.declaration, reference );
                if (ret == null) {
                    throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
                            "The external variable \"" + variable.declaration.name + "\" has not been initialized.");
                }
                return ret;
            } catch (IncompleteKeyException ike) {
                // This indicates that the external variable needed to be written do, put has not been.
                __log.error("External variable could not be read due to incomplete key; the following key " +
                        "components were missing: " + ike.getMissing());
                throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
                        "The extenral variable \"" + variable.declaration.name + "\" has not been properly initialized;" +
                                "the following key compoenents were missing:" + ike.getMissing());
            } catch (ExternalVariableModuleException e) {
                throw new BpelEngineException(e);
            }
        } else /* not external */ {
            Node data = brc.readVariable(variable.scopeInstance,variable.declaration.name, forWriting);
            if (data == null) {
                // Special case of messageType variables with no part
                if (variable.declaration.type instanceof OMessageVarType) {
                    OMessageVarType msgType = (OMessageVarType) variable.declaration.type;
                    if (msgType.parts.size() == 0) {
                        Document doc = DOMUtils.newDocument();
                        Element root = doc.createElement("message");
                        doc.appendChild(root);
                        return root;
                    }
                }
                throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
                        "The variable " + variable.declaration.name + " isn't properly initialized.");
            }
            return data;
        }
    }
View Full Code Here

     */
    public static class CombineUrl implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
            final QName FAULT_QNAME = new QName(Namespaces.ODE_EXTENSION_NS, "combineUrlInvalidSource");
            if (args.size() != 2) {
                throw new XPathFunctionException(new FaultException(FAULT_QNAME, "Invalid arguments"));
            }


            String base;
            try {
                base = Helper.extractString(args.get(0));
            } catch (IllegalArgumentException e) {
                throw new XPathFunctionException(new FaultException(FAULT_QNAME, "Invalid argument: " + args.get(0), e));
            }
            String relative;
            try {
                relative = Helper.extractString(args.get(1));
            } catch (IllegalArgumentException e) {
                throw new XPathFunctionException(new FaultException(FAULT_QNAME, "Invalid argument: " + args.get(1), e));
            }

            URL baseURL;
            try {
                baseURL = new URL(base);
            } catch (MalformedURLException e) {
                throw new XPathFunctionException(new FaultException(FAULT_QNAME, "First parameter [" + base + "] MUST point to a well-formed URL.", e));
            }
            try {
                URL combined = new URL(baseURL, relative);
                return combined.toExternalForm();
            } catch (MalformedURLException e) {
                throw new XPathFunctionException(new FaultException(FAULT_QNAME, e.getMessage(), e));
            }
        }
View Full Code Here

            if (args.size() == 2) {
                separareParameteters = false;
            } else if (args.size() > 2 && args.size() % 2 == 1) {
                separareParameteters = true;
            } else {
                throw new XPathFunctionException(new FaultException(faultQName, "Illegal Arguments"));
            }
            try {
                uriTemplate = Helper.extractString(args.get(0));
            } catch (IllegalArgumentException e) {
                throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument: URI Template expected. " + args.get(0), e));
            }
            if (separareParameteters) {
                // /!\ Do NOT get the first element
                try {
                    pairs = Helper.buildNameValueMap(args, 1);
                } catch (IllegalArgumentException e) {
                    throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument", e));
                }
            } else {
                try {
                    Element elt = null;
                    if (args.get(1) instanceof List) {
                        List elmts = (List) args.get(1);
                        elt = (Element) elmts.get(0);
                    } else if (args.get(1) instanceof Element) {
                        elt = (Element) args.get(1);
                    }
                    pairs = Helper.extractNameValueMap(elt);
                } catch (ClassCastException e) {
                    throw new XPathFunctionException(new FaultException(faultQName, "Expected an element similar too: <foo><name1>value1</name1><name2>value2</name2>...</foo>"));
                }
            }

            try {
                if (preserveUndefinedVar) {
                    return URITemplate.expandLazily(uriTemplate, pairs);
                } else {
                    return URITemplate.expand(uriTemplate, pairs);
                }
            } catch (URIException e) {
                throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument", e));
            } catch (UnsupportedOperationException e) {
                throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument", e));
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.common.FaultException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.