Author: rajika
Date: Wed Jul  1 01:26:38 2009
New Revision: 40489
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=40489

Log:
Fixed docs.

Modified:
   trunk/esb/java/docs/xdoc/mediators/class.xml
   trunk/esb/java/docs/xdoc/mediators/send.xml

Modified: trunk/esb/java/docs/xdoc/mediators/class.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/mediators/class.xml?rev=40489&r1=40488&r2=40489&view=diff
==============================================================================
--- trunk/esb/java/docs/xdoc/mediators/class.xml        (original)
+++ trunk/esb/java/docs/xdoc/mediators/class.xml        Wed Jul  1 01:26:38 2009
@@ -68,8 +68,105 @@
     </li>
   </ul>
 
-<h3>Example</h3>
+    <h3>Example</h3>
+    <pre xml:space="preserve">&lt;definitions 
xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
 
+        &lt;sequence name=&quot;fault&quot;&gt;
+            &lt;makefault&gt;
+                &lt;code value=&quot;tns:Receiver&quot; 
xmlns:tns=&quot;http://www.w3.org/2003/05/soap-envelope&quot;/&gt;
+                &lt;reason value=&quot;Mediation failed.&quot;/&gt;
+            &lt;/makefault&gt;
+            &lt;send/&gt;
+        &lt;/sequence&gt;
+
+        &lt;sequence name=&quot;main&quot; onError=&quot;fault&quot;&gt;
+            &lt;in&gt;
+                &lt;send&gt;
+                    &lt;endpoint name=&quot;stockquote&quot;&gt;
+                        &lt;address 
uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;
+                    &lt;/endpoint&gt;
+                &lt;/send&gt;
+            &lt;/in&gt;
+            &lt;out&gt;
+                &lt;class 
name=&quot;samples.mediators.SimpleClassMediator&quot;&gt;
+                    &lt;property name=&quot;varible1&quot; 
value=&quot;10&quot;/&gt;
+                    &lt;property name=&quot;varible2&quot; 
value=&quot;5&quot;/&gt;
+                &lt;/class&gt;
+                &lt;send/&gt;
+            &lt;/out&gt;
+        &lt;/sequence&gt;
+
+    &lt;/definitions&gt;</pre>
+
+    <p>In this configuration, ESB hands over the request message to the 
specified endpoint, which sends it to the
+        Axis2 server running on port 9000. But the response message is passed 
through the class mediator before sending it
+        back to the client. Two parameters named "varible1" and "varible2" are 
passed to the instance mediator
+        implementation class(SimpleClassMediator). Look at the following 
sample class mediator. Note how the
+        SynapseMessageContext and to the full Synapse API in there. </p>
+    <p>A simple class mediator implementaion. </p>
+
+    <pre xml:space="preserve">package samples.mediators;
+
+    import org.apache.synapse.MessageContext;
+    import org.apache.synapse.Mediator;
+    import org.apache.axiom.om.OMElement;
+    import org.apache.axiom.om.OMAbstractFactory;
+    import org.apache.axiom.om.OMFactory;
+    import org.apache.axiom.soap.SOAPFactory;
+    import org.apache.commons.logging.Log;
+    import org.apache.commons.logging.LogFactory;
+
+    import javax.xml.namespace.QName;
+
+    public class SimpleClassMediator implements Mediator {
+
+        private static final Log log = 
LogFactory.getLog(DiscountQuoteMediator.class);
+
+        private String varible1=&quot;10&quot;;
+
+        private String varible2=&quot;10&quot;;
+
+        private int varible3=0;
+
+        public DiscountQuoteMediator(){}
+
+        public boolean mediate(MessageContext mc) {
+            // Do somthing useful..
+            // Note the access to the Synapse Message context
+            return true;
+        }
+
+        public String getType() {
+            return null;
+        }
+
+        public void setTraceState(int traceState) {
+            traceState = 0;
+        }
+
+        public int getTraceState() {
+            return 0;
+        }
+
+        public void setvarible1(String newValue) {
+            varible1=newValue;
+        }
+
+        public String getvarible1() {
+            return varible1;
+        }
+
+        public void setvarible2(String newValue){
+            varible2=newValue;
+        }
+
+        public String getvarible2(){
+            return varible2;
+        }
+    }</pre>
+
+    <p>A fully working sample is availble. See synapase configuration lanaguge 
guide for detailed(under
+        section called class mediator) working sample.</p>
 
 </body>
 </html>

Modified: trunk/esb/java/docs/xdoc/mediators/send.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/mediators/send.xml?rev=40489&r1=40488&r2=40489&view=diff
==============================================================================
--- trunk/esb/java/docs/xdoc/mediators/send.xml (original)
+++ trunk/esb/java/docs/xdoc/mediators/send.xml Wed Jul  1 01:26:38 2009
@@ -81,7 +81,7 @@
 accessed from the Manage-&gt; Mediation-&gt; Endpoints menu from the left hand
 side bar.</em> 
 
-<h3>Usage Scenario</h3>
+<h3>Example</h3>
 
 <p>Send mediator used in in-path and out path</p>
 <pre xml:space="preserve">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;    

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

Reply via email to