You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by vi...@apache.org on 2006/02/13 13:16:27 UTC

svn commit: r377364 - in /incubator/synapse/trunk/java/scripts/samples/sla_mediator: ./ README.txt build.xml synapse.xml

Author: vikas
Date: Mon Feb 13 04:16:25 2006
New Revision: 377364

URL: http://svn.apache.org/viewcvs?rev=377364&view=rev
Log:
Add-on to SLA mediator!

Added:
    incubator/synapse/trunk/java/scripts/samples/sla_mediator/
    incubator/synapse/trunk/java/scripts/samples/sla_mediator/README.txt
    incubator/synapse/trunk/java/scripts/samples/sla_mediator/build.xml
    incubator/synapse/trunk/java/scripts/samples/sla_mediator/synapse.xml

Added: incubator/synapse/trunk/java/scripts/samples/sla_mediator/README.txt
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/scripts/samples/sla_mediator/README.txt?rev=377364&view=auto
==============================================================================
--- incubator/synapse/trunk/java/scripts/samples/sla_mediator/README.txt (added)
+++ incubator/synapse/trunk/java/scripts/samples/sla_mediator/README.txt Mon Feb 13 04:16:25 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/java/scripts/samples/sla_mediator/build.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/scripts/samples/sla_mediator/build.xml?rev=377364&view=auto
==============================================================================
--- incubator/synapse/trunk/java/scripts/samples/sla_mediator/build.xml (added)
+++ incubator/synapse/trunk/java/scripts/samples/sla_mediator/build.xml Mon Feb 13 04:16:25 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="axis.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="axis.classpath" fork="true">
+            <arg value="../../synapse_repository"/>
+            <arg value="-p${port}"/>
+        </java>
+    </target>
+
+</project>

Added: incubator/synapse/trunk/java/scripts/samples/sla_mediator/synapse.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/scripts/samples/sla_mediator/synapse.xml?rev=377364&view=auto
==============================================================================
--- incubator/synapse/trunk/java/scripts/samples/sla_mediator/synapse.xml (added)
+++ incubator/synapse/trunk/java/scripts/samples/sla_mediator/synapse.xml Mon Feb 13 04:16:25 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>
+
+



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