Package org.apache.synapse.mediators

Examples of org.apache.synapse.mediators.Value


     * @param elem OMElement
     * @return Key
     */
    public Value createValue(String name, OMElement elem) {

        Value key = null;

        OMAttribute attKey = elem.getAttribute(new QName(name));

        if (attKey != null) {
            String attributeValue = attKey.getAttributeValue();
            boolean hasEscape = isEscapedExpression(attributeValue);
            if (!hasEscape && isDynamicKey(attributeValue)) {
                /** dynamic key */
                SynapseXPath synXpath = createSynXpath(elem, attributeValue);
                key = new Value(synXpath);
            } else if (hasEscape) {
                /** escaped expr */
                key = new Value(getEscapedExpression(attributeValue));
                key.setNamespaces(elem);
            } else {
                /** static key */
                key = new Value(attributeValue);
            }
        } else {
            handleException("The 'key' attribute is required for the XSLT mediator");
        }
        return key;
View Full Code Here


                OMAttribute keyAtt = omElem.getAttribute(ATT_KEY);
                if (keyAtt != null) {
                    // ValueFactory for creating dynamic or static Value
                    ValueFactory keyFac = new ValueFactory();
                    // create dynamic or static key based on OMElement
                    Value generatedKey = keyFac.createValue(XMLConfigConstants.KEY, omElem);
                    schemaKeys.add(generatedKey);
                } else {
                    handleException("A 'schema' definition must contain a local property 'key'");
                }
            } else {
View Full Code Here

        Iterator subElements = elem.getChildElements();
        while (subElements.hasNext()) {
            OMElement child = (OMElement) subElements.next();
            if (child.getQName().equals(WITH_PARAM_Q)) {
                OMAttribute paramNameAttr = child.getAttribute(ATT_NAME);
                Value paramValue = new ValueFactory().createValue("value", child);
                if (paramNameAttr != null) {
                    //set parameter value
                    invoker.addExpressionForParamName(paramNameAttr.getAttributeValue(), paramValue);
                }
            }
View Full Code Here

    public void build(OMElement element) {
        OMAttribute topicAttr = element.getAttribute(new QName("topic"));
        if (topicAttr != null) {
            ValueFactory vf = new ValueFactory();
            Value value = vf.createValue("topic", element);

            setTopic(value);
        }

        OMAttribute expression = element.getAttribute(new QName("expression"));
View Full Code Here

        EventMediator event = new EventMediator();

        OMAttribute topicAttr = element.getAttribute(new QName("topic"));
        if (topicAttr != null) {
            ValueFactory vf = new ValueFactory();
            Value value = vf.createValue("topic", element);

            event.setTopic(value);
        }

        OMAttribute expression = element.getAttribute(new QName("expression"));
View Full Code Here

                OMElement omElem = (OMElement) o;
                OMAttribute keyAtt = omElem.getAttribute(ATT_KEY);
                if (keyAtt != null) {
                    //Use KeyFactory to create Key
                    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'");
                }
View Full Code Here

        SequenceMediator sequence = (SequenceMediator) m;
        List<ConfigurationObject> providers = new ArrayList<ConfigurationObject>();
        if (sequence.getKey() != null) {
            // If this is a sequence which simply refers to another sequence then
            // the provider sequence acts as the only dependency
            Value key = sequence.getKey();
            if (key != null) {
                addProvider(new ConfigurationObject(ConfigurationObject.TYPE_SEQUENCE,
                                                    key.getKeyValue()), providers);
            }
            return providers;
        } else {
            // Otherwise we need to resolve child mediators
            resolveListMediator(sequence, providers);
View Full Code Here

        SequenceMediator seq = new SequenceMediator();
        seq.setName(key);
        if (seqRef != null) {
            SequenceMediator ref = new SequenceMediator();
            //Create keyValue from static key(seqRef)
            Value seqRefValue = new Value(seqRef);
            ref.setKey(seqRefValue);
            seq.addChild(ref);
        }
        return seq;
    }
View Full Code Here

    private void populateParameters(MessageContext synCtx, String templateQualifiedName) {
        Iterator<String> params = pName2ExpressionMap.keySet().iterator();
        while (params.hasNext()) {
            String parameter = params.next();
            if (!"".equals(parameter)) {
                Value expression = pName2ExpressionMap.get(parameter);
                if (expression != null) {
                    EIPUtils.createSynapseEIPTemplateProperty(synCtx, templateQualifiedName, parameter, expression);
                }
            }
        }
View Full Code Here

     * @param keyName String key value (static key) to create Value object
     * @return immutable Value list with one Value element
     */
    private List<Value> createKeyListFromStaticKey(String keyName) {
        // create static key using given string key name
        Value xsdKey = new Value(keyName);
        return Collections.singletonList(xsdKey);
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.mediators.Value

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.