Examples of MediatorException


Examples of org.wso2.carbon.mediator.service.MediatorException

        if (valueAttr == null && xpathAttr == null) {
          String msg =
                       "The 'value'/'xpath' attribute is required for "
                               + "the configuration for the 'set'/'append'"
                               + "/'prepend' or repalce action";
          throw new MediatorException(msg);
        }

        if (valueAttr != null && valueAttr.getAttributeValue() != null) {
          urlRewriteActions.setValue(valueAttr.getAttributeValue());
        }
        if (xpathAttr != null && xpathAttr.getAttributeValue() != null) {
          try {
            urlRewriteActions.setXpath(SynapseXPathFactory.getSynapseXPath(actionEle,
                                                                           ATT_XPATH));

          } catch (JaxenException e) {
            throw new MediatorException("Could not construct the" + " xpath");
          }
        }
      }

      if ("replace".equals(typeAttr.getAttributeValue())) {
        if (regexAttr == null) {
          String msg =
                       "The 'regex' attribute is required for the "
                               + "configuration for the 'replace' action";
          throw new MediatorException(msg);
        }
        urlRewriteActions.setRegex(regexAttr.getAttributeValue());
      }
      if (typeAttr.getAttributeValue() != null) {
        urlRewriteActions.setAction(typeAttr.getAttributeValue());
      }

      if (fragmentAttr != null) {
        urlRewriteActions.setFragment(fragmentAttr.getAttributeValue());
      }

      // if a value is specified, use it, else look for an expression
      if (valueAttr != null) {
        urlRewriteActions.setValue(valueAttr.getAttributeValue());
      } else if (xpathAttr != null) {
        try {
          urlRewriteActions.setXpath(SynapseXPathFactory.getSynapseXPath(actionEle,
                                                                         XPATH_Q));

        } catch (JaxenException e) {
          String msg = "Invalid XPapth expression : " + xpathAttr.getAttributeValue();
          throw new MediatorException(msg);
        }
      }
      actionList.add(urlRewriteActions);
    }
    return actionList;
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

        processAuditStatus(this, elem);

        OMAttribute msName = elem.getAttribute(ATT_MESSAGE_STORE_Q);
        if(msName == null) {
            String msg = "Name of the Message Store name is a required attribute";
            throw new MediatorException(msg);
        }

        this.messageStoreName = msName.getAttributeValue();

        OMAttribute sqName = elem.getAttribute(ATT_SEQUENCE_Q);
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

                "language"));
        OMAttribute funcAtt = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE,
                "function"));

        if (langAtt == null) {
            throw new MediatorException("The 'language' attribute is required for" +
                    " a script mediator");           
        }
        if (keyAtt == null && funcAtt != null) {
            throw new MediatorException("Cannot use 'function' attribute without 'key' " +
                    "attribute for a script mediator");
        }

        getIncludeKeysMap(elem);
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

            OMElement includeElem = (OMElement) iter.next();
            OMAttribute key = includeElem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE,
                    "key"));

            if (key == null) {
                throw new MediatorException("Cannot use 'include' element without 'key'" +
                        " attribute for a script mediator");
            }

            String keyText = key.getAttributeValue();
            includes.put(keyText, null);
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

    public void build(OMElement elem) {
        OMAttribute action
                = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "action"));

        if (action == null) {
            throw new MediatorException("The 'action' attribute " +
                    "is required for Transaction mediator definition");
        } else {

            // after successfully creating the mediator
            // set its common attributes such as tracing etc
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

            if (key != null) {
                String keyValue = key.getAttributeValue();
                if (keyValue != null && !"".equals(keyValue)) {
                    policyKey = keyValue;
                } else {
                    throw new MediatorException("key attribute should have a value ");
                }
            } else {
                OMElement inLine = policy.getFirstElement();
                if (inLine != null) {
                    inLinePolicy = inLine;
                }
            }
        }
        // after successfully creating the mediator
        // set its common attributes such as tracing etc
        processAuditStatus(this, elem);

        String id = elem.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "id"));
        if (id != null && !"".equals(id)) {
            this.id = id.trim();
        } else {
           throw new MediatorException("Idy attribute must have defined ");
        }

        OMAttribute onReject = elem.getAttribute(
                new QName(XMLConfigConstants.NULL_NAMESPACE, XMLConfigConstants.ONREJECT));
        if (onReject != null) {
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

      if (URLRewriteActions.TYPE_APPEND.equals(type) ||
          URLRewriteActions.TYPE_PREPEND.equals(type) ||
          URLRewriteActions.TYPE_SET.equals(type) ||
          URLRewriteActions.TYPE_REPLACE.equals(type)) {
        if (value == null && xpath == null) {
          throw new MediatorException("Set, Append, Prepend," + "Repalce actions need"
                                      + "value attribute/xpath" + "attribute need to be"
                                      + "specified");

        }
        if (xpath != null) {
          SynapseXPathSerializer.serializeXPath(xpath, actionElement, "xpath");
        }
        if (value != null) {
          actionElement.addAttribute(fac.createOMAttribute("value", nullNS, value));
        }

      }
      // 'regex' attribute must be specified
      if (URLRewriteActions.TYPE_REPLACE.equals(type)) {
        if (regex != null) {
          actionElement.addAttribute(fac.createOMAttribute("regex", nullNS,regex));
        } else {
          throw new MediatorException("Replace action needs " + "'regex'attribute to"
                                      + " be specified");
        }
      }
      if(type !=null){
        actionElement.addAttribute(fac.createOMAttribute("type", nullNS,type));
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

        if (beanName != null) {
            spring.addAttribute(fac.createOMAttribute(
                "bean", nullNS, beanName));
        } else {
            throw new MediatorException("Invalid mediator. Bean name required.");
        }
        saveTracingState(spring, this);

        if (configKey != null) {
            spring.addAttribute(fac.createOMAttribute(
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

    public void build(OMElement elem) {
        OMAttribute bean = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "bean"));
        OMAttribute key  = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));

        if (bean == null) {
            throw new MediatorException("The 'bean' attribute is required for a Spring mediator definition");
        } else if (key == null) {
            throw new MediatorException("A 'key' attribute is required for a Spring mediator definition");
        } else {

             // after successfully creating the mediator
             // set its common attributes such as tracing etc
            processAuditStatus(this, elem);
View Full Code Here

Examples of org.wso2.carbon.mediator.service.MediatorException

        OMElement   targetElt     = elem.getFirstChildWithName(Q_TARGET);

        if (attServiceURL != null) {
            serviceURL = attServiceURL.getAttributeValue();
        } else {
            throw new MediatorException("The 'serviceURL' attribute is required for the Callout mediator");
        }

        if (attAction != null) {
            action = attAction.getAttributeValue();
        }

        if (configElt != null) {

            OMAttribute axis2xmlAttr = configElt.getAttribute(ATT_AXIS2XML);
            OMAttribute repoAttr = configElt.getAttribute(ATT_REPOSITORY);

            if (axis2xmlAttr != null && axis2xmlAttr.getAttributeValue() != null) {
                axis2xml = axis2xmlAttr.getAttributeValue();
            }

            if (repoAttr != null && repoAttr.getAttributeValue() != null) {
                clientRepository = repoAttr.getAttributeValue();
            }
        }

        if (sourceElt != null) {
            if (sourceElt.getAttribute(ATT_XPATH) != null) {
                try {
                    requestXPath = SynapseXPathFactory.getSynapseXPath(sourceElt, ATT_XPATH);
                } catch (JaxenException e) {
                    throw new MediatorException("Invalid source XPath : "
                        + sourceElt.getAttributeValue(ATT_XPATH));
                }
            } else if (sourceElt.getAttribute(ATT_KEY) != null) {
                requestKey = sourceElt.getAttributeValue(ATT_KEY);
            } else {
                throw new MediatorException("A 'xpath' or 'key' attribute " +
                    "is required for the Callout 'source'");
            }
        } else {
            throw new MediatorException("The message 'source' must be specified for a Callout mediator");
        }

        if (targetElt != null) {
            if (targetElt.getAttribute(ATT_XPATH) != null) {
                try {
                    targetXPath = SynapseXPathFactory.getSynapseXPath(targetElt, ATT_XPATH);
                } catch (JaxenException e) {
                    throw new MediatorException("Invalid target XPath : "
                        + targetElt.getAttributeValue(ATT_XPATH));
                }
            } else if (targetElt.getAttribute(ATT_KEY) != null) {
                targetKey = targetElt.getAttributeValue(ATT_KEY);
            } else {
                throw new MediatorException("A 'xpath' or 'key' attribute " +
                    "is required for the Callout 'target'");
            }
        } else {
            throw new MediatorException("The message 'target' must be specified for a Callout mediator");
        }       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.