Examples of MediatorException


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

                    ValueFactory keyFactory = new ValueFactory();
                    Value key = keyFactory.createValue(XMLConfigConstants.KEY, omElem);
                    schemaKeys.add(key);

                } else {
                    throw new MediatorException("A 'schema' definition must contain a local property 'key'");
                }
            } else {
                throw new MediatorException("Invalid 'schema' declaration for validate mediator");
            }
        }

        if (schemaKeys.size() == 0) {
            throw new MediatorException("No schemas specified for the validate mediator");
        } else {
            this.schemaKeys = schemaKeys;
        }

        // process source XPath attribute if present
        OMAttribute attSource = elem.getAttribute(ATT_SOURCE);

        if (attSource != null) {
            try {
                source = SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE);
            } catch (JaxenException e) {
                throw new MediatorException("Invalid XPath expression specified for attribute 'source'");
            }
        }

        // process on-fail
        OMElement onFail = null;
        Iterator iterator = elem.getChildrenWithName(ON_FAIL_Q);
        if (iterator.hasNext()) {
            onFail = (OMElement) iterator.next();
        }

        if (onFail != null && onFail.getChildElements().hasNext()) {
            addChildren(onFail, this);
        } else {
            throw new MediatorException("A non-empty <on-fail> child element is required for " +
                    "the <validate> mediator");
        }

        // after successfully creating the mediator
        // set its common attributes such as tracing etc
        processAuditStatus(this, elem);
        // set the features
        for (Map.Entry<String, String> entry : collectNameValuePairs(elem, FEATURE_Q).entrySet()) {
            String value = entry.getValue();
            boolean isFeatureEnabled;
            if ("true".equals(value)) {
                isFeatureEnabled = true;
            } else if ("false".equals(value)) {
                isFeatureEnabled = false;
            } else {
                throw new MediatorException("The feature must have value true or false");
            }
            addFeature(entry.getKey(), isFeatureEnabled);
        }
    }
View Full Code Here

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

        if (executor != null) {
            enqueue.addAttribute(fac.createOMAttribute(
                    "executor", nullNS, executor));
        } else {
            throw new MediatorException("executor not specified");
        }


        enqueue.addAttribute(fac.createOMAttribute(
                "priority", nullNS, Integer.toString(priority)));


        if (sequence != null) {
            enqueue.addAttribute(fac.createOMAttribute("sequence", nullNS, sequence));
        } else {
            throw new MediatorException("sequence not specified");
        }

        if (parent != null) {
            parent.addChild(enqueue);
        }
View Full Code Here

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

        OMAttribute executor = elem.getAttribute(new QName("executor"));

        if (sequence == null) {
            String msg = "The 'sequence' attribute is required for the " +
                    "configuration of a enqueue mediator";
            throw new MediatorException(msg);
        }
        this.sequence = sequence.getAttributeValue();

        if (priority == null) {
            String msg = "The 'priority' attribute is required for the " +
                    "configuration of a enqueue mediator";
            throw new MediatorException(msg);
        }
        this.priority = Integer.parseInt(priority.getAttributeValue());

        if (executor == null) {
            String msg = "The 'executor' attribute is required for the " +
                    "configuration of a enqueue mediator";
            throw new MediatorException(msg);
        }
        this.executor = executor.getAttributeValue();

        // 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

            } else if ("TIME".equals(type)) {
                this.type = Types.TIME;
             } else if ("TIMESTAMP".equals(type)) {
                this.type = Types.TIMESTAMP;
            } else {
                throw new MediatorException("Unknown or unsupported JDBC type : " + type);
            }
        }
View Full Code Here

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

                    key = keyFactory.createValue(XMLConfigConstants.KEY, elem);

                    if (e != null) {
                        String msg = "A sequence mediator with a reference to another " +
                                "sequence can not have 'ErrorHandler'";
                        throw new MediatorException(msg);
                    }
                } else {
                    String msg = "A sequence mediator should be a named sequence or a reference " +
                            "to another sequence (i.e. a name attribute or key attribute is required)";
                    throw new MediatorException(msg);
                }
            }
        } else {
            if (e != null) {
                errorHandler = e.getAttributeValue();
View Full Code Here

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

        for (MediatorProperty mp : props) {
            OMElement prop = fac.createOMElement(childElementName, parent);
            if (mp.getName() != null) {
                prop.addAttribute(fac.createOMAttribute("name", nullNS, mp.getName()));
            } else {
                throw new MediatorException("Mediator property name missing");
            }

            if (mp.getValue() != null) {
                prop.addAttribute(fac.createOMAttribute("value", nullNS, mp.getValue()));

            } else if (mp.getExpression() != null) {
                SynapseXPathSerializer.serializeXPath(mp.getExpression(), prop, "expression");
            } else {
                throw new MediatorException("Mediator property must have a " +
                        "literal value or be an expression");
            }
        }
    }
View Full Code Here

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

            MediatorProperty prop = new MediatorProperty();

            if (attName == null || attName.getAttributeValue() == null ||
                attName.getAttributeValue().trim().length() == 0) {
                String msg = "Entry name is a required attribute for a Log property";
                throw new MediatorException(msg);
            } else {
                prop.setName(attName.getAttributeValue());
            }

            // if a value is specified, use it, else look for an expression
            if (attValue != null) {

                if (attValue.getAttributeValue() == null ||
                    attValue.getAttributeValue().trim().length() == 0) {

                    String msg = "Entry attribute value (if specified) " +
                        "is required for a Log property";
                    throw new MediatorException(msg);

                } else {
                    prop.setValue(attValue.getAttributeValue());
                }

            } else if (attExpr != null) {

                if (attExpr.getAttributeValue() == null ||
                    attExpr.getAttributeValue().trim().length() == 0) {

                    String msg = "Entry attribute expression (if specified) " +
                        "is required for a mediator property";
                    throw new MediatorException(msg);

                } else {
                    try {
                        prop.setExpression(SynapseXPathFactory.getSynapseXPath(
                            propEle, MediatorProperty.ATT_EXPR_Q));

                    } catch (JaxenException e) {
                        String msg = "Invalid XPapth expression : " + attExpr.getAttributeValue();
                        throw new MediatorException(msg);
                    }
                }

            } else {
                String msg = "Entry attribute value OR expression must " +
                    "be specified for a mediator property";
                throw new MediatorException(msg);
            }

            propertyList.add(prop);
        }
View Full Code Here

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

            OMAttribute attValue = child.getAttribute(ATT_VALUE);
            if (attName != null && attValue != null) {
                String name = attName.getAttributeValue().trim();
                String value = attValue.getAttributeValue().trim();
                if (result.containsKey(name)) {
                    throw new MediatorException("Duplicate " + childElementName.getLocalPart()
                            + " with name " + name);
                } else {
                    result.put(name, value);
                }
            } else {
                throw new MediatorException("Both of the name and value attributes are required for a "
                        + childElementName.getLocalPart());
            }
        }
        return result;
    }
View Full Code Here

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

        if (remoteServiceUrl != null) {
            entitlementService.addAttribute(fac.createOMAttribute("remoteServiceUrl", nullNS,
                    remoteServiceUrl));
        } else {
            throw new MediatorException(
                    "Invalid Entitlement mediator.Entitlement service epr required");
        }

        if (remoteServiceUserName != null) {
            entitlementService.addAttribute(fac.createOMAttribute("remoteServiceUserName", nullNS,
                    remoteServiceUserName));
        } else {
            throw new MediatorException(
                    "Invalid Entitlement mediator. Remote service user name required");
        }

        if (remoteServicePassword != null) {
            entitlementService.addAttribute(fac.createOMAttribute("remoteServicePassword", nullNS,
                    remoteServicePassword));
        } else {
            throw new MediatorException(
                    "Invalid Entitlement mediator. Remote service password required");
        }

        saveTracingState(entitlementService, this);
View Full Code Here

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

        OMAttribute attRemoteServicePassword = elem.getAttribute(PROP_NAME_PASSWORD);

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

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

        if (attRemoteServicePassword != null) {
            remoteServicePassword = attRemoteServicePassword.getAttributeValue();
        } else {
            throw new MediatorException(
                    "The 'remoteServicePassword' attribute is required for the Entitlement 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.