synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: svn commit: r1373302 - in /synapse/trunk/java: modules/core/ modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/src/main/java/org/apache/synapse/libraries/util/ modules/core/src/main/java/org/apache/synapse/mediators/ modules/
Date Wed, 15 Aug 2012 18:34:38 GMT
Please note that new samples are pretty much useless if there is no
corresponding documentation...

Andreas

On Wed, Aug 15, 2012 at 12:03 PM,  <uswick@apache.org> wrote:
> Author: uswick
> Date: Wed Aug 15 10:03:18 2012
> New Revision: 1373302
>
> URL: http://svn.apache.org/viewvc?rev=1373302&view=rev
> Log:
> commiting patches SYNAPSE-898,SYNAPSE-884, SYNAPSE-897 SYNAPSE-899, SYNAPSE-901
>
> Added:
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterFactory.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterSerializer.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/TemplateParameter.java
>     synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/
>     synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/AbstractEipLibTestCase.java
>     synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/EipLibTest.java
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/artifacts.xml
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/artifact.xml
>     synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/template_splitter.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_850.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_851.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_852.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_853.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_854.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_855.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_856.xml
>     synapse/trunk/java/repository/conf/sample/synapse_sample_857.xml
> Modified:
>     synapse/trunk/java/modules/core/pom.xml
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorFactory.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorSerializer.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorFactory.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorSerializer.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateContext.java
>     synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateMediator.java
>
> Modified: synapse/trunk/java/modules/core/pom.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/pom.xml?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/pom.xml (original)
> +++ synapse/trunk/java/modules/core/pom.xml Wed Aug 15 10:03:18 2012
> @@ -96,6 +96,25 @@
>                              </descriptors>
>                          </configuration>
>                      </execution>
> +                     <execution>
> +                        <id>eip-library-assembly</id>
> +                        <phase>generate-test-resources</phase>
> +                        <goals>
> +                            <goal>attached</goal>
> +                        </goals>
> +                        <configuration>
> +                            <finalName>synapse-eip-lib</finalName>
> +                            <filters>
> +                                <filter>
> +                                    ${basedir}/src/test/resources/synapse-libraries/assembly/filter.properties
> +                                </filter>
> +                            </filters>
> +                            <descriptors>
> +                                <descriptor>src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml
> +                                </descriptor>
> +                            </descriptors>
> +                        </configuration>
> +                    </execution>
>                  </executions>
>              </plugin>
>
> @@ -115,6 +134,7 @@
>                                  <mkdir dir="target/test_repos/client/modules"/>
>                                  <mkdir dir="target/test_repos/synapse/synapse-libraries"/>
>                                  <copy file="target/synapse-test-lib.zip" todir="target/test_repos/synapse/synapse-libraries"/>
> +                                <copy file="target/synapse-eip-lib.zip" todir="target/test_repos/synapse/synapse-libraries"/>
>                              </tasks>
>                          </configuration>
>                          <goals>
> @@ -127,6 +147,7 @@
>                          <configuration>
>                              <tasks>
>                                  <delete file="target/synapse-test-lib.zip"/>
> +                                <delete file="target/synapse-eip-lib.zip"/>
>                              </tasks>
>                          </configuration>
>                          <goals>
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CloneMediatorFactory.java Wed Aug 15 10:03:18 2012
> @@ -73,7 +73,7 @@ public class CloneMediatorFactory extend
>       */
>      public Mediator createSpecificMediator(OMElement elem, Properties properties) {
>
> -       boolean asynchronousExe = true;
> +       boolean asynchronousExe = false;
>
>         CloneMediator mediator = new CloneMediator();
>          processAuditStatus(mediator, elem);
> @@ -94,8 +94,6 @@ public class CloneMediatorFactory extend
>          if (synchronousExeAttr != null && synchronousExeAttr.getAttributeValue().equals("true")) {
>                 asynchronousExe = false;
>          }
> -
> -        mediator.setSequential(!asynchronousExe);
>
>          Iterator targetElements = elem.getChildrenWithName(TARGET_Q);
>          while (targetElements.hasNext()) {
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorFactory.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorFactory.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorFactory.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorFactory.java Wed Aug 15 10:03:18 2012
> @@ -128,7 +128,7 @@ public class IterateMediatorFactory exte
>                  attachPathValue, e);
>          }
>
> -        boolean asynchronous = true;
> +        boolean asynchronous = false;
>          OMAttribute asynchronousAttr = elem.getAttribute(ATT_SEQUENCIAL);
>          if (asynchronousAttr != null && asynchronousAttr.getAttributeValue().equals("true")) {
>              asynchronous = false;
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorSerializer.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorSerializer.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorSerializer.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/IterateMediatorSerializer.java Wed Aug 15 10:03:18 2012
> @@ -85,8 +85,8 @@ public class IterateMediatorSerializer e
>              handleException("Missing expression of the IterateMediator which is required.");
>          }
>
> -        if (itrMed.getTarget() != null && !itrMed.getTarget().isAsynchronous()) {
> -            itrElem.addAttribute("sequential", "true", nullNS);
> +        if (itrMed.getTarget() != null && itrMed.getTarget().isAsynchronous()) {
> +            itrElem.addAttribute("sequential", "false", nullNS);
>          }
>
>          itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorFactory.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorFactory.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorFactory.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorFactory.java Wed Aug 15 10:03:18 2012
> @@ -22,6 +22,7 @@ import org.apache.axiom.om.OMAttribute;
>  import org.apache.axiom.om.OMElement;
>  import org.apache.synapse.Mediator;
>  import org.apache.synapse.SynapseException;
> +import org.apache.synapse.mediators.TemplateParameter;
>  import org.apache.synapse.mediators.template.TemplateMediator;
>
>  import javax.xml.namespace.QName;
> @@ -32,8 +33,8 @@ import java.util.Properties;
>  /**
>   * Factory class for Template configuration as follows
>   * <template name="simple_func">
> -           <parameter name="p1"/>
> -        <parameter name="p2"/>*
> +           <parameter name="p1" [default="value|expression"] [optional=(true|false)]/>
> +        <parameter name="p2" [default="value|expression"] [optional=(true|false)]/>*
>          <mediator/>+
>      </template>
>   */
> @@ -43,20 +44,14 @@ public class TemplateMediatorFactory ext
>      private static final QName TEMPLATE_BODY_Q
>              = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "sequence");
>
> -    /**
> -     * Element  QName Definitions
> -     */
> -    public static final QName PARAMETER_Q = new QName(
> -            XMLConfigConstants.SYNAPSE_NAMESPACE, "parameter");
> -
> -
>      protected Mediator createSpecificMediator(OMElement elem, Properties properties) {
>          TemplateMediator templateTemplateMediator = new TemplateMediator();
>          OMAttribute nameAttr = elem.getAttribute(ATT_NAME);
>          if (nameAttr != null) {
>              templateTemplateMediator.setName(nameAttr.getAttributeValue());
>              processAuditStatus(templateTemplateMediator, elem);
> -            initParameters(elem, templateTemplateMediator);
> +            //set template parameters
> +            templateTemplateMediator.setParameters(TemplateParameterFactory.getTemplateParameters(elem));
>              OMElement templateBodyElem = elem.getFirstChildWithName(TEMPLATE_BODY_Q);
>              addChildren(templateBodyElem, templateTemplateMediator, properties);
>          } else {
> @@ -67,22 +62,6 @@ public class TemplateMediatorFactory ext
>          return templateTemplateMediator;
>      }
>
> -    private void initParameters(OMElement templateElem, TemplateMediator templateMediator) {
> -        Iterator subElements = templateElem.getChildElements();
> -        Collection<String> paramNames = new ArrayList<String>();
> -        while (subElements.hasNext()) {
> -            OMElement child = (OMElement) subElements.next();
> -            if (child.getQName().equals(PARAMETER_Q)) {
> -                OMAttribute paramNameAttr = child.getAttribute(ATT_NAME);
> -                if (paramNameAttr != null) {
> -                    paramNames.add(paramNameAttr.getAttributeValue());
> -                }
> -//                child.detach();
> -            }
> -        }
> -        templateMediator.setParameters(paramNames);
> -    }
> -
>      public QName getTagQName() {
>          return TEMPLATE_Q;
>      }
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorSerializer.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorSerializer.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorSerializer.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateMediatorSerializer.java Wed Aug 15 10:03:18 2012
> @@ -20,17 +20,17 @@ package org.apache.synapse.config.xml;
>
>  import org.apache.axiom.om.OMElement;
>  import org.apache.synapse.Mediator;
> +import org.apache.synapse.mediators.TemplateParameter;
>  import org.apache.synapse.mediators.template.TemplateMediator;
>
>  import java.util.Collection;
> -import java.util.Iterator;
>  import java.util.List;
>
>  /**
>   *  Serializer class for Template to serialize into a  configuration as follows
>   * <template name="simple_func">
> -           <parameter name="p1"/>
> -        <parameter name="p2"/>*
> +           <parameter name="p1" [default="value|expression"] [optional=(true|false)]/>
> +        <parameter name="p2" [default="value|expression"] [optional=(true|false)]/>*
>          <mediator/>+
>      </template>
>   */
> @@ -47,6 +47,7 @@ public class TemplateMediatorSerializer
>          if (mediator.getName() != null) {
>              templateElem.addAttribute(fac.createOMAttribute(
>                      "name", nullNS, mediator.getName()));
> +            //serialize parameters
>              serializeParams(templateElem,mediator);
>              serializeBody(templateElem, mediator.getList());
>              saveTracingState(templateElem, mediator);
> @@ -55,14 +56,16 @@ public class TemplateMediatorSerializer
>          return templateElem;
>      }
>
> +     /**
> +     * Serialize parameters for the template mediator specified
> +     *
> +     * @param templateElem the OMElement that specifies the template configuration
> +     * @param mediator the TemplateMediator
> +     */
>      private void serializeParams(OMElement templateElem, TemplateMediator mediator) {
> -        Collection<String> params = mediator.getParameters();
> -        for (String param : params) {
> -            if (param != null && !"".equals(param)) {
> -                OMElement paramEl = fac.createOMElement("parameter", synNS);
> -                paramEl.addAttribute(fac.createOMAttribute("name", nullNS, param));
> -                templateElem.addChild(paramEl);
> -            }
> +        Collection<TemplateParameter> params = mediator.getParameters();
> +        if (params != null && params.size() > 0) {
> +               TemplateParameterSerializer.serializeTemplateParameters(templateElem,mediator.getParameters());
>          }
>      }
>
>
> Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterFactory.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterFactory.java?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterFactory.java (added)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterFactory.java Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,98 @@
> +/*
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +package org.apache.synapse.config.xml;
> +
> +import org.apache.axiom.om.OMAttribute;
> +import org.apache.axiom.om.OMElement;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.synapse.SynapseException;
> +import org.apache.synapse.mediators.TemplateParameter;
> +import org.apache.synapse.mediators.Value;
> +
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +
> +/**
> + * A utility class capable of creating instances of TemplateParameter objects by reading
> + * through a given XML configuration
> + *
> + * <pre>
> + * &lt;element&gt;
> + *    &lt;parameter name="p1" [default="value|expression"] [optional=(true|false)]/&gt;*
> + * &lt;/element&gt;
> + * </pre>
> + */
> +public class TemplateParameterFactory {
> +    private static final Log log = LogFactory.getLog(TemplateParameterFactory.class);
> +
> +     /**
> +     * Creates a list of parameters in a given template
> +     *
> +     * @param elem the OMElement that specifies the template configuration
> +     * @return the list of TemplateParameter instances created
> +     */
> +    public static List<TemplateParameter> getTemplateParameters(OMElement elem) {
> +
> +        List<TemplateParameter> parameterList = new ArrayList<TemplateParameter>();
> +
> +        Iterator iter = elem.getChildrenWithName(TemplateParameter.PARAMETER_Q);
> +
> +        while (iter.hasNext()) {
> +
> +            OMElement paramEle = (OMElement) iter.next();
> +            OMAttribute attName = paramEle.getAttribute(TemplateParameter.ATT_NAME_Q);
> +            OMAttribute attDefault = paramEle.getAttribute(TemplateParameter.ATT_DEFAULT_Q);
> +            OMAttribute attOptional = paramEle.getAttribute(TemplateParameter.ATT_OPTIONAL_Q);
> +
> +            TemplateParameter param = new TemplateParameter();
> +
> +            if (attName == null || attName.getAttributeValue() == null ||
> +                    attName.getAttributeValue().trim().length() == 0) {
> +                String msg = "Parameter name is a required attribute for a Template Parameter";
> +                log.error(msg);
> +                throw new SynapseException(msg);
> +            } else {
> +                param.setName(attName.getAttributeValue());
> +            }
> +
> +
> +            if (attDefault == null || attDefault.getAttributeValue() == null ||
> +                    attDefault.getAttributeValue().trim().length() == 0) {
> +                String msg = "Default value is not specified for " + param.getName() + " Parameter";
> +                log.warn(msg);
> +            } else {
> +                Value paramValue = new ValueFactory().createValue("default", paramEle);
> +                param.setDefaultValue(paramValue);
> +            }
> +
> +            if (attOptional == null || attOptional.getAttributeValue() == null ||
> +                    attOptional.getAttributeValue().trim().length() == 0) {
> +            } else {
> +                param.setOptional(Boolean.valueOf(attOptional.getAttributeValue()));
> +            }
> +
> +            parameterList.add(param);
> +        }
> +
> +        return parameterList;
> +    }
> +
> +}
>
> Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterSerializer.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterSerializer.java?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterSerializer.java (added)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/TemplateParameterSerializer.java Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,111 @@
> +/*
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +package org.apache.synapse.config.xml;
> +
> +import org.apache.axiom.om.OMAbstractFactory;
> +import org.apache.axiom.om.OMElement;
> +import org.apache.axiom.om.OMFactory;
> +import org.apache.axiom.om.OMNamespace;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.synapse.SynapseConstants;
> +import org.apache.synapse.SynapseException;
> +import org.apache.synapse.mediators.TemplateParameter;
> +
> +import javax.xml.namespace.QName;
> +import java.util.Collection;
> +
> +/**
> + * A utility class for serializing instances of TemplateParameter objects by reading
> + * through a given XML configuration
> + *
> + * <pre>
> + * &lt;element&gt;
> + *    &lt;parameter name="p1" [default="value|expression"] [optional=(true|false)]/&gt;*
> + * &lt;/element&gt;
> + * </pre>
> + */
> +public class TemplateParameterSerializer {
> +    private static final Log log = LogFactory.getLog(TemplateParameterSerializer.class);
> +
> +    protected static final OMFactory fac = OMAbstractFactory.getOMFactory();
> +    protected static final OMNamespace synNS = SynapseConstants.SYNAPSE_OMNAMESPACE;
> +    protected static final OMNamespace nullNS
> +            = fac.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
> +
> +    protected static final QName PARAMETER_Q
> +        = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "parameter");
> +
> +    /**
> +     * Serialize all the parameters to the given parent element. For each and every
> +     * parameter there will be a separate parameter element created inside the parent element.
> +     *
> +     * @param parent element to which parameter elements should be added
> +     * @param params the list of  TemplateParameter objects
> +     */
> +    public static void serializeTemplateParameters(OMElement parent,
> +                                               Collection<TemplateParameter> params) {
> +            serializeTemplateParameters(parent, params, PARAMETER_Q);
> +    }
> +
> +    /**
> +     * Serialize all the parameters to the given parent element. For each and every
> +     * parameter there will be a separate parameter element created inside the parent element.
> +     *
> +     * @param parent element to which parameter elements should be added
> +     * @param params the list of  TemplateParameter objects
> +     * @param childElementName of the parameter element to be created
> +     */
> +    public static void serializeTemplateParameters(OMElement parent,
> +                                               Collection<TemplateParameter> params,
> +                                               QName childElementName) {
> +        for (TemplateParameter tp : params) {
> +            serializeTemplateParameter(parent,tp, childElementName);
> +        }
> +    }
> +
> +    /**
> +     * Serialize the parameter to the given parent element. There will be a element created with
> +     * given configuration inside the parent element.
> +     *
> +     * @param parent element to which parameter elements should be added
> +     * @param tp a property to be serialized
> +     * @param childElementName of the parameter element to be created
> +     */
> +    public static void serializeTemplateParameter(OMElement parent,
> +                                             TemplateParameter tp,
> +                                             QName childElementName) {
> +        OMElement param = fac.createOMElement(childElementName, parent);
> +        if (tp.getName() != null) {
> +            param.addAttribute(fac.createOMAttribute("name", nullNS, tp.getName()));
> +        } else {
> +            String msg = "Template parameter name missing";
> +            log.error(msg);
> +            throw new SynapseException(msg);
> +        }
> +
> +        if (tp.getDefaultValue() != null) {
> +            new ValueSerializer().serializeValue(tp.getDefaultValue(), "default", param);
> +
> +        if (tp.isOptional()) {
> +            param.addAttribute(fac.createOMAttribute("optional", nullNS, "true"));
> +        }
> +    }
> +}
> +}
> \ No newline at end of file
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java Wed Aug 15 10:03:18 2012
> @@ -56,6 +56,8 @@ public class LibDeployerUtils {
>
>
>      public static Library createSynapseLibrary(String libPath) {
> +        createDir(APP_UNZIP_DIR);
> +
>          String libFilePath = LibDeployerUtils.formatPath(libPath);
>          //extract
>          String extractPath = LibDeployerUtils.extractSynapseLib(libFilePath);
>
> Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/TemplateParameter.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/TemplateParameter.java?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/TemplateParameter.java (added)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/TemplateParameter.java Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,71 @@
> +/*
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +package org.apache.synapse.mediators;
> +
> +import javax.xml.namespace.QName;
> +
> +import org.apache.synapse.config.xml.XMLConfigConstants;
> +
> +/**
> + * A template parameter is a variable which is used when creating templates and contains following configuration
> + * parameter name="p1" [default="value|expression"] [optional=(true|false)]
> + *
> + */
> +public class TemplateParameter {
> +    public static final QName PARAMETER_Q = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "parameter");
> +    public static final QName ATT_NAME_Q = new QName(XMLConfigConstants.NULL_NAMESPACE, "name");
> +    public static final QName ATT_DEFAULT_Q = new QName(XMLConfigConstants.NULL_NAMESPACE, "default");
> +    public static final QName ATT_OPTIONAL_Q = new QName(XMLConfigConstants.NULL_NAMESPACE, "optional");
> +
> +
> +    private String name;
> +    private Value defaultValue;
> +    private boolean isOptional;
> +
> +    public TemplateParameter() {
> +        this.name = null;
> +        this.defaultValue = null;
> +        this.isOptional = false;
> +    }
> +
> +    public String getName() {
> +        return name;
> +    }
> +
> +    public void setName(String name) {
> +        this.name = name;
> +    }
> +
> +    public Value getDefaultValue() {
> +        return defaultValue;
> +    }
> +
> +    public void setDefaultValue(Value defaultValue) {
> +        this.defaultValue = defaultValue;
> +    }
> +
> +    public boolean isOptional() {
> +        return isOptional;
> +    }
> +
> +    public void setOptional(boolean optional) {
> +        isOptional = optional;
> +    }
> +
> +}
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateContext.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateContext.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateContext.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateContext.java Wed Aug 15 10:03:18 2012
> @@ -18,7 +18,10 @@
>   */
>  package org.apache.synapse.mediators.template;
>
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
>  import org.apache.synapse.MessageContext;
> +import org.apache.synapse.mediators.TemplateParameter;
>  import org.apache.synapse.mediators.Value;
>  import org.apache.synapse.mediators.eip.EIPUtils;
>  import org.jaxen.JaxenException;
> @@ -30,6 +33,7 @@ import java.util.*;
>   * a context will be populated with function parameters.
>   */
>  public class TemplateContext {
> +    private static final Log log = LogFactory.getLog(TemplateContext.class);
>      /**
>       * refers to the function-template name this context is binded to
>       */
> @@ -37,31 +41,40 @@ public class TemplateContext {
>      /**
>       * refers to the parameter names of the function
>       */
> -    private Collection<String> parameters;
> +    private Collection<TemplateParameter> parameters;
>      /**
>       * contains a map for parameterNames to evaluated values
>       */
>      private Map mappedValues;
>
> -    TemplateContext(String name, Collection<String> parameters) {
> +    TemplateContext(String name, Collection<TemplateParameter> parameters) {
>          this.fName = name;
>          this.parameters = parameters;
>          mappedValues = new HashMap();
>      }
>
>      /**
> -     * evaluate raw parameters passed from an invoke medaiator and store them in this context
> +     * evaluate raw parameters passed from an invoke mediator and store them in this context
>       * @param synCtxt Synapse MessageContext
>       */
>      public void setupParams(MessageContext synCtxt) {
> -        Iterator<String> paramNames = parameters.iterator();
> +        Iterator<TemplateParameter> paramNames = parameters.iterator();
>          while (paramNames.hasNext()) {
> -            String parameter = paramNames.next();
> -            String mapping = EIPUtils.getTemplatePropertyMapping(fName, parameter);
> +            TemplateParameter parameter = paramNames.next();
> +            String mapping = EIPUtils.getTemplatePropertyMapping(fName, parameter.getName());
>              Object propertyValue = synCtxt.getProperty(mapping);
> -            Object paramValue = getEvaluatedParamValue(synCtxt, parameter, (Value) propertyValue);
> +            //If property value is not provided assign default value
> +            if (propertyValue == null && parameter.getDefaultValue() != null) {
> +                propertyValue = parameter.getDefaultValue();
> +            }
> +            //If this parameter is a required one give an error
> +            if (!parameter.isOptional() && propertyValue == null) {
> +                String msg = parameter.getName() + " is a required parameter for " + fName + " template";
> +                log.error(msg);
> +            }
> +            Object paramValue = getEvaluatedParamValue(synCtxt, parameter.getName(), (Value) propertyValue);
>              if (paramValue != null) {
> -                mappedValues.put(parameter, paramValue);
> +                mappedValues.put(parameter.getName(), paramValue);
>                  //remove temp property from the context
>                  removeProperty(synCtxt, mapping);
>              }
>
> Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateMediator.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateMediator.java?rev=1373302&r1=1373301&r2=1373302&view=diff
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateMediator.java (original)
> +++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/template/TemplateMediator.java Wed Aug 15 10:03:18 2012
> @@ -23,6 +23,7 @@ import org.apache.synapse.SynapseConstan
>  import org.apache.synapse.SynapseLog;
>  import org.apache.synapse.core.SynapseEnvironment;
>  import org.apache.synapse.mediators.AbstractListMediator;
> +import org.apache.synapse.mediators.TemplateParameter;
>
>  import javax.sound.midi.Sequence;
>  import java.util.Collection;
> @@ -37,19 +38,19 @@ import java.util.Stack;
>   */
>  public class TemplateMediator extends AbstractListMediator {
>
> -    private Collection<String> paramNames;
> +    private Collection<TemplateParameter> parameters;
>
>      private String eipPatternName;
>      private String fileName;
>      /** flag to ensure that each and every sequence is initialized and destroyed atmost once */
>      private boolean initialized = false;
>
> -    public void setParameters(Collection<String> paramNames) {
> -        this.paramNames = paramNames;
> +    public void setParameters(Collection<TemplateParameter> paramNames) {
> +        this.parameters = paramNames;
>      }
>
> -    public Collection<String> getParameters() {
> -        return paramNames;
> +    public Collection<TemplateParameter> getParameters() {
> +        return parameters;
>      }
>
>      public void setName(String name) {
> @@ -64,7 +65,7 @@ public class TemplateMediator extends Ab
>          SynapseLog synLog = getLog(synCtx);
>
>          if (synLog.isTraceOrDebugEnabled()) {
> -            synLog.traceOrDebug("Start : EIP Sequence " + "paramNames : " + paramNames);
> +            synLog.traceOrDebug("Start : EIP Sequence " + "paramNames : " + parameters);
>
>              if (synLog.isTraceTraceEnabled()) {
>                  synLog.traceTrace("Message : " + synCtx.getEnvelope());
> @@ -86,7 +87,7 @@ public class TemplateMediator extends Ab
>       * @param synCtx  Synapse Message context
>       */
>      private void pushFuncContextTo(MessageContext synCtx) {
> -        TemplateContext funcContext = new TemplateContext(eipPatternName, paramNames);
> +        TemplateContext funcContext = new TemplateContext(eipPatternName, parameters);
>          //process the raw parameters parsed in
>          funcContext.setupParams(synCtx);
>          //if a function stack has not already been created for this message flow create new one
>
> Added: synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/AbstractEipLibTestCase.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/AbstractEipLibTestCase.java?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/AbstractEipLibTestCase.java (added)
> +++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/AbstractEipLibTestCase.java Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,26 @@
> +package org.apache.synapse.libraries.eip;
> +
> +import junit.framework.TestCase;
> +import org.apache.synapse.libraries.imports.SynapseImport;
> +import org.apache.synapse.libraries.model.Library;
> +import org.apache.synapse.libraries.util.LibDeployerUtils;
> +import org.apache.synapse.mediators.eip.AbstractSplitMediatorTestCase;
> +
> +import java.io.File;
> +import java.net.URISyntaxException;
> +
> +public abstract class AbstractEipLibTestCase extends TestCase {
> +    public String path = null;
> +
> +    protected String getResourcePath() {
> +        try {
> +            if (path == null) {
> +                path = new File("./target/test_repos/synapse/synapse-libraries/synapse-eip-lib.zip").getAbsolutePath();
> +            }
> +        } catch (Exception e) {
> +            return null;
> +        }
> +        return path;
> +
> +    }
> +}
>
> Added: synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/EipLibTest.java
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/EipLibTest.java?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/EipLibTest.java (added)
> +++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/libraries/eip/EipLibTest.java Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,87 @@
> +package org.apache.synapse.libraries.eip;
> +
> +import org.apache.axiom.om.OMAbstractFactory;
> +import org.apache.axiom.soap.SOAPEnvelope;
> +import org.apache.axis2.context.ConfigurationContext;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.synapse.MessageContext;
> +import org.apache.synapse.config.SynapseConfigUtils;
> +import org.apache.synapse.config.SynapseConfiguration;
> +import org.apache.synapse.config.xml.InvokeMediatorFactory;
> +import org.apache.synapse.config.xml.MediatorFactory;
> +import org.apache.synapse.core.axis2.Axis2MessageContext;
> +import org.apache.synapse.core.axis2.Axis2SynapseEnvironment;
> +import org.apache.synapse.libraries.imports.SynapseImport;
> +import org.apache.synapse.libraries.model.Library;
> +import org.apache.synapse.libraries.util.LibDeployerUtils;
> +import org.apache.synapse.mediators.base.SequenceMediator;
> +import org.apache.synapse.mediators.template.InvokeMediator;
> +
> +import java.util.Properties;
> +
> +/**
> + * Tests for synapse template invoke
> + */
> +public class EipLibTest extends AbstractEipLibTestCase {
> +    private MessageContext synCtx;
> +
> +
> +    protected void setUp() throws Exception {
> +        super.setUp();
> +        Library library = LibDeployerUtils.createSynapseLibrary(getResourcePath());
> +        SynapseImport validSynImport = new SynapseImport();
> +        validSynImport.setLibName("EipLibrary");
> +        validSynImport.setLibPackage("synapse.lang.eip");
> +        if (validSynImport != null) {
> +            LibDeployerUtils.loadLibArtifacts(validSynImport, library);
> +        }
> +        assertEquals("EipLibrary", library.getQName().getLocalPart());
> +        assertEquals("synapse.lang.eip", library.getPackage());
> +        assertEquals("eip synapse library", library.getDescription());
> +        assertNotNull(library.getArtifact("synapse.lang.eip.splitter"));
> +        //setting up synapse context & configuration
> +        SynapseConfiguration synConf = new SynapseConfiguration();
> +        synConf.addSynapseLibrary(library.toString(), library);
> +        synConf.addSequence("main", new SequenceMediator());
> +        synConf.addSequence("fault", new SequenceMediator());
> +        AxisConfiguration config = new AxisConfiguration();
> +        synCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(),
> +                synConf, new Axis2SynapseEnvironment(new ConfigurationContext(config), synConf));
> +        //((Axis2MessageContext)synCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config));
> +        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
> +        envelope.getBody().addChild(SynapseConfigUtils.stringToOM("<original><itr><a>IBM</a></itr><itr><a>DELL</a></itr></original>"));
> +        synCtx.setEnvelope(envelope);
> +        SequenceMediator seqMed = new SequenceMediator();
> +        synCtx.getConfiguration().addSequence("seqRef", seqMed);
> +
> +    }
> +
> +
> +    public void testValidEipLibInvoke() throws Exception {
> +
> +        //Invoke Template
> +        MediatorFactory fac = new InvokeMediatorFactory();
> +
> +        InvokeMediator iterate = (InvokeMediator) fac.createMediator(SynapseConfigUtils.stringToOM("<call-template xmlns=\"http://ws.apache.org/ns/synapse\" " +
> +                "target=\"synapse.lang.eip.splitter\">" +
> +                "<with-param xmlns=\"http://ws.apache.org/ns/synapse\" name=\"iterate_exp\" value=\"{{//original/itr}}\"/>" +
> +                "<with-param xmlns=\"http://ws.apache.org/ns/synapse\" name=\"endpoint_uri\" value=\"http://localhost:9000/services/IterateTestService\"/>" +
> +                "<with-param xmlns=\"http://ws.apache.org/ns/synapse\" name=\"sequence_ref\" value=\"seqRef\"/>" +
> +                "</call-template>"), new Properties());
> +
> +        boolean returnValue = iterate.mediate(synCtx);
> +
> +        //Test Template Parameters
> +        assertEquals("<itr><a>IBM</a></itr><itr><a>DELL</a></itr>", synCtx.getProperty("ItrExp"));
> +        assertEquals("http://localhost:9000/services/IterateTestService", synCtx.getProperty("EndPUri"));
> +        assertEquals("<original><itr><a>IBM</a></itr><itr><a>DELL</a></itr></original>", synCtx.getProperty("AttachPath"));
> +        assertEquals("seqRef", synCtx.getProperty("SRef"));
> +
> +        //Test Template invoke & mediation
> +        assertTrue(returnValue);
> +        assertEquals("", synCtx.getProperty("Endpoint_1"));
> +        assertEquals("http://localhost:9000/services/IterateTestService", synCtx.getProperty("Endpoint_2"));
> +    }
> +
> +
> +}
>
> Added: synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml (added)
> +++ synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/assembly/assemble-eip-lib.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,23 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<assembly>
> +    <formats>
> +        <format>zip</format>
> +    </formats>
> +    <includeBaseDirectory>false</includeBaseDirectory>
> +    <fileSets>
> +        <fileSet>
> +            <directory>src/test/resources/synapse-libraries/synapse-eip-lib</directory>
> +            <outputDirectory></outputDirectory>
> +        </fileSet>
> +        <fileSet>
> +            <directory>target/classes</directory>
> +            <outputDirectory></outputDirectory>
> +            <excludes>
> +                <exclude>**/metrics_module.xml</exclude>
> +                <exclude>**/META-INF/*</exclude>
> +            </excludes>
> +        </fileSet>
> +    </fileSets>
> +
> +
> +</assembly>
>
> Added: synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/artifacts.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/artifacts.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/artifacts.xml (added)
> +++ synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/artifacts.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,7 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<artifacts>
> +    <artifact name="EipLibrary" package="synapse.lang.eip" >
> +        <dependency artifact="systemManagement" />
> +        <description>eip synapse library</description>
> +    </artifact>
> +</artifacts>
>
> Added: synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/artifact.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/artifact.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/artifact.xml (added)
> +++ synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/artifact.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,11 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<artifact name="systemManagement" type="synapse/template">
> +
> +    <subArtifacts>
> +        <artifact name="splitter">
> +            <file>template_splitter.xml</file>
> +            <description>Splitter library function</description>
> +        </artifact>
> +    </subArtifacts>
> +
> +</artifact>
> \ No newline at end of file
>
> Added: synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/template_splitter.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/template_splitter.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/template_splitter.xml (added)
> +++ synapse/trunk/java/modules/core/src/test/resources/synapse-libraries/synapse-eip-lib/eip_systemManagement/template_splitter.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,20 @@
> +<template xmlns="http://ws.apache.org/ns/synapse" name="splitter">
> +    <parameter name="iterate_exp"/>
> +    <parameter name="endpoint_uri"/>
> +    <parameter name="attach_path" default="{{//original}}" optional="true"/>
> +    <parameter name="sequence_ref"/>
> +    <sequence>
> +        <property name="ItrExp" expression="$func:iterate_exp" />
> +        <property name="EndPUri" expression="$func:endpoint_uri" />
> +        <property name="AttachPath" expression="$func:attach_path" />
> +        <property name="SRef" expression="$func:sequence_ref" />
> +        <property name="Endpoint_1" expression="get-property('To')" />
> +        <header name="To" expression="$func:endpoint_uri"/>
> +        <iterate xmlns:ns="http://org.apache.synapse/xsd" continueParent="true" preservePayload="true" attachPath="$func:attach_path" expression="$func:iterate_exp">
> +            <target>
> +              <sequence key="{$func:sequence_ref}"/>
> +            </target>
> +        </iterate>
> +        <property name="Endpoint_2" expression="get-property('To')" />
> +    </sequence>
> +</template>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_850.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_850.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_850.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_850.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,36 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Callout Block function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +   <sequence name="main">
> +    <call-template target="synapse.lang.eip.callout_block">
> +        <with-param name="action" value="urn:getQuote"/>
> +        <with-param name="service_URL" value="http://localhost:9000/services/SimpleStockQuoteService"/>
> +        <with-param xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" name="source_xpath" value="{{s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]}}"/>
> +        <with-param xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" name="target_xpath" value="{{s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]}}"/>
> +    </call-template>
> +     <property name="RESPONSE" value="true"/>
> +        <header name="To" action="remove"/>
> +        <send/>
> +        <drop/>
> +</sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_851.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_851.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_851.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_851.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,57 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Splitter & Aggregator eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> + <proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
> +        <target>
> +        <inSequence>
> +            <log level="custom">
> +                <property name="text" value="splitterAggrigator"/>
> +            </log>
> +            <call-template target="synapse.lang.eip.splitter">
> +                <with-param xmlns:m0="http://services.samples" name="iterate_exp" value="{{//m0:getQuote/m0:request}}"/>
> +                <with-param xmlns:m0="http://services.samples" name="attach_path" value="{{//m0:getQuote}}"/>
> +                <with-param name="attach_path_enabled" value="true"/>
> +                <with-param name="endpoint_uri" value="http://localhost:9000/services/SimpleStockQuoteService"/>
> +            </call-template>
> +        </inSequence>
> +        <outSequence>
> +            <call-template target="synapse.lang.eip.aggregator">
> +                <with-param name="sequence_ref" value="enr"/>
> +                <with-param xmlns:m0="http://services.samples" name="aggregator_exp" value="{{//m0:return}}"/>
> +                <with-param name="oncomplete_seq_enabled" value="true"/>
> +            </call-template>
> +        </outSequence>
> +    </target>
> +    </proxy>
> +<sequence xmlns="http://ws.apache.org/ns/synapse" name="enr">
> +    <log level="custom">
> +        <property name="text" value="seqhit"/>
> +    </log>
> +    <enrich>
> +        <source xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" clone="true"
> +                xpath="//m0:return[not(preceding-sibling::m0:return/m1:last &lt;= m1:last) and not(following-sibling::m0:return/m1:last &lt; m1:last)]"/>
> +        <target type="body"/>
> +    </enrich>
> +    <send/>
> +</sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_852.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_852.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_852.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_852.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,46 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Splitter-Agrregator eip function templates -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +   <sequence name="main">
> +      <call-template target="synapse.lang.eip.splitter_aggregator">
> +        <with-param name="attach_path_enabled" value="true"/>
> +        <with-param name="endpoint_uri" value="http://localhost:9000/services/SimpleStockQuoteService"/>
> +        <with-param xmlns:m0="http://services.samples" name="iterate_exp" value="{{//m0:getQuote/m0:request}}"/>
> +        <with-param xmlns:m0="http://services.samples" name="attach_path" value="{{//m0:getQuote}}"/>
> +        <with-param name="sequence_ref" value="enr"/>
> +        <with-param xmlns:m0="http://services.samples" name="aggregator_exp" value="{{//m0:return}}"/>
> +        <with-param name="oncomplete_seq_enabled" value="true"/>
> +    </call-template>
> +</sequence>
> +<sequence xmlns="http://ws.apache.org/ns/synapse" name="enr">
> +    <log level="custom">
> +        <property name="text" value="seqhit"/>
> +    </log>
> +    <enrich>
> +        <source xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" clone="true"
> +                xpath="//m0:return[not(preceding-sibling::m0:return/m1:last &lt;= m1:last) and not(following-sibling::m0:return/m1:last &lt; m1:last)]"/>
> +        <target type="body"/>
> +    </enrich>
> +    <send/>
> +</sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_853.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_853.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_853.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_853.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,42 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Scatter-Gather eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +<sequence name="enr">
> +        <log level="custom">
> +            <property name="text" value="seqhit"/>
> +        </log>
> +        <enrich>
> +            <source xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" clone="true" xpath="//m0:return[not(preceding-sibling::m0:return/m1:last &lt;= m1:last) and not(following-sibling::m0:return/m1:last &lt; m1:last)]"/>
> +            <target type="body"/>
> +        </enrich>
> +        <send/>
> +    </sequence>
> +    <sequence name="main">
> +        <call-template target="synapse.lang.eip.scatter_gather">
> +            <with-param name="sequence_ref" value="enr"/>
> +            <with-param xmlns:m0="http://services.samples" name="aggregator_exp" value="{{//m0:return}}"/>
> +            <with-param name="oncomplete_seq_enabled" value="true"/>
> +            <with-param name="recipient_list" value="http://localhost:9001/services/SimpleStockQuoteService,http://localhost:9002/services/SimpleStockQuoteService,http://localhost:9003/services/SimpleStockQuoteService"/>
> +        </call-template>
> +    </sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_854.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_854.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_854.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_854.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,32 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Wire Tap eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +    <sequence name="main">
> +<property name="OUT_ONLY" value="true"/>
> +        <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
> +        <call-template target="synapse.lang.eip.wire_tap">
> +<with-param name="wiretap_uri" value="http://localhost:9000/services/SimpleStockQuoteService"/>
> +            <with-param name="destination_uri" value="http://localhost:9001/services/SimpleStockQuoteService"/>
> +        </call-template>
> +    </sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_855.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_855.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_855.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_855.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,66 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Content Based Router eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +<proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
> +        <target>
> +        <inSequence>
> +               <call-template target="synapse.lang.eip.content_based_router">
> +<with-param name="routing_exp" value="{{//m0:getQuote/m0:request/m0:symbol}}" xmlns:m0="http://services.samples"/>
> +<with-param name="match_content" value="IBM:cnd1_seq,MSFT:cnd2_seq;cnd3_seq"/>
> +    </call-template>
> +</inSequence>
> +<outSequence>
> +<send/>
> +   </outSequence>
> +    </target>
> +    </proxy>
> +<sequence name="send_seq">
> +        <log level="custom">
> +            <property name="DEBUG" value="Condition Satisfied"/>
> +        </log>
> +        <send>
> +            <endpoint name="simple">
> +                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
> +            </endpoint>
> +        </send>
> +    </sequence>
> +
> +    <sequence name="cnd1_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (I) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +    <sequence name="cnd2_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (II) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +    <sequence name="cnd3_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (III) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_856.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_856.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_856.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_856.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,65 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Dynamic Router eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> + <proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
> +        <target>
> +            <inSequence>
> +               <call-template target="synapse.lang.eip.dynamic_router">
> +<with-param name="conditions" value="header=foo:bar.*#url=/services/StockQuoteProxy.*;seq=cnd1_seq,header=custom_header1:bar.*@header=custom_header1:foo.*;seq=cnd2_seq,header=custom_header2:foo.*;seq=cnd3_seq"/>
> +    </call-template>
> +     </inSequence>
> +            <outSequence>
> +                <send/>
> +            </outSequence>
> +        </target>
> +    </proxy>
> +<sequence name="send_seq">
> +        <log level="custom">
> +            <property name="DEBUG" value="Condition Satisfied"/>
> +        </log>
> +        <send>
> +            <endpoint name="simple">
> +                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
> +            </endpoint>
> +        </send>
> +    </sequence>
> +
> +    <sequence name="cnd1_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (I) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +    <sequence name="cnd2_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (II) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +    <sequence name="cnd3_seq">
> +        <log level="custom">
> +            <property name="MSG_FLOW" value="Condition (III) Satisfied"/>
> +        </log>
> +        <sequence key="send_seq"/>
> +    </sequence>
> +</definitions>
>
> Added: synapse/trunk/java/repository/conf/sample/synapse_sample_857.xml
> URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_857.xml?rev=1373302&view=auto
> ==============================================================================
> --- synapse/trunk/java/repository/conf/sample/synapse_sample_857.xml (added)
> +++ synapse/trunk/java/repository/conf/sample/synapse_sample_857.xml Wed Aug 15 10:03:18 2012
> @@ -0,0 +1,32 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +  ~  Licensed to the Apache Software Foundation (ASF) under one
> +  ~  or more contributor license agreements.  See the NOTICE file
> +  ~  distributed with this work for additional information
> +  ~  regarding copyright ownership.  The ASF licenses this file
> +  ~  to you under the Apache License, Version 2.0 (the
> +  ~  "License"); you may not use this file except in compliance
> +  ~  with the License.  You may obtain a copy of the License at
> +  ~
> +  ~   http://www.apache.org/licenses/LICENSE-2.0
> +  ~
> +  ~  Unless required by applicable law or agreed to in writing,
> +  ~  software distributed under the License is distributed on an
> +  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  ~  KIND, either express or implied.  See the License for the
> +  ~  specific language governing permissions and limitations
> +  ~  under the License.
> +  -->
> +
> +<!-- Introduction to Synapse Recipient List eip function template -->
> +<definitions xmlns="http://ws.apache.org/ns/synapse">
> +<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
> +   <sequence name="main">
> +    <property name="OUT_ONLY" value="true"/>
> +                <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
> +    <call-template target="synapse.lang.eip.recipient_list">
> +        <with-param name="recipient_list" value="http://localhost:9000/services/SimpleStockQuoteService,http://localhost:9001/services/SimpleStockQuoteService"/>
> +    </call-template>
> +    <drop/>
> +</sequence>
> +</definitions>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message