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

Log:
Fixed docs.

Modified:
   branches/esb/java/2.1/product/docs/xdoc/mediators/class.xml
   branches/esb/java/2.1/product/docs/xdoc/mediators/send.xml

Modified: branches/esb/java/2.1/product/docs/xdoc/mediators/class.xml
URL: 
http://wso2.org/svn/browse/wso2/branches/esb/java/2.1/product/docs/xdoc/mediators/class.xml?rev=40488&r1=40487&r2=40488&view=diff
==============================================================================
--- branches/esb/java/2.1/product/docs/xdoc/mediators/class.xml (original)
+++ branches/esb/java/2.1/product/docs/xdoc/mediators/class.xml Wed Jul  1 
01:26:28 2009
@@ -69,7 +69,104 @@
   </ul>
 
 <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: branches/esb/java/2.1/product/docs/xdoc/mediators/send.xml
URL: 
http://wso2.org/svn/browse/wso2/branches/esb/java/2.1/product/docs/xdoc/mediators/send.xml?rev=40488&r1=40487&r2=40488&view=diff
==============================================================================
--- branches/esb/java/2.1/product/docs/xdoc/mediators/send.xml  (original)
+++ branches/esb/java/2.1/product/docs/xdoc/mediators/send.xml  Wed Jul  1 
01:26:28 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