Author: indika
Date: Wed Jun  3 11:23:54 2009
New Revision: 37663
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=37663

Log:
add rule mediator samples and required resources to run samples

Added:
   trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/advanced_rule_base.xml
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/always_ibm.xml
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/commission_rule.xml
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.drl
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.xml
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_back_rule.drl
   
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_forward_rule.drl
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_600.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_601.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_602.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_603.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_604.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_605.xml
   trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_606.xml

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/advanced_rule_base.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/advanced_rule_base.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/advanced_rule_base.xml
  Wed Jun  3 11:23:54 2009
@@ -0,0 +1,59 @@
+<package name="AdvancedRoutingRules"
+         xmlns="http://drools.org/drools-5.0";
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
+         xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
+
+    <import name="org.apache.synapse.MessageContext"/>
+    <import name="org.wso2.rule.Inputs"/>
+    <import name="org.wso2.rule.Outputs"/>
+    <import name="org.apache.synapse.Mediator"/>
+
+    <rule name="Invoke IBM ">
+        <lhs>
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+            <eval>((String)inputs.get("symbol")).equals("IBM")</eval>
+        </lhs>
+
+        <rhs>
+            ((Mediator)inputs.get("ibmSeq")).mediate(mc);
+        </rhs>
+    </rule>
+
+    <rule name="Invoke SUN ">
+        <lhs>
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+            <eval>((String)inputs.get("symbol")).equals("SUN")</eval>
+        </lhs>
+
+        <rhs>
+            ((Mediator)inputs.get("sunSeq")).mediate(mc);
+        </rhs>
+    </rule>
+
+    <rule name="Invoke MFST ">
+        <lhs>
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+            <eval>((String)inputs.get("symbol")).equals("MSFT")</eval>
+        </lhs>
+
+        <rhs>
+            ((Mediator)inputs.get("msftSeq")).mediate(mc);
+        </rhs>
+    </rule>
+
+</package>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/always_ibm.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/always_ibm.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/always_ibm.xml
  Wed Jun  3 11:23:54 2009
@@ -0,0 +1,28 @@
+<package name="SimpleMessageTransformationRules"
+         xmlns="http://drools.org/drools-5.0";
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
+         xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
+
+    <import name="org.apache.synapse.MessageContext"/>
+    <import name="org.wso2.rule.Inputs"/>
+    <import name="org.wso2.rule.Outputs"/>
+
+    <rule name="Invoke Always IBM ">
+        <lhs>
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+            <eval>((String)inputs.get("symbol")).equals("MSFT")
+                || ((String)inputs.get("symbol")).equals("SUN")
+            </eval>
+        </lhs>
+
+        <rhs>
+            outputs.put("symbol","IBM");
+        </rhs>
+    </rule>
+
+</package>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/commission_rule.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/commission_rule.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/commission_rule.xml
     Wed Jun  3 11:23:54 2009
@@ -0,0 +1,32 @@
+<package name="SimpleMessageTransformationRules"
+         xmlns="http://drools.org/drools-5.0";
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
+         xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
+
+    <import name="org.apache.synapse.MessageContext"/>
+    <import name="org.wso2.rule.Inputs"/>
+    <import name="org.wso2.rule.Outputs"/>
+    <import name="java.lang.Double"/>
+
+
+    <rule name="Get commission form SUN and MSFT but not from IBM ">
+        <lhs>
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+            <eval>((String)inputs.get("symbol")).equals("MSFT")
+                || ((String)inputs.get("symbol")).equals("SUN")
+            </eval>
+        </lhs>
+
+        <rhs>
+            Double price = (Double)inputs.get("price");
+            Object newPrice = price.doubleValue()+ 3000.68;
+            outputs.put("price",newPrice);
+        </rhs>
+    </rule>
+
+</package>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.drl
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.drl?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.drl
    Wed Jun  3 11:23:54 2009
@@ -0,0 +1,24 @@
+<drl>
+    <![CDATA[
+package SimpleRoutingRules;
+
+import org.apache.synapse.MessageContext;
+import org.wso2.rule.Inputs;
+import org.wso2.rule.Outputs;
+
+rule InvokeIBM
+
+when
+
+inputs : Inputs()
+outputs : Outputs()
+eval( ((String)inputs.get("symbol")).equals("IBM") )
+
+then
+
+outputs.put("execute_children","true");
+
+end
+
+]]>
+</drl>

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/simple_rule_base.xml
    Wed Jun  3 11:23:54 2009
@@ -0,0 +1,30 @@
+<package name="SimpleRoutingRules"
+         xmlns="http://drools.org/drools-5.0";
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
+         xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
+
+    <import name="org.apache.synapse.MessageContext"/>
+    <import name="org.wso2.rule.Inputs"/>
+    <import name="org.wso2.rule.Outputs"/>
+
+    <rule name="Invoke IBM ">
+
+        <lhs>
+
+            <pattern object-type="MessageContext" identifier="mc">
+            </pattern>
+            <pattern object-type="Inputs" identifier="inputs">
+            </pattern>
+            <pattern object-type="Outputs" identifier="outputs">
+            </pattern>
+
+            <eval>((String)inputs.get("symbol")).equals("IBM")</eval>
+        </lhs>
+
+        <rhs>
+            outputs.put("execute_children","true");
+        </rhs>
+
+    </rule>
+
+</package>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_back_rule.drl
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_back_rule.drl?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_back_rule.drl
  Wed Jun  3 11:23:54 2009
@@ -0,0 +1,30 @@
+<drl>
+    <![CDATA[
+package BackwardTransformation;
+
+import org.apache.synapse.MessageContext;
+import org.wso2.rule.Inputs;
+import org.wso2.rule.Outputs;
+import samples.CheckPriceResponse;
+
+rule BackwardTransformation
+
+when
+
+inputs : Inputs()
+outputs : Outputs()
+eval( (inputs.get("price") != null) && (inputs.get("symbol") != null) )
+
+then
+
+CheckPriceResponse response = new CheckPriceResponse();
+
+response.setCode((String)inputs.get("symbol"));
+response.setPrice(((Double)inputs.get("price")).toString());
+
+outputs.put("response",response);
+
+end
+
+]]>
+</drl>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_forward_rule.drl
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_forward_rule.drl?pathrev=37663
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/samples/src/main/conf/synapse/resources/rule/tranform_forward_rule.drl
       Wed Jun  3 11:23:54 2009
@@ -0,0 +1,31 @@
+<drl>
+    <![CDATA[
+package ForwardTransformation;
+
+import org.apache.synapse.MessageContext;
+import org.wso2.rule.Inputs;
+import org.wso2.rule.Outputs;
+import samples.GetQuoteRequest;
+
+rule ForwardTransformation
+
+when
+
+inputs : Inputs()
+outputs : Outputs()
+
+eval( (inputs.get("symbol") != null) )
+
+then
+
+GetQuoteRequest request = new GetQuoteRequest();
+
+request.setSymbol((String)inputs.get("symbol"));
+outputs.put("request",request);
+
+outputs.put("execute_children","true");
+
+end
+
+]]>
+</drl>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_600.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_600.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_600.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,82 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Simple rule based routing  of messages - same as filter mediator -->
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+
+    <in>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource>
+
+                    <package name="SimpleRoutingRules"
+                             xmlns="http://drools.org/drools-5.0";
+                             
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
+                             xs:schemaLocation="http://drools.org/drools-5.0 
drools-4.0.xsd">
+
+                        <import name="org.apache.synapse.MessageContext"/>
+                        <import name="org.wso2.rule.Inputs"/>
+                        <import name="org.wso2.rule.Outputs"/>
+
+                        <rule name="Invoke IBM ">
+
+                            <lhs>
+
+                                <pattern object-type="MessageContext" 
identifier="mc">
+                                </pattern>
+                                <pattern object-type="Inputs" 
identifier="inputs">
+                                </pattern>
+                                <pattern object-type="Outputs" 
identifier="outputs">
+                                </pattern>
+
+                                
<eval>((String)inputs.get("symbol")).equals("IBM")</eval>
+                            </lhs>
+
+                            <rhs>
+                                outputs.put("execute_children","true");
+                            </rhs>
+
+                        </rule>
+                    </package>
+
+                </ruleSource>
+
+                <input name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                       xmlns:m0="http://services.samples"; type="string"/>
+            </configuration>
+
+            <childMediators>
+                <send>
+                    <endpoint>
+                        <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                    </endpoint>
+                </send>
+                <drop/>
+            </childMediators>
+
+        </rule>
+
+    </in>
+
+    <out>
+        <send/>
+    </out>
+
+</definitions>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_601.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_601.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_601.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,61 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Simple rule based routing  of messages - same as filter mediator -->
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+
+    <localEntry key="rule-script-key"
+                
src="file:repository/samples/resources/rule/simple_rule_base.xml"/>
+
+    <in>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-key"/>
+
+                <input name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                       xmlns:m0="http://services.samples"; type="string"/>
+            </configuration>
+            <childMediators>
+                <send>
+                    <endpoint>
+                        <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                    </endpoint>
+                </send>
+                <drop/>
+            </childMediators>
+
+        </rule>
+
+    </in>
+
+    <out>
+        <send/>
+    </out>
+
+</definitions>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_602.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_602.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_602.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,69 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!--  Simple rule based routing  of messages - same as filter mediator -->
+<!-- The use of Drools native language -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+
+    <localEntry key="rule-script-key"
+                
src="file:repository/samples/resources/rule/simple_rule_base.drl"/>
+
+    <in>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-key" sourceFormat="drl"/>
+
+                <ruleSet>
+                    <creation>
+                        <property name="source" value="drl"/>
+                    </creation>
+                </ruleSet>
+
+                <input name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                       xmlns:m0="http://services.samples"; type="string"/>
+            </configuration>
+            <childMediators>
+                <send>
+                    <endpoint>
+                        <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                    </endpoint>
+                </send>
+                <drop/>
+            </childMediators>
+
+        </rule>
+
+    </in>
+
+    <out>
+        <send/>
+    </out>
+
+</definitions>

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_603.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_603.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_603.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,96 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Advance rule based routing - Switching routing decision from rules  -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+
+    <localEntry key="rule-script-key"
+                
src="file:repository/samples/resources/rule/advanced_rule_base.xml"/>
+
+    <sequence name="ibmSequence">
+        <send>
+            <endpoint>
+                <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+            </endpoint>
+        </send>
+    </sequence>
+
+    <sequence name="myFaultHandler">
+        <makefault>
+            <code value="tns:Receiver" 
xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
+            <reason expression="get-property('ERROR_MESSAGE')"/>
+        </makefault>
+
+        <property name="RESPONSE" value="true"/>
+        <header name="To" expression="get-property('ReplyTo')"/>
+        <send/>
+    </sequence>
+
+    <sequence name="sunSequence" onError="myFaultHandler">
+
+        <send>
+            <endpoint>
+                <address 
uri="http://localhost:9009/services/NonExistentStockQuoteService"/>
+            </endpoint>
+        </send>
+        <drop/>
+
+    </sequence>
+
+    <sequence name="msftSequence" onError="myFaultHandler">
+
+        <send>
+            <endpoint>
+                <address 
uri="http://bogus:9000/services/NonExistentStockQuoteService"/>
+            </endpoint>
+        </send>
+        <drop/>
+
+    </sequence>
+
+    <in>
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-key"/>
+                <input name="ibmSeq" key="ibmSequence" type="sequence"/>
+                <input name="sunSeq" key="sunSequence" type="sequence"/>
+                <input name="msftSeq" key="msftSequence" type="sequence"/>
+
+                <input name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                       xmlns:m0="http://services.samples"; type="string"/>
+            </configuration>
+        </rule>
+
+        <drop/>
+
+    </in>
+
+    <out>
+        <send/>
+    </out>
+</definitions>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_604.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_604.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_604.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,59 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Simple rule based transformation (changing message )  -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+
+    <localEntry key="rule-script-key"
+                src="file:repository/samples/resources/rule/always_ibm.xml"/>
+    <in>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-key"/>
+                <input name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                       xmlns:m0="http://services.samples"; type="string"/>
+                <output name="symbol" 
expression="//m0:getQuote/m0:request/m0:symbol"
+                        xmlns:m0="http://services.samples"; type="string"/>
+            </configuration>
+
+        </rule>
+
+        <send>
+            <endpoint>
+                <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+            </endpoint>
+        </send>
+
+    </in>
+
+    <out>
+        <send/>
+    </out>
+
+</definitions>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_605.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_605.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_605.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,61 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Simple rule based transformation (changing message ) -->
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+    <localEntry key="rule-script-key"
+                
src="file:repository/samples/resources/rule/commission_rule.xml"/>
+    <in>
+        <send>
+            <endpoint>
+                <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+            </endpoint>
+        </send>
+    </in>
+
+    <out>
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-key"/>
+                <input name="symbol" type="string"
+                       
expression="self::node()//m0:return/m1:symbol/child::text()"
+                       xmlns:m0="http://services.samples";
+                       xmlns:m1="http://services.samples/xsd"/>
+                <input name="price" type="double"
+                       
expression="self::node()//m0:return/m1:last/child::text()"
+                       xmlns:m0="http://services.samples";
+                       xmlns:m1="http://services.samples/xsd"/>
+
+                <output name="price" type="double"
+                        expression="self::node()//m0:return/m1:last"
+                        xmlns:m0="http://services.samples";
+                        xmlns:m1="http://services.samples/xsd"/>
+            </configuration>
+        </rule>
+        <send/>
+    </out>
+</definitions>
\ No newline at end of file

Added: 
trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_606.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_606.xml?pathrev=37663
==============================================================================
--- (empty file)
+++ trunk/esb/java/modules/samples/src/main/conf/synapse/synapse_sample_606.xml 
Wed Jun  3 11:23:54 2009
@@ -0,0 +1,100 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<!-- Transformation with custom Java object -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse";>
+
+    <!-- the SimpleURLRegistry allows access to a URL based registry (e.g. 
file:/// or http://) -->
+    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <parameter name="root">file:repository/samples/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+    <localEntry key="rule-script-forward-key"
+                
src="file:repository/samples/resources/rule/tranform_forward_rule.drl"/>
+    <localEntry key="rule-script-back-key"
+                
src="file:repository/samples/resources/rule/tranform_back_rule.drl"/>
+
+    <in>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-forward-key" sourceFormat="drl"/>
+                <ruleSet>
+                    <creation>
+                        <property name="source" value="drl"/>
+                    </creation>
+                </ruleSet>
+
+                <input name="symbol"
+                       
expression="self::node()//m0:CheckPriceRequest/m0:Code/child::text()"
+                       xmlns:m0="http://services.samples"; type="string"/>
+
+                <output name="request" 
expression="self::node()//m0:CheckPriceRequest"
+                        xmlns:m0="http://services.samples";
+                        class="samples.GetQuoteRequest" type="custom"/>
+            </configuration>
+            <childMediators>
+                <send>
+                    <endpoint>
+                        <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                    </endpoint>
+                </send>
+                <drop/>
+            </childMediators>
+        </rule>
+
+    </in>
+
+    <out>
+
+        <rule>
+            <configuration 
xmlns="http://www.wso2.org/products/wso2commons/rule";>
+                <ruleSource key="rule-script-back-key" sourceFormat="drl"/>
+
+                <ruleSet>
+                    <creation>
+                        <property name="source" value="drl"/>
+                    </creation>
+                </ruleSet>
+
+                <input name="symbol" type="string"
+                       
expression="self::node()//m0:return/m1:symbol/child::text()"
+                       xmlns:m0="http://services.samples";
+                       xmlns:m1="http://services.samples/xsd"/>
+
+                <input name="price" type="double"
+                       
expression="self::node()//m0:return/m1:last/child::text()"
+                       xmlns:m0="http://services.samples";
+                       xmlns:m1="http://services.samples/xsd"/>
+
+                <output name="response" type="custom"
+                        expression="self::node()//m0:return"
+                        class="samples.CheckPriceResponse"
+                        xmlns:m0="http://services.samples"/>
+            </configuration>
+        </rule>
+
+        <send/>
+
+    </out>
+</definitions>
\ No newline at end of file

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to