You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ka...@apache.org on 2011/12/23 12:55:09 UTC

svn commit: r1222651 [12/14] - in /synapse/branches/2.1: ./ modules/distribution/ modules/distribution/src/main/assembly/ modules/documentation/ modules/documentation/src/ modules/documentation/src/site/ modules/documentation/src/site/resources/ module...

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample600.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample600.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample600.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample600.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 600</title>
+    </properties>
+    <body>
+        <section name="Sample 600: File Hierarchy Based Configuration Builder">
+            <p>
+                In this sample we will be looking at how Synapse configuration files can be
+                organized into a single rooted file hierarchy. We will be using the following set
+                of files and directories.
+            </p>
+            <div class="consoleOutput">synapse_sample_600.xml
+            |-- endpoints
+            |   `-- foo.xml
+            |-- events
+            |   `-- event1.xml
+            |-- local-entries
+            |   `-- bar.xml
+            |-- proxy-services
+            |   |-- proxy1.xml
+            |   |-- proxy2.xml
+            |   `-- proxy3.xml
+            |-- registry.xml
+            |-- sequences
+            |   |-- custom-logger.xml
+            |   |-- fault.xml
+            |   `-- main.xml
+            |-- synapse.xml
+            `-- tasks
+                `-- task1.xml</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the ability to load the Synapse configuration from a file hierarchy
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 600 (this is available
+                            in the directory at repository/conf/sample/synapse_sample_600.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 600<br/>
+                                Windows: synapse.bat -sample 600
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Description">
+                <p>
+                    Go to the SYNAPSE_HOME/repository/conf/sample directory and locate the subdirectory
+                    named synapse_sample_600.xml within it. When Synapse is started with the sample
+                    configuration 600, Synapse will load the configuration from this directory. You
+                    will find a number of subdirectories and a set of XML files in each of those
+                    directories. Synapse will parse all the XML files in this file hierarchy and
+                    construct the full Synapse configuration at startup. As a result when this sample
+                    is executed Synapse will start with four proxy services, several sequences, a task,
+                    an event source and some endpoint and local entry definitions.
+                </p>
+                <p>
+                    The names of the subdirectories (eg: proxy-services, sequences, endpoints) are
+                    fixed and hence cannot be changed. Also the registry definition should go into a
+                    file named registry.xml which resides at the top level of the file hierarchy. It
+                    can also be specified in the synapse.xml file at top level. This synapse.xml file
+                    can include any item that can be normally defined in a synapse.xml file. The files
+                    which define proxy services, sequences, endpoints etc can have any name. These
+                    configuration files must have the .xml extension at the end of the name. Synapse
+                    will ignore any files which do not have the .xml extension.
+                </p>
+                <p>
+                    None of the directories and files in the sample file hierachy are mandatory. You
+                    can leave entire directories out if you do not need them. For example if your
+                    configuration does not contain any proxy services you can leave the
+                    subdirectory named proxy-services out.
+                </p>
+                <p>
+                    To use this feature you should simply pass a path to an existing directory when
+                    starting the Synapse server. The SynapseServer class which is responsible for
+                    starting the server accepts a file path as an argument from where to
+                    load the configuration. Generally we pass the path to the synapse.xml file as the
+                    value of this argument. If you pass a directory path instead, Synapse configuration
+                    will be loaded from the specified directory. Note the following line on the console
+                    when Synapse is loading the configuration from a file hierarchy.
+                </p>
+                <div class="consoleOutput">2009-08-04 14:14:42,489 [-] [main]  INFO SynapseConfigurationBuilder Loaded Synapse configuration from the directory hierarchy at : /home/synapse/repository/conf/sample/synapse_sample_600.xml</div>
+                <p>
+                    This feature comes in handy when managing large Synapse configurations. It is
+                    easier to maintain a well structured file hierarchy than managing one large, flat
+                    XML file.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample601.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample601.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample601.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample601.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 601</title>
+    </properties>
+    <body>
+        <section name="Sample 601: Using Synapse Observers">
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the ability to monitor the Synapse configuration at runtime using the
+                    SynapseObserver interface
+                </p>
+            </subsection>
+            <subsection name="Running the Sample">
+                <p>
+                    Open the synapse.properties file in the SYNAPSE_HOME/repository/conf directory
+                    using a text editor and uncomment the line which defines the simple logging
+                    Synapse observer.
+                </p>
+                <div class="consoleOutput">synapse.observers=samples.userguide.SimpleLoggingObserver</div>
+                <p>
+                    Open the log4j.properties file in the SYNAPSE_HOME/lib directory and
+                    uncomment the line which sets the INFO log level to the samples.userguide
+                    package.
+                </p>
+                <div class="consoleOutput">log4j.category.samples.userguide=INFO</div>
+                <p>
+                    Start Synapse using any of the sample configurations. The SimpleLoggingObserver
+                    will capture events that occur while constructing the Synapse configuration
+                    and log them on the console as follows.
+                </p>
+                <div class="consoleOutput">2009-08-06 14:30:24,578 [-] [main]  INFO SimpleLoggingObserver Simple logging observer initialized...Capturing Synapse events...
+ 2009-08-06 14:30:24,604 [-] [main]  INFO SimpleLoggingObserver Endpoint : a3 was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,605 [-] [main]  INFO SimpleLoggingObserver Endpoint : a2 was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,606 [-] [main]  INFO SimpleLoggingObserver Endpoint : null was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,611 [-] [main]  INFO SimpleLoggingObserver Local entry : a1 was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,649 [-] [main]  INFO SimpleLoggingObserver Proxy service : StockQuoteProxy2 was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,661 [-] [main]  INFO SimpleLoggingObserver Proxy service : StockQuoteProxy1 was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,664 [-] [main]  INFO SimpleLoggingObserver Sequence : main was added to the Synapse configuration successfully
+ 2009-08-06 14:30:24,701 [-] [main]  INFO SimpleLoggingObserver Sequence : fault was added to the Synapse configuration successfully</div>
+                <p>
+                    The SimpleLoggingObserver is implemented as follows. It does not override any of the event handler implementations
+                    in the AbstractSynapseObserver class. The AbstractSynapseObserver logs all the received events by default.
+                </p>
+                <div class="consoleOutput">package samples.userguide;
+
+import org.apache.synapse.config.AbstractSynapseObserver;
+
+public class SimpleLoggingObserver extends AbstractSynapseObserver {
+
+    public SimpleLoggingObserver() {
+        super();
+        log.info("Simple logging observer initialized...Capturing Synapse events...");
+    }
+}</div>
+            </subsection>            
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample650.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample650.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample650.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample650.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 650</title>
+    </properties>
+    <body>
+        <section name="Sample 650: Introduction to Priority Based Mediation">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;priorityExecutor name="exec"&gt;
+        &lt;queues&gt;
+            &lt;queue size="100" priority="1"/&gt;
+            &lt;queue size="100" priority="10"/&gt;
+        &lt;/queues&gt;
+    &lt;/priorityExecutor&gt;
+
+    &lt;proxy name="StockQuoteProxy"&gt;
+        &lt;target&gt;
+            &lt;inSequence&gt;
+                &lt;filter source="$trp:priority" regex="1"&gt;
+                    &lt;then&gt;
+                        &lt;enqueue priority="1" sequence="priority_sequence" executor="exec"/&gt;
+                    &lt;/then&gt;
+                    &lt;else&gt;
+                        &lt;enqueue priority="10" sequence="priority_sequence" executor="exec"/&gt;
+                    &lt;/else&gt;
+                &lt;/filter&gt;
+            &lt;/inSequence&gt;
+            &lt;outSequence&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/&gt;
+    &lt;/proxy&gt;
+
+    &lt;sequence name="priority_sequence"&gt;
+        &lt;log level="full"/&gt;
+        &lt;send&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+        &lt;/send&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the usage of priority executors in Synapse to assign priority levels
+                    to requests and mediate them based on the assigned priority
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 650 (repository/conf/sample/synapse_sample_650.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 650<br/>
+                                Windows: synapse.bat -sample 650
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Priority is applied only when synapse is loaded with enough messages to consume
+                    all of its core worker threads. So to observe the priority based mediation, it is
+                    required to use a load testing tool like JMeter, SOAP UI or Apache bench.
+                </p>
+                <p>
+                    In this sample, client should send a HTTP header that specifies the priority of
+                    the message.This header name is 'priority'. This header is retrieved in the synapse
+                    configuration using the $trp:priority XPath expression. Then it is matched against
+                    the value 1. If it has the value 1, message is executed with priority 1. Otherwise
+                    the message is executed with priority 10.
+                </p>
+                <p>
+                    Messages with different priorities are put into different priority queues. Then they
+                    are mediated in a manner so that high priority messages are always processed first.
+                </p>
+                <p>
+                    Here are two sample SOAP requests that can be used to invoke the service using a
+                    tool like JMeter, or Apache Bench. For SOAP UI, user can use the WSDL
+                    repository/conf/sample/resources/proxy/sample_proxy_1.wsdl to create the request.
+                    The only difference between the two requests shown here is the symbol. One
+                    has the symbol as IBM and other has MSFT. For one type of requests set the priority
+                    header to 1 and for the next set the priority header to 10. Then load Synapse with
+                    a large volume of traffic consisting of both types of requests using the load testing tool.
+                    Back end Axis2 server prints the symbol of the incoming requests. User should be
+                    able to see more of the high priority symbol.
+                </p>
+                <div class="xmlConf">&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+     &lt;soapenv:Header xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot;&gt;
+        &lt;wsa:To&gt;http://localhost:8281/services/SimpleStockQuoteService&lt;/wsa:To&gt;
+        &lt;wsa:MessageID&gt;urn:uuid:1B57D0B0BF770678DE1261165228620&lt;/wsa:MessageID&gt;
+        &lt;wsa:Action&gt;urn:getQuote&lt;/wsa:Action&gt;
+     &lt;/soapenv:Header&gt;
+     &lt;soapenv:Body&gt;
+        &lt;m0:getQuote xmlns:m0=&quot;http://services.samples&quot;&gt;
+           &lt;m0:request&gt;
+              &lt;m0:symbol&gt;IBM&lt;/m0:symbol&gt;
+           &lt;/m0:request&gt;
+        &lt;/m0:getQuote&gt;
+     &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</div>
+           <div class="xmlConf">&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+     &lt;soapenv:Header xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot;&gt;
+        &lt;wsa:To&gt;http://localhost:8281/services/SimpleStockQuoteService&lt;/wsa:To&gt;
+        &lt;wsa:MessageID&gt;urn:uuid:1B57D0B0BF770678DE1261165228620&lt;/wsa:MessageID&gt;
+        &lt;wsa:Action&gt;urn:getQuote&lt;/wsa:Action&gt;
+     &lt;/soapenv:Header&gt;
+     &lt;soapenv:Body&gt;
+        &lt;m0:getQuote xmlns:m0=&quot;http://services.samples&quot;&gt;
+           &lt;m0:request&gt;
+              &lt;m0:symbol&gt;MSFT&lt;/m0:symbol&gt;
+           &lt;/m0:request&gt;
+        &lt;/m0:getQuote&gt;
+     &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample651.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample651.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample651.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample651.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 651</title>
+    </properties>
+    <body>
+        <section name="Sample 651: Priority Based Dispatching at Transport Level">
+            <p>
+                For this sample we will be using the same Synapse configuration used in
+                <a href="sample150.html">sample 150</a>. In addition we will be using the following
+                priority configuration for the Synapse NHTTP transport.
+            </p>
+            <div class="xmlConf">&lt;priorityConfiguration&gt;
+    &lt;priorityExecutor&gt;
+        &lt;!-- two priorities specified with priority 10 and 1. Both priority messages has a queue depth of 100 --&gt;
+        &lt;queues isFixedCapacity=&quot;true&quot; nextQueue=&quot;org.apache.synapse.commons.executors.PRRNextQueueAlgorithm&quot;&gt;
+            &lt;queue size=&quot;100&quot; priority=&quot;10&quot;/&gt;
+            &lt;queue size=&quot;100&quot; priority=&quot;1&quot;/&gt;
+        &lt;/queues&gt;
+        &lt;!-- these are the default values, values are put here to show their availability --&gt;
+        &lt;threads core=&quot;20&quot; max=&quot;100&quot; keep-alive=&quot;5&quot;/&gt;
+    &lt;/priorityExecutor&gt;
+
+    &lt;!-- if a message comes that we cannot determine priority, we set a default priority of 1 --&gt;
+    &lt;conditions defaultPriority=&quot;1&quot;&gt;
+        &lt;condition priority=&quot;10&quot;&gt;
+            &lt;!-- check for the header named priority --&gt;
+            &lt;equal type=&quot;header&quot; source=&quot;priority&quot; value=&quot;5&quot;/&gt;
+        &lt;/condition&gt;
+        &lt;condition priority=&quot;1&quot;&gt;
+            &lt;equal type=&quot;header&quot; source=&quot;priority&quot; value=&quot;1&quot;/&gt;
+        &lt;/condition&gt;
+    &lt;/conditions&gt;
+&lt;/priorityConfiguration&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate priority based dispatching capabilities of the Synapse NHTTP
+                    transport
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Open axis2.xml file in repository/conf directory and uncomment the
+                            following parameter in the NHTTP transport receiver configuration.
+                            <br/><strong>priorityConfigFile</strong>
+                            <br/>Set the value to repository/conf/sample/resources/priority/priority-configuration.xml
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 150 (repository/conf/sample/synapse_sample_150.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 150<br/>
+                                Windows: synapse.bat -sample 150
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Priority is applied only when synapse is loaded with enough messages to consume
+                    all of its core worker threads. So to observe the priority based mediation, it is
+                    required to use a load testing tool like JMeter, SOAP UI or Apache bench.
+                </p>
+                <p>
+                    In this sample, client should send a HTTP header that specifies the priority of
+                    the message.This header name is 'priority'. This header is retrieved in the synapse
+                    configuration using the $trp:priority XPath expression. Then it is matched against
+                    the value 1. If it has the value 1, message is executed with priority 1. Otherwise
+                    the message is executed with priority 10.
+                </p>
+                <p>
+                    Messages with different priorities are put into different priority queues. Then they
+                    are mediated in a manner so that high priority messages are always processed first.
+                </p>
+                <p>
+                    Here are two sample SOAP requests that can be used to invoke the service using a
+                    tool like JMeter, or Apache Bench. For SOAP UI, user can use the WSDL
+                    repository/conf/sample/resources/proxy/sample_proxy_1.wsdl to create the request.
+                    The only difference between the two requests shown here is the symbol. One
+                    has the symbol as IBM and other has MSFT. For one type of requests set the priority
+                    header to 1 and for the next set the priority header to 10. Then load Synapse with
+                    a large volume of traffic consisting of both types of requests using the load testing tool.
+                    Back end Axis2 server prints the symbol of the incoming requests. User should be
+                    able to see more of the high priority symbol.
+                </p>
+                <div class="xmlConf">&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+     &lt;soapenv:Header xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot;&gt;
+        &lt;wsa:To&gt;http://localhost:8281/services/SimpleStockQuoteService&lt;/wsa:To&gt;
+        &lt;wsa:MessageID&gt;urn:uuid:1B57D0B0BF770678DE1261165228620&lt;/wsa:MessageID&gt;
+        &lt;wsa:Action&gt;urn:getQuote&lt;/wsa:Action&gt;
+     &lt;/soapenv:Header&gt;
+     &lt;soapenv:Body&gt;
+        &lt;m0:getQuote xmlns:m0=&quot;http://services.samples&quot;&gt;
+           &lt;m0:request&gt;
+              &lt;m0:symbol&gt;IBM&lt;/m0:symbol&gt;
+           &lt;/m0:request&gt;
+        &lt;/m0:getQuote&gt;
+     &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</div>
+           <div class="xmlConf">&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+     &lt;soapenv:Header xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot;&gt;
+        &lt;wsa:To&gt;http://localhost:8281/services/SimpleStockQuoteService&lt;/wsa:To&gt;
+        &lt;wsa:MessageID&gt;urn:uuid:1B57D0B0BF770678DE1261165228620&lt;/wsa:MessageID&gt;
+        &lt;wsa:Action&gt;urn:getQuote&lt;/wsa:Action&gt;
+     &lt;/soapenv:Header&gt;
+     &lt;soapenv:Body&gt;
+        &lt;m0:getQuote xmlns:m0=&quot;http://services.samples&quot;&gt;
+           &lt;m0:request&gt;
+              &lt;m0:symbol&gt;MSFT&lt;/m0:symbol&gt;
+           &lt;/m0:request&gt;
+        &lt;/m0:getQuote&gt;
+     &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</div>
+                <p>
+                    In this sample, priority based mediation takes place at the transport level
+                    itself (before the message is even received by the mediation engine). High
+                    priority messages will reach the service bus first.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample652.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample652.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample652.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample652.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 652</title>
+    </properties>
+    <body>
+        <section name="Sample 652: Distributed transaction management">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+&lt;sequence name="myFaultHandler"&gt;
+    &lt;log level="custom"&gt;
+        &lt;property name="text" value="** Rollback Transaction**"/&gt;
+    &lt;/log&gt;
+    &lt;transaction action="rollback"/&gt;
+    &lt;send/&gt;
+&lt;/sequence&gt;
+
+&lt;sequence name="main" onError="myFaultHandler"&gt;
+    &lt;in&gt;
+        &lt;send&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+        &lt;/send&gt;
+    &lt;/in&gt;
+
+    &lt;out&gt;
+        &lt;transaction action="new"/&gt;
+
+        &lt;log level="custom"&gt;
+            &lt;property name="text" value="** Reporting to the Database esbdb**"/&gt;
+        &lt;/log&gt;
+        &lt;dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse"&gt;
+            &lt;connection&gt;
+                &lt;pool&gt;
+                    &lt;dsName&gt;java:jdbc/XADerbyDS&lt;/dsName&gt;
+                    &lt;icClass&gt;org.jnp.interfaces.NamingContextFactory&lt;/icClass&gt;
+                    &lt;url&gt;localhost:1099&lt;/url&gt;
+                    &lt;user&gt;synapse&lt;/user&gt;
+                    &lt;password&gt;synapse&lt;/password&gt;
+                &lt;/pool&gt;
+            &lt;/connection&gt;
+            &lt;statement&gt;
+                &lt;sql&gt;delete from company where name =?&lt;/sql&gt;
+                &lt;parameter expression="//m0:return/m1:symbol/child::text()"
+                           xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd"
+                           type="VARCHAR"/&gt;
+            &lt;/statement&gt;
+        &lt;/dbreport&gt;
+
+        &lt;log level="custom"&gt;
+            &lt;property name="text" value="** Reporting to the Database esbdb1**"/&gt;
+        &lt;/log&gt;
+        &lt;dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse"&gt;
+            &lt;connection&gt;
+                &lt;pool&gt;
+                    &lt;dsName&gt;java:jdbc/XADerbyDS1&lt;/dsName&gt;
+                    &lt;icClass&gt;org.jnp.interfaces.NamingContextFactory&lt;/icClass&gt;
+                    &lt;url&gt;localhost:1099&lt;/url&gt;
+                    &lt;user&gt;synapse&lt;/user&gt;
+                    &lt;password&gt;synapse&lt;/password&gt;
+                &lt;/pool&gt;
+            &lt;/connection&gt;
+            &lt;statement&gt;
+                &lt;sql&gt; INSERT into company values ('IBM','c4',12.0)&lt;/sql&gt;
+            &lt;/statement&gt;
+        &lt;/dbreport&gt;
+        &lt;transaction action="commit"/&gt;
+        &lt;send/&gt;
+    &lt;/out&gt;
+&lt;/sequence&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+					Demonstrate the use of the transaction mediator in a distributed transaction
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                              Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                              <p>To run this sample it is required to deploy synpase on JBoss application server(This is only tested with JBoss application sever), you
+                              can use the war distribution to deploy synapse on JBoss application server. Use the synpase_sample_652.xml as the synapse confiuration
+                              file and start JBoss with that synpase configuration file. Also you need to define two XA datasources for above two datasources.
+                              You'll need to refer JBoss documentation to see how to do this.</p>
+                              <p>
+                                It also required to have two database instances, this will be used by the two XA datasources.
+                                Refer the <a href="setup/db.html#derby">Sample Setup Guide </a> to see how you can set up the derby database server.
+                              </p>
+                              <p>
+                                In this sample a record is delete from one database and it is added into the second database.
+                                If either of the operations(deleting from the 1st database and adding into the second database)
+                                fails everything will be roll backed. The records will be untoched.
+                              </p>
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 652 (repository/conf/sample/synapse_sample_652.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 652<br/>
+                                Windows: synapse.bat -sample 652
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+
+                <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
+
+                <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample7.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample7.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample7.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample7.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 7</title>
+    </properties>
+    <body>
+        <section name="Sample 7: Introduction to Local Registry Entries and Using Schema Validation">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;validate&gt;
+                &lt;schema key="validate_schema"/&gt;
+                &lt;on-fail&gt;
+                    &lt;!-- if the request does not validate againt schema throw a fault --&gt;
+                    &lt;makefault response="true"&gt;
+                        &lt;code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/&gt;
+                        &lt;reason value="Invalid custom quote request"/&gt;
+                    &lt;/makefault&gt;
+                &lt;/on-fail&gt;
+            &lt;/validate&gt;
+        &lt;/in&gt;
+        &lt;send/&gt;
+    &lt;/sequence&gt;
+
+    &lt;localEntry key="validate_schema"&gt;
+        &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                   xmlns="http://services.samples" elementFormDefault="qualified"
+                   attributeFormDefault="unqualified" targetNamespace="http://services.samples"&gt;
+            &lt;xs:element name="getQuote"&gt;
+                &lt;xs:complexType&gt;
+                    &lt;xs:sequence&gt;
+                        &lt;xs:element name="request"&gt;
+                            &lt;xs:complexType&gt;
+                                &lt;xs:sequence&gt;
+                                    &lt;xs:element name="stocksymbol" type="xs:string"/&gt;
+                                &lt;/xs:sequence&gt;
+                            &lt;/xs:complexType&gt;
+                        &lt;/xs:element&gt;
+                    &lt;/xs:sequence&gt;
+                &lt;/xs:complexType&gt;
+            &lt;/xs:element&gt;
+        &lt;/xs:schema&gt;
+    &lt;/localEntry&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrating the usage of the validate mediator for XML schema validation
+                    and using local registry (local entries) for storing configuration metadata.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 7 (repository/conf/sample/synapse_sample_7.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 7<br/>
+                                Windows: synapse.bat -sample 7
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This example shows how a static XML fragment could be stored in the the
+                    Synapse local registry. Resources defined in the local registry are static
+                    (i.e. never changes over the lifetime of the configuration) and may be
+                    specified as a source URL, in-line text or in-line xml. In this example the
+                    schema is made available under the key 'validate_schema'.
+                </p>
+                <p>
+                    The validate mediator by default operates on the first child element of the
+                    SOAP body. You may specify an XPath expression using the 'source' attribute
+                    to override this behaviour. The validate mediator in this sample uses the 'validate_schema'
+                    resource to validate the incoming message, and if the message validation fails
+                    it invokes the 'on-fail' sequence of mediators.
+                </p>
+                <p>
+                    If you send a stockquote request using the 'ant stockquote ...' command as follows
+                    you will get a fault back with the message 'Invalid custom quote request' as
+                    the schema validation fails. This is because the schema used in the example
+                    expects a slightly different message than what is created by the stock quote
+                    client. (i.e. expects a 'stocksymbol' element instead of 'symbol' to specify
+                    the stock symbol)
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample700.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample700.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample700.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample700.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 700</title>
+    </properties>
+    <body>
+        <section name="Sample 700: Introduction to Synapse Message Stores">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+    &lt;!--Simple in Memory Message Store with name foo --&gt;
+    &lt;messageStore name="foo" sequence="bar"&gt;
+        &lt;redelivery&gt;
+            &lt;!--retry interval 1 sec --&gt;
+            &lt;interval&gt;1&lt;/interval&gt;
+            &lt;!--Message will be stored after 2 redeliveries --&gt;
+            &lt;maximumRedeliveries&gt;2&lt;/maximumRedeliveries&gt;
+            &lt;exponentialBackoff&gt;true&lt;/exponentialBackoff&gt;
+            &lt;backoffMutiplier&gt;2&lt;/backoffMutiplier&gt;
+        &lt;/redelivery&gt;
+    &lt;/messageStore&gt;
+
+    &lt;!-- filtering of messages with XPath and regex matches --&gt;
+    &lt;filter source="get-property('To')" regex=".*/StockQuote.*"&gt;
+        &lt;send&gt;
+            &lt;endpoint key="SampleEndpoint"/&gt;
+        &lt;/send&gt;
+        &lt;drop/&gt;
+    &lt;/filter&gt;
+    &lt;send/&gt;
+    &lt;!-- Endpoint named SampleEndpoint--&gt;
+    &lt;endpoint name="SampleEndpoint" onFault="foo"&gt;
+        &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"&gt;
+            &lt;suspendDurationOnFailure&gt;2&lt;/suspendDurationOnFailure&gt;
+        &lt;/address&gt;
+    &lt;/endpoint&gt;
+
+    &lt;sequence name="bar"&gt;
+        &lt;log level="full"/&gt;
+    &lt;/sequence&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the usage of Synapse message stores and how to use a message store
+                    to implement the popular 'Dead Letter Channel' integration pattern
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 700 (repository/conf/sample/synapse_sample_700.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 700<br/>
+                                Windows: synapse.bat -sample 700
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    First execute the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/soap/StockQuote</div>
+                <p>
+                    Since you have the sample Axis2 server running, you will get a stock quote response
+                    at the client side. Axis2 server will also print a log confirming the generation
+                    of a new quote value. Now shut the Axis2 server down and invoke the sample client
+                    again. Now Synapse will attempt twice to deliever the message and faling that, the
+                    message will be stored in the specified in-memory message store (dead letter channel)
+                    for later delivery.
+                </p>
+                <p>
+                    Now you can use the JMX view of the Synapse message store to see the message
+                    stored in the dead letter channel and manually retry on them.
+                </p>                
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample750.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample750.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample750.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample750.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 750</title>
+    </properties>
+    <body>
+        <section name="Sample 750: Stereotyping XSLT Transformations with Templates">
+            <div class="xmlConf">&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
+
+        &lt;proxy name=&quot;StockQuoteProxy&quot;&gt;
+            &lt;target&gt;
+            &lt;inSequence&gt;
+            &lt;!--use sequence template to trasnform incoming request--&gt;
+            &lt;call-template target=&quot;xslt_func&quot;&gt;
+                            &lt;with-param name=&quot;xslt_key&quot; value=&quot;xslt-key-req&quot;/&gt;
+                    &lt;/call-template&gt;
+            &lt;send&gt;
+                &lt;endpoint&gt;
+                                  &lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;
+                            &lt;/endpoint&gt;
+                    &lt;/send&gt;
+                &lt;/inSequence&gt;
+
+                &lt;outSequence&gt;
+            &lt;!--use sequence template to trasnform incoming response--&gt;
+            &lt;call-template target=&quot;xslt_func&quot;&gt;
+                            &lt;with-param name=&quot;xslt_key&quot; value=&quot;xslt-key-back&quot;/&gt;
+                    &lt;/call-template&gt;
+                    &lt;send/&gt;
+                &lt;/outSequence&gt;
+            &lt;/target&gt;
+        &lt;/proxy&gt;
+
+        &lt;!--this sequence template will trasnform requests with the given xslt local entry key And will log
+        the message before and after. Takes Iterate local entry key as an argument--&gt;
+        &lt;template xmlns=&quot;http://ws.apache.org/ns/synapse&quot; name=&quot;xslt_func&quot;&gt;
+            &lt;parameter name=&quot;xslt_key&quot;/&gt;
+            &lt;sequence&gt;
+                    &lt;log level=&quot;full&quot;&gt;
+                &lt;property name=&quot;BEFORE_TRANSFORM&quot; value=&quot;true&quot; /&gt;
+            &lt;/log&gt;
+                 &lt;xslt key=&quot;{$func:xslt_key}&quot;/&gt;
+            &lt;log level=&quot;full&quot;&gt;
+                &lt;property name=&quot;AFTER_TRANSFORM&quot; value=&quot;true&quot; /&gt;
+            &lt;/log&gt;
+            &lt;/sequence&gt;
+        &lt;/template&gt;
+
+        &lt;localEntry key=&quot;xslt-key-req&quot; src=&quot;file:repository/samples/resources/transform/transform.xslt&quot;/&gt;
+        &lt;localEntry key=&quot;xslt-key-back&quot; src=&quot;file:repository/samples/resources/transform/transform_back.xslt&quot;/&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Introduction to Apache Synapse Sequence Templates
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 750 (repository/conf/sample/synapse_sample_750.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 750<br/>
+                                Windows: synapse.bat -sample 750
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    First execute the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy  -Dmode=customquote</div>
+                <p>
+                    Sequence Template can act a reusable function. Here the proxy service reuses
+                    template xslt_func which will transform requests with the given xslt local entry
+                    key And will log the message before and after. It takes xslt transformation corresponding
+                    to local entry key as an argument (for insequence this key is xslt-key-req and out sequence it is xslt-key-back).
+                    We use call-template mediator for passing the xslt key parameter to a sequence template.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample8.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample8.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample8.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample8.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 8</title>
+    </properties>
+    <body>
+        <section name="Sample 8: Introduction to Static and Dynamic Registry Resources, and Using XSLT Transformations">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;!-- the SimpleURLRegistry allows access to a URL based registry (e.g. file:/// or http://) --&gt;
+    &lt;registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"&gt;
+        &lt;!-- the root property of the simple URL registry helps resolve a resource URL as root + key --&gt;
+        &lt;parameter name="root"&gt;file:repository/conf/sample/resources/&lt;/parameter&gt;
+        &lt;!-- all resources loaded from the URL registry would be cached for this number of milli seconds --&gt;
+        &lt;parameter name="cachableDuration"&gt;15000&lt;/parameter&gt;
+    &lt;/registry&gt;
+
+    &lt;!-- define the request processing XSLT resource as a static URL source --&gt;
+    &lt;localEntry key="xslt-key-req" src="file:repository/conf/sample/resources/transform/transform.xslt"/&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;!-- transform the custom quote request into a standard quote requst expected by the service --&gt;
+            &lt;xslt key="xslt-key-req"/&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;!-- transform the standard response back into the custom format the client expects --&gt;
+            &lt;!-- the key is looked up in the remote registry and loaded as a 'dynamic' registry resource --&gt;
+            &lt;xslt key="transform/transform_back.xslt"/&gt;
+        &lt;/out&gt;
+        &lt;send/&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrating the usage of the XSLT mediator for transforming message content
+                    and using local registry and remote registry for storing configuration
+                    metadata.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 8 (repository/conf/sample/synapse_sample_8.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 8<br/>
+                                Windows: synapse.bat -sample 8
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This example uses the XSLT mediator to perform transformations, and the xslt
+                    transformations are specified as registry resources. The first resource
+                    'xslt-key-req' is specified as a 'local' registry entry. Local entries do not
+                    place the resource on the registry, but simply make it available to the local
+                    configuration. If a local entry is defined with a key that already exists in
+                    the remote registry, the local entry will get higher precedence over the remote
+                    resource.
+                </p>
+                <p>
+                    In this example you will notice the new 'registry' definition. Synapse comes
+                    with a simple URL based registry implementation (SimpleURLRegistry). During
+                    initialization of the registry, the SimpleURLRegistry expects to find a property
+                    named 'root', which specifies a prefix for the registry keys used later.
+                    When the SimpleURLRegistry is used, this root is prefixed to the entry keys to
+                    form the complete URL of the resource being looked up. The registry caches a
+                    resource once requested, and stores it internally for a specified duration.
+                    Once this period expires, it will reload the meta information about the resource
+                    and reloads its cached copy if necessary, the next time the resource is requested.
+                </p>
+                <p>
+                    Hence the second XSLT resource key 'transform/transform_back.xslt' concatenated
+                    with the 'root' of the SimpleURLRegistry 'file:repository/conf/sample/resources/'
+                    forms the complete URL of the resource as
+                    'file:repository/conf/sample/resources/transform/transform_back.xslt' and caches
+                    its value for a period of 15000 ms. 
+                </p>
+                <p>
+                    Execute the custom quote client as follows and analyze the the Synapse debug
+                    log output.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+                <p>
+                    The incoming message is transformed into a standard stock quote request by the
+                    XSLT mediator. The XSLT mediator uses Xalan-J to perform the transformations.
+                    It is possible to configure the underlying transformation engine using properties
+                    when necessary. The response from the SimpleStockQuoteService is converted back
+                    into the custom format as expected by the client during the out message processing.
+                </p>
+                <p>
+                    During the response processing you could see the SimpleURLRegistry fetching the
+                    resource as shown by the log message below.
+                </p>
+                <div class="consoleOutput">[HttpClientWorker-1] DEBUG SimpleURLRegistry ==&gt; Repository fetch of resource with key : transform/transform_back.xslt</div>
+                <p>
+                    If you run the client again immediately (i.e within 15 seconds of the first
+                    request) you will not see the resource being reloaded by the registry as the
+                    cached value would be still valid.
+                </p>
+                <p>
+                    However if you leave the system idle for 15 seconds or more and then retry the
+                    same request, you will now notice that the registry notices the cached resource
+                    has expired and will reload the meta information about the resource to check if
+                    the resource has changed and will require a fresh fetch from the source URL.
+                    If the meta data / version number indicates that a reload of the cached resource
+                    is not necessary (i.e. unless the resource itself actually changed) the updated
+                    meta information is used and the cache lease extended as appropriate.
+                </p>
+                <div class="consoleOutput">[HttpClientWorker-1] DEBUG AbstractRegistry - Cached object has expired for key : transform/transform_back.xslt
+[HttpClientWorker-1] DEBUG SimpleURLRegistry - Perform RegistryEntry lookup for key : transform/transform_back.xslt
+[HttpClientWorker-1] DEBUG AbstractRegistry - Expired version number is same as current version in registry
+[HttpClientWorker-1] DEBUG AbstractRegistry - Renew cache lease for another 15s</div>
+                <p>
+                    Thus the SimpleURLRegistry allows resource to be cached, and updates are detected
+                    so that the configuration changes could be reloaded without restarting the
+                    Synapse instance.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample800.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample800.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample800.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample800.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 800</title>
+    </properties>
+    <body>
+        <section name="Sample 800: Introduction to REST APIs">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+&lt;api name="StockQuoteAPI" context="/stockquote"&gt;
+   &lt;resource uri-template="/view/{symbol}" methods="GET"&gt;
+      &lt;inSequence&gt;
+         &lt;payloadFactory&gt;
+	    &lt;format&gt;
+		&lt;m0:getQuote xmlns:m0="http://services.samples"&gt;
+	            &lt;m0:request&gt;
+        	       &lt;m0:symbol&gt;$1&lt;/m0:symbol&gt;
+	            &lt;/m0:request&gt;
+        	 &lt;/m0:getQuote&gt;
+	    &lt;/format&gt;
+	    &lt;args&gt;
+		&lt;arg expression="get-property('uri.var.symbol')"/&gt;
+	    &lt;/args&gt;
+	 &lt;/payloadFactory&gt;
+	 &lt;send&gt;
+	    &lt;endpoint&gt;
+		&lt;address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/&gt;
+	    &lt;/endpoint&gt;
+	 &lt;/send&gt;
+      &lt;/inSequence&gt;
+      &lt;outSequence&gt;
+	 &lt;send/&gt;
+      &lt;/outSequence&gt;
+   &lt;/resource&gt;
+   &lt;resource url-pattern="/order/*" methods="POST"&gt;
+      &lt;inSequence&gt;
+        &lt;property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/&gt;
+	&lt;property name="OUT_ONLY" value="true"/&gt;
+	&lt;send&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/&gt;
+            &lt;/endpoint&gt;
+         &lt;/send&gt;
+      &lt;/inSequence&gt;
+   &lt;/resource&gt;
+&lt;/api&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    APIs in Synapse provide a convenient approach for receiving and processing
+                    REST traffic through the service bus. APIs can be used to receive specific
+                    types of RESTful invocations and then process them through a set of user
+                    defined resources. This sample is aimed at introducing the basic capabilities
+                    of APIs and how they are configured to front existing services.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 Server
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 800 (repository/conf/sample/synapse_sample_800.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 800<br/>
+                                Windows: synapse.bat -sample 800
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the REST Client">
+                <p>
+                    You might need a REST client like curl to test this
+                </p>
+                <div class="command">curl -v http://127.0.0.1:8280/stockquote/view/IBM</div>
+                <div class="command">curl -v http://127.0.0.1:8280/stockquote/view/MSFT</div>
+
+                <p>
+                    The above GET calls will be handled by the first resource in the StockQuoteAPI.
+                    These REST calls will get converted into SOAP calls and will be sent to the Axis2
+                    server. Response will be sent to the client in POX format.
+                </p>
+                <p>
+                    The following command POSTs a simple XML to the ESB. Save following sample place
+                    order request as  "placeorder.xml" file in your local file system and execute the
+                    command. That is used to invoke a SOAP service. ESB returns the 202 response back to the client.
+                </p>
+                <div class="command">curl -v -d @placeorder.xml -H "Content-type: application/xml" http://127.0.0.1:8280/stockquote/order/</div>
+
+                <div class="xmlConf">&lt;placeOrder xmlns="http://services.samples"&gt;
+  &lt;order&gt;
+     &lt;price&gt;50&lt;/price&gt;
+     &lt;quantity&gt;10&lt;/quantity&gt;
+     &lt;symbol&gt;IBM&lt;/symbol&gt;
+  &lt;/order&gt;
+&lt;/placeOrder&gt;</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample9.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample9.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample9.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample9.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 9</title>
+    </properties>
+    <body>
+        <section name="Sample 9: Introduction to Dynamic Sequences with Registry">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"&gt;
+        &lt;parameter name="root"&gt;file:./repository/conf/sample/resources/&lt;/parameter&gt;
+        &lt;parameter name="cachableDuration"&gt;15000&lt;/parameter&gt;
+    &lt;/registry&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;sequence key="sequence/dynamic_seq_1.xml"/&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrating the ability to load sequence definitions dynamically from the
+                    remote registry.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 9 (repository/conf/sample/synapse_sample_9.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 9<br/>
+                                Windows: synapse.bat -sample 9
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This example demonstrates the dynamic behaviour of Synapse through the use of a
+                    registry. Synapse supports dynamic definitions for sequences and endpoints, and
+                    as seen before, for configuration resources (eg: schema files, XSLT files etc).
+                    In this example we define a Synapse configuration which references a sequence
+                    definition specified as a registry key. The registry key resolves to the actual
+                    content of the sequence which would be loaded dynamically by Synapse at runtime,
+                    and cached appropriately as per its definition in the registry. Once the cache
+                    expires, Synapse would re-check the meta information for the definition and
+                    re-load the sequence definition if necessary and re-cache it again.
+                </p>
+                <p>
+                    Execute the client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+                <p>
+                    Go through the mediation debug logs to see how Synapse has dynamically loaded
+                    the sequence configurations from the registry.
+                </p>
+                <div class="consoleOutput">[HttpServerWorker-1] DEBUG  SimpleURLRegistry - ==&gt; Repository fetch of resource with key : sequence/dynamic_seq_1.xml
+...
+[HttpServerWorker-1] DEBUG SequenceMediator - Sequence mediator &lt;dynamic_sequence&gt; :: mediate()
+...
+[HttpServerWorker-1] INFO  LogMediator - message = *** Test Message 1 ***</div>
+                <p>
+                    Now if you execute the client immediately (i.e. within 15 seconds of the last
+                    execution) you will notice that the sequence is not reloaded. If you edit the
+                    sequence definition in repository/conf/sample/resources/sequence/dynamic_seq_1.xml
+                    (i.e. edit the log message to read as '*** Test Message 2 ***') and execute the
+                    client again, you will notice that the new message is not yet visible (i.e. if
+                    you execute this within 15 seconds of loading the resource for the first time).
+                    However, after 15 seconds elapsed since the original caching of the sequence,
+                    you will notice that the new sequence is loaded and executed by Synapse from the
+                    following log messages.
+                </p>
+                <div class="consoleOutput">[HttpServerWorker-1] DEBUG  SimpleURLRegistry - ==&gt; Repository fetch of resource with key : sequence/dynamic_seq_1.xml
+...
+[HttpServerWorker-1] DEBUG SequenceMediator - Sequence mediator &lt;dynamic_sequence&gt; :: mediate()
+...
+[HttpServerWorker-1] INFO  LogMediator - message = *** Test Message 2 ***</div>
+                <p>
+                    The cache timeout could be tuned appropriately by configuring the URL registry
+                    to suit the environment and the needs.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/setup/db.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/setup/db.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/setup/db.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/setup/db.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Database Setup Guide</title>
+    </properties>
+    <body>
+        <section name="Database Setup Guide">
+            <p>
+                This document explains how to setup a database and some data sources as required
+                by the samples. Most samples require an Apache Derby installation whereas a few
+                would require a MySQL setup.
+            </p>
+        </section>
+        <section name="Contents">
+            <ul>
+                <li><a href="#intro">Introduction</a></li>
+                <li><a href="#derby">Setting Up Apache Derby</a></li>
+                <li><a href="#mysql">Setting Up MySQL</a></li>
+                <li><a href="#other">Using Other Database Engines</a></li>
+                <li><a href="#ds">Setting Up Data Sources</a></li>
+            </ul>
+        </section>
+        <section name="Introduction" id="intro">
+            <p>
+                Apache Synapse has the ability to lookup and update relational databases through
+                JDBC. Any database engine that provides JDBC drivers can be integrated with
+                Synapse using the dblookup and dbreport mediators. Synapse ships with a collection
+                of samples which demonstrates various aspects of dblookup, dbreport mediators and
+                database integration. This article describes how to setup the databases, sample
+                tables and reusable data sources required to try these examples out.
+            </p>
+            <p>
+                Most samples assume Apache Derby is used as the database engine. And therefore this
+                article also focuses mainly on setting up Apache Derby. Byt in reality
+                any database engine can be used to run these samples. The database schema and SQL
+                queries described here will work with any database engine. However in such cases
+                some minor changes should be made to the Synapse configuration files.
+            </p>
+            <p>
+                Some samples involve invoking database stored procedures from Synapse. For these
+                samples MySQL database engine is assumed. Therefore this article provides some
+                basic information on setting up MySQL for the example scenarios.
+            </p>
+        </section>
+        <section name="Setting Up Apache Derby" id="derby">
+            <p>
+                To start with, download the latest binary distribution of <a href="http://db.apache.org/derby/">Apache Derby</a>.
+                Extract the downloaded archive to a suitable location in the local disk and switch
+                to the 'bin' directory of the installation. Start the Derby network server by
+                executing the 'startNetworkServer' startup script. An output similar to the following
+                will be displayed as the database engine starts up.
+            </p>
+            <div class="consoleOutput">Sun Jan 02 10:53:28 IST 2011 : Security manager installed using the Basic server security policy.
+Sun Jan 02 10:53:30 IST 2011 : Apache Derby Network Server - 10.7.1.1 - (1040133) started and ready to accept connections on port 1527</div>
+            <p>
+                Now launch the Derby client tool by executing the 'ij' script. This will give a command
+                prompt where you can execute various command and SQL queries. Execute the following
+                connect statement to create a fresh database named 'synapsedb' and obtain a connection
+                to it.
+            </p>
+            <div class="command">CONNECT 'jdbc:derby://localhost:1527/synapsedb;user=synapse;password=synapse;create=true';</div>
+            <p>
+                Now execute the following SQL query to create a new table.
+            </p>
+            <div class="command">CREATE table company(name varchar(10), id varchar(10), price double);</div>
+            <p>
+                Insert some sample data to the table by executing following statements.
+            </p>
+            <div class="command">INSERT into company values ('IBM','c1',0.0);
+INSERT into company values ('SUN','c2',0.0);
+INSERT into company values ('MSFT','c3',0.0);</div>
+            <p>
+                Now we have finished setting up the Derby server for the samples. As the final step
+                we should copy the Derby JDBC drivers to Synapse 'lib' directory. Locate the following
+                jar files in Derby installation and copy them into Synapse.
+            </p>
+            <ul>
+                <li>derby.jar</li>
+                <li>derbyclient.jar</li>
+                <li>derbynet.jar</li>
+            </ul>
+        </section>
+        <section name="Setting Up MySQL" id="mysql">
+            <p>
+                This section assumes that you already have a MySQL server instance up and running.
+                For details on installing MySQL, please refer the relevant
+                <a href="http://dev.mysql.com/doc/refman/5.1/en/installing.html">MySQL documentation</a>.
+            </p>
+            <p>
+                Create a new database named 'synapsedb' in MySQL. Then execute the SQL queries
+                given in the previous section to create a table named 'company' and insert some
+                sample data into it. Then execute the following two commands in MySQL client to
+                create two stored procedures.
+            </p>
+            <div class="command">CREATE PROCEDURE getCompany(compName VARCHAR(10)) SELECT name, id, price FROM company WHERE name = compName;
+CREATE PROCEDURE updateCompany(compPrice DOUBLE,compName VARCHAR(10)) UPDATE company SET price = compPrice WHERE name = compName;</div>
+            <p>
+                Then you should download the <a href="http://www.mysql.com/products/connector/">MySQL JDBC driver</a>
+                and deploy it into the 'lib' directory of Synapse.
+            </p>
+        </section>
+        <section name="Using Other Database Engines" id="other">
+            <p>
+                You can run the given samples using any RDBMS engine you prefer. In that case please
+                make sure you do the following.
+            </p>
+            <ul>
+                <li>Deploy the JDBC drivers for your database engine into Synapse</li>
+                <li>
+                    Update the sample configuration files and change the driver class name and JDBC
+                    connection string correctly
+                </li>
+            </ul>
+        </section>
+        <section name="Setting Up Data Sources">
+            <p>
+                Synapse is capable of connecting to databases through predefined data sources.
+                This enables database connection pooling and connection reuse. Different instances
+                of the database mediators (dblookup/dbreport) can either use different data sources
+                or share the same data source.
+            </p>
+            <p>
+                Data sources are configured in the synapse.properties file which can be found in the
+                'lib' directory of the Synapse installation. Currently Synapse supports following
+                types of data sources.
+            </p>
+            <ul>
+                <li>BasicDataSource</li>
+                <li>PerUserPoolDataSource</li>
+            </ul>
+            <p>
+                Both these types of data sources are based on <a href="http://commons.apache.org/dbcp">Apache DBCP</a>.
+            </p>
+            <p>
+                Following section describes how to setup two data sources as required by some of the
+                database integration samples of Synapse. First, it is required to setup two
+                Derby databases. So launch 'ij' client tool for Derby and create two databases
+                named 'lookupdb' and 'reportdb'. Specify the username and password to be 'synapse'
+                for both databases. Create the 'company' table in each database and add some sample
+                data as described under <a href="#derby">Setting Up Apache Derby</a> section.
+            </p>
+            <p>
+                Now you can define two data sources for these databases by adding the following
+                entries to the synapse.properties file.
+            </p>
+            <div class="consoleOutput">synapse.datasources=lookupds,reportds
+synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
+synapse.datasources.providerUrl=rmi://localhost:2199
+synapse.datasources.providerPort=2199
+
+synapse.datasources.lookupds.type=BasicDataSource
+synapse.datasources.lookupds.driverClassName=org.apache.derby.jdbc.ClientDriver
+synapse.datasources.lookupds.url=jdbc:derby://localhost:1527/lookupdb;create=false
+synapse.datasources.lookupds.username=synapse
+synapse.datasources.lookupds.password=synapse
+synapse.datasources.lookupds.dsName=lookupdb
+synapse.datasources.lookupds.maxActive=100
+synapse.datasources.lookupds.maxIdle=20
+synapse.datasources.lookupds.maxWait=10000
+
+synapse.datasources.reportds.type=PerUserPoolDataSource
+synapse.datasources.reportds.cpdsadapter.factory=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+synapse.datasources.reportds.cpdsadapter.className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+synapse.datasources.reportds.cpdsadapter.name=cpds
+synapse.datasources.reportds.dsName=reportdb
+synapse.datasources.reportds.driverClassName=org.apache.derby.jdbc.ClientDriver
+synapse.datasources.reportds.url=jdbc:derby://localhost:1527/reportdb;create=false
+synapse.datasources.reportds.username=synapse
+synapse.datasources.reportds.password=synapse
+synapse.datasources.reportds.maxActive=100
+synapse.datasources.reportds.maxIdle=20
+synapse.datasources.reportds.maxWait=10000</div>
+            <p>
+                Here we are defining two data sources named 'lookupds' and 'reportds'. The first
+                data source is defined as a BasicDataSource and the other one is defined as a
+                PerUserPoolDataSource. Note the various parameters we have specified for each
+                data source thereby further customizing the behavior of each data source.
+            </p>
+        </section>
+    </body>
+</document>
\ No newline at end of file