synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r397884 [7/8] - in /incubator/synapse/trunk/scratch/synapse2: ./ bin/ modules/ modules/core/ modules/core/conf/ modules/core/src/ modules/core/src/org/ modules/core/src/org/apache/ modules/core/src/org/apache/synapse/ modules/core/src/org/a...
Date Fri, 28 Apr 2006 12:49:34 GMT
Added: incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/Axis2EnvSetup.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/Axis2EnvSetup.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/Axis2EnvSetup.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/Axis2EnvSetup.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,77 @@
+package org.apache.synapse.extensions.utils;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.synapse.axis2.SynapseMessageReceiver;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+import java.io.ByteArrayInputStream;
+
+/**
+ * Utils for extensions
+ */
+public class Axis2EnvSetup {
+    public static MessageContext axis2Deployment(String testingRepository)
+            throws AxisFault {
+        final ConfigurationContext configCtx = ConfigurationContextFactory
+                .createConfigurationContextFromFileSystem(testingRepository,null);
+        MessageContext msgCtx = new MessageContext();
+        msgCtx.setConfigurationContext(configCtx);
+        msgCtx.setEnvelope(testEnvSetup());
+        msgCtx.setServerSide(true);
+
+        AxisConfiguration axisConfiguration = msgCtx.getConfigurationContext()
+                .getAxisConfiguration();
+        AxisService service = new AxisService("se");
+        msgCtx.setAxisService(service);
+        service.setClassLoader(axisConfiguration.getServiceClassLoader());
+        AxisOperation axisOp = new InOutAxisOperation(
+                new QName("op"));
+        msgCtx.setAxisOperation(axisOp);
+        axisOp.setMessageReceiver(new SynapseMessageReceiver());
+        service.addOperation(axisOp);
+        axisConfiguration.addService(service);
+        msgCtx.setTo(
+                new EndpointReference("/axis2/services/" + "se" + "/" + "op"));
+        msgCtx.setSoapAction("op");
+        return msgCtx;
+    }
+
+    private static SOAPEnvelope testEnvSetup() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
+                .getDefaultEnvelope();
+        OMDocument doc = fac.createOMDocument();
+        doc.addChild(env);
+        OMElement ele = fac.createOMElement("text", "urn:text-body", "ns");
+        env.getBody().addChild(ele);
+        return env;
+    }
+
+    public static OMElement getSynapseConfigElement(String synapseXml)
+            throws XMLStreamException {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new ByteArrayInputStream(synapseXml.getBytes()));
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        StAXOMBuilder staxBuilder = new StAXOMBuilder(fac, parser);
+        return staxBuilder.getDocumentElement();
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/SimpleSpringBean.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/SimpleSpringBean.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/SimpleSpringBean.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/extensions/utils/SimpleSpringBean.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,47 @@
+package org.apache.synapse.extensions.utils;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseMessage;
+import junit.framework.TestCase;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class SimpleSpringBean implements Mediator {
+    public String getEpr() {
+        return epr;
+    }
+
+    public void setEpr(String epr) {
+        this.epr = epr;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    private String epr;
+    private String ip;
+
+    public boolean mediate(SynapseMessage smc) {
+        TestCase.assertNotNull(getIp());
+        TestCase.assertNotNull(getEpr());
+        return true;
+    }
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/spi/injection/SpringMediatorProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/spi/injection/SpringMediatorProcessorWithRuleTest.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/spi/injection/SpringMediatorProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/extensions/test/org/apache/synapse/spi/injection/SpringMediatorProcessorWithRuleTest.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,58 @@
+package org.apache.synapse.spi.injection;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.extensions.utils.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.axiom.om.OMElement;
+import junit.framework.TestCase;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (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.
+ */
+
+public class SpringMediatorProcessorWithRuleTest extends TestCase {
+    private MessageContext msgCtx;
+        private SynapseEnvironment env;
+        private String synapsexml =
+                "<synapse xmlns=\"http://ws.apache.org/ns/synapse\" xmlns:spring=\"http://ws.apache.org/ns/synapse/spring\">\n" +
+                        "<spring:springmediator bean=\"unit_test_spring_bean\" >\n" +
+                        "    <beans xmlns=\"\">\n" +
+                        "          <bean id=\"unit_test_spring_bean\" class=\"org.apache.synapse.extensions.utils.SimpleSpringBean\" >\n"+
+                        "              <property name=\"epr\">\n"+
+                        "                   <value>127.0.0.1:8008/axis2/services/MyService</value>\n"+
+                        "              </property>\n"+
+                        "              <property name=\"ip\">\n"+
+                        "                   <value>192.168.1.245</value>\n"+
+                        "              </property>\n"+
+                        "           </bean>\n"+
+                        "    </beans>\n" +
+                        "</spring:springmediator>\n"+
+                        "</synapse>";
+        public void setUp() throws Exception {
+            msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
+            OMElement config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+            env = new Axis2SynapseEnvironment(config,
+                    Thread.currentThread().getContextClassLoader());
+        }
+
+        public void testSpringProcessor() throws Exception {
+
+            SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
+            env.injectMessage(smc);
+
+        }
+
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/maven.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/maven.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/maven.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="jar"
+         xmlns:j="jelly:core"
+         xmlns:u="jelly:util"
+         xmlns:deploy="deploy"
+         xmlns:ant="jelly:ant"
+         xmlns:maven="jelly:maven"
+         xmlns:define="jelly:define">
+
+    <j:set var="dist.name" value="${pom.artifactId}-${pom.currentVersion}"/>
+    <!--<j:set var="dist.dir" value="target/dist"/>-->
+    <j:set var="mediators.dir" value="target/mediators"/>
+
+    <postGoal name="test:test">
+        <j:if test="${context.getVariable('maven.test.skip') != 'true'}">
+            <attainGoal name="toDistBin"/>
+        </j:if>
+    </postGoal>
+
+
+    <goal name="mediators">
+        <mkdir dir="target/mediators"/>
+        <echo message="----------------Creating DeprecationMediator aar----------------"/>
+        <mkdir dir="target/deprecation/META-INF"/>
+        <copy file="src/org/apache/synapse/mediators/deprecation/META-INF/services.xml"
+              tofile="target/deprecation/META-INF/services.xml"/>
+        <copy file="src/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml"
+              tofile="target/deprecation/META-INF/deprecation.xml"/>
+
+        <ant:copy todir="target/deprecation">
+            <ant:fileset dir="target/classes">
+                <ant:include name="**/deprecation/**"/>
+                <ant:exclude name="**/deprecation/**/*.xml"/>
+            </ant:fileset>
+        </ant:copy>
+
+        <echo message="----------------Creating SLAMediator aar----------------"/>
+        <mkdir dir="target/sla/META-INF"/>
+        <copy file="src/org/apache/synapse/mediators/sla/META-INF/services.xml"
+              tofile="target/sla/META-INF/services.xml"/>
+        <copy file="src/org/apache/synapse/mediators/sla/META-INF/sla.xml"
+              tofile="target/sla/META-INF/sla.xml"/>
+
+        <ant:copy todir="target/sla">
+            <ant:fileset dir="target/classes">
+                <ant:include name="**/sla/**"/>
+                <ant:exclude name="**/sla/**/*.xml"/>
+            </ant:fileset>
+        </ant:copy>
+
+        <mkdir dir="${mediators.dir}/deprecation"/>
+        <jar jarfile="target/mediators/deprecation/DeprecationMediator.aar"
+             basedir="target/deprecation">
+            <include name="**"/>
+        </jar>
+
+        <mkdir dir="${mediators.dir}/sla"/>
+        <jar jarfile="target/mediators/sla/SLAMediator.aar"
+             basedir="target/sla">
+            <include name="**"/>
+        </jar>
+
+        <mkdir dir="${mediators.dir}/deprecation/src"/>
+        <ant:copy todir="${mediators.dir}/deprecation/src">
+            <ant:fileset dir="src">
+                <ant:include name="org/apache/synapse/**/deprecation/**"/>
+            </ant:fileset>
+            <!-- To run the sample we include StockQuoteClient in the source path-->
+            <ant:fileset dir="../samples/src">
+                <ant:include name="samples/userguide/StockQuoteClient.java"/>
+            </ant:fileset>
+        </ant:copy>
+
+        <mkdir dir="${mediators.dir}/sla/src"/>
+        <ant:copy todir="${mediators.dir}/sla/src">
+            <ant:fileset dir="src">
+                <ant:include name="org/apache/synapse/**/sla/**"/>
+            </ant:fileset>
+            <!-- To run the sample we include StockQuoteClient in the source path-->
+            <ant:fileset dir="../samples/src">
+                <ant:include name="samples/userguide/StockQuoteClient.java"/>
+            </ant:fileset>
+        </ant:copy>
+
+    </goal>
+
+    <goal name="toDistBin" prereqs="mediators">
+        <property name="bin.dist.dir"
+                  value="target/dist-bin"/>
+        <ant:mkdir dir="${bin.dist.dir}"/>
+        <ant:mkdir dir="${bin.dist.dir}/mediators"/>
+
+        <ant:copy file="scripts/deprecation_mediator/synapse.xml"
+                  tofile="${bin.dist.dir}/mediators/deprecation/synapse.xml"/>
+        <ant:copy file="scripts/deprecation_mediator/README.txt"
+                  tofile="${bin.dist.dir}/mediators/deprecation/README.txt"/>
+        <ant:copy file="scripts/deprecation_mediator/build.xml"
+                  tofile="${bin.dist.dir}/mediators/deprecation/build.xml"/>
+
+        <ant:copy file="scripts/sla_mediator/synapse.xml"
+                  tofile="${bin.dist.dir}/mediators/sla/synapse.xml"/>
+        <ant:copy file="scripts/sla_mediator/README.txt"
+                  tofile="${bin.dist.dir}/mediators/sla/README.txt"/>
+        <ant:copy file="scripts/sla_mediator/build.xml"
+                  tofile="${bin.dist.dir}/mediators/sla/build.xml"/>
+
+        <ant:copy todir="${bin.dist.dir}/mediators">
+            <ant:fileset dir="target/mediators/">
+                <include name="**"/>
+            </ant:fileset>
+        </ant:copy>
+
+        <ant:delete dir="target/mediators"/>
+        <ant:delete dir="target/deprecation"/>
+        <ant:delete dir="target/sla"/>
+    </goal>
+</project>

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.properties
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.properties?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.properties (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.properties Fri Apr 28 05:49:17 2006
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed 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.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/project.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+
+    <name>Apache Synapse - Mediators</name>
+    <id>synapse-mediators</id>
+    <groupId>synapse</groupId>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+
+    <dependencies>
+
+        <dependency>
+            <groupId>synapse</groupId>
+            <artifactId>synapse-core</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>synapse</groupId>
+            <artifactId>synapse-extensions</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <nagEmailAddress>synapse-dev@ws.apache.org</nagEmailAddress>
+        <sourceDirectory>src</sourceDirectory>
+        <unitTestSourceDirectory>test</unitTestSourceDirectory>
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+            <!--<excludes>-->
+                <!--<exclude>**/*Test.java</exclude>-->
+            <!--</excludes>-->
+        </unitTest>
+        <!--b-->
+
+    </build>
+</project>
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/README.txt?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/README.txt (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/README.txt Fri Apr 28 05:49:17 2006
@@ -0,0 +1,15 @@
+Running Deprecation Mediator Sample
+===================================
+
+1. Copy synapse.xml in this repository to synapse_repository in the binary distribution.
+2. Place the DeprecationMediator.aar in the synape_repository/services.
+3. Using the Ant command "ant synapse", start the stand-alone synapse server. This will be start at port 8080. 
+4. Use Ant command "ant" StockQuoteClient to run the sample. 
+ 
+You will get an answer if the system date is not between 06/09/2005:00:00 and 07/02/2006:00:00 [DD/MM/yyyy:HH:mm]
+
+The prior configuration is available at deprecation.xml, where it will located at DeprecationMediator.aar's META-INF folder. 
+
+Note : 
+The service is deprecated between these dates, i.e. it is not available or is not to be used.
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/build.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/build.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/build.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/build.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,74 @@
+<project name="samples" default="help">
+    <target name="help">
+        <echo>
+            This script requires Ant 1.5 or higher
+
+            usage:
+            ant -help display ant help screen
+            ant help display this message
+            ant clean delete the built directory
+
+            ant compile build the deprecation_mediator sample
+
+            ant StockQuote [Symbol] [webserviceurl] [synapseurl] {optional[repository]}
+            Use the smart client - Synapse in WS-Addressing router mode
+
+        </echo>
+    </target>
+
+    <property name="symbol" value="IBM"/>
+    <property name="url" value="http://www.webservicex.net/stockquote.asmx"/>
+    <property name="synapseurl" value="http://localhost:8080"/>
+    <property name="repository" value="../../synapse_repository"/>
+
+    <property name="class.dir" value="target/classes"/>
+
+    <path id="axis.classpath">
+        <fileset dir="../../lib">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="clean">
+        <delete dir="target" quiet="true"/>
+        <delete dir="${class.dir}" quiet="true"/>
+    </target>
+
+
+    <target name="StockQuote" depends="compile">
+        <java classname="samples.userguide.StockQuoteClient"
+              classpathref="javac.classpath" fork="true">
+            <arg value="${symbol}"/>
+            <arg value="${url}"/>
+            <arg value="${synapseurl}"/>
+            <arg value="${repository}"/>
+        </java>
+    </target>
+
+    <target name="init">
+        <mkdir dir="${class.dir}"/>
+        <mkdir dir="src/ddl"/>
+
+        <path id="javac.classpath">
+            <pathelement path="${class.dir}"/>
+            <fileset dir="../../lib">
+                <include name="**/*.jar"/>
+            </fileset>
+        </path>
+    </target>
+
+    <target name="compile" depends="init" description="Compile all Java">
+        <javac srcdir="src" destdir="${class.dir}">
+            <classpath refid="javac.classpath"/>
+        </javac>
+    </target>
+
+    <target name="synapse">
+        <java classname="org.apache.axis2.transport.http.SimpleHTTPServer"
+              classpathref="axis.classpath" fork="true">
+            <arg value="../../synapse_repository"/>
+            <arg value="8080"/>
+        </java>
+    </target>
+
+</project>

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/synapse.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/synapse.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/synapse.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/deprecation_mediator/synapse.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,36 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+
+    <engage-addressing-in/>
+    <log/>
+
+    <!-- this matches the gateway case -->
+    <regex message-address="to" pattern="/StockQuote.*">
+        <ref ref="stockquote"/>
+    </regex>
+    <!-- this matches the virtual url case for either the proxy or ws-add case -->
+    <regex message-address="to" pattern="http://stockquote.*">
+        <ref ref="stockquote"/>
+    </regex>
+
+
+    <regex message-address="to"
+           pattern="http://www.webservicex.net/stockquote.asmx">
+        <servicemediator name="Deprecation" service="DeprecationMediator"/>
+    </regex>
+
+    <send/>
+
+    <never>
+        <stage name="stockquote">
+            <!-- set the To address to the real endpoint -->
+            <header type="to" value="http://www.webservicex.net/stockquote.asmx"/>
+            <!-- check if the symbol is MSFT -->
+            <xpath expr="//*[wsx:symbol='MSFT']" xmlns:wsx="http://www.webserviceX.NET/">
+                <!-- if it is throw a fault -->
+                <fault/>
+            </xpath>
+        </stage>
+
+    </never>
+</synapse>
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/README.txt?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/README.txt (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/README.txt Fri Apr 28 05:49:17 2006
@@ -0,0 +1,39 @@
+Hi everybody,
+
+Note
+-----
+
+A SLA or Service Level Aggrement, is between a consumer and a provider, enforced through a 
+contract or a policy.
+In this case its enforced through the SLAMediator and the configuration is stored in the sla.xml.
+Every known consumer, identified by the IP address of his system is alloted a priority for every 
+service for which SLA is to be enforced.
+In case more than 1 request for a given service, land on the server at the same time,
+the SLA mediator if provisioned is able to arrange these requests based on the priority alloted to
+the consumer for the given request. 
+
+Priority
+---------
+
+0  has the highest priority.
+-1 is returned in case there is no priority configured for this 
+   particular (consumer, service) combination.
+
+Return Value
+-------------
+
+true  - SLA successfully executed.
+false - Error while procesing.
+
+
+Running SLA Mediator Sample
+===================================
+
+1. Copy synapse.xml in this repository to synapse_repository in the binary distribution.
+2. Place the SLAMediator.aar in the synape_repository/services.
+3. Using the Ant command "ant synapse", start the stand-alone synapse server. 
+   This will be start at port 8080. 
+4. Use Ant command "ant" StockQuoteClient available in this folder to run the sample. 
+ 
+The configuration is available in sla.xml, which is located in SLAMediator.aar's META-INF folder. 
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/build.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/build.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/build.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/build.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,80 @@
+<project name="samples" default="help">
+    <target name="help">
+        <echo>
+            This script requires Ant 1.5 or higher
+
+            usage:
+            ant -help display ant help screen
+            ant help display this message
+            ant clean delete the built directory
+
+            ant compile build the deprecation_mediator sample
+
+            ant StockQuote [Symbol] [webserviceurl] [synapseurl] {optional[repository]}
+            Use the smart client - Synapse in WS-Addressing router mode
+
+            ant synapse
+                -Dport  
+                    The port on which Synapse should listen, as provided in the synapseurl.
+                    Default is 8080.
+
+        </echo>
+    </target>
+
+    <property name="symbol" value="IBM"/>
+    <property name="url" value="http://www.webservicex.net/stockquote.asmx"/>
+    <property name="synapseurl" value="http://localhost:8080"/>
+    <property name="repository" value="../../synapse_repository"/>
+
+    <property name="class.dir" value="target/classes"/>
+
+    <path id="axis.classpath">
+        <fileset dir="../../lib">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="clean">
+        <delete dir="target" quiet="true"/>
+        <delete dir="${class.dir}" quiet="true"/>
+    </target>
+
+
+    <target name="StockQuote" depends="compile">
+        <java classname="samples.userguide.StockQuoteClient"
+              classpathref="javac.classpath" fork="true">
+            <arg value="${symbol}"/>
+            <arg value="${url}"/>
+            <arg value="${synapseurl}"/>
+            <arg value="${repository}"/>
+        </java>
+    </target>
+
+    <target name="init">
+        <mkdir dir="${class.dir}"/>
+        <mkdir dir="src/ddl"/>
+
+        <path id="javac.classpath">
+            <pathelement path="${class.dir}"/>
+            <fileset dir="../../lib">
+                <include name="**/*.jar"/>
+            </fileset>
+        </path>
+    </target>
+
+    <target name="compile" depends="init" description="Compile all Java">
+        <javac srcdir="src" destdir="${class.dir}">
+            <classpath refid="javac.classpath"/>
+        </javac>
+    </target>
+
+    <target name="synapse">
+        <property name="port" value="8080"/>
+        <java classname="org.apache.axis2.transport.http.SimpleHTTPServer"
+              classpathref="javac.classpath" fork="true">
+            <arg value="../../synapse_repository"/>
+            <arg value="-p${port}"/>
+        </java>
+    </target>
+
+</project>

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/synapse.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/synapse.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/synapse.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/scripts/sla_mediator/synapse.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,40 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+
+    <stage name="logall">
+        <engage-addressing-in/>
+        <log/>
+    </stage>
+
+    <stage name="service-specific">
+        <!-- this matches the gateway case -->
+        <regex message-address="to" pattern="/StockQuote.*">
+            <ref ref="stockquote"/>
+        </regex>
+        <!-- this matches the virtual url case for either the proxy or ws-add case -->
+        <regex message-address="to" pattern="http://stockquote.*">
+            <ref ref="stockquote"/>
+        </regex>
+    </stage>
+
+    <stage name="check-sla" >
+        <regex message-address="to" pattern="http://www.webservicex.net/stockquote.asmx">
+            <servicemediator name="SLA" service="SLAMediator"/>
+        </regex>
+    </stage>
+
+    <stage name="sender">
+        <send/>
+    </stage>
+
+    <!-- these are only called if referenced above-->
+    <never>
+        <stage name="stockquote">
+            <header type="to" value="http://www.webservicex.net/stockquote.asmx" />
+            <xpath expr="//*[wsx:symbol='MSFT']" xmlns:wsx="http://www.webserviceX.NET/">
+                <fault/>
+            </xpath>
+        </stage>
+    </never>
+</synapse>
+
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfiguration.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.deprecation;
+
+public class DeprecationConfiguration {
+
+    private DeprecationRule rules[] = new DeprecationRule[0];
+    private String enabled;
+
+    public DeprecationConfiguration() {
+    }
+
+    public void addRule(DeprecationRule rule) {
+        DeprecationRule tmp[] = new DeprecationRule[rules.length + 1];
+        for (int i = 0; i < rules.length; i++) {
+            tmp[i] = rules[i];
+        }
+        tmp[rules.length] = rule;
+        this.rules = tmp;
+    }
+
+    public void removeRule() {
+        if (rules.length == 0)
+            return;
+        DeprecationRule tmp[] = new DeprecationRule[rules.length - 1];
+        for (int i = 0; i < rules.length - 1; i++) {
+            tmp[i] = rules[i];
+        }
+        this.rules = tmp;
+    }
+
+    public boolean hasRule(String service) {
+        for (int i = 0; i < rules.length; i++) {
+            if (rules[i].getService().equals(service)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public DeprecationRule[] getRules() {
+        return rules;
+    }
+
+    public void setEnabled(String enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getEnabled() {
+        return this.enabled;
+    }
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConfigurator.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.deprecation;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class DeprecationConfigurator {
+
+    /*
+    *** MAP STRUCTURE ***
+    The config map contains the parameter-sets for all the services and also a default
+    parameter set. The key to this map is the endPoint reference of the service and the
+    value associated with it is the parameter map corresponding to it.
+
+    <deprecationConfig>
+        <service Id = "the serviceEPR">
+                <parameterSet>
+                    <fromDate>value</fromDate>
+                    <toDate>value</toDate>
+                </parameterSet>
+                <parameterSet>
+                    <fromDate>value</fromDate>
+                    <toDate>value</toDate>
+                </parameterSet>*
+        </service>*
+    </deprecationConfig>
+
+    This should map to
+    key is ("serviceEPR")
+    value is (map of parameterSet) i.e.
+        map with key (parameter name), value (parameter value).
+    */
+
+    public Map deprecationConfig;
+    private Map configMap;
+
+    public DeprecationConfigurator(InputStream inStream) {
+
+        //Read from some source, probably a file and set the config map here.
+        //If the source is service specific, we can use getConfig() and only access
+        //service based parameters else make a general config and filter out the needed parameters
+        //and create a Map in the getConfig(EndpointReference to)
+        try {
+            configMap = generateMap(inStream);
+            setConfig(configMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map generateMap(InputStream inStream) throws Exception {
+
+
+        StAXOMBuilder staxOMBuilder;
+
+        staxOMBuilder = new StAXOMBuilder(inStream);
+
+        //Read the source and generate a map of the
+        Map generatedMap = new HashMap();
+
+        OMElement config = staxOMBuilder.getDocumentElement();
+        config.build();
+        Iterator serviceItr = config.getChildrenWithName(new QName(DeprecationConstants.CFG_DEPRECATION_SERVICE));
+
+        while (serviceItr.hasNext()) {
+            OMElement serviceEle = (OMElement) serviceItr.next();
+            String serviceKey = serviceEle.getAttributeValue(new QName("Id"));
+            Iterator paramItr = serviceEle.getChildElements();
+            int counter = 0;
+            Map dataMap = new HashMap();
+
+            while (paramItr.hasNext()) {
+                OMElement paramEle = (OMElement) paramItr.next();
+                Iterator dataItr = paramEle.getChildElements();
+
+                while (dataItr.hasNext()) {
+                    OMElement dataEle = (OMElement) dataItr.next();
+                    String dataName = dataEle.getLocalName() + "[" + counter + "]";
+                    String dataValue = dataEle.getText();
+                    dataMap.put(dataName, dataValue);
+                }
+
+                //Will be of use if multiple services are facaded by a single serviceEPR
+                dataMap.put(DeprecationConstants.CFG_DEPRECATION_SERVICE + "[" + counter + "]", serviceKey);
+                counter++;
+
+            }
+            generatedMap.put(serviceKey, dataMap);
+        }
+        return generatedMap;
+    }
+
+    public Map getConfig(EndpointReference to) {
+
+        //Filter out the required parameters and generate the ConfigMap for this service
+        //This is done by using the EndPointReference as a key into the configMap.
+        //The value object corresponding to it is the required deprecationMap.
+
+        deprecationConfig = (Map) configMap.get(to.getAddress());
+
+        return deprecationConfig;
+    }
+
+    public void setConfig(Map configMap) {
+
+        //In case we go for service-specific impl then the configMap will contain details
+        // for the single service alone, hence this line.
+        //If an aggregate approach is taken [i.e. all service data in a single source file]
+        // then this method should not assign configMap to deprecationConfig.
+
+        this.deprecationConfig = configMap;
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConstants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConstants.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConstants.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationConstants.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.deprecation;
+
+public interface DeprecationConstants {
+
+    public static final String CFG_DEPRECATION_SERVICE = "deprecationService";
+    public static final String CFG_DEPRECATION_FROM_DATE = "deprecationFromdate";
+    public static final String CFG_DEPRECATION_TO_DATE = "deprecationTodate";
+    public static final String CFG_DEPRECATION_ENABLED = "deprecationEnabled";
+    public static final String CFG_DEPRECATION_RESULT = "synapse.deprecation.result";
+    public static final String CFG_DEPRECATION_XML = "deprecation.xml";
+    public static final String CFG_XML_FOLDER = "META-INF";
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationMediator.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationMediator.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationMediator.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.deprecation;
+
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.api.Mediator;
+
+import java.util.Map;
+import java.io.InputStream;
+
+public class DeprecationMediator implements Mediator {
+
+    DeprecationConfiguration configuration;
+    private ClassLoader classLoader;
+    
+    public DeprecationMediator() {
+    }
+
+    public boolean mediate(SynapseMessage synapseMessageContext) {
+
+        try {
+
+            String resource = DeprecationConstants.CFG_XML_FOLDER+"/"+DeprecationConstants.CFG_DEPRECATION_XML;
+            InputStream inStream = classLoader.getResourceAsStream(resource);
+            final DeprecationConfigurator deprecationConfigurator =
+                    new DeprecationConfigurator(inStream);
+            Map mediatorConfig = deprecationConfigurator
+                    .getConfig(synapseMessageContext.getTo());
+            loadConfiguration(mediatorConfig);
+            DeprecationRule rules[] = configuration.getRules();
+            boolean deprecated = false;
+
+            for (int i = 0, len = rules.length; i < len; i++) {
+
+                if (rules[i].isDeprecated()) {
+
+                    deprecated = true;
+                }
+
+            }
+
+            synapseMessageContext.setProperty(
+                    DeprecationConstants.CFG_DEPRECATION_RESULT,
+                    Boolean.valueOf(deprecated));
+
+            return !(deprecated);
+
+        } catch (Exception e) {
+
+            return false;
+        }
+    }
+
+    private void loadConfiguration(Map mediatorConfig) {
+        configuration = new DeprecationConfiguration();
+
+        for (int i = 0; true; i++) {
+
+            String serviceKey = DeprecationConstants.CFG_DEPRECATION_SERVICE +
+                    "[" + i + "]";
+            String fromDateKey = DeprecationConstants
+                    .CFG_DEPRECATION_FROM_DATE + "[" + i + "]";
+            String toDateKey = DeprecationConstants.CFG_DEPRECATION_TO_DATE +
+                    "[" + i + "]";
+            String enabledKey = DeprecationConstants.CFG_DEPRECATION_ENABLED +
+                    "[" + i + "]";
+
+            if (mediatorConfig.get(serviceKey) == null) {
+                break;
+            }
+
+
+            DeprecationRule rule = new DeprecationRule();
+            rule.setService((String) mediatorConfig.get(serviceKey));
+            rule.setFromDate((String) mediatorConfig.get(fromDateKey));
+            rule.setToDate((String) mediatorConfig.get(toDateKey));
+            rule.setEnabled((String) mediatorConfig.get(enabledKey));
+            configuration.addRule(rule);
+        }
+
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment se) {
+        //not used for now
+    }
+
+    public void setClassLoader(ClassLoader cl) {
+        this.classLoader = cl;
+    }
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationRule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationRule.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationRule.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/DeprecationRule.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.deprecation;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+public class DeprecationRule {
+
+    private String service;
+    private String fromDate;
+    private String toDate;
+    private String enabled;
+
+    public DeprecationRule() {
+
+    }
+
+    public DeprecationRule(String service) {
+        this.service = service;
+    }
+
+    public String getService() {
+        return this.service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getFromDate() {
+        return this.fromDate;
+    }
+
+    public void setFromDate(String fromDate) {
+        this.fromDate = fromDate;
+    }
+
+    public String getToDate() {
+        return this.toDate;
+    }
+
+    public void setToDate(String toDate) {
+        this.toDate = toDate;
+    }
+
+    public String getEnabled() {
+        return this.enabled;
+    }
+
+    public void setEnabled(String enabled) {
+        this.enabled = enabled;
+    }
+
+    public boolean isDeprecated() {
+        try {
+            if (Boolean.TRUE == Boolean.valueOf(enabled)) {
+                Calendar current = Calendar.getInstance();
+                TimeZone tz = current.getTimeZone();
+                int offset = tz.getRawOffset();
+                Calendar calendar = new GregorianCalendar(tz);
+
+                DateFormat df = new SimpleDateFormat("d/M/y:H:m");
+                df.setTimeZone(tz);
+
+                Date d1 = df.parse(fromDate);
+                Calendar fromCalendar = new GregorianCalendar(tz);
+                d1.setTime(d1.getTime() + offset);
+                fromCalendar.setTime(d1);
+
+                if (toDate == null || (toDate.length() == 0)) {
+                    return calendar.before(fromCalendar);
+                }
+
+                Date d2 = df.parse(toDate);
+                Calendar toCalendar = new GregorianCalendar(tz);
+                d2.setTime(d2.getTime() + offset);
+                toCalendar.setTime(d2);
+
+                return (calendar.after(fromCalendar) && calendar.before(toCalendar));
+            }
+        } catch (ParseException e) {
+            return false;
+        }
+
+        return false;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(1024);
+        buf.append("Service : ").append(getService()).append("\n");
+        buf.append("FromDate: ").append(getFromDate()).append("\n");
+        buf.append("ToDate: ").append(getToDate()).append("\n");
+        buf.append("Enabled: ").append(getEnabled()).append("\n");
+
+        return buf.toString();
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/deprecation.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,11 @@
+<!-- The time format is dd/mm/yyyy:H:m and its with respect to UTC.
+TimeZone is that of the system, offset from UTC is calculated internally -->
+<deprecationConfig>
+    <deprecationService Id="http://www.webservicex.net/stockquote.asmx">
+        <parameterSet>
+            <deprecationFromdate>06/09/2005:00:00</deprecationFromdate>
+            <deprecationTodate>07/02/2006:00:00</deprecationTodate>
+            <deprecationEnabled>true</deprecationEnabled>
+        </parameterSet>
+    </deprecationService>
+</deprecationConfig>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/services.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/services.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/META-INF/services.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,10 @@
+<!-- Can be used if the mediator is to be provided as an axis2 service-->
+<service name="DeprecationMediator">
+    <parameter name="ServiceClass" locked="false">
+        org.apache.synapse.mediators.deprecation.DeprecationMediator</parameter>
+    <operation name="mediate">
+        <messageReceiver
+                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+    </operation>
+</service>
+  
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/README.txt?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/README.txt (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/deprecation/README.txt Fri Apr 28 05:49:17 2006
@@ -0,0 +1,35 @@
+Hi everybody,
+
+Note
+-----
+
+This is the first shot towards a Deprecation mediator.
+A trivial explanation would be - A service configured as deprecated between certain dates/time will not
+be accessible for requests coming in between those dates.
+You are free to declare more than one set of dates/time and enable or disable the set when required.
+
+The mediator depends on the UTC - Date/time settings and these are converted and offset to local time,
+during processing, internally.
+
+It implements the Mediator interface and hence has the "boolean mediate(SynapseMessage)" method.
+The configuration data about the deprecation for a particular service is provided in a 
+"deprecation.xml" file.
+
+When a SynapseContext is sent to the DeprecationMediator it checks wether the service to which the request is
+addressed is deprecatd or not. It sets the value in the "synapse.deprecation.result" property in the synapseContext.
+
+Return Values
+--------------
+True - Service is not deprecated, the request can go on.
+False - The service is deprecated, need not send the request to the service.
+
+To try out the mediator
+------------------------
+
+ - Modify the deprecation.xml present in the 
+      * aar (in case you are using the binary)
+      * src/org/apache/synapse/mediators/deprection/META-INF (in case you are working with the source)
+   to suit the configuration you want.
+ - Send in a request to Synapse and see it work/get rejected depending on the settings.
+
+~Lots of scope for enhancement and improvement. Will keep adding up!
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/services.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/services.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/services.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,10 @@
+<!-- Can be used if the mediator is to be provided as an axis2 service-->
+<service name="SLAMediator">
+    <parameter name="ServiceClass" locked="false">
+        org.apache.synapse.mediators.sla.SLAMediator</parameter>
+    <operation name="mediate">
+        <messageReceiver
+                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+    </operation>
+</service>
+  
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/sla.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/sla.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/sla.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/META-INF/sla.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,17 @@
+<slaConfig>
+    <slaRequest ip="192.168.6.71" enabled="true">
+        <serviceURL url="http://www.webservicex.net/stockquote.asmx" enabled="true" >
+            <priority>0</priority>
+        </serviceURL>    
+    </slaRequest>
+    <slaRequest ip="192.168.6.81" enabled="true">
+        <serviceURL url="http://www.webservicex.net/stockquote.asmx" enabled="true" >
+            <priority>0</priority>
+        </serviceURL>    
+    </slaRequest>    
+    <slaRequest ip="192.168.6.127" enabled="true">
+        <serviceURL url="http://www.webservicex.net/stockquote.asmx" enabled="true" >
+            <priority>1</priority>
+        </serviceURL>    
+    </slaRequest>
+</slaConfig>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/README.txt?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/README.txt (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/README.txt Fri Apr 28 05:49:17 2006
@@ -0,0 +1,37 @@
+Note
+-----
+
+A SLA or Service Level Aggrement, is between a consumer and a provider, enforced through a 
+contract or a policy.
+In this case its enforced through the SLAMediator and the configuration is stored in the sla.xml.
+Every known consumer, identified by the IP address of his system is alloted a priority for every 
+service for which SLA is to be enforced.
+In case more than 1 request for a given service, lands on the server at the same time,
+the SLA mediator if provisioned will be able to arrange these requests based on the priority assigned to
+the them for the given request. 
+
+Priority
+---------
+
+0  has the highest priority.(it's an int value)
+-1 is returned in case there is no priority configured for a 
+   particular (consumer, service) combination.
+
+Return Value
+-------------
+
+true  - SLA successfully executed.
+false - Error while procesing.
+
+
+Running SLA Mediator Sample
+===================================
+
+1. Copy synapse.xml in this repository to synapse_repository in the binary distribution.
+2. Place the SLAMediator.aar in the synape_repository/services.
+3. Using the Ant command "ant synapse", start the stand-alone synapse server. 
+   This will be start at port 8080. 
+4. Use Ant command "ant" StockQuoteClient available in this folder to run the sample. 
+
+The configuration details are available in sla.xml, which is located in SLAMediator's META-INF folder. 
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConfigurator.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConfigurator.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConfigurator.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.sla;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.OMElement;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.io.InputStream;
+
+
+public class SLAConfigurator {
+    private static Map SLAConfig;
+    private Log log = LogFactory.getLog(getClass());
+
+
+       public SLAConfigurator(InputStream inStream) {
+
+           try {
+               Map configMap = generateMap(inStream);
+               setConfig(configMap);
+           } catch (Exception e) {
+               log.info(e);
+           }
+       }
+
+       private Map generateMap(InputStream inStream) throws Exception {
+
+
+           StAXOMBuilder staxOMBuilder;
+           staxOMBuilder = new StAXOMBuilder(inStream);
+           Map generatedMap = new HashMap();
+           OMElement config = staxOMBuilder.getDocumentElement();
+           config.build();
+           Iterator clientItr = config.getChildrenWithName(new QName("slaRequest"));
+           while (clientItr.hasNext()) {
+               OMElement clientEle = (OMElement) clientItr.next();
+               String enabled = clientEle.getAttributeValue(new QName("enabled"));
+               boolean isClientEnabled = enabled.equalsIgnoreCase("true");
+               if(isClientEnabled){
+
+                   String clientKey = clientEle.getAttributeValue(new QName("ip"));
+                   Iterator serviceItr = clientEle.getChildrenWithName(new QName("serviceURL"));
+
+                   Map dataMap = new HashMap();
+
+                   while (serviceItr.hasNext()) {
+                       OMElement serviceEle = (OMElement) serviceItr.next();
+                       OMElement priorityEle = serviceEle.getFirstChildWithName(new QName("priority"));
+                       String serviceEnabled = serviceEle.getAttributeValue(new QName("enabled"));
+                       boolean isServiceEnabled = serviceEnabled.equalsIgnoreCase("true");
+                       if(isServiceEnabled) {
+                           String serviceKey = serviceEle.getAttributeValue(new QName("url"));
+                           String priority = priorityEle.getText();
+                           dataMap.put(serviceKey,priority);
+                       }
+                   }
+                   generatedMap.put(clientKey, dataMap);
+               }
+           }
+           return generatedMap;
+       }
+
+       public int getPriority(String ip, EndpointReference to) {
+
+           int priority=-1;
+           Map clientMap = (Map) SLAConfig.get(ip);
+           if(clientMap!=null){
+               log.info("address" + to.getAddress());
+               String priorityValue = (String)clientMap.get(to.getAddress());
+                if(priorityValue!=null){
+                    priority = Integer.parseInt(priorityValue);
+                }
+           }
+           return priority;
+       }
+
+       public void setConfig(Map configMap) {
+
+           SLAConfig = configMap;
+
+       }
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConstants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConstants.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConstants.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAConstants.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.sla;
+
+public interface SLAConstants {
+
+    public static final String CFG_SLA_ENABLED = "slaEnabled";
+    public static final String CFG_SLA_RESULT = "synapse.sla.result";
+    public static final String CFG_SLA_XML = "sla.xml";
+    public static final String CFG_XML_FOLDER = "META-INF";
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAMediator.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAMediator.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAMediator.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.sla;
+
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
+
+import org.apache.synapse.api.Mediator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.InputStream;
+
+public class SLAMediator implements Mediator {
+		private ClassLoader classLoader;
+
+	private SynapseEnvironment se;
+
+	private Log log = LogFactory.getLog(getClass());
+
+	public SLAMediator() {
+	}
+
+	public boolean mediate(SynapseMessage synapseMessageContext) {
+
+		try {
+			log.info("SLA Mediator!");
+			// MessageContext mc =
+			// ((Axis2SynapseMessage)synapseMessageContext).getMessageContext();
+			String resource = SLAConstants.CFG_XML_FOLDER + "/"
+					+ SLAConstants.CFG_SLA_XML;
+			InputStream inStream = classLoader.getResourceAsStream(resource);
+			final SLAConfigurator slaConfigurator = new SLAConfigurator(
+					inStream);
+			SLAStack slaStack = null;
+			try {
+				if (se.getProperty("PRIORITY_STACK") != null) {
+					slaStack = (SLAStack) se.getProperty("PRIORITY_STACK");
+				} else {
+					slaStack = new SLAStack();
+					se.setProperty("PRIORITY_STACK", slaStack);
+				}
+			} catch (Exception ex) {
+				log.info(ex);
+
+			}
+			String fromAddress = (String) synapseMessageContext.getFrom()
+					.getAddress();
+			int priority = slaConfigurator.getPriority(fromAddress,
+					synapseMessageContext.getTo());
+			SLAObject slaObject = new SLAObject(priority, System
+					.currentTimeMillis(), fromAddress);
+			try {
+				slaStack.addRequest(slaObject);
+			} catch (Exception ex) {
+				log.info(ex);
+			}
+
+			while (true) {
+				if (!slaStack.isEmpty()) {
+					SLAObject slaObjectStack = (SLAObject) slaStack.get(0);
+					if (slaObjectStack.equals(slaObject)) {
+						slaStack.remove(0);
+						break;
+					}
+				} else {
+					break;
+				}
+			}
+
+			return true;
+
+		} catch (Exception e) {
+			log.info(e);
+			return false;
+		}
+	}
+
+	public void setSynapseEnvironment(SynapseEnvironment se) {
+
+		this.se = se;
+		if (se != null) {
+			log.info("ENVIRONMENT NOT NULL IN SLA");
+		}
+	}
+
+	public void setClassLoader(ClassLoader cl) {
+		this.classLoader = cl;
+	}
+
+
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAObject.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAObject.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAObject.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAObject.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.sla;
+
+public class SLAObject implements Comparable {
+
+    int priority;
+    long time;
+    Object object;
+
+    public SLAObject() {
+    }
+
+    public SLAObject(int priority, long time, Object object) {
+        this.priority = priority;
+        this.time = time;
+        this.object = object;
+    }
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int index) {
+        this.priority = index;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    public Object getObject() {
+        return object;
+    }
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+
+    public int compareTo(Object o2) {
+        SLAObject obj1 = this;
+        SLAObject obj2 = (SLAObject) o2;
+        if (obj1.getTime() == obj2.getTime()) {
+            if (obj1.getPriority() == obj2.getPriority()) {
+                if (obj1.hashCode() == obj2.hashCode()) {
+                    return 0;
+                } else if (obj1.hashCode() < obj2.hashCode()) {
+                    return -1;
+                } else return 1;
+            } else if (obj1.getPriority() < obj2.getPriority()) {
+                return -1;
+            } else {
+                return 1;
+            }
+        } else if (obj1.getTime() < obj2.getTime()) {
+            return -1;
+        } else {
+            return 1;
+        }
+    }
+}

Added: incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAStack.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAStack.java?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAStack.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/mediators/src/org/apache/synapse/mediators/sla/SLAStack.java Fri Apr 28 05:49:17 2006
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.sla;
+import java.util.Collections;
+import java.util.ArrayList;
+
+public class SLAStack extends ArrayList
+{
+  /**
+	 * Needs a serialVersionUID as ArrayList is serializable. 
+	 */
+	private static final long serialVersionUID = 2705084012795071404L;
+	
+public SLAStack()
+  {
+  }
+  public void addRequest(SLAObject slaObject)
+  {
+      this.add(slaObject);
+      if(this.size() > 1){
+          Collections.sort(this);
+      }
+  }
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synapse2/modules/samples/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/samples/maven.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/samples/maven.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/samples/maven.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="jar"
+         xmlns:j="jelly:core"
+         xmlns:u="jelly:util"
+         xmlns:deploy="deploy"
+         xmlns:ant="jelly:ant"
+         xmlns:maven="jelly:maven"
+         xmlns:define="jelly:define">
+
+    <j:set var="dist.name" value="${pom.artifactId}-${pom.currentVersion}"/>
+    <!--<j:set var="dist.dir" value="target/dist"/>-->
+    <j:set var="samples.dir" value="target/samples"/>
+
+    <postGoal name="test:test">
+        <j:if test="${context.getVariable('maven.test.skip') != 'true'}">
+            <attainGoal name="toDistBin"/>
+        </j:if>
+    </postGoal>
+
+
+    <goal name="samples_userguide">
+
+        <mkdir dir="target/samples"/>
+        <mkdir dir="${samples.dir}/src"/>
+        <ant:copy todir="${samples.dir}/src">
+            <ant:fileset dir="src">
+                <ant:include name="samples/**"/>
+            </ant:fileset>
+        </ant:copy>
+
+    </goal>
+
+    <goal name="toDistBin" prereqs="samples_userguide">
+        <property name="bin.dist.dir"
+                  value="target/dist-bin"/>
+        <ant:mkdir dir="${bin.dist.dir}"/>
+        <ant:mkdir dir="${bin.dist.dir}/samples"/>
+
+        <ant:copy file="scripts/userguide/build.xml"
+                  tofile="${bin.dist.dir}/samples/build.xml"/>
+        <ant:copy file="scripts/userguide/README.txt"
+                  tofile="${bin.dist.dir}/samples/README.txt"/>
+
+        <ant:copy todir="${bin.dist.dir}/samples">
+            <ant:fileset dir="target/samples/">
+                <include name="**"/>
+            </ant:fileset>
+        </ant:copy>
+        <ant:delete dir="target/samples"/><ant:delete dir="target/samples"/>
+    </goal>
+</project>

Added: incubator/synapse/trunk/scratch/synapse2/modules/samples/project.properties
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/samples/project.properties?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/samples/project.properties (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/samples/project.properties Fri Apr 28 05:49:17 2006
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed 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.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar

Added: incubator/synapse/trunk/scratch/synapse2/modules/samples/project.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/samples/project.xml?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/samples/project.xml (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/samples/project.xml Fri Apr 28 05:49:17 2006
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <name>Apache Synapse - Sample</name>
+    <id>synapse-sample</id>
+    <groupId>synapse</groupId>
+
+    <dependencies>
+        <dependency>
+            <groupId>synapse</groupId>
+            <artifactId>synapse-core</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>synapse</groupId>
+            <artifactId>synapse-mediators</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>synapse</groupId>
+            <artifactId>synapse-extensions</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <!-- external JARs -->
+        <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-core</artifactId>
+            <version>${axis2.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>${commons.httpclient.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>commons-discovery</groupId>
+            <artifactId>commons-discovery</artifactId>
+            <version>${commons.discovery.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>${commons.codec.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>${log4j.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>${stax.impl.groupid}</groupId>
+            <artifactId>${stax.impl.artifactid}</artifactId>
+            <version>${stax.impl.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>${stax.api.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis-wsdl4j</artifactId>
+            <version>${axis.wsdl4j.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-javamail</artifactId>
+            <version>${geronimo.spec.javamail.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-activation</artifactId>
+            <version>${geronimo.spec.activation.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-jms</artifactId>
+            <version>${geronimo.spec.jms.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <properties>
+                <classloader>root</classloader>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxen</groupId>
+            <artifactId>jaxen</artifactId>
+            <version>${jaxen.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.6.0</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>annogen</groupId>
+            <artifactId>annogen</artifactId>
+            <version>${annogen.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>XmlSchema</artifactId>
+            <version>${XmlSchema.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>policy</artifactId>
+            <version>${policy.version}</version>
+            <properties>
+                <module>false</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>axiom</artifactId>
+            <version>${axiom.version}</version>
+            <properties>
+                <module>false</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
+            <version>${backport_util_concurrent.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+    </dependencies>    
+</project>
+

Added: incubator/synapse/trunk/scratch/synapse2/modules/samples/scripts/userguide/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/samples/scripts/userguide/README.txt?rev=397884&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/samples/scripts/userguide/README.txt (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/samples/scripts/userguide/README.txt Fri Apr 28 05:49:17 2006
@@ -0,0 +1,11 @@
+Running Userguide Samples
+=========================
+
+To run these samples, please use Ant 1.5 or above. Ant can be downloaded from 
+http://ant.apache.org
+
+For help on running these samples try
+> ant help 
+
+Thanks
+The Synapse team
\ No newline at end of file



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


Mime
View raw message