Author: hiranya
Date: Thu Dec 30 09:24:14 2010
New Revision: 1053834

URL: http://svn.apache.org/viewvc?rev=1053834&view=rev
Log:
Config management samples


Added:
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample600.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample601.xml
Modified:
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml?rev=1053834&r1=1053833&r2=1053834&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml 
(original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml 
Thu Dec 30 09:24:14 2010
@@ -206,33 +206,33 @@
             <subsection name="Eventing">
                 <p>
                     <ul>
-                        <li><a href="">Sample 500: Introduction to 
Eventing</a></li>
-                        <li><a href="">Sample 501: Event source with static 
subscriptions</a></li>
-                        <li><a href="">Sample 502: Transforming events before 
publish</a></li>
+                        <li><a href="samples/sample500.html">Sample 500: 
Introduction to Eventing</a></li>
+                        <li><a href="samples/sample501.html">Sample 501: Event 
source with static subscriptions</a></li>
+                        <li><a href="samples/sample502.html">Sample 502: 
Transforming events before publish</a></li>
                     </ul>
                 </p>
             </subsection>
             <subsection name="Synapse Configuration Model">
                 <p>
                     <ul>
-                        <li><a href="#Sample600">Sample 600: File hierarchy 
based configuration builder</a></li>
-                        <li><a href="#Sample601">Sample 601: Using Synapse 
Observers</a></li>
+                        <li><a href="samples/sample600.html">Sample 600: File 
hierarchy based configuration builder</a></li>
+                        <li><a href="samples/sample601.html">Sample 601: Using 
Synapse Observers</a></li>
                     </ul>
                 </p>
             </subsection>
             <subsection name="Priority Based Mediation">
                 <p>
                     <ul>
-                        <li><a href="#Sample650">Sample 650: Introduction to 
priority based mediation</a></li>
-                        <li><a href="#Sample651">Sample 651: Priority based 
dispatching at transport level</a></li>
-                        <li><a href="#Sample652">Sample 652: Distributed 
transactions management</a></li>
+                        <li><a href="samples/sample650.html">Sample 650: 
Introduction to priority based mediation</a></li>
+                        <li><a href="samples/sample651.html">Sample 651: 
Priority based dispatching at transport level</a></li>
+                        <li><a href="samples/sample652.html">Sample 652: 
Distributed transactions management</a></li>
                     </ul>
                 </p>
             </subsection>
             <subsection name="Message Store and Dead Letter Channel">
                 <p>
                     <ul>
-                        <li><a href="#Sample700">Sample 700: Introduction to 
Synapse message store </a></li>
+                        <li><a href="samples/sample700.html">Sample 700: 
Introduction to Synapse message store </a></li>
                     </ul>
                 </p>
             </subsection>

Added: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample600.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample600.xml?rev=1053834&view=auto
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample600.xml
 (added)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample600.xml
 Thu Dec 30 09:24:14 2010
@@ -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/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample601.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample601.xml?rev=1053834&view=auto
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample601.xml
 (added)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample601.xml
 Thu Dec 30 09:24:14 2010
@@ -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


Reply via email to