You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Saminda Abeyruwan <sa...@gmail.com> on 2006/05/05 11:09:51 UTC

[VOTE] Moving Code from Scratch Area

Hi All,

With Respect to the discussion had on the Chat (4th May 2006) [
http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser]
and the mailing thread [
http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser]
following members have approved of moving the Synapse code in scratch [
https://svn.apache.org/repos/asf/incubator/synapse/trunk/scratch/synapse2]
to the main branch.

Paul Fremantle +1

Ant Elder +1

Saminda Abeyruwan +1

This code consists on implementing of the configuration syntax that Sanjiva
and Asankha proposed few weeks back. [
http://wiki.apache.org/incubator/Synapse/SynapseConfigurationLanguage
] [
http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser]

So please be kind enough to go through the code and let your consensus
regarding prior so that we can start moving it ahead to the main branch.

Until such time, the code in [
https://svn.apache.org/repos/asf/incubator/synapse/trunk/java ] has been
freeze.

Thank you

Saminda

Re: [VOTE] Moving Code from Scratch Area

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Patch Applied. Keep on the good work Asanka.

Saminda

On 5/8/06, Asankha C. Perera <as...@wso2.com> wrote:
>
> Saminda
>
> Here is the patch to be applied to the main to bring in the latest changes
> performed so far on the scratch area. Could you please commit this..
>
> asankha
>
>
>
> Saminda Abeyruwan wrote:
>
> Hi All,
>
> With Respect to the discussion had on the Chat (4th May 2006) [
> http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser] and the mailing thread [
> http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser]
> following members have approved of moving the Synapse code in scratch [
> https://svn.apache.org/repos/asf/incubator/synapse/trunk/scratch/synapse2]
> to the main branch.
>
> Paul Fremantle +1
>
> Ant Elder +1
>
> Saminda Abeyruwan +1
>
> This code consists on implementing of the configuration syntax that
> Sanjiva and Asankha proposed few weeks back. [ http://wiki.apache.org/incubator/Synapse/SynapseConfigurationLanguage
> ] [
> http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser]
>
> So please be kind enough to go through the code and let your consensus
> regarding prior so that we can start moving it ahead to the main branch.
>
> Until such time, the code in [
> https://svn.apache.org/repos/asf/incubator/synapse/trunk/java ] has been
> freeze.
>
> Thank you
>
> Saminda
>
>
> Index: bin/synapse.bat
> ===================================================================
> --- bin/synapse.bat     (revision 405035)
> +++ bin/synapse.bat     (working copy)
> @@ -74,7 +74,7 @@
>
>  :runSynapse
>  @echo on
> -"%_JAVACMD%" -Djava.ext.dirs=%SYNAPSE_HOME%\lib;%SYNAPSE_HOME% -cp
> %SYNAPSE_HOME%\lib org.apache.axis2.transport.http.SimpleHTTPServer%SYNAPSE_CMD_LINE_ARGS%
> +"%_JAVACMD%" -Daxis2.xml=%SYNAPSE_HOME%\synapse_repository\conf\axis2.xml-
> Djava.ext.dirs=%SYNAPSE_HOME%\lib;%SYNAPSE_HOME% -cp %SYNAPSE_HOME%\lib
> org.apache.axis2.transport.http.SimpleHTTPServer %SYNAPSE_CMD_LINE_ARGS%
>  goto end
>
>  :end
> Index: bin/synapse.sh
> ===================================================================
> --- bin/synapse.sh      (revision 405035)
> +++ bin/synapse.sh      (working copy)
> @@ -89,4 +89,4 @@
>  echo "Using $SYNAPSE_HOME:   $SYNAPSE_HOME"
>  echo "Using JAVA_HOME:       $JAVA_HOME"
>
> -$JAVA_HOME/bin/java -classpath $SYNAPSE_CLASSPATH
> org.apache.axis2.transport.http.SimpleHTTPServer$SYNAPSE_HOME/synapse_repository -p8080
> +$JAVA_HOME/bin/java -
> Daxis2.xml=$SYNAPSE_HOME/synapse_repository/conf/axis2.xml -classpath
> $SYNAPSE_CLASSPATH org.apache.axis2.transport.http.SimpleHTTPServer$SYNAPSE_HOME/synapse_repository -p8080
> Index: etc/project.properties
> ===================================================================
> --- etc/project.properties      (revision 405035)
> +++ etc/project.properties      (working copy)
> @@ -18,9 +18,12 @@
>  # -------------------------------------------------------------------
>  #                JUnit
>  # -------------------------------------------------------------------
> -maven.junit.jvmargs=-Djava.awt.headless=true
> +# explicit setting of Sax parser as below is a hack to avoid Junit from
> loading its own parsers ignoring maven.test.excludeXmlApis
> +maven.junit.jvmargs=-Djava.awt.headless=true -
> Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
>  maven.junit.fork=true
> +#maven.junit.dir=${basedir}/modules/core
>
> +
>  # -------------------------------------------------------------------
>  #                Compile
>  # -------------------------------------------------------------------
> @@ -32,11 +35,13 @@
>  # -------------------------------------------------------------------
>  ant.version=1.6.5
>  axis.wsdl4j.version=1.2
> -axis2.version=SNAPSHOT
> -axiom.version=SNAPSHOT
> +axis2.version=1.0-RC5
> +axis2.wsdl.version=SNAPSHOT
> +axiom.version=1.0
>  policy.version=SNAPSHOT
> +#XmlSchema.version=1.0.2
>  XmlSchema.version=SNAPSHOT
> -wss4j.version=SNAPSHOT
> +wss4j.version=1.5.0
>  commons.codec.version=1.3
>  commons.discovery.version=0.2
>  commons.httpclient.version=3.0
> @@ -46,20 +51,20 @@
>  geronimo.spec.servlet.version=2.4-rc4
>  servletapi.version=2.3
>  groovy.all.version=1.0-jsr-01
> -jaxen.version=1.1-beta-7
> +jaxen.version=1.1-beta-8
>  junit.version=3.8.1
> -log4j.version=1.2.12
> +log4j.version=1.2.13
>  opensaml.version=1.0.1
> -stax.api.version=1.0
>  stax.impl.groupid=woodstox
>  stax.impl.artifactid=wstx
> -stax.impl.version=asl-2.8.1
> -xalan.version=2.6.0
> -xerces.version=2.6.2
> +stax.impl.version=asl-2.9.3
> +stax.api.version=1.0
> +xalan.version=2.7.0
> +xerces.version=2.7.1
>  xmlunit.version=1.0
>  annogen.version=0.1.0
>  geronimo.spec.jms.version=1.1-rc4
> -backport_util_concurrent.version=2.0_01_pd
> +backport_util_concurrent.version=2.1
>  spring.version=1.2.6
>
>
> @@ -70,12 +75,12 @@
>  optional.includes=
>  maven.multiproject.includes=\
>  modules/core/project.xml,\
> -modules/mediators/project.xml,\
> +#modules/mediators/project.xml,\
>  modules/samples/project.xml,\
> -modules/extensions/project.xml,\
> +#modules/extensions/project.xml,\
>  ${optional.includes}
>
>  # -------------------------------------------------------------------
>  #                Addressing Version
>  # -------------------------------------------------------------------
> -addressing.version=0.95
> +addressing.version=1.0
> Index: etc/project.xml
> ===================================================================
> --- etc/project.xml     (revision 405035)
> +++ etc/project.xml     (working copy)
> @@ -69,7 +69,7 @@
>         <dependency>
>             <groupId>axis2</groupId>
>             <artifactId>axis2-wsdl</artifactId>
> -            <version>${axis2.version}</version>
> +            <version>${axis2.wsdl.version}</version>
>         </dependency>
>
>         <dependency>
> Index: maven.xml
> ===================================================================
> --- maven.xml   (revision 405035)
> +++ maven.xml   (working copy)
> @@ -335,7 +335,7 @@
>         <ant:mkdir dir="${bin.dist.dir}/xdocs"/>
>         <ant:mkdir dir="${bin.dist.dir}/synapse_repository"/>
>         <ant:mkdir dir="${bin.dist.dir}/samples"/>
> -        <ant:mkdir dir="${bin.dist.dir}/mediators"/>
> +        <!--<ant:mkdir dir="${bin.dist.dir}/mediators"/>-->
>
>         <ant:mkdir dir="target/temp/"/>
>
> @@ -360,13 +360,13 @@
>             <ant:fileset dir="modules/core/target/synapse-repository"/>
>         </ant:copy>
>
> -        <ant:copy todir="${bin.dist.dir}/samples" flatten="false">
> +        <!--<ant:copy todir="${bin.dist.dir}/samples" flatten="false">
>             <ant:fileset dir="modules/samples/target/dist-bin/samples"/>
>         </ant:copy>
>
>         <ant:copy todir="${bin.dist.dir}/mediators" flatten="false">
>             <ant:fileset
> dir="modules/mediators/target/dist-bin/mediators"/>
> -        </ant:copy>
> +        </ant:copy>-->
>
>         <ant:copy todir="target/temp/">
>             <ant:fileset dir="target/dist-bin/">
> Index: modules/core/maven.xml
> ===================================================================
> --- modules/core/maven.xml      (revision 405035)
> +++ modules/core/maven.xml      (working copy)
> @@ -40,145 +40,7 @@
>         </jar>
>
>
> -        <echo message="----------------Creating NPE
> aar----------------"/>
> -        <mkdir dir="target/services/npe/META-INF"/>
> -        <mkdir dir="target/services/npe/org/apache/axis2/test"/>
> -        <copy
> file="test-resources/org/apache/axis2/META-INF/services.xml"
> -              tofile="target/services/npe/META-INF/services.xml"/>
> -        <copy file="target/test-classes/org/apache/axis2/test/Echo.class"
> -
>  tofile="target/services/npe/org/apache/axis2/test/Echo.class"/>
> -        <jar jarfile="target/npe.aar"
> -             basedir="target/services/npe">
> -            <include name="**"/>
> -        </jar>
> -        <echo message="----------------Creating test-mediator
> aar----------------"/>
> -        <mkdir dir="target/services/test-mediator/META-INF"/>
> -        <mkdir
> dir="target/services/test-mediator/org/apache/axis2/test"/>
> -        <copy file="test-resources/org/apache/axis2/META-INF/service-
> mediator.xml"
> -
>  tofile="target/services/test-mediator/META-INF/services.xml"/>
> -        <copy
> file="target/test-classes/org/apache/axis2/test/TestMediator.class"
> -
>  tofile="target/services/test-mediator/org/apache/axis2/test/TestMediator.class"/>
> -        <jar jarfile="target/test-mediator.aar"
> -             basedir="target/services/test-mediator">
> -            <include name="**"/>
> -        </jar>
>
> -        <!--echo message="Creating EnvironmentAware-Mediator aar"/>
> -        <mkdir dir="target/services/environmentaware-mediator/META-INF"/>
> -        <mkdir
> dir="target/services/environmentaware-mediator/org/apache/axis2/test"/>
> -        <copy
> file="test-resources/org/apache/axis2/META-INF/environmentaware-
> service.xml"
> -
>  tofile="target/services/environmentaware-mediator/META-INF/services.xml"/>
> -        <copy
> file="target/test-classes/org/apache/axis2/test/EnvironmentAwareMediator.class"
> -
>  tofile="target/services/environmentaware-mediator/org/apache/axis2/test/EnvironmentAwareMediator.class"/>
> -        <jar jarfile="target/environmentaware-mediator.aar"
> -             basedir="target/services/environmentaware-mediator">
> -            <include name="**"/>
> -        </jar-->
> -
> -        <echo message="-----------Creating Testing Repository - SendOn
> ----------"/>
> -        <mkdir dir="target/synapse-repository-sendon"/>
> -        <copy file="target/synapse.aar"
> -
>  tofile="target/synapse-repository-sendon/services/synapse.aar"/>
> -        <copy file="target/npe.aar"
> -
>  tofile="target/synapse-repository-sendon/services/npe.aar"/>
> -        <copy file="target/emptymediator.aar"
> -
>  tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
> -        <mkdir dir="target/synapse-repository-sendon/modules"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-sendon/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="../../repository/conf/axis2.xml"
> -              tofile="target/synapse-repository-sendon/conf/axis2.xml"/>
> -        <copy file="test/rules/synapse-sendon.xml"
> -
>  tofile="target/synapse-repository-sendon/conf/synapse.xml"/>
> -
> -
> -        <echo message="-----------Creating Testing Repository - SendNow
> ----------"/>
> -            <mkdir dir="target/synapse-repository-sendnow"/>
> -            <copy file="target/synapse.aar"
> -
>  tofile="target/synapse-repository-sendnow/services/synapse.aar"/>
> -            <copy file="target/npe.aar"
> -
>  tofile="target/synapse-repository-sendnow/services/npe.aar"/>
> -            <copy file="target/emptymediator.aar"
> -
>  tofile="target/synapse-repository-sendnow/services/emptymediator.aar"/>
> -            <mkdir dir="target/synapse-repository-sendnow/modules"/>
> -            <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-sendnow/modules/addressing-${
> addressing.version}.mar"/>
> -            <copy file="../../repository/conf/axis2.xml"
> -
>  tofile="target/synapse-repository-sendnow/conf/axis2.xml"/>
> -            <copy file="test/rules/synapse-sendnow.xml"
> -
>  tofile="target/synapse-repository-sendnow/conf/synapse.xml"/>
> -
> -        <echo message="-----------Creating Testing Repository -
> SendOnAxis2 ----------"/>
> -        <mkdir dir="target/synapse-repository-sendonAxis2"/>
> -
> -        <copy file="target/npe.aar"
> -
>  tofile="target/synapse-repository-sendonAxis2/services/npe.aar"/>
> -        <copy file="target/test-mediator.aar"
> -
>  tofile="target/synapse-repository-sendonAxis2/services/test-mediator.aar
> "/>
> -        <copy file="target/emptymediator.aar"
> -
>  tofile="target/synapse-repository-sendonAxis2/services/emptymediator.aar"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-sendonAxis2/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="test-resources/axis2/conf/axis2.xml"
> -
>  tofile="target/synapse-repository-sendonAxis2/conf/axis2.xml"/>
> -
> -        <echo message="-----------Creating Testing Repository -
> SendonAxis2Tcp ----------"/>
> -        <mkdir dir="target/synapse-repository-sendonAxis2"/>
> -
> -        <copy file="target/npe.aar"
> -
>  tofile="target/synapse-repository-sendonAxis2Tcp/services/npe.aar"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-sendonAxis2Tcp/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="test-resources/tcp/axis2-tcp.xml"
> -
>  tofile="target/synapse-repository-sendonAxis2Tcp/conf/axis2.xml"/>
> -
> -        <echo message="-----------Creating Testing Repository - HttpTcp
> ----------"/>
> -        <mkdir dir="target/synapse-repository-httptcp"/>
> -
> -        <copy file="target/emptymediator.aar"
> -
>  tofile="target/synapse-repository-httptcp/services/emptymediator.aar"/>
> -        <copy file="target/synapse.aar"
> -
>  tofile="target/synapse-repository-httptcp/services/synapse.aar"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-httptcp/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="../../repository/conf/axis2.xml"
> -              tofile="target/synapse-repository-httptcp/conf/axis2.xml"/>
> -        <copy file="test/rules/synapse-httptcp.xml"
> -
>  tofile="target/synapse-repository-httptcp/conf/synapse.xml"/>
> -
> -        <echo message="-----------Creating Testing Repository -
> EnvironmentAware ----------"/>
> -        <!--mkdir dir="target/synapse-repository-environmentaware"/>
> -
> -        <copy file="target/environmentaware-mediator.aar"
> -
>  tofile="target/synapse-repository-environmentaware/services/environmentaware-
> mediator.aar"/>
> -        <copy file="target/emptymediator.aar"
> -
>  tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
> -        <copy file="target/synapse.aar"
> -
>  tofile="target/synapse-repository-environmentaware/services/synapse.aar"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-environmentaware/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="../../repository/conf/axis2.xml"
> -
>  tofile="target/synapse-repository-environmentaware/conf/axis2.xml"/>
> -        <copy file="test/rules/synapse-environmentaware.xml"
> -
>  tofile="target/synapse-repository-environmentaware/conf/synapse.xml"/-->
> -
> -        <echo message="-----------Creating Testing Repository - Simple
> REST Repository ----------"/>
> -        <mkdir dir="target/synapse-repository-resources"/>
> -
> -        <copy file="target/npe.aar"
> -
>  tofile="target/synapse-repository-resources/services/npe.aar"/>
> -        <copy file="../../repository/modules/addressing-${
> addressing.version}.mar"
> -
>  tofile="target/synapse-repository-resources/modules/addressing-${
> addressing.version}.mar"/>
> -        <copy file="test-resources/rest/conf/axis2-rest.xml"
> -
>  tofile="target/synapse-repository-resources/conf/axis2.xml"/>
> -
> -        <ant:delete file="target/npe.aar"/>
> -        <ant:delete file="target/test-mediator.aar"/>
> -        <ant:delete dir="target/test-mediator"/>
> -        <ant:delete dir="target/environmentaware-mediator.aar"/>
> -        <ant:delete dir="target/environmentaware-mediator"/>
> -
> -
>         <echo message="-----------Creating Testing Repository -
> Genral----------"/>
>         <mkdir dir="target/synapse-repository"/>
>         <copy file="target/synapse.aar"
> Index: modules/core/src/org/apache/synapse/api/EnvironmentAware.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/api/EnvironmentAware.java
> (revision 405035)
> +++ modules/core/src/org/apache/synapse/api/EnvironmentAware.java
> (working copy)
> @@ -1,30 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.api;
> -
> -import org.apache.synapse.SynapseEnvironment;
> -
> -/**
> - * @deprecated
> - * <p>API for Mediators to get access to the Synapse Environment
> - *
> - */
> -public interface EnvironmentAware  {
> -       public void setSynapseEnvironment(SynapseEnvironment se);
> -       public void setClassLoader(ClassLoader cl);
> -
> -}
> Index: modules/core/src/org/apache/synapse/api/FilterMediator.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/api/FilterMediator.java (revision
> 405035)
> +++ modules/core/src/org/apache/synapse/api/FilterMediator.java (working
> copy)
> @@ -1,7 +1,20 @@
>  package org.apache.synapse.api;
>
> -import org.apache.synapse.SynapseMessage;
> +import org.apache.synapse.SynapseContext;
>
> +/**
> + * The filter mediator is a list mediator, which executes the given (sub)
> list of mediators
> + * if the specified condition is satisfied
> + *
> + * @see FilterMediator#test(org.apache.synapse.SynapseContext)
> + */
>  public interface FilterMediator extends ListMediator {
> -       public boolean test(SynapseMessage sm);
> +
> +    /**
> +     * Should return true if the sub/child mediators should execute. i.e.
> if the filter
> +     * condition is satisfied
> +     * @param synCtx
> +     * @return true if the configured filter condition evaluates to true
> +     */
> +    public boolean test(SynapseContext synCtx);
>  }
> Index: modules/core/src/org/apache/synapse/api/ListMediator.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/api/ListMediator.java   (revision
> 405035)
> +++ modules/core/src/org/apache/synapse/api/ListMediator.java   (working
> copy)
> @@ -1,3 +1,18 @@
> +/*
> +* Copyright 2004,2005 The Apache Software Foundation.
> +*
> +* Licensed 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.
> +*/
>  package org.apache.synapse.api;
>
>  import java.util.List;
> @@ -2,5 +17,40 @@
>
> +/**
> + * The List mediator executes a given sequence/list of child mediators
> + */
>  public interface ListMediator extends Mediator {
> -       public void setList(List m);
> -       public List getList();
> +
> +    /**
> +     * Appends the specified mediator to the end of this mediator's
> (children) list
> +     * @param m the mediator to be added
> +     * @return true (as per the general contract of the Collection.addmethod)
> +     */
> +    public boolean addChild(Mediator m);
> +
> +    /**
> +     * Returns the mediator at the specified position
> +     * @param pos index of mediator to return
> +     * @return the mediator at the specified position in this list
> +     */
> +    public Mediator getChild(int pos);
> +
> +    /**
> +     * Removes the first occurrence in this list of the specified
> mediator
> +     * @param m mediator to be removed from this list, if present
> +     * @return true if this list contained the specified mediator
> +     */
> +    public boolean removeChild(Mediator m);
> +
> +    /**
> +     * Removes the mediator at the specified position in this list
> +     * @param pos the index of the mediator to remove
> +     * @return the mediator previously at the specified position
> +     */
> +    public Mediator removeChild(int pos);
> +
> +    /**
> +     * Return the list of mediators of this List mediator instance
> +     * @return the child/sub mediator list
> +     */
> +    public List getList();
>  }
> Index: modules/core/src/org/apache/synapse/api/Mediator.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/api/Mediator.java       (revision
> 405035)
> +++ modules/core/src/org/apache/synapse/api/Mediator.java       (working
> copy)
> @@ -16,14 +16,29 @@
>  package org.apache.synapse.api;
>
>  import org.apache.synapse.SynapseMessage;
> +import org.apache.synapse.SynapseContext;
>
>  /**
> - *
> - * <p>API interface for pluggable mediators
> - *
> + * All Synapse mediators must implement this Mediator interface. As a
> message passes
> + * through the synapse system, each mediator's mediate() method is
> invoked in the
> + * sequence/order defined in the SynapseConfiguration.
>  */
>  public interface Mediator {
> -       public boolean mediate(SynapseMessage smc);
> -       //public String getName();
> -       //public void setName(String name);
> +
> +    /**
> +     * Invokes the mediator passing the current message for mediation.
> Each
> +     * mediator performs its mediation action, and returns true if
> mediation
> +     * should continue, or false if further mediation should be aborted.
> +     *
> +     * @param synCtx the current message for mediation
> +     * @return true if further mediation should continue
> +     */
> +    public boolean mediate(SynapseContext synCtx);
> +
> +    /**
> +     * This is used for debugging purposes and exposes the type of the
> current
> +     * mediator for logging and debugging purposes
> +     * @return a String representation of the mediator type
> +     */
> +    public String getType();
>  }
> \ No newline at end of file
> Index: modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java
>  (revision 405035)
> +++ modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java
>  (working copy)
> @@ -1,20 +0,0 @@
> -package org.apache.synapse.api;
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -public interface ResourceUpdateAware {
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
> ===================================================================
> ---
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
>       (revision 405035)
> +++
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
>       (working copy)
> @@ -1,30 +0,0 @@
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.receivers.AbstractMessageReceiver;
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.synapse.api.Mediator;
> -
> -public class ServiceMediatorMessageReceiver extends
> AbstractMessageReceiver {
> -    public void receive(MessageContext messageContext) throws AxisFault {
> -        Object obj = makeNewServiceObject(messageContext);
> -
> -        Mediator mediator = (Mediator) obj;
> -/*
> -        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass()))
> {
> -            SynapseEnvironment se = (SynapseEnvironment) messageContext
> -                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY
> );
> -            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
> -            ((EnvironmentAware) mediator).setClassLoader(
> -                    messageContext.getAxisService().getClassLoader());
> -        }
> -
> -*/
> -        SynapseMessage smc = new Axis2SynapseMessage(messageContext,
> Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
> -        boolean returnValue = mediator.mediate(smc);
> -        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
> -                new Boolean(returnValue));
> -    }
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
>       (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
>       (working copy)
> @@ -1,191 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -
> -import org.apache.axis2.context.ConfigurationContext;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.context.ServiceContext;
> -import org.apache.axis2.context.ServiceGroupContext;
> -import org.apache.axis2.description.*;
> -import org.apache.axis2.engine.AxisConfiguration;
> -
> -import org.apache.axis2.util.UUIDGenerator;
> -import org.apache.axis2.wsdl.WSDLConstants;
> -import org.apache.axis2.deployment.util.PhasesInfo;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.addressing.AddressingConstants;
> -import org.apache.axis2.client.OperationClient;
> -import org.apache.axis2.client.Options;
> -
> -import org.apache.synapse.Constants;
> -import org.apache.axiom.soap.SOAPEnvelope;
> -import org.apache.axiom.soap.SOAPHeader;
> -import org.apache.axiom.soap.SOAPHeaderBlock;
> -
> -
> -import javax.xml.namespace.QName;
> -import java.util.Iterator;
> -import java.util.ArrayList;
> -
> -
> -/**
> - * This is a simple client that handles both in only and in out
> - */
> -public class Axis2FlexibleMEPClient {
> -
> -    public static SOAPEnvelope outEnvelopeConfiguration(MessageContext
> smc) {
> -        SOAPEnvelope env = smc.getEnvelope();
> -        SOAPHeader soapHeader = env.getHeader();
> -        ArrayList addressingHeaders;
> -        if (soapHeader != null) {
> -            addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
> -                    AddressingConstants.Submission.WSA_NAMESPACE);
> -            if (addressingHeaders != null && addressingHeaders.size() !=
> 0) {
> -                detachAddressingInformation(addressingHeaders);
> -
> -            } else {
> -                addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
> -                        AddressingConstants.Final.WSA_NAMESPACE);
> -                if (addressingHeaders != null && addressingHeaders.size()
> != 0) {
> -                    detachAddressingInformation(addressingHeaders);
> -                }
> -            }
> -        }
> -        return env;
> -    }
> -
> -    /**
> -     *
> -     * @param headerInformation
> -     */
> -    private static void detachAddressingInformation(ArrayList
> headerInformation) {
> -        Iterator iterator = headerInformation.iterator();
> -        while (iterator.hasNext()) {
> -            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next
> ();
> -            headerBlock.detach();
> -        }
> -
> -    }
> -
> -    // Following code is based on Axis2 Client code.
> -    public static MessageContext send(MessageContext smc) throws
> AxisFault {
> -        // In this logic Synapse Work as a Client to a Server
> -        // So here this logic should expect 200 ok, 202 ok and 500
> internal server error
> -        // current state of the code in Synchronus
> -
> -        // This is the original_configuration_context
> -        ConfigurationContext cc = smc.getConfigurationContext();
> -        AxisConfiguration ac = cc.getAxisConfiguration();
> -        PhasesInfo phasesInfo = ac.getPhasesInfo();
> -
> -        // setting operation default chains
> -        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
> -            // Lets default be OUT_IN
> -            OutInAxisOperation outInOperation =
> -                    new OutInAxisOperation(new QName(
> -                            "__OPERATION_OUT_IN__"));
> -            AxisService axisAnonymousService =
> -                    new AxisService("__ANONYMOUS_SERVICE__");
> -            axisAnonymousService.addOperation(outInOperation);
> -            ac.addService(axisAnonymousService);
> -            phasesInfo.setOperationPhases(outInOperation);
> -        }
> -        ServiceGroupContext sgc = new ServiceGroupContext(cc,
> -
>  (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
> -        ServiceContext sc =
> -                sgc.getServiceContext(new
> AxisService("__ANONYMOUS_SERVICE__"));
> -
> -        MessageContext mc = new MessageContext();
> -        mc.setConfigurationContext(sc.getConfigurationContext());
> -
>  ///////////////////////////////////////////////////////////////////////
> -        // filtering properties
> -        if (smc.getSoapAction() != null)
> -            mc.setSoapAction(smc.getSoapAction());
> -        if (smc.getWSAAction() != null)
> -            mc.setWSAAction(smc.getWSAAction());
> -        if (smc.getFrom() != null)
> -            mc.setFrom(smc.getFrom());
> -        if (smc.getMessageID() != null)
> -            mc.setMessageID(smc.getMessageID());
> -        else
> -            mc.setMessageID(String.valueOf("uuid:"
> -                    + UUIDGenerator.getUUID()));
> -        if (smc.getReplyTo() != null)
> -            mc.setReplyTo(smc.getReplyTo());
> -        if (smc.getRelatesTo() != null)
> -            mc.setRelatesTo(smc.getRelatesTo());
> -        if (smc.getTo() != null) {
> -            mc.setTo(smc.getTo());
> -        } else {
> -            throw new AxisFault(
> -                    "To canno't be null, if null Synapse can't infer the
> transport");
> -        }
> -        if (smc.isDoingREST()) {
> -            mc.setDoingREST(true);
> -        }
> -
> -        // handling the outbound message with addressing
> -        AxisModule module = ac.getModule(new QName(
> org.apache.axis2.Constants.MODULE_ADDRESSING));
> -        if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) !=
> null) ||
> -                (smc.getProperty(
> -                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) !=
> null)){
> -            if (!ac.getService("__ANONYMOUS_SERVICE__")
> -                    .isEngaged(module.getName())) {
> -                ac.getService("__ANONYMOUS_SERVICE__").engageModule(module,
> ac);
> -            }
> -        }
> -
> -
> -        //TODO; following line needed to be removed
> -
> -        mc.setEnvelope(outEnvelopeConfiguration(smc));
> -
> -        AxisOperation axisAnonymousOperation =
> -                ac.getService("__ANONYMOUS_SERVICE__")
> -                        .getOperation(new QName("__OPERATION_OUT_IN__"));
> -
> -        //Options class from Axis2 holds client side settings
> -        Options options = new Options();
> -        OperationClient mepClient =
> -                axisAnonymousOperation.createClient(sc, options);
> -        mepClient.addMessageContext(mc);
> -        mepClient.execute(true);
> -        MessageContext response = mepClient
> -                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> -        response.setProperty(MessageContext.TRANSPORT_OUT,
> -                smc.getProperty(MessageContext.TRANSPORT_OUT));
> -        response.setProperty(
> org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
> -                smc.getProperty(
> -                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
> -
> -
> -        // If request is REST we assume the response is REST, so set the
> -        // variable
> -        response.setDoingREST(smc.isDoingREST());
> -        response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE
> );
> -
> -        if (ac.getService("__ANONYMOUS_SERVICE__")
> -                .isEngaged(module.getName())) {
> -            ac.getService("__ANONYMOUS_SERVICE__")
> -                    .disEngageModule(ac.getModule(module.getName()));
> -        }
> -        return response;
> -    }
> -
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
> ===================================================================
> ---
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
>        (revision 405035)
> +++
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
>        (working copy)
> @@ -1,97 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.io.InputStream;
> -
> -import javax.xml.stream.XMLStreamException;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.description.Parameter;
> -import org.apache.axis2.engine.AxisConfiguration;
> -
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseException;
> -import org.apache.synapse.Constants;
> -import org.apache.axiom.om.impl.builder.StAXOMBuilder;
> -import org.apache.axiom.om.OMElement;
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> -
> -/**
> - * <p/>
> - * The SynapseEnvironment needs to be set up and then is used by the
> SynapseMessageReceiver to inject messages.
> - * This class is used by the SynapseMessageReceiver to find the
> environment. The env is stored in a Parameter to the Axis2 config
> - */
> -public class Axis2SynapseEnvironmentFinder implements Constants {
> -       private static Log log = LogFactory.getLog(
> Axis2SynapseEnvironmentFinder.class);
> -    public static synchronized SynapseEnvironment getSynapseEnvironment(
> -            MessageContext mc) {
> -        AxisConfiguration ac =
> -                mc.getConfigurationContext().getAxisConfiguration();
> -        Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
> -        if (synapseEnvParam == null) {
> -               log.debug("synapse env not available - creating");
> -            Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
> -            if (param == null) {
> -                throw new SynapseException("no parameter '"
> -                        + SYNAPSECONFIGURATION + "' in axis2.xml");
> -            }
> -            String synapseConfig = (String) param.getValue();
> -            InputStream is = mc.getAxisService().getClassLoader()
> -                    .getResourceAsStream(synapseConfig.trim());
> -
> -            StAXOMBuilder builder;
> -            try {
> -                builder = new StAXOMBuilder(is);
> -
> -            } catch (XMLStreamException e1) {
> -                throw new SynapseException(
> -                        "Trouble parsing Synapse Configuration ", e1);
> -
> -            }
> -            OMElement config = builder.getDocumentElement();
> -            config.build();
> -            Axis2SynapseEnvironment se = new
> Axis2SynapseEnvironment(config, mc
> -                    .getAxisService().getClassLoader());
> -
> -            synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
> -            synapseEnvParam.setValue(se);
> -            try {
> -                ac.addParameter(synapseEnvParam);
> -            } catch (AxisFault e) {
> -                throw new SynapseException(e);
> -            }
> -        }
> -        return (SynapseEnvironment) synapseEnvParam.getValue();
> -
> -    }
> -    public static synchronized void setSynapseEnvironment(MessageContext
> mc, SynapseEnvironment se) {
> -         AxisConfiguration ac =
> -              mc.getConfigurationContext().getAxisConfiguration();
> -         Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT,
> null);
> -          synapseEnvParam.setValue(se);
> -         try {
> -                       ac.addParameter(synapseEnvParam);
> -               } catch (AxisFault e) {
> -                       throw new SynapseException(e);
> -               }
> -
> -    }
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2Sender.java  (revision
> 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2Sender.java  (working
> copy)
> @@ -1,114 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.description.TransportInDescription;
> -
> -import org.apache.axis2.engine.AxisEngine;
> -
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseException;
> -import org.apache.synapse.SynapseMessage;
> -
> -
> -
> -/**
> - * This class helps the Axis2SynapseEnvironment implement the send method
> - */
> -public class Axis2Sender {
> -
> -    public static void sendOn(SynapseMessage smc) {
> -
> -        try {
> -
> -            MessageContext messageContext = ((Axis2SynapseMessage) smc)
> -                    .getMessageContext();
> -            // At any time any QOS is disengaged. It's engaged iff, a
> flag is
> -            // set in execution chain.
> -            // ex: addressing will be engage in outpath iff
> ADDRESSING_PROCESSED
> -            // is set.
> -
> -            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE)
> != null)
> -            {
> -
> -                messageContext.setProperty(
> -                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE,
> Boolean.TRUE);
> -
> -            }
> -            //Now hadle the outbound message with addressing
> -            if (smc.getProperty(
> -                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) !=
> null) {
> -                messageContext.setProperty(
> -                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
> -                        Boolean.TRUE);
> -
> -            }
> -
> -            MessageContext outMsgContext = Axis2FlexibleMEPClient
> -                    .send(messageContext);
> -
> -            // run all rules on response
> -
> -            smc.setResponse(true);//
> -
> -            outMsgContext.setServerSide(true);
> -
> -            Object os = messageContext
> -                    .getProperty(MessageContext.TRANSPORT_OUT);
> -            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
> -            TransportInDescription ti = messageContext.getTransportIn();
> -
> -            outMsgContext.setTransportIn(ti);
> -
> -            if (smc.getSynapseEnvironment() == null) {
> -                throw new SynapseException("no Synapse Env set on
> message");
> -            }
> -            smc.getSynapseEnvironment().injectMessage(new
> Axis2SynapseMessage(
> -                    outMsgContext, smc.getSynapseEnvironment()));
> -        } catch (Exception e) {
> -            e.printStackTrace();
> -            throw new SynapseException(e);
> -        }
> -    }
> -
> -    public static void sendBack(SynapseMessage smc) {
> -        MessageContext messageContext = ((Axis2SynapseMessage) smc)
> -                .getMessageContext();
> -        AxisEngine ae =
> -                new AxisEngine(messageContext.getConfigurationContext());
> -        try {
> -//
> -
> -
> -            messageContext
> -                    .setProperty(Constants.ISRESPONSE_PROPERTY,
> Boolean.TRUE);
> -            // check for addressing is alredy engaged for this message.
> -            // if engage we should use the address enable Configuraion
> context.
> -//
> -
> -            ae.send(messageContext);
> -        } catch (AxisFault e) {
> -            throw new SynapseException(e);
> -
> -        }
> -
> -    }
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> (working copy)
> @@ -1,37 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -
> -import org.apache.axis2.engine.MessageReceiver;
> -import org.apache.synapse.Constants;
> -
> -/**
> - *
> - * <p>Does nothing! Used as an endpoint so we can engage modules
> - *
> - */
> -public class EmptyMessageReceiver implements MessageReceiver {
> -
> -       public void receive(MessageContext mc) throws AxisFault {
> -               mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
> Boolean
> -                               .valueOf(true));
> -       }
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
>  (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
>  (working copy)
> @@ -1,63 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -package org.apache.synapse.axis2;
> -
> -import javax.xml.namespace.QName;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.description.AxisOperation;
> -import org.apache.axis2.description.AxisService;
> -import org.apache.axis2.description.HandlerDescription;
> -import org.apache.axis2.engine.AbstractDispatcher;
> -import org.apache.axis2.engine.AxisConfiguration;
> -
> -/**
> - *
> - *
> - * This sends every message to the SynapseMessageReceiver so that it can
> pass them to Synapse
> - *
> - */
> -public class SynapseDispatcher extends AbstractDispatcher {
> -       // FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
> -
> -       private static final long serialVersionUID =
> -6970206989111592645L;
> -
> -       private static final String SYNAPSE_SERVICE_NAME = "synapse";
> -
> -       private static final QName MEDIATE_OPERATION_NAME = new
> QName("mediate");
> -
> -       public void initDispatcher() {
> -               QName qn = new QName("http://synapse.apache.org",
> "SynapseDispatcher");
> -               HandlerDescription hd = new HandlerDescription(qn);
> -               super.init(hd);
> -
> -       }
> -
> -       public AxisService findService(MessageContext mc) throws AxisFault
> {
> -               AxisConfiguration ac = mc.getConfigurationContext
> ().getAxisConfiguration();
> -               AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
> -               return as;
> -       }
> -
> -       public AxisOperation findOperation(AxisService svc, MessageContext
> mc)
> -                       throws AxisFault {
> -
> -               AxisOperation ao = svc.getOperation
> (MEDIATE_OPERATION_NAME);
> -               return ao;
> -       }
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> (working copy)
> @@ -1,177 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.context.OperationContext;
> -import org.apache.axis2.context.ServiceContext;
> -import org.apache.axis2.context.ConfigurationContext;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.wsdl.WSDLConstants;
> -import org.apache.axis2.engine.AxisEngine;
> -import org.apache.axis2.addressing.EndpointReference;
> -import org.apache.axis2.client.OperationClient;
> -import org.apache.axis2.client.Options;
> -import org.apache.axis2.client.async.Callback;
> -import org.apache.axis2.description.AxisOperation;
> -import org.apache.axis2.description.ClientUtils;
> -import org.apache.axis2.description.InOutAxisOperation;
> -import org.apache.axis2.description.Parameter;
> -import org.apache.axis2.description.TransportInDescription;
> -import org.apache.axis2.description.TransportOutDescription;
> -import org.apache.synapse.SynapseException;
> -
> -
> -import javax.xml.namespace.QName;
> -import java.util.HashMap;
> -
> -/**
> - * DynamicAxisOperation which switch dynamically between MEPs
> - */
> -public class DynamicAxisOperation extends InOutAxisOperation {
> -    public DynamicAxisOperation() {
> -        super();
> -    }
> -
> -    public DynamicAxisOperation(QName name) {
> -        super(name);
> -    }
> -
> -    public void addMessageContext(MessageContext msgContext,
> -                                  OperationContext opContext) throws
> AxisFault {
> -        HashMap mep = opContext.getMessageContexts();
> -        MessageContext immsgContext = (MessageContext) mep
> -                .get(MESSAGE_LABEL_IN_VALUE);
> -        MessageContext outmsgContext = (MessageContext) mep
> -                .get(MESSAGE_LABEL_OUT_VALUE);
> -
> -        if ((immsgContext != null) && (outmsgContext != null)) {
> -            throw new AxisFault(
> -                    "Invalid message addition , operation context
> completed");
> -        }
> -
> -        if (outmsgContext == null) {
> -            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
> -        } else {
> -            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
> -            opContext.setComplete(true);
> -        }
> -    }
> -
> -
> -    public OperationClient createClient(ServiceContext sc, Options
> options) {
> -        return new DynamicOperationClient(this,sc,options);
> -    }
> -
> -}
> -
> -class DynamicOperationClient implements OperationClient {
> -    private DynamicAxisOperation axisOp;
> -    private ServiceContext sc;
> -    private OperationContext oc;
> -    private Options options;
> -
> -    public DynamicOperationClient(DynamicAxisOperation axisOp,
> ServiceContext sc, Options options){
> -        this.options = options;
> -        this.axisOp = axisOp;
> -        this.sc = sc;
> -        this.oc = new OperationContext(axisOp,sc);
> -        this.oc.setParent(this.sc);
> -    }
> -
> -    public void setOptions(Options options) {
> -        // Not supported
> -    }
> -
> -    public Options getOptions() {
> -        throw new SynapseException("Not Supported");
> -    }
> -
> -    public void addMessageContext(MessageContext mc) throws AxisFault {
> -        mc.setServiceContext(sc);
> -        axisOp.registerOperationContext(mc, oc);
> -    }
> -
> -    public MessageContext getMessageContext(String messageLabel) throws
> AxisFault {
> -        return oc.getMessageContext(messageLabel);
> -    }
> -
> -    public void setCallback(Callback callback) {
> -        // Not supported
> -    }
> -
> -    public void execute(boolean block) throws AxisFault {
> -        if (block) {
> -            ConfigurationContext cc = sc.getConfigurationContext();
> -
> -            // copy interesting info from options to message context.
> -            MessageContext mc = oc
> -                    .getMessageContext(
> WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> -            if (mc == null) {
> -                throw new AxisFault(
> -                        "Out message context is null ,"
> -                                + " please set the out message context
> before calling this method");
> -            }
> -
> -            EndpointReference toEPR = mc.getTo();
> -
> -            TransportOutDescription transportOut =
> ClientUtils.inferOutTransport(cc
> -                    .getAxisConfiguration(), toEPR, mc);
> -            mc.setTransportOut(transportOut);
> -
> -            /*
> -            Options need to Infer TransportInDescription
> -            */
> -            if (mc.getTransportIn() == null) {
> -                TransportInDescription transportIn =
> options.getTransportIn();
> -                if (transportIn == null) {
> -                    mc.setTransportIn(ClientUtils.inferInTransport(cc
> -                            .getAxisConfiguration(), options, mc));
> -                } else {
> -                    mc.setTransportIn(transportIn);
> -                }
> -            }
> -
> -            if (mc.getSoapAction() == null || "".equals(mc.getSoapAction()))
> {
> -                Parameter soapaction = axisOp.getParameter(
> AxisOperation.SOAP_ACTION);
> -                if (soapaction != null) {
> -                    mc.setSoapAction((String) soapaction.getValue());
> -                }
> -            }
> -
> -            oc.addMessageContext(mc);
> -            // ship it out
> -            AxisEngine engine = new AxisEngine(cc);
> -            engine.send(mc);
> -        }
> -
> -    }
> -    public OperationContext getOperationContext() {
> -       return oc;
> -    }
> -
> -    public void reset() throws AxisFault {
> -        // Not supported
> -    }
> -
> -    public void complete(MessageContext msgCtxt) throws AxisFault {
> -        // Not supported
> -    }
> -
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
>       (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
>       (working copy)
> @@ -1,68 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.Constants;
> -import org.apache.axis2.context.MessageContext;
> -
> -import org.apache.axis2.engine.MessageReceiver;
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> -
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseMessage;
> -
> -/**
> - * <p/>
> - * <p/>
> - * This is used to "catch" messages in Axis2 and pass them to Synapse for
> processing.
> - */
> -public class SynapseMessageReceiver implements MessageReceiver {
> -
> -    private Log log = LogFactory.getLog(getClass());
> -
> -    public void receive(MessageContext mc) throws AxisFault {
> -        log.debug("receiving message");
> -        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
> -                .getSynapseEnvironment(mc);
> -
>  ////////////////////////////////////////////////////////////////////////
> -        // SynapseEnvironment is set as a property in MessageContext.
> This is due
> -        // use we can expect in ServiceMediatorProcessor and many
> extensions yet to come
> -        // So it a mediator uses EnvironmentAware, that mediator will be
> injected with the correct environment
> -
> -
>  ////////////////////////////////////////////////////////////////////////
> -        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
> -        smc.setSynapseEnvironment(env);
> -        env.injectMessage(smc);
> -
> -
>  ///////////////////////////////////////////////////////////////////////
> -        // Response handling mechanism for 200/202 and 5XX
> -        // smc.isResponse =true then the response will be handle with 200
> OK
> -        // else, response will be 202 OK without no http body
> -        // smc.isFaultRespose = true then the response is a fault with
> 500 Internal Server Error
> -        if (smc.isResponse()) {
> -            mc.getOperationContext().setProperty(
> Constants.RESPONSE_WRITTEN,
> -                    Constants.VALUE_TRUE);
> -        }
> -        if (smc.isFaultResponse()) {
> -            // todo: a good way to inject faultSoapEnv to the Axis2
> Transport
> -            throw new AxisFault(
> -                    "Synapse Encounters an Error - Please See Log for
> More Details");
> -        }
> -
>  ///////////////////////////////////////////////////////////////////////
> -    }
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
>      (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
>      (working copy)
> @@ -1,189 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.util.HashMap;
> -import java.util.List;
> -import java.util.Map;
> -
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> -
> -
> -import org.apache.synapse.Metrics;
> -import org.apache.synapse.MetricsFactory;
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.synapse.api.Mediator;
> -import org.apache.synapse.registry.Registry;
> -//import org.apache.synapse.resources.ResourceHelperFactory;
> -//import org.apache.synapse.resources.ResourceHelper;
> -//import org.apache.synapse.resources.xml.ResourceMediator;
> -
> -import org.apache.synapse.xml.MediatorFactoryFinder;
> -import org.apache.axiom.om.OMElement;
> -import org.apache.axis2.addressing.EndpointReference;
> -
> -/**
> - *
> - *
> - *
> - * <p> This is the Axis2 implementation of the SynapseEnvironment
> - *
> - */
> -public class Axis2SynapseEnvironment implements SynapseEnvironment {
> -
> -    private Mediator mainmediator = null;
> -
> -    private ClassLoader cl = null;
> -    private Map properties = new HashMap();
> -    private Map mediators = new HashMap();
> -
> -    private Log log = LogFactory.getLog(getClass());
> -
> -    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
> -                                   ClassLoader cl) {
> -        super();
> -        this.cl = cl;
> -        if (synapseConfiguration!=null)
> -            mainmediator = MediatorFactoryFinder.getMediator(this,
> synapseConfiguration);
> -    }
> -
> -    /**
> -     * Retrieves an object given a key.
> -     *
> -     * @param key - if not found, will return null
> -     * @return Returns the property.
> -     */
> -
> -    public Object getProperty(String key) {
> -        Object obj = null;
> -
> -        obj = properties.get(key);
> -
> -
> -        return obj;
> -    }
> -
> -    /**
> -     * Store a property for message context
> -     *
> -     * @param key
> -     * @param value
> -     */
> -    public void setProperty(String key, Object value) {
> -        properties.put(key, value);
> -    }
> -
> -
> -    public void injectMessage(SynapseMessage smc) {
> -       smc.setSynapseEnvironment(this);
> -       mainmediator.mediate(smc);
> -    }
> -
> -    public ClassLoader getClassLoader() {
> -        return cl;
> -    }
> -
> -    public void setClassLoader(ClassLoader cl) {
> -        this.cl = cl;
> -    }
> -
> -    public void send(SynapseMessage sm) {
> -        if (sm.isResponse())
> -            Axis2Sender.sendBack(sm);
> -        else
> -            Axis2Sender.sendOn(sm);
> -    }
> -
> -
> -    public Mediator lookupMediator(String name) {
> -        return (Mediator) mediators.get(name);
> -    }
> -
> -    public void addMediator(String name, Mediator m) {
> -        log.debug("adding mediator with name " + name);
> -        if (mediators.containsKey(name))
> -            log.warn("name " + name + "already present");
> -        mediators.put(name, m);
> -    }
> -
> -    public Mediator getMasterMediator() {
> -        return mainmediator;
> -    }
> -
> -    public void setMasterMediator(Mediator m) {
> -        mainmediator = m;
> -    }
> -
> -       public Registry getRegistry() {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public void setRegistry(Registry reg) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -       public Metrics getMetrics(String URI) {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public Metrics getMetrics(EndpointReference epr) {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public void setMetricsFactory(MetricsFactory mf) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -       public void publish(OMElement element) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -    // lookup methods for resources handling
> - //   public Mediator lookupResourceMediator(String uriRoot) {
> -   //     return (Mediator) fac.getResourceMediator(uriRoot);
> -   // }
> -
> -  //  public void addResourceMediator(String uri, Mediator m) {
> -   //     log.debug("adding "+uri+" with "+m.getClass());
> -
> -       /*if (resourceMediators.containsKey(uri)) {
> -            throw new SynapseException(
> -                    "Uri Root is already exists. Not acceptable");
> -        }*/
> -
> -   //     fac.addResourceMediator(uri, (ResourceMediator)m);
> -   // }
> -
> -   // public ResourceHelper getResourceHelper() {
> -        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance
> ();
> -        //fac.setResourceProcessorsMap(this.resourceMediators);
> -        //log.debug("size in env is "+this.resourceMediators.size());
> -    //    return fac.createResourceHelper();
> -   // }
> -
> -
> -
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
>  (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
>  (working copy)
> @@ -1,228 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.util.HashMap;
> -import java.util.Iterator;
> -import java.util.Map;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.addressing.EndpointReference;
> -import org.apache.axis2.addressing.RelatesTo;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.axiom.soap.SOAPEnvelope;
> -
> -/**
> - *
> - *
> - * <p>
> - * A wrapper on Axis2's Message Context that implements the
> SynapseMessage interface
> - *
> - */
> -public class Axis2SynapseMessage implements SynapseMessage {
> -
> -    private MessageContext mc = null;
> -
> -    private Map props = new HashMap();
> -
> -    private boolean response = false;
> -
> -    private boolean faultResponse = false;
> -
> -    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se)
> {
> -        setMessageContext(mc);
> -        setSynapseEnvironment(se);
> -    }
> -
> -    public EndpointReference getFaultTo() {
> -        return mc.getFaultTo();
> -    }
> -
> -    public void setFaultTo(EndpointReference reference) {
> -        mc.setFaultTo(reference);
> -    }
> -
> -    public EndpointReference getFrom() {
> -        return mc.getFrom();
> -    }
> -
> -    public void setFrom(EndpointReference reference) {
> -        mc.setFrom(reference);
> -
> -    }
> -
> -    public SOAPEnvelope getEnvelope() {
> -
> -        return mc.getEnvelope();
> -    }
> -
> -    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
> -        mc.setEnvelope(envelope);
> -
> -    }
> -
> -    public String getMessageID() {
> -        return mc.getMessageID();
> -    }
> -
> -    public void setMessageID(String string) {
> -        mc.setMessageID(string);
> -
> -    }
> -
> -    public RelatesTo getRelatesTo() {
> -        return mc.getRelatesTo();
> -
> -    }
> -
> -    public void setRelatesTo(RelatesTo reference) {
> -        mc.setRelatesTo(reference);
> -
> -    }
> -
> -    public EndpointReference getReplyTo() {
> -        return mc.getReplyTo();
> -
> -    }
> -
> -    public void setReplyTo(EndpointReference reference) {
> -        mc.setReplyTo(reference);
> -
> -    }
> -
> -    public EndpointReference getTo() {
> -        return mc.getTo();
> -
> -    }
> -
> -    public void setTo(EndpointReference reference) {
> -        mc.setTo(reference);
> -
> -    }
> -
> -    public void setWSAAction(String actionURI) {
> -        mc.setWSAAction(actionURI);
> -
> -    }
> -
> -    public String getWSAAction() {
> -
> -        return mc.getWSAAction();
> -    }
> -
> -    public void setMessageId(String messageID) {
> -        mc.setWSAMessageId(messageID);
> -
> -    }
> -
> -    public String getMessageId() {
> -        return mc.getMessageID();
> -    }
> -
> -    public Object getProperty(String key) {
> -        Object obj = props.get(key);
> -        if ( obj == null) {
> -            obj = mc.getProperty(key);
> -        }
> -        return obj;
> -
> -    }
> -
> -    public void setProperty(String key, Object value) {
> -        props.put(key, value);
> -    }
> -
> -    public Iterator getPropertyNames() {
> -        return props.keySet().iterator();
> -    }
> -
> -    public String getSoapAction() {
> -        return mc.getSoapAction();
> -    }
> -
> -    public void setSoapAction(String string) {
> -        mc.setSoapAction(string);
> -
> -    }
> -
> -    public boolean isDoingMTOM() {
> -
> -        return mc.isDoingMTOM();
> -    }
> -
> -    public void setDoingMTOM(boolean b) {
> -        mc.setDoingMTOM(b);
> -
> -    }
> -
> -    public boolean isDoingREST() {
> -
> -        return mc.isDoingREST();
> -    }
> -
> -    public void setDoingREST(boolean b) {
> -        mc.setDoingREST(b);
> -
> -    }
> -
> -    public boolean isSOAP11() {
> -
> -        return mc.isSOAP11();
> -    }
> -
> -    public MessageContext getMessageContext() {
> -        return mc;
> -    }
> -
> -    public void setMessageContext(MessageContext mc) {
> -        this.mc = mc;
> -        Boolean resp = (Boolean) mc.getProperty(
> Constants.ISRESPONSE_PROPERTY);
> -        if (resp != null)
> -            response = resp.booleanValue();
> -    }
> -
> -    public void setResponse(boolean b) {
> -        response = b;
> -        mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf
> (b));
> -    }
> -
> -    public boolean isResponse() {
> -        return response;
> -    }
> -
> -    public void setFaultResponse(boolean b) {
> -        this.faultResponse = b;
> -    }
> -
> -    public boolean isFaultResponse() {
> -        return this.faultResponse;
> -    }
> -
> -       public SynapseEnvironment getSynapseEnvironment() {
> -               return Axis2SynapseEnvironmentFinder.getSynapseEnvironment
> (mc);
> -       }
> -
> -       public void setSynapseEnvironment(SynapseEnvironment env) {
> -               Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc,
> env);
> -               return;
> -       }
> -
> -
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
>       (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
>       (working copy)
> @@ -1,191 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -
> -import org.apache.axis2.context.ConfigurationContext;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.context.ServiceContext;
> -import org.apache.axis2.context.ServiceGroupContext;
> -import org.apache.axis2.description.*;
> -import org.apache.axis2.engine.AxisConfiguration;
> -
> -import org.apache.axis2.util.UUIDGenerator;
> -import org.apache.axis2.wsdl.WSDLConstants;
> -import org.apache.axis2.deployment.util.PhasesInfo;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.addressing.AddressingConstants;
> -import org.apache.axis2.client.OperationClient;
> -import org.apache.axis2.client.Options;
> -
> -import org.apache.synapse.Constants;
> -import org.apache.axiom.soap.SOAPEnvelope;
> -import org.apache.axiom.soap.SOAPHeader;
> -import org.apache.axiom.soap.SOAPHeaderBlock;
> -
> -
> -import javax.xml.namespace.QName;
> -import java.util.Iterator;
> -import java.util.ArrayList;
> -
> -
> -/**
> - * This is a simple client that handles both in only and in out
> - */
> -public class Axis2FlexibleMEPClient {
> -
> -    public static SOAPEnvelope outEnvelopeConfiguration(MessageContext
> smc) {
> -        SOAPEnvelope env = smc.getEnvelope();
> -        SOAPHeader soapHeader = env.getHeader();
> -        ArrayList addressingHeaders;
> -        if (soapHeader != null) {
> -            addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
> -                    AddressingConstants.Submission.WSA_NAMESPACE);
> -            if (addressingHeaders != null && addressingHeaders.size() !=
> 0) {
> -                detachAddressingInformation(addressingHeaders);
> -
> -            } else {
> -                addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
> -                        AddressingConstants.Final.WSA_NAMESPACE);
> -                if (addressingHeaders != null && addressingHeaders.size()
> != 0) {
> -                    detachAddressingInformation(addressingHeaders);
> -                }
> -            }
> -        }
> -        return env;
> -    }
> -
> -    /**
> -     *
> -     * @param headerInformation
> -     */
> -    private static void detachAddressingInformation(ArrayList
> headerInformation) {
> -        Iterator iterator = headerInformation.iterator();
> -        while (iterator.hasNext()) {
> -            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next
> ();
> -            headerBlock.detach();
> -        }
> -
> -    }
> -
> -    // Following code is based on Axis2 Client code.
> -    public static MessageContext send(MessageContext smc) throws
> AxisFault {
> -        // In this logic Synapse Work as a Client to a Server
> -        // So here this logic should expect 200 ok, 202 ok and 500
> internal server error
> -        // current state of the code in Synchronus
> -
> -        // This is the original_configuration_context
> -        ConfigurationContext cc = smc.getConfigurationContext();
> -        AxisConfiguration ac = cc.getAxisConfiguration();
> -        PhasesInfo phasesInfo = ac.getPhasesInfo();
> -
> -        // setting operation default chains
> -        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
> -            // Lets default be OUT_IN
> -            OutInAxisOperation outInOperation =
> -                    new OutInAxisOperation(new QName(
> -                            "__OPERATION_OUT_IN__"));
> -            AxisService axisAnonymousService =
> -                    new AxisService("__ANONYMOUS_SERVICE__");
> -            axisAnonymousService.addOperation(outInOperation);
> -            ac.addService(axisAnonymousService);
> -            phasesInfo.setOperationPhases(outInOperation);
> -        }
> -        ServiceGroupContext sgc = new ServiceGroupContext(cc,
> -
>  (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
> -        ServiceContext sc =
> -                sgc.getServiceContext(new
> AxisService("__ANONYMOUS_SERVICE__"));
> -
> -        MessageContext mc = new MessageContext();
> -        mc.setConfigurationContext(sc.getConfigurationContext());
> -
>  ///////////////////////////////////////////////////////////////////////
> -        // filtering properties
> -        if (smc.getSoapAction() != null)
> -            mc.setSoapAction(smc.getSoapAction());
> -        if (smc.getWSAAction() != null)
> -            mc.setWSAAction(smc.getWSAAction());
> -        if (smc.getFrom() != null)
> -            mc.setFrom(smc.getFrom());
> -        if (smc.getMessageID() != null)
> -            mc.setMessageID(smc.getMessageID());
> -        else
> -            mc.setMessageID(String.valueOf("uuid:"
> -                    + UUIDGenerator.getUUID()));
> -        if (smc.getReplyTo() != null)
> -            mc.setReplyTo(smc.getReplyTo());
> -        if (smc.getRelatesTo() != null)
> -            mc.setRelatesTo(smc.getRelatesTo());
> -        if (smc.getTo() != null) {
> -            mc.setTo(smc.getTo());
> -        } else {
> -            throw new AxisFault(
> -                    "To canno't be null, if null Synapse can't infer the
> transport");
> -        }
> -        if (smc.isDoingREST()) {
> -            mc.setDoingREST(true);
> -        }
> -
> -        // handling the outbound message with addressing
> -        AxisModule module = ac.getModule(new QName(
> org.apache.axis2.Constants.MODULE_ADDRESSING));
> -        if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) !=
> null) ||
> -                (smc.getProperty(
> -                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) !=
> null)){
> -            if (!ac.getService("__ANONYMOUS_SERVICE__")
> -                    .isEngaged(module.getName())) {
> -                ac.getService("__ANONYMOUS_SERVICE__").engageModule(module,
> ac);
> -            }
> -        }
> -
> -
> -        //TODO; following line needed to be removed
> -
> -        mc.setEnvelope(outEnvelopeConfiguration(smc));
> -
> -        AxisOperation axisAnonymousOperation =
> -                ac.getService("__ANONYMOUS_SERVICE__")
> -                        .getOperation(new QName("__OPERATION_OUT_IN__"));
> -
> -        //Options class from Axis2 holds client side settings
> -        Options options = new Options();
> -        OperationClient mepClient =
> -                axisAnonymousOperation.createClient(sc, options);
> -        mepClient.addMessageContext(mc);
> -        mepClient.execute(true);
> -        MessageContext response = mepClient
> -                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> -        response.setProperty(MessageContext.TRANSPORT_OUT,
> -                smc.getProperty(MessageContext.TRANSPORT_OUT));
> -        response.setProperty(
> org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
> -                smc.getProperty(
> -                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
> -
> -
> -        // If request is REST we assume the response is REST, so set the
> -        // variable
> -        response.setDoingREST(smc.isDoingREST());
> -        response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE
> );
> -
> -        if (ac.getService("__ANONYMOUS_SERVICE__")
> -                .isEngaged(module.getName())) {
> -            ac.getService("__ANONYMOUS_SERVICE__")
> -                    .disEngageModule(ac.getModule(module.getName()));
> -        }
> -        return response;
> -    }
> -
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2Sender.java  (revision
> 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2Sender.java  (working
> copy)
> @@ -1,114 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.description.TransportInDescription;
> -
> -import org.apache.axis2.engine.AxisEngine;
> -
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseException;
> -import org.apache.synapse.SynapseMessage;
> -
> -
> -
> -/**
> - * This class helps the Axis2SynapseEnvironment implement the send method
> - */
> -public class Axis2Sender {
> -
> -    public static void sendOn(SynapseMessage smc) {
> -
> -        try {
> -
> -            MessageContext messageContext = ((Axis2SynapseMessage) smc)
> -                    .getMessageContext();
> -            // At any time any QOS is disengaged. It's engaged iff, a
> flag is
> -            // set in execution chain.
> -            // ex: addressing will be engage in outpath iff
> ADDRESSING_PROCESSED
> -            // is set.
> -
> -            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE)
> != null)
> -            {
> -
> -                messageContext.setProperty(
> -                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE,
> Boolean.TRUE);
> -
> -            }
> -            //Now hadle the outbound message with addressing
> -            if (smc.getProperty(
> -                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) !=
> null) {
> -                messageContext.setProperty(
> -                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
> -                        Boolean.TRUE);
> -
> -            }
> -
> -            MessageContext outMsgContext = Axis2FlexibleMEPClient
> -                    .send(messageContext);
> -
> -            // run all rules on response
> -
> -            smc.setResponse(true);//
> -
> -            outMsgContext.setServerSide(true);
> -
> -            Object os = messageContext
> -                    .getProperty(MessageContext.TRANSPORT_OUT);
> -            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
> -            TransportInDescription ti = messageContext.getTransportIn();
> -
> -            outMsgContext.setTransportIn(ti);
> -
> -            if (smc.getSynapseEnvironment() == null) {
> -                throw new SynapseException("no Synapse Env set on
> message");
> -            }
> -            smc.getSynapseEnvironment().injectMessage(new
> Axis2SynapseMessage(
> -                    outMsgContext, smc.getSynapseEnvironment()));
> -        } catch (Exception e) {
> -            e.printStackTrace();
> -            throw new SynapseException(e);
> -        }
> -    }
> -
> -    public static void sendBack(SynapseMessage smc) {
> -        MessageContext messageContext = ((Axis2SynapseMessage) smc)
> -                .getMessageContext();
> -        AxisEngine ae =
> -                new AxisEngine(messageContext.getConfigurationContext());
> -        try {
> -//
> -
> -
> -            messageContext
> -                    .setProperty(Constants.ISRESPONSE_PROPERTY,
> Boolean.TRUE);
> -            // check for addressing is alredy engaged for this message.
> -            // if engage we should use the address enable Configuraion
> context.
> -//
> -
> -            ae.send(messageContext);
> -        } catch (AxisFault e) {
> -            throw new SynapseException(e);
> -
> -        }
> -
> -    }
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
>      (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
>      (working copy)
> @@ -1,189 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.util.HashMap;
> -import java.util.List;
> -import java.util.Map;
> -
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> -
> -
> -import org.apache.synapse.Metrics;
> -import org.apache.synapse.MetricsFactory;
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.synapse.api.Mediator;
> -import org.apache.synapse.registry.Registry;
> -//import org.apache.synapse.resources.ResourceHelperFactory;
> -//import org.apache.synapse.resources.ResourceHelper;
> -//import org.apache.synapse.resources.xml.ResourceMediator;
> -
> -import org.apache.synapse.xml.MediatorFactoryFinder;
> -import org.apache.axiom.om.OMElement;
> -import org.apache.axis2.addressing.EndpointReference;
> -
> -/**
> - *
> - *
> - *
> - * <p> This is the Axis2 implementation of the SynapseEnvironment
> - *
> - */
> -public class Axis2SynapseEnvironment implements SynapseEnvironment {
> -
> -    private Mediator mainmediator = null;
> -
> -    private ClassLoader cl = null;
> -    private Map properties = new HashMap();
> -    private Map mediators = new HashMap();
> -
> -    private Log log = LogFactory.getLog(getClass());
> -
> -    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
> -                                   ClassLoader cl) {
> -        super();
> -        this.cl = cl;
> -        if (synapseConfiguration!=null)
> -            mainmediator = MediatorFactoryFinder.getMediator(this,
> synapseConfiguration);
> -    }
> -
> -    /**
> -     * Retrieves an object given a key.
> -     *
> -     * @param key - if not found, will return null
> -     * @return Returns the property.
> -     */
> -
> -    public Object getProperty(String key) {
> -        Object obj = null;
> -
> -        obj = properties.get(key);
> -
> -
> -        return obj;
> -    }
> -
> -    /**
> -     * Store a property for message context
> -     *
> -     * @param key
> -     * @param value
> -     */
> -    public void setProperty(String key, Object value) {
> -        properties.put(key, value);
> -    }
> -
> -
> -    public void injectMessage(SynapseMessage smc) {
> -       smc.setSynapseEnvironment(this);
> -       mainmediator.mediate(smc);
> -    }
> -
> -    public ClassLoader getClassLoader() {
> -        return cl;
> -    }
> -
> -    public void setClassLoader(ClassLoader cl) {
> -        this.cl = cl;
> -    }
> -
> -    public void send(SynapseMessage sm) {
> -        if (sm.isResponse())
> -            Axis2Sender.sendBack(sm);
> -        else
> -            Axis2Sender.sendOn(sm);
> -    }
> -
> -
> -    public Mediator lookupMediator(String name) {
> -        return (Mediator) mediators.get(name);
> -    }
> -
> -    public void addMediator(String name, Mediator m) {
> -        log.debug("adding mediator with name " + name);
> -        if (mediators.containsKey(name))
> -            log.warn("name " + name + "already present");
> -        mediators.put(name, m);
> -    }
> -
> -    public Mediator getMasterMediator() {
> -        return mainmediator;
> -    }
> -
> -    public void setMasterMediator(Mediator m) {
> -        mainmediator = m;
> -    }
> -
> -       public Registry getRegistry() {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public void setRegistry(Registry reg) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -       public Metrics getMetrics(String URI) {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public Metrics getMetrics(EndpointReference epr) {
> -               // TODO Auto-generated method stub
> -               return null;
> -       }
> -
> -       public void setMetricsFactory(MetricsFactory mf) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -       public void publish(OMElement element) {
> -               // TODO Auto-generated method stub
> -
> -       }
> -
> -    // lookup methods for resources handling
> - //   public Mediator lookupResourceMediator(String uriRoot) {
> -   //     return (Mediator) fac.getResourceMediator(uriRoot);
> -   // }
> -
> -  //  public void addResourceMediator(String uri, Mediator m) {
> -   //     log.debug("adding "+uri+" with "+m.getClass());
> -
> -       /*if (resourceMediators.containsKey(uri)) {
> -            throw new SynapseException(
> -                    "Uri Root is already exists. Not acceptable");
> -        }*/
> -
> -   //     fac.addResourceMediator(uri, (ResourceMediator)m);
> -   // }
> -
> -   // public ResourceHelper getResourceHelper() {
> -        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance
> ();
> -        //fac.setResourceProcessorsMap(this.resourceMediators);
> -        //log.debug("size in env is "+this.resourceMediators.size());
> -    //    return fac.createResourceHelper();
> -   // }
> -
> -
> -
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
> ===================================================================
> ---
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
>        (revision 405035)
> +++
> modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
>        (working copy)
> @@ -1,97 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.io.InputStream;
> -
> -import javax.xml.stream.XMLStreamException;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.description.Parameter;
> -import org.apache.axis2.engine.AxisConfiguration;
> -
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseException;
> -import org.apache.synapse.Constants;
> -import org.apache.axiom.om.impl.builder.StAXOMBuilder;
> -import org.apache.axiom.om.OMElement;
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> -
> -/**
> - * <p/>
> - * The SynapseEnvironment needs to be set up and then is used by the
> SynapseMessageReceiver to inject messages.
> - * This class is used by the SynapseMessageReceiver to find the
> environment. The env is stored in a Parameter to the Axis2 config
> - */
> -public class Axis2SynapseEnvironmentFinder implements Constants {
> -       private static Log log = LogFactory.getLog(
> Axis2SynapseEnvironmentFinder.class);
> -    public static synchronized SynapseEnvironment getSynapseEnvironment(
> -            MessageContext mc) {
> -        AxisConfiguration ac =
> -                mc.getConfigurationContext().getAxisConfiguration();
> -        Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
> -        if (synapseEnvParam == null) {
> -               log.debug("synapse env not available - creating");
> -            Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
> -            if (param == null) {
> -                throw new SynapseException("no parameter '"
> -                        + SYNAPSECONFIGURATION + "' in axis2.xml");
> -            }
> -            String synapseConfig = (String) param.getValue();
> -            InputStream is = mc.getAxisService().getClassLoader()
> -                    .getResourceAsStream(synapseConfig.trim());
> -
> -            StAXOMBuilder builder;
> -            try {
> -                builder = new StAXOMBuilder(is);
> -
> -            } catch (XMLStreamException e1) {
> -                throw new SynapseException(
> -                        "Trouble parsing Synapse Configuration ", e1);
> -
> -            }
> -            OMElement config = builder.getDocumentElement();
> -            config.build();
> -            Axis2SynapseEnvironment se = new
> Axis2SynapseEnvironment(config, mc
> -                    .getAxisService().getClassLoader());
> -
> -            synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
> -            synapseEnvParam.setValue(se);
> -            try {
> -                ac.addParameter(synapseEnvParam);
> -            } catch (AxisFault e) {
> -                throw new SynapseException(e);
> -            }
> -        }
> -        return (SynapseEnvironment) synapseEnvParam.getValue();
> -
> -    }
> -    public static synchronized void setSynapseEnvironment(MessageContext
> mc, SynapseEnvironment se) {
> -         AxisConfiguration ac =
> -              mc.getConfigurationContext().getAxisConfiguration();
> -         Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT,
> null);
> -          synapseEnvParam.setValue(se);
> -         try {
> -                       ac.addParameter(synapseEnvParam);
> -               } catch (AxisFault e) {
> -                       throw new SynapseException(e);
> -               }
> -
> -    }
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
>  (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
>  (working copy)
> @@ -1,228 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import java.util.HashMap;
> -import java.util.Iterator;
> -import java.util.Map;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.addressing.EndpointReference;
> -import org.apache.axis2.addressing.RelatesTo;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseEnvironment;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.axiom.soap.SOAPEnvelope;
> -
> -/**
> - *
> - *
> - * <p>
> - * A wrapper on Axis2's Message Context that implements the
> SynapseMessage interface
> - *
> - */
> -public class Axis2SynapseMessage implements SynapseMessage {
> -
> -    private MessageContext mc = null;
> -
> -    private Map props = new HashMap();
> -
> -    private boolean response = false;
> -
> -    private boolean faultResponse = false;
> -
> -    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se)
> {
> -        setMessageContext(mc);
> -        setSynapseEnvironment(se);
> -    }
> -
> -    public EndpointReference getFaultTo() {
> -        return mc.getFaultTo();
> -    }
> -
> -    public void setFaultTo(EndpointReference reference) {
> -        mc.setFaultTo(reference);
> -    }
> -
> -    public EndpointReference getFrom() {
> -        return mc.getFrom();
> -    }
> -
> -    public void setFrom(EndpointReference reference) {
> -        mc.setFrom(reference);
> -
> -    }
> -
> -    public SOAPEnvelope getEnvelope() {
> -
> -        return mc.getEnvelope();
> -    }
> -
> -    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
> -        mc.setEnvelope(envelope);
> -
> -    }
> -
> -    public String getMessageID() {
> -        return mc.getMessageID();
> -    }
> -
> -    public void setMessageID(String string) {
> -        mc.setMessageID(string);
> -
> -    }
> -
> -    public RelatesTo getRelatesTo() {
> -        return mc.getRelatesTo();
> -
> -    }
> -
> -    public void setRelatesTo(RelatesTo reference) {
> -        mc.setRelatesTo(reference);
> -
> -    }
> -
> -    public EndpointReference getReplyTo() {
> -        return mc.getReplyTo();
> -
> -    }
> -
> -    public void setReplyTo(EndpointReference reference) {
> -        mc.setReplyTo(reference);
> -
> -    }
> -
> -    public EndpointReference getTo() {
> -        return mc.getTo();
> -
> -    }
> -
> -    public void setTo(EndpointReference reference) {
> -        mc.setTo(reference);
> -
> -    }
> -
> -    public void setWSAAction(String actionURI) {
> -        mc.setWSAAction(actionURI);
> -
> -    }
> -
> -    public String getWSAAction() {
> -
> -        return mc.getWSAAction();
> -    }
> -
> -    public void setMessageId(String messageID) {
> -        mc.setWSAMessageId(messageID);
> -
> -    }
> -
> -    public String getMessageId() {
> -        return mc.getMessageID();
> -    }
> -
> -    public Object getProperty(String key) {
> -        Object obj = props.get(key);
> -        if ( obj == null) {
> -            obj = mc.getProperty(key);
> -        }
> -        return obj;
> -
> -    }
> -
> -    public void setProperty(String key, Object value) {
> -        props.put(key, value);
> -    }
> -
> -    public Iterator getPropertyNames() {
> -        return props.keySet().iterator();
> -    }
> -
> -    public String getSoapAction() {
> -        return mc.getSoapAction();
> -    }
> -
> -    public void setSoapAction(String string) {
> -        mc.setSoapAction(string);
> -
> -    }
> -
> -    public boolean isDoingMTOM() {
> -
> -        return mc.isDoingMTOM();
> -    }
> -
> -    public void setDoingMTOM(boolean b) {
> -        mc.setDoingMTOM(b);
> -
> -    }
> -
> -    public boolean isDoingREST() {
> -
> -        return mc.isDoingREST();
> -    }
> -
> -    public void setDoingREST(boolean b) {
> -        mc.setDoingREST(b);
> -
> -    }
> -
> -    public boolean isSOAP11() {
> -
> -        return mc.isSOAP11();
> -    }
> -
> -    public MessageContext getMessageContext() {
> -        return mc;
> -    }
> -
> -    public void setMessageContext(MessageContext mc) {
> -        this.mc = mc;
> -        Boolean resp = (Boolean) mc.getProperty(
> Constants.ISRESPONSE_PROPERTY);
> -        if (resp != null)
> -            response = resp.booleanValue();
> -    }
> -
> -    public void setResponse(boolean b) {
> -        response = b;
> -        mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf
> (b));
> -    }
> -
> -    public boolean isResponse() {
> -        return response;
> -    }
> -
> -    public void setFaultResponse(boolean b) {
> -        this.faultResponse = b;
> -    }
> -
> -    public boolean isFaultResponse() {
> -        return this.faultResponse;
> -    }
> -
> -       public SynapseEnvironment getSynapseEnvironment() {
> -               return Axis2SynapseEnvironmentFinder.getSynapseEnvironment
> (mc);
> -       }
> -
> -       public void setSynapseEnvironment(SynapseEnvironment env) {
> -               Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc,
> env);
> -               return;
> -       }
> -
> -
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
> (working copy)
> @@ -1,177 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.context.OperationContext;
> -import org.apache.axis2.context.ServiceContext;
> -import org.apache.axis2.context.ConfigurationContext;
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.wsdl.WSDLConstants;
> -import org.apache.axis2.engine.AxisEngine;
> -import org.apache.axis2.addressing.EndpointReference;
> -import org.apache.axis2.client.OperationClient;
> -import org.apache.axis2.client.Options;
> -import org.apache.axis2.client.async.Callback;
> -import org.apache.axis2.description.AxisOperation;
> -import org.apache.axis2.description.ClientUtils;
> -import org.apache.axis2.description.InOutAxisOperation;
> -import org.apache.axis2.description.Parameter;
> -import org.apache.axis2.description.TransportInDescription;
> -import org.apache.axis2.description.TransportOutDescription;
> -import org.apache.synapse.SynapseException;
> -
> -
> -import javax.xml.namespace.QName;
> -import java.util.HashMap;
> -
> -/**
> - * DynamicAxisOperation which switch dynamically between MEPs
> - */
> -public class DynamicAxisOperation extends InOutAxisOperation {
> -    public DynamicAxisOperation() {
> -        super();
> -    }
> -
> -    public DynamicAxisOperation(QName name) {
> -        super(name);
> -    }
> -
> -    public void addMessageContext(MessageContext msgContext,
> -                                  OperationContext opContext) throws
> AxisFault {
> -        HashMap mep = opContext.getMessageContexts();
> -        MessageContext immsgContext = (MessageContext) mep
> -                .get(MESSAGE_LABEL_IN_VALUE);
> -        MessageContext outmsgContext = (MessageContext) mep
> -                .get(MESSAGE_LABEL_OUT_VALUE);
> -
> -        if ((immsgContext != null) && (outmsgContext != null)) {
> -            throw new AxisFault(
> -                    "Invalid message addition , operation context
> completed");
> -        }
> -
> -        if (outmsgContext == null) {
> -            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
> -        } else {
> -            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
> -            opContext.setComplete(true);
> -        }
> -    }
> -
> -
> -    public OperationClient createClient(ServiceContext sc, Options
> options) {
> -        return new DynamicOperationClient(this,sc,options);
> -    }
> -
> -}
> -
> -class DynamicOperationClient implements OperationClient {
> -    private DynamicAxisOperation axisOp;
> -    private ServiceContext sc;
> -    private OperationContext oc;
> -    private Options options;
> -
> -    public DynamicOperationClient(DynamicAxisOperation axisOp,
> ServiceContext sc, Options options){
> -        this.options = options;
> -        this.axisOp = axisOp;
> -        this.sc = sc;
> -        this.oc = new OperationContext(axisOp,sc);
> -        this.oc.setParent(this.sc);
> -    }
> -
> -    public void setOptions(Options options) {
> -        // Not supported
> -    }
> -
> -    public Options getOptions() {
> -        throw new SynapseException("Not Supported");
> -    }
> -
> -    public void addMessageContext(MessageContext mc) throws AxisFault {
> -        mc.setServiceContext(sc);
> -        axisOp.registerOperationContext(mc, oc);
> -    }
> -
> -    public MessageContext getMessageContext(String messageLabel) throws
> AxisFault {
> -        return oc.getMessageContext(messageLabel);
> -    }
> -
> -    public void setCallback(Callback callback) {
> -        // Not supported
> -    }
> -
> -    public void execute(boolean block) throws AxisFault {
> -        if (block) {
> -            ConfigurationContext cc = sc.getConfigurationContext();
> -
> -            // copy interesting info from options to message context.
> -            MessageContext mc = oc
> -                    .getMessageContext(
> WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> -            if (mc == null) {
> -                throw new AxisFault(
> -                        "Out message context is null ,"
> -                                + " please set the out message context
> before calling this method");
> -            }
> -
> -            EndpointReference toEPR = mc.getTo();
> -
> -            TransportOutDescription transportOut =
> ClientUtils.inferOutTransport(cc
> -                    .getAxisConfiguration(), toEPR, mc);
> -            mc.setTransportOut(transportOut);
> -
> -            /*
> -            Options need to Infer TransportInDescription
> -            */
> -            if (mc.getTransportIn() == null) {
> -                TransportInDescription transportIn =
> options.getTransportIn();
> -                if (transportIn == null) {
> -                    mc.setTransportIn(ClientUtils.inferInTransport(cc
> -                            .getAxisConfiguration(), options, mc));
> -                } else {
> -                    mc.setTransportIn(transportIn);
> -                }
> -            }
> -
> -            if (mc.getSoapAction() == null || "".equals(mc.getSoapAction()))
> {
> -                Parameter soapaction = axisOp.getParameter(
> AxisOperation.SOAP_ACTION);
> -                if (soapaction != null) {
> -                    mc.setSoapAction((String) soapaction.getValue());
> -                }
> -            }
> -
> -            oc.addMessageContext(mc);
> -            // ship it out
> -            AxisEngine engine = new AxisEngine(cc);
> -            engine.send(mc);
> -        }
> -
> -    }
> -    public OperationContext getOperationContext() {
> -       return oc;
> -    }
> -
> -    public void reset() throws AxisFault {
> -        // Not supported
> -    }
> -
> -    public void complete(MessageContext msgCtxt) throws AxisFault {
> -        // Not supported
> -    }
> -
> -
> -}
> Index: modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
> (working copy)
> @@ -1,37 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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.
> - */
> -
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -
> -import org.apache.axis2.engine.MessageReceiver;
> -import org.apache.synapse.Constants;
> -
> -/**
> - *
> - * <p>Does nothing! Used as an endpoint so we can engage modules
> - *
> - */
> -public class EmptyMessageReceiver implements MessageReceiver {
> -
> -       public void receive(MessageContext mc) throws AxisFault {
> -               mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
> Boolean
> -                               .valueOf(true));
> -       }
> -
> -}
> Index:
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
> ===================================================================
> ---
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
>       (revision 405035)
> +++
> modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
>       (working copy)
> @@ -1,30 +0,0 @@
> -package org.apache.synapse.axis2;
> -
> -import org.apache.axis2.AxisFault;
> -import org.apache.axis2.context.MessageContext;
> -import org.apache.axis2.receivers.AbstractMessageReceiver;
> -import org.apache.synapse.Constants;
> -import org.apache.synapse.SynapseMessage;
> -import org.apache.synapse.api.Mediator;
> -
> -public class ServiceMediatorMessageReceiver extends
> AbstractMessageReceiver {
> -    public void receive(MessageContext messageContext) throws AxisFault {
> -        Object obj = makeNewServiceObject(messageContext);
> -
> -        Mediator mediator = (Mediator) obj;
> -/*
> -        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass()))
> {
> -            SynapseEnvironment se = (SynapseEnvironment) messageContext
> -                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY
> );
> -            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
> -            ((EnvironmentAware) mediator).setClassLoader(
> -                    messageContext.getAxisService().getClassLoader());
> -        }
> -
> -*/
> -        SynapseMessage smc = new Axis2SynapseMessage(messageContext,
> Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
> -        boolean returnValue = mediator.mediate(smc);
> -        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
> -                new Boolean(returnValue));
> -    }
> -}
> Index: modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
> ===================================================================
> --- modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
>  (revision 405035)
> +++ modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
>  (working copy)
> @@ -1,63 +0,0 @@
> -/*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed 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 im
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>

Re: [VOTE] Moving Code from Scratch Area

Posted by "Asankha C. Perera" <as...@wso2.com>.
Index: bin/synapse.bat
===================================================================
--- bin/synapse.bat	(revision 405035)
+++ bin/synapse.bat	(working copy)
@@ -74,7 +74,7 @@
 
 :runSynapse
 @echo on
-"%_JAVACMD%" -Djava.ext.dirs=%SYNAPSE_HOME%\lib;%SYNAPSE_HOME% -cp %SYNAPSE_HOME%\lib org.apache.axis2.transport.http.SimpleHTTPServer %SYNAPSE_CMD_LINE_ARGS%
+"%_JAVACMD%" -Daxis2.xml=%SYNAPSE_HOME%\synapse_repository\conf\axis2.xml -Djava.ext.dirs=%SYNAPSE_HOME%\lib;%SYNAPSE_HOME% -cp %SYNAPSE_HOME%\lib org.apache.axis2.transport.http.SimpleHTTPServer %SYNAPSE_CMD_LINE_ARGS%
 goto end
 
 :end
Index: bin/synapse.sh
===================================================================
--- bin/synapse.sh	(revision 405035)
+++ bin/synapse.sh	(working copy)
@@ -89,4 +89,4 @@
 echo "Using $SYNAPSE_HOME:   $SYNAPSE_HOME"
 echo "Using JAVA_HOME:       $JAVA_HOME"
 
-$JAVA_HOME/bin/java -classpath $SYNAPSE_CLASSPATH org.apache.axis2.transport.http.SimpleHTTPServer $SYNAPSE_HOME/synapse_repository -p8080
+$JAVA_HOME/bin/java -Daxis2.xml=$SYNAPSE_HOME/synapse_repository/conf/axis2.xml -classpath $SYNAPSE_CLASSPATH org.apache.axis2.transport.http.SimpleHTTPServer $SYNAPSE_HOME/synapse_repository -p8080
Index: etc/project.properties
===================================================================
--- etc/project.properties	(revision 405035)
+++ etc/project.properties	(working copy)
@@ -18,9 +18,12 @@
 # -------------------------------------------------------------------
 #                JUnit
 # -------------------------------------------------------------------
-maven.junit.jvmargs=-Djava.awt.headless=true
+# explicit setting of Sax parser as below is a hack to avoid Junit from loading its own parsers ignoring maven.test.excludeXmlApis
+maven.junit.jvmargs=-Djava.awt.headless=true -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
 maven.junit.fork=true
+#maven.junit.dir=${basedir}/modules/core
 
+
 # -------------------------------------------------------------------
 #                Compile
 # -------------------------------------------------------------------
@@ -32,11 +35,13 @@
 # -------------------------------------------------------------------
 ant.version=1.6.5
 axis.wsdl4j.version=1.2
-axis2.version=SNAPSHOT
-axiom.version=SNAPSHOT
+axis2.version=1.0-RC5
+axis2.wsdl.version=SNAPSHOT
+axiom.version=1.0
 policy.version=SNAPSHOT
+#XmlSchema.version=1.0.2
 XmlSchema.version=SNAPSHOT
-wss4j.version=SNAPSHOT
+wss4j.version=1.5.0
 commons.codec.version=1.3
 commons.discovery.version=0.2
 commons.httpclient.version=3.0
@@ -46,20 +51,20 @@
 geronimo.spec.servlet.version=2.4-rc4
 servletapi.version=2.3
 groovy.all.version=1.0-jsr-01
-jaxen.version=1.1-beta-7
+jaxen.version=1.1-beta-8
 junit.version=3.8.1
-log4j.version=1.2.12
+log4j.version=1.2.13
 opensaml.version=1.0.1
-stax.api.version=1.0
 stax.impl.groupid=woodstox
 stax.impl.artifactid=wstx
-stax.impl.version=asl-2.8.1
-xalan.version=2.6.0
-xerces.version=2.6.2
+stax.impl.version=asl-2.9.3
+stax.api.version=1.0
+xalan.version=2.7.0
+xerces.version=2.7.1
 xmlunit.version=1.0
 annogen.version=0.1.0
 geronimo.spec.jms.version=1.1-rc4
-backport_util_concurrent.version=2.0_01_pd
+backport_util_concurrent.version=2.1
 spring.version=1.2.6
 
 
@@ -70,12 +75,12 @@
 optional.includes=
 maven.multiproject.includes=\
 modules/core/project.xml,\
-modules/mediators/project.xml,\
+#modules/mediators/project.xml,\
 modules/samples/project.xml,\
-modules/extensions/project.xml,\
+#modules/extensions/project.xml,\
 ${optional.includes}
 
 # -------------------------------------------------------------------
 #                Addressing Version
 # -------------------------------------------------------------------
-addressing.version=0.95
+addressing.version=1.0
Index: etc/project.xml
===================================================================
--- etc/project.xml	(revision 405035)
+++ etc/project.xml	(working copy)
@@ -69,7 +69,7 @@
         <dependency>
             <groupId>axis2</groupId>
             <artifactId>axis2-wsdl</artifactId>
-            <version>${axis2.version}</version>
+            <version>${axis2.wsdl.version}</version>
         </dependency>
 
         <dependency>
Index: maven.xml
===================================================================
--- maven.xml	(revision 405035)
+++ maven.xml	(working copy)
@@ -335,7 +335,7 @@
         <ant:mkdir dir="${bin.dist.dir}/xdocs"/>
         <ant:mkdir dir="${bin.dist.dir}/synapse_repository"/>
         <ant:mkdir dir="${bin.dist.dir}/samples"/>
-        <ant:mkdir dir="${bin.dist.dir}/mediators"/>
+        <!--<ant:mkdir dir="${bin.dist.dir}/mediators"/>-->
 
         <ant:mkdir dir="target/temp/"/>
 
@@ -360,13 +360,13 @@
             <ant:fileset dir="modules/core/target/synapse-repository"/>
         </ant:copy>
 
-        <ant:copy todir="${bin.dist.dir}/samples" flatten="false">
+        <!--<ant:copy todir="${bin.dist.dir}/samples" flatten="false">
             <ant:fileset dir="modules/samples/target/dist-bin/samples"/>
         </ant:copy>
 
         <ant:copy todir="${bin.dist.dir}/mediators" flatten="false">
             <ant:fileset dir="modules/mediators/target/dist-bin/mediators"/>
-        </ant:copy>
+        </ant:copy>-->
 
         <ant:copy todir="target/temp/">
             <ant:fileset dir="target/dist-bin/">
Index: modules/core/maven.xml
===================================================================
--- modules/core/maven.xml	(revision 405035)
+++ modules/core/maven.xml	(working copy)
@@ -40,145 +40,7 @@
         </jar>
 
 
-        <echo message="----------------Creating NPE aar----------------"/>
-        <mkdir dir="target/services/npe/META-INF"/>
-        <mkdir dir="target/services/npe/org/apache/axis2/test"/>
-        <copy file="test-resources/org/apache/axis2/META-INF/services.xml"
-              tofile="target/services/npe/META-INF/services.xml"/>
-        <copy file="target/test-classes/org/apache/axis2/test/Echo.class"
-              tofile="target/services/npe/org/apache/axis2/test/Echo.class"/>
-        <jar jarfile="target/npe.aar"
-             basedir="target/services/npe">
-            <include name="**"/>
-        </jar>
-        <echo message="----------------Creating test-mediator aar----------------"/>
-        <mkdir dir="target/services/test-mediator/META-INF"/>
-        <mkdir dir="target/services/test-mediator/org/apache/axis2/test"/>
-        <copy file="test-resources/org/apache/axis2/META-INF/service-mediator.xml"
-              tofile="target/services/test-mediator/META-INF/services.xml"/>
-        <copy file="target/test-classes/org/apache/axis2/test/TestMediator.class"
-              tofile="target/services/test-mediator/org/apache/axis2/test/TestMediator.class"/>
-        <jar jarfile="target/test-mediator.aar"
-             basedir="target/services/test-mediator">
-            <include name="**"/>
-        </jar>
 
-        <!--echo message="Creating EnvironmentAware-Mediator aar"/>
-        <mkdir dir="target/services/environmentaware-mediator/META-INF"/>
-        <mkdir dir="target/services/environmentaware-mediator/org/apache/axis2/test"/>
-        <copy file="test-resources/org/apache/axis2/META-INF/environmentaware-service.xml"
-              tofile="target/services/environmentaware-mediator/META-INF/services.xml"/>
-        <copy file="target/test-classes/org/apache/axis2/test/EnvironmentAwareMediator.class"
-              tofile="target/services/environmentaware-mediator/org/apache/axis2/test/EnvironmentAwareMediator.class"/>
-        <jar jarfile="target/environmentaware-mediator.aar"
-             basedir="target/services/environmentaware-mediator">
-            <include name="**"/>
-        </jar-->
-
-        <echo message="-----------Creating Testing Repository - SendOn ----------"/>
-        <mkdir dir="target/synapse-repository-sendon"/>
-        <copy file="target/synapse.aar"
-              tofile="target/synapse-repository-sendon/services/synapse.aar"/>
-        <copy file="target/npe.aar"
-              tofile="target/synapse-repository-sendon/services/npe.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
-        <mkdir dir="target/synapse-repository-sendon/modules"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-sendon/modules/addressing-${addressing.version}.mar"/>
-        <copy file="../../repository/conf/axis2.xml"
-              tofile="target/synapse-repository-sendon/conf/axis2.xml"/>
-        <copy file="test/rules/synapse-sendon.xml"
-              tofile="target/synapse-repository-sendon/conf/synapse.xml"/>
-
-
-        <echo message="-----------Creating Testing Repository - SendNow ----------"/>
-            <mkdir dir="target/synapse-repository-sendnow"/>
-            <copy file="target/synapse.aar"
-                  tofile="target/synapse-repository-sendnow/services/synapse.aar"/>
-            <copy file="target/npe.aar"
-                  tofile="target/synapse-repository-sendnow/services/npe.aar"/>
-            <copy file="target/emptymediator.aar"
-                  tofile="target/synapse-repository-sendnow/services/emptymediator.aar"/>
-            <mkdir dir="target/synapse-repository-sendnow/modules"/>
-            <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-                  tofile="target/synapse-repository-sendnow/modules/addressing-${addressing.version}.mar"/>
-            <copy file="../../repository/conf/axis2.xml"
-                  tofile="target/synapse-repository-sendnow/conf/axis2.xml"/>
-            <copy file="test/rules/synapse-sendnow.xml"
-                  tofile="target/synapse-repository-sendnow/conf/synapse.xml"/>
-
-        <echo message="-----------Creating Testing Repository - SendOnAxis2 ----------"/>
-        <mkdir dir="target/synapse-repository-sendonAxis2"/>
-
-        <copy file="target/npe.aar"
-              tofile="target/synapse-repository-sendonAxis2/services/npe.aar"/>
-        <copy file="target/test-mediator.aar"
-              tofile="target/synapse-repository-sendonAxis2/services/test-mediator.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-sendonAxis2/services/emptymediator.aar"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-sendonAxis2/modules/addressing-${addressing.version}.mar"/>
-        <copy file="test-resources/axis2/conf/axis2.xml"
-              tofile="target/synapse-repository-sendonAxis2/conf/axis2.xml"/>
-
-        <echo message="-----------Creating Testing Repository - SendonAxis2Tcp ----------"/>
-        <mkdir dir="target/synapse-repository-sendonAxis2"/>
-
-        <copy file="target/npe.aar"
-              tofile="target/synapse-repository-sendonAxis2Tcp/services/npe.aar"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-sendonAxis2Tcp/modules/addressing-${addressing.version}.mar"/>
-        <copy file="test-resources/tcp/axis2-tcp.xml"
-              tofile="target/synapse-repository-sendonAxis2Tcp/conf/axis2.xml"/>
-
-        <echo message="-----------Creating Testing Repository - HttpTcp ----------"/>
-        <mkdir dir="target/synapse-repository-httptcp"/>
-
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-httptcp/services/emptymediator.aar"/>
-        <copy file="target/synapse.aar"
-              tofile="target/synapse-repository-httptcp/services/synapse.aar"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-httptcp/modules/addressing-${addressing.version}.mar"/>
-        <copy file="../../repository/conf/axis2.xml"
-              tofile="target/synapse-repository-httptcp/conf/axis2.xml"/>
-        <copy file="test/rules/synapse-httptcp.xml"
-              tofile="target/synapse-repository-httptcp/conf/synapse.xml"/>
-
-        <echo message="-----------Creating Testing Repository - EnvironmentAware ----------"/>
-        <!--mkdir dir="target/synapse-repository-environmentaware"/>
-
-        <copy file="target/environmentaware-mediator.aar"
-              tofile="target/synapse-repository-environmentaware/services/environmentaware-mediator.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
-        <copy file="target/synapse.aar"
-              tofile="target/synapse-repository-environmentaware/services/synapse.aar"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-environmentaware/modules/addressing-${addressing.version}.mar"/>
-        <copy file="../../repository/conf/axis2.xml"
-              tofile="target/synapse-repository-environmentaware/conf/axis2.xml"/>
-        <copy file="test/rules/synapse-environmentaware.xml"
-              tofile="target/synapse-repository-environmentaware/conf/synapse.xml"/-->
-
-        <echo message="-----------Creating Testing Repository - Simple REST Repository ----------"/>
-        <mkdir dir="target/synapse-repository-resources"/>
-
-        <copy file="target/npe.aar"
-              tofile="target/synapse-repository-resources/services/npe.aar"/>
-        <copy file="../../repository/modules/addressing-${addressing.version}.mar"
-              tofile="target/synapse-repository-resources/modules/addressing-${addressing.version}.mar"/>
-        <copy file="test-resources/rest/conf/axis2-rest.xml"
-              tofile="target/synapse-repository-resources/conf/axis2.xml"/>
-
-        <ant:delete file="target/npe.aar"/>
-        <ant:delete file="target/test-mediator.aar"/>
-        <ant:delete dir="target/test-mediator"/>
-        <ant:delete dir="target/environmentaware-mediator.aar"/>
-        <ant:delete dir="target/environmentaware-mediator"/>
-
-
         <echo message="-----------Creating Testing Repository - Genral----------"/>
         <mkdir dir="target/synapse-repository"/>
         <copy file="target/synapse.aar"
Index: modules/core/src/org/apache/synapse/api/EnvironmentAware.java
===================================================================
--- modules/core/src/org/apache/synapse/api/EnvironmentAware.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/api/EnvironmentAware.java	(working copy)
@@ -1,30 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.api;
-
-import org.apache.synapse.SynapseEnvironment;
-
-/**
- * @deprecated
- * <p>API for Mediators to get access to the Synapse Environment
- *
- */
-public interface EnvironmentAware  {
-	public void setSynapseEnvironment(SynapseEnvironment se);
-	public void setClassLoader(ClassLoader cl);
-
-}
Index: modules/core/src/org/apache/synapse/api/FilterMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/api/FilterMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/api/FilterMediator.java	(working copy)
@@ -1,7 +1,20 @@
 package org.apache.synapse.api;
 
-import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
 
+/**
+ * The filter mediator is a list mediator, which executes the given (sub) list of mediators
+ * if the specified condition is satisfied
+ *
+ * @see FilterMediator#test(org.apache.synapse.SynapseContext)
+ */
 public interface FilterMediator extends ListMediator {
-	public boolean test(SynapseMessage sm);
+
+    /**
+     * Should return true if the sub/child mediators should execute. i.e. if the filter
+     * condition is satisfied
+     * @param synCtx
+     * @return true if the configured filter condition evaluates to true
+     */
+    public boolean test(SynapseContext synCtx);
 }
Index: modules/core/src/org/apache/synapse/api/ListMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/api/ListMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/api/ListMediator.java	(working copy)
@@ -1,3 +1,18 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
 package org.apache.synapse.api;
 
 import java.util.List;
@@ -2,5 +17,40 @@
 
+/**
+ * The List mediator executes a given sequence/list of child mediators
+ */
 public interface ListMediator extends Mediator {
-	public void setList(List m);
-	public List getList();
+
+    /**
+     * Appends the specified mediator to the end of this mediator's (children) list
+     * @param m the mediator to be added
+     * @return true (as per the general contract of the Collection.add method)
+     */
+    public boolean addChild(Mediator m);
+
+    /**
+     * Returns the mediator at the specified position
+     * @param pos index of mediator to return
+     * @return the mediator at the specified position in this list
+     */
+    public Mediator getChild(int pos);
+
+    /**
+     * Removes the first occurrence in this list of the specified mediator
+     * @param m mediator to be removed from this list, if present
+     * @return true if this list contained the specified mediator
+     */
+    public boolean removeChild(Mediator m);
+
+    /**
+     * Removes the mediator at the specified position in this list
+     * @param pos the index of the mediator to remove
+     * @return the mediator previously at the specified position
+     */
+    public Mediator removeChild(int pos);
+
+    /**
+     * Return the list of mediators of this List mediator instance
+     * @return the child/sub mediator list
+     */
+    public List getList();
 }
Index: modules/core/src/org/apache/synapse/api/Mediator.java
===================================================================
--- modules/core/src/org/apache/synapse/api/Mediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/api/Mediator.java	(working copy)
@@ -16,14 +16,29 @@
 package org.apache.synapse.api;
 
 import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
 
 /**
- *
- * <p>API interface for pluggable mediators
- *
+ * All Synapse mediators must implement this Mediator interface. As a message passes
+ * through the synapse system, each mediator's mediate() method is invoked in the
+ * sequence/order defined in the SynapseConfiguration.
  */
 public interface Mediator {
-	public boolean mediate(SynapseMessage smc);
-	//public String getName();
-	//public void setName(String name);
+
+    /**
+     * Invokes the mediator passing the current message for mediation. Each
+     * mediator performs its mediation action, and returns true if mediation
+     * should continue, or false if further mediation should be aborted.
+     *
+     * @param synCtx the current message for mediation
+     * @return true if further mediation should continue
+     */
+    public boolean mediate(SynapseContext synCtx);
+
+    /**
+     * This is used for debugging purposes and exposes the type of the current
+     * mediator for logging and debugging purposes
+     * @return a String representation of the mediator type
+     */
+    public String getType();
 }
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java
===================================================================
--- modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java	(working copy)
@@ -1,20 +0,0 @@
-package org.apache.synapse.api;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public interface ResourceUpdateAware {
-	
-}
Index: modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-
-public class ServiceMediatorMessageReceiver extends AbstractMessageReceiver {
-    public void receive(MessageContext messageContext) throws AxisFault {
-        Object obj = makeNewServiceObject(messageContext);
-
-        Mediator mediator = (Mediator) obj;
-/*
-        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
-            SynapseEnvironment se = (SynapseEnvironment) messageContext
-                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
-            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
-            ((EnvironmentAware) mediator).setClassLoader(
-                    messageContext.getAxisService().getClassLoader());
-        }
-        
-*/
-        SynapseMessage smc = new Axis2SynapseMessage(messageContext, Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
-        boolean returnValue = mediator.mediate(smc);
-        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
-                new Boolean(returnValue));
-    }
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java	(working copy)
@@ -1,191 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.*;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-
-import org.apache.synapse.Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-
-/**
- * This is a simple client that handles both in only and in out
- */
-public class Axis2FlexibleMEPClient {
-
-    public static SOAPEnvelope outEnvelopeConfiguration(MessageContext smc) {
-        SOAPEnvelope env = smc.getEnvelope();
-        SOAPHeader soapHeader = env.getHeader();
-        ArrayList addressingHeaders;
-        if (soapHeader != null) {
-            addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                    AddressingConstants.Submission.WSA_NAMESPACE);
-            if (addressingHeaders != null && addressingHeaders.size() != 0) {
-                detachAddressingInformation(addressingHeaders);
-
-            } else {
-                addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                        AddressingConstants.Final.WSA_NAMESPACE);
-                if (addressingHeaders != null && addressingHeaders.size() != 0) {
-                    detachAddressingInformation(addressingHeaders);
-                }
-            }
-        }
-        return env;
-    }
-
-    /**
-     *
-     * @param headerInformation
-     */
-    private static void detachAddressingInformation(ArrayList headerInformation) {
-        Iterator iterator = headerInformation.iterator();
-        while (iterator.hasNext()) {
-            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();
-            headerBlock.detach();
-        }
-
-    }
-
-    // Following code is based on Axis2 Client code.
-    public static MessageContext send(MessageContext smc) throws AxisFault {
-        // In this logic Synapse Work as a Client to a Server
-        // So here this logic should expect 200 ok, 202 ok and 500 internal server error
-        // current state of the code in Synchronus
-
-        // This is the original_configuration_context
-        ConfigurationContext cc = smc.getConfigurationContext();
-        AxisConfiguration ac = cc.getAxisConfiguration();
-        PhasesInfo phasesInfo = ac.getPhasesInfo();
-
-        // setting operation default chains
-        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
-            // Lets default be OUT_IN
-            OutInAxisOperation outInOperation =
-                    new OutInAxisOperation(new QName(
-                            "__OPERATION_OUT_IN__"));
-            AxisService axisAnonymousService =
-                    new AxisService("__ANONYMOUS_SERVICE__");
-            axisAnonymousService.addOperation(outInOperation);
-            ac.addService(axisAnonymousService);
-            phasesInfo.setOperationPhases(outInOperation);
-        }
-        ServiceGroupContext sgc = new ServiceGroupContext(cc,
-                (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
-        ServiceContext sc =
-                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
-
-        MessageContext mc = new MessageContext();
-        mc.setConfigurationContext(sc.getConfigurationContext());
-        ///////////////////////////////////////////////////////////////////////
-        // filtering properties
-        if (smc.getSoapAction() != null)
-            mc.setSoapAction(smc.getSoapAction());
-        if (smc.getWSAAction() != null)
-            mc.setWSAAction(smc.getWSAAction());
-        if (smc.getFrom() != null)
-            mc.setFrom(smc.getFrom());
-        if (smc.getMessageID() != null)
-            mc.setMessageID(smc.getMessageID());
-        else
-            mc.setMessageID(String.valueOf("uuid:"
-                    + UUIDGenerator.getUUID()));
-        if (smc.getReplyTo() != null)
-            mc.setReplyTo(smc.getReplyTo());
-        if (smc.getRelatesTo() != null)
-            mc.setRelatesTo(smc.getRelatesTo());
-        if (smc.getTo() != null) {
-            mc.setTo(smc.getTo());
-        } else {
-            throw new AxisFault(
-                    "To canno't be null, if null Synapse can't infer the transport");
-        }
-        if (smc.isDoingREST()) {
-            mc.setDoingREST(true);
-        }
-
-        // handling the outbound message with addressing
-        AxisModule module = ac.getModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-        if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) ||
-                (smc.getProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)){
-            if (!ac.getService("__ANONYMOUS_SERVICE__")
-                    .isEngaged(module.getName())) {
-                ac.getService("__ANONYMOUS_SERVICE__").engageModule(module, ac);
-            }
-        }
-
-
-        //TODO; following line needed to be removed
-
-        mc.setEnvelope(outEnvelopeConfiguration(smc));
-
-        AxisOperation axisAnonymousOperation =
-                ac.getService("__ANONYMOUS_SERVICE__")
-                        .getOperation(new QName("__OPERATION_OUT_IN__"));
-
-        //Options class from Axis2 holds client side settings
-        Options options = new Options();
-        OperationClient mepClient =
-                axisAnonymousOperation.createClient(sc, options);
-        mepClient.addMessageContext(mc);
-        mepClient.execute(true);
-        MessageContext response = mepClient
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-        response.setProperty(MessageContext.TRANSPORT_OUT,
-                smc.getProperty(MessageContext.TRANSPORT_OUT));
-        response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                smc.getProperty(
-                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-
-
-        // If request is REST we assume the response is REST, so set the
-        // variable
-        response.setDoingREST(smc.isDoingREST());
-        response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
-
-        if (ac.getService("__ANONYMOUS_SERVICE__")
-                .isEngaged(module.getName())) {
-            ac.getService("__ANONYMOUS_SERVICE__")
-                    .disEngageModule(ac.getModule(module.getName()));
-        }
-        return response;
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java	(working copy)
@@ -1,97 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Constants;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * <p/>
- * The SynapseEnvironment needs to be set up and then is used by the SynapseMessageReceiver to inject messages.
- * This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
- */
-public class Axis2SynapseEnvironmentFinder implements Constants {
-	private static Log log = LogFactory.getLog(Axis2SynapseEnvironmentFinder.class);
-    public static synchronized SynapseEnvironment getSynapseEnvironment(
-            MessageContext mc) {
-        AxisConfiguration ac =
-                mc.getConfigurationContext().getAxisConfiguration();
-        Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
-        if (synapseEnvParam == null) {
-        	log.debug("synapse env not available - creating");
-            Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
-            if (param == null) {
-                throw new SynapseException("no parameter '"
-                        + SYNAPSECONFIGURATION + "' in axis2.xml");
-            }
-            String synapseConfig = (String) param.getValue();
-            InputStream is = mc.getAxisService().getClassLoader()
-                    .getResourceAsStream(synapseConfig.trim());
-
-            StAXOMBuilder builder;
-            try {
-                builder = new StAXOMBuilder(is);
-
-            } catch (XMLStreamException e1) {
-                throw new SynapseException(
-                        "Trouble parsing Synapse Configuration ", e1);
-
-            }
-            OMElement config = builder.getDocumentElement();
-            config.build();
-            Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc
-                    .getAxisService().getClassLoader());
-
-            synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
-            synapseEnvParam.setValue(se);
-            try {
-                ac.addParameter(synapseEnvParam);
-            } catch (AxisFault e) {
-                throw new SynapseException(e);
-            }
-        }
-        return (SynapseEnvironment) synapseEnvParam.getValue();
-
-    }
-    public static synchronized void setSynapseEnvironment(MessageContext mc, SynapseEnvironment se) {
-    	  AxisConfiguration ac =
-              mc.getConfigurationContext().getAxisConfiguration();
-    	  Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
-          synapseEnvParam.setValue(se);
-    	  try {
-			ac.addParameter(synapseEnvParam);
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-		}
-    	
-    }
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(working copy)
@@ -1,114 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportInDescription;
-
-import org.apache.axis2.engine.AxisEngine;
-
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-
-
-/**
- * This class helps the Axis2SynapseEnvironment implement the send method
- */
-public class Axis2Sender {
-
-    public static void sendOn(SynapseMessage smc) {
-
-        try {
-
-            MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                    .getMessageContext();
-            // At any time any QOS is disengaged. It's engaged iff, a flag is
-            // set in execution chain.
-            // ex: addressing will be engage in outpath iff ADDRESSING_PROCESSED
-            // is set.
-
-            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null)
-            {
-
-                messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
-
-            }
-            //Now hadle the outbound message with addressing
-            if (smc.getProperty(
-                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
-                messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
-                        Boolean.TRUE);
-
-            }
-
-            MessageContext outMsgContext = Axis2FlexibleMEPClient
-                    .send(messageContext);
-
-            // run all rules on response
-
-            smc.setResponse(true);//
-
-            outMsgContext.setServerSide(true);
-
-            Object os = messageContext
-                    .getProperty(MessageContext.TRANSPORT_OUT);
-            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
-            TransportInDescription ti = messageContext.getTransportIn();
-
-            outMsgContext.setTransportIn(ti);
-
-            if (smc.getSynapseEnvironment() == null) {
-                throw new SynapseException("no Synapse Env set on message");
-            }
-            smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
-                    outMsgContext, smc.getSynapseEnvironment()));
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new SynapseException(e);
-        }
-    }
-
-    public static void sendBack(SynapseMessage smc) {
-        MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                .getMessageContext();
-        AxisEngine ae =
-                new AxisEngine(messageContext.getConfigurationContext());
-        try {
-//
-
-
-            messageContext
-                    .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
-            // check for addressing is alredy engaged for this message.
-            // if engage we should use the address enable Configuraion context.
-//
-
-            ae.send(messageContext);
-        } catch (AxisFault e) {
-            throw new SynapseException(e);
-
-        }
-
-    }
-
-}
Index: modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java	(working copy)
@@ -1,37 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.synapse.Constants;
-
-/**
- *
- * <p>Does nothing! Used as an endpoint so we can engage modules
- *
- */
-public class EmptyMessageReceiver implements MessageReceiver {
-
-	public void receive(MessageContext mc) throws AxisFault {
-		mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
-				.valueOf(true));
-	}
-
-}
Index: modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java	(working copy)
@@ -1,63 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.axis2;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.engine.AbstractDispatcher;
-import org.apache.axis2.engine.AxisConfiguration;
-
-/**
- *
- * 
- * This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
- *
- */
-public class SynapseDispatcher extends AbstractDispatcher {
-	// FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
-
-	private static final long serialVersionUID = -6970206989111592645L;
-
-	private static final String SYNAPSE_SERVICE_NAME = "synapse";
-
-	private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
-
-	public void initDispatcher() {
-		QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
-		HandlerDescription hd = new HandlerDescription(qn);
-		super.init(hd);
-
-	}
-
-	public AxisService findService(MessageContext mc) throws AxisFault {
-		AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-		AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
-		return as;
-	}
-
-	public AxisOperation findOperation(AxisService svc, MessageContext mc)
-			throws AxisFault {
-
-		AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
-		return ao;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java	(working copy)
@@ -1,177 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.ClientUtils;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.synapse.SynapseException;
-
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-
-/**
- * DynamicAxisOperation which switch dynamically between MEPs
- */
-public class DynamicAxisOperation extends InOutAxisOperation {
-    public DynamicAxisOperation() {
-        super();
-    }
-
-    public DynamicAxisOperation(QName name) {
-        super(name);
-    }
-
-    public void addMessageContext(MessageContext msgContext,
-                                  OperationContext opContext) throws AxisFault {
-        HashMap mep = opContext.getMessageContexts();
-        MessageContext immsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_IN_VALUE);
-        MessageContext outmsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_OUT_VALUE);
-
-        if ((immsgContext != null) && (outmsgContext != null)) {
-            throw new AxisFault(
-                    "Invalid message addition , operation context completed");
-        }
-
-        if (outmsgContext == null) {
-            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
-        } else {
-            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
-            opContext.setComplete(true);
-        }
-    }
-
-
-    public OperationClient createClient(ServiceContext sc, Options options) {
-        return new DynamicOperationClient(this,sc,options);
-    }
-
-}
-
-class DynamicOperationClient implements OperationClient {
-    private DynamicAxisOperation axisOp;
-    private ServiceContext sc;
-    private OperationContext oc;
-    private Options options;
-
-    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
-        this.options = options;
-        this.axisOp = axisOp;
-        this.sc = sc;
-        this.oc = new OperationContext(axisOp,sc);
-        this.oc.setParent(this.sc);
-    }
-
-    public void setOptions(Options options) {
-        // Not supported
-    }
-
-    public Options getOptions() {
-        throw new SynapseException("Not Supported");
-    }
-
-    public void addMessageContext(MessageContext mc) throws AxisFault {
-        mc.setServiceContext(sc);
-        axisOp.registerOperationContext(mc, oc);
-    }
-
-    public MessageContext getMessageContext(String messageLabel) throws AxisFault {
-        return oc.getMessageContext(messageLabel);
-    }
-
-    public void setCallback(Callback callback) {
-        // Not supported
-    }
-
-    public void execute(boolean block) throws AxisFault {
-        if (block) {
-            ConfigurationContext cc = sc.getConfigurationContext();
-
-            // copy interesting info from options to message context.
-            MessageContext mc = oc
-                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-            if (mc == null) {
-                throw new AxisFault(
-                        "Out message context is null ,"
-                                + " please set the out message context before calling this method");
-            }
-
-            EndpointReference toEPR = mc.getTo();
-
-            TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
-            mc.setTransportOut(transportOut);
-
-            /*
-            Options need to Infer TransportInDescription
-            */
-            if (mc.getTransportIn() == null) {
-                TransportInDescription transportIn = options.getTransportIn();
-                if (transportIn == null) {
-                    mc.setTransportIn(ClientUtils.inferInTransport(cc
-                            .getAxisConfiguration(), options, mc));
-                } else {
-                    mc.setTransportIn(transportIn);
-                }
-            }
-
-            if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
-                Parameter soapaction = axisOp.getParameter(AxisOperation.SOAP_ACTION);
-                if (soapaction != null) {
-                    mc.setSoapAction((String) soapaction.getValue());
-                }
-            }
-
-            oc.addMessageContext(mc);
-            // ship it out
-            AxisEngine engine = new AxisEngine(cc);
-            engine.send(mc);
-        }
-
-    }
-    public OperationContext getOperationContext() {
-    	return oc;
-    }
-
-    public void reset() throws AxisFault {
-        // Not supported
-    }
-
-    public void complete(MessageContext msgCtxt) throws AxisFault {
-        // Not supported
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(working copy)
@@ -1,68 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.MessageContext;
-
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-
-/**
- * <p/>
- * <p/>
- * This is used to "catch" messages in Axis2 and pass them to Synapse for processing.
- */
-public class SynapseMessageReceiver implements MessageReceiver {
-
-    private Log log = LogFactory.getLog(getClass());
-
-    public void receive(MessageContext mc) throws AxisFault {
-        log.debug("receiving message");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-                .getSynapseEnvironment(mc);
-        ////////////////////////////////////////////////////////////////////////
-        // SynapseEnvironment is set as a property in MessageContext. This is due
-        // use we can expect in ServiceMediatorProcessor and many extensions yet to come
-        // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
-        
-        ////////////////////////////////////////////////////////////////////////
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
-
-        ///////////////////////////////////////////////////////////////////////
-        // Response handling mechanism for 200/202 and 5XX
-        // smc.isResponse =true then the response will be handle with 200 OK
-        // else, response will be 202 OK without no http body
-        // smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
-        if (smc.isResponse()) {
-            mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
-                    Constants.VALUE_TRUE);
-        }
-        if (smc.isFaultResponse()) {
-            // todo: a good way to inject faultSoapEnv to the Axis2 Transport 
-            throw new AxisFault(
-                    "Synapse Encounters an Error - Please See Log for More Details");
-        }
-        ///////////////////////////////////////////////////////////////////////
-    }
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java	(working copy)
@@ -1,189 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-import org.apache.synapse.Metrics;
-import org.apache.synapse.MetricsFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
-//import org.apache.synapse.resources.ResourceHelperFactory;
-//import org.apache.synapse.resources.ResourceHelper;
-//import org.apache.synapse.resources.xml.ResourceMediator;
-
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-
-/**
- *
- *
- *
- * <p> This is the Axis2 implementation of the SynapseEnvironment
- *
- */
-public class Axis2SynapseEnvironment implements SynapseEnvironment {
-	
-    private Mediator mainmediator = null;
-
-    private ClassLoader cl = null;
-    private Map properties = new HashMap();
-    private Map mediators = new HashMap();
-
-    private Log log = LogFactory.getLog(getClass());
-
-    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
-                                   ClassLoader cl) {
-        super();
-        this.cl = cl;
-        if (synapseConfiguration!=null)
-            mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
-    }
-
-    /**
-     * Retrieves an object given a key.
-     *
-     * @param key - if not found, will return null
-     * @return Returns the property.
-     */
-
-    public Object getProperty(String key) {
-        Object obj = null;
-
-        obj = properties.get(key);
-
-
-        return obj;
-    }
-    
-    /**
-     * Store a property for message context
-     *
-     * @param key
-     * @param value
-     */
-    public void setProperty(String key, Object value) {
-        properties.put(key, value);
-    }
-
-    
-    public void injectMessage(SynapseMessage smc) {
-    	smc.setSynapseEnvironment(this);
-    	mainmediator.mediate(smc);
-    }
-
-    public ClassLoader getClassLoader() {
-        return cl;
-    }
-
-    public void setClassLoader(ClassLoader cl) {
-        this.cl = cl;
-    }
-
-    public void send(SynapseMessage sm) {
-        if (sm.isResponse())
-            Axis2Sender.sendBack(sm);
-        else
-            Axis2Sender.sendOn(sm);
-    }
-
-
-    public Mediator lookupMediator(String name) {
-        return (Mediator) mediators.get(name);
-    }
-
-    public void addMediator(String name, Mediator m) {
-        log.debug("adding mediator with name " + name);
-        if (mediators.containsKey(name))
-            log.warn("name " + name + "already present");
-        mediators.put(name, m);
-    }
-
-    public Mediator getMasterMediator() {
-        return mainmediator;
-    }
-
-    public void setMasterMediator(Mediator m) {
-        mainmediator = m;
-    }
-
-	public Registry getRegistry() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setRegistry(Registry reg) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public Metrics getMetrics(String URI) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Metrics getMetrics(EndpointReference epr) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setMetricsFactory(MetricsFactory mf) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void publish(OMElement element) {
-		// TODO Auto-generated method stub
-		
-	}
-
-    // lookup methods for resources handling
- //   public Mediator lookupResourceMediator(String uriRoot) {
-   //     return (Mediator) fac.getResourceMediator(uriRoot);
-   // }
-
-  //  public void addResourceMediator(String uri, Mediator m) {
-   //     log.debug("adding "+uri+" with "+m.getClass());
-    	
-    	/*if (resourceMediators.containsKey(uri)) {
-            throw new SynapseException(
-                    "Uri Root is already exists. Not acceptable");
-        }*/
-        
-   //     fac.addResourceMediator(uri, (ResourceMediator)m);
-   // }
-
-   // public ResourceHelper getResourceHelper() {
-        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
-        //fac.setResourceProcessorsMap(this.resourceMediators);
-        //log.debug("size in env is "+this.resourceMediators.size());
-    //    return fac.createResourceHelper();
-   // }
-
-
-
-	
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java	(working copy)
@@ -1,228 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-/**
- *
- * 
- * <p>
- * A wrapper on Axis2's Message Context that implements the SynapseMessage interface
- *
- */
-public class Axis2SynapseMessage implements SynapseMessage {
-
-    private MessageContext mc = null;
-
-    private Map props = new HashMap();
-
-    private boolean response = false;
-
-    private boolean faultResponse = false;
-
-    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se) {
-        setMessageContext(mc);
-        setSynapseEnvironment(se);
-    }
-
-    public EndpointReference getFaultTo() {
-        return mc.getFaultTo();
-    }
-
-    public void setFaultTo(EndpointReference reference) {
-        mc.setFaultTo(reference);
-    }
-
-    public EndpointReference getFrom() {
-        return mc.getFrom();
-    }
-
-    public void setFrom(EndpointReference reference) {
-        mc.setFrom(reference);
-
-    }
-
-    public SOAPEnvelope getEnvelope() {
-
-        return mc.getEnvelope();
-    }
-
-    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
-        mc.setEnvelope(envelope);
-
-    }
-
-    public String getMessageID() {
-        return mc.getMessageID();
-    }
-
-    public void setMessageID(String string) {
-        mc.setMessageID(string);
-
-    }
-
-    public RelatesTo getRelatesTo() {
-        return mc.getRelatesTo();
-
-    }
-
-    public void setRelatesTo(RelatesTo reference) {
-        mc.setRelatesTo(reference);
-
-    }
-
-    public EndpointReference getReplyTo() {
-        return mc.getReplyTo();
-
-    }
-
-    public void setReplyTo(EndpointReference reference) {
-        mc.setReplyTo(reference);
-
-    }
-
-    public EndpointReference getTo() {
-        return mc.getTo();
-
-    }
-
-    public void setTo(EndpointReference reference) {
-        mc.setTo(reference);
-
-    }
-
-    public void setWSAAction(String actionURI) {
-        mc.setWSAAction(actionURI);
-
-    }
-
-    public String getWSAAction() {
-
-        return mc.getWSAAction();
-    }
-
-    public void setMessageId(String messageID) {
-        mc.setWSAMessageId(messageID);
-
-    }
-
-    public String getMessageId() {
-        return mc.getMessageID();
-    }
-
-    public Object getProperty(String key) {
-        Object obj = props.get(key);
-        if ( obj == null) {
-            obj = mc.getProperty(key);
-        }
-        return obj;
-
-    }
-
-    public void setProperty(String key, Object value) {
-        props.put(key, value);
-    }
-
-    public Iterator getPropertyNames() {
-        return props.keySet().iterator();
-    }
-
-    public String getSoapAction() {
-        return mc.getSoapAction();
-    }
-
-    public void setSoapAction(String string) {
-        mc.setSoapAction(string);
-
-    }
-
-    public boolean isDoingMTOM() {
-
-        return mc.isDoingMTOM();
-    }
-
-    public void setDoingMTOM(boolean b) {
-        mc.setDoingMTOM(b);
-
-    }
-
-    public boolean isDoingREST() {
-
-        return mc.isDoingREST();
-    }
-
-    public void setDoingREST(boolean b) {
-        mc.setDoingREST(b);
-
-    }
-
-    public boolean isSOAP11() {
-
-        return mc.isSOAP11();
-    }
-
-    public MessageContext getMessageContext() {
-        return mc;
-    }
-
-    public void setMessageContext(MessageContext mc) {
-        this.mc = mc;
-        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
-        if (resp != null)
-            response = resp.booleanValue();
-    }
-
-    public void setResponse(boolean b) {
-        response = b;
-        mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf(b));
-    }
-
-    public boolean isResponse() {
-        return response;
-    }
-
-    public void setFaultResponse(boolean b) {
-        this.faultResponse = b;
-    }
-
-    public boolean isFaultResponse() {
-        return this.faultResponse;
-    }
-
-	public SynapseEnvironment getSynapseEnvironment() {
-		return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
-	}
-
-	public void setSynapseEnvironment(SynapseEnvironment env) {
-		Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
-		return;
-	}
-	
-	
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java	(working copy)
@@ -1,191 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.*;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-
-import org.apache.synapse.Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-
-/**
- * This is a simple client that handles both in only and in out
- */
-public class Axis2FlexibleMEPClient {
-
-    public static SOAPEnvelope outEnvelopeConfiguration(MessageContext smc) {
-        SOAPEnvelope env = smc.getEnvelope();
-        SOAPHeader soapHeader = env.getHeader();
-        ArrayList addressingHeaders;
-        if (soapHeader != null) {
-            addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                    AddressingConstants.Submission.WSA_NAMESPACE);
-            if (addressingHeaders != null && addressingHeaders.size() != 0) {
-                detachAddressingInformation(addressingHeaders);
-
-            } else {
-                addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                        AddressingConstants.Final.WSA_NAMESPACE);
-                if (addressingHeaders != null && addressingHeaders.size() != 0) {
-                    detachAddressingInformation(addressingHeaders);
-                }
-            }
-        }
-        return env;
-    }
-
-    /**
-     *
-     * @param headerInformation
-     */
-    private static void detachAddressingInformation(ArrayList headerInformation) {
-        Iterator iterator = headerInformation.iterator();
-        while (iterator.hasNext()) {
-            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();
-            headerBlock.detach();
-        }
-
-    }
-
-    // Following code is based on Axis2 Client code.
-    public static MessageContext send(MessageContext smc) throws AxisFault {
-        // In this logic Synapse Work as a Client to a Server
-        // So here this logic should expect 200 ok, 202 ok and 500 internal server error
-        // current state of the code in Synchronus
-
-        // This is the original_configuration_context
-        ConfigurationContext cc = smc.getConfigurationContext();
-        AxisConfiguration ac = cc.getAxisConfiguration();
-        PhasesInfo phasesInfo = ac.getPhasesInfo();
-
-        // setting operation default chains
-        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
-            // Lets default be OUT_IN
-            OutInAxisOperation outInOperation =
-                    new OutInAxisOperation(new QName(
-                            "__OPERATION_OUT_IN__"));
-            AxisService axisAnonymousService =
-                    new AxisService("__ANONYMOUS_SERVICE__");
-            axisAnonymousService.addOperation(outInOperation);
-            ac.addService(axisAnonymousService);
-            phasesInfo.setOperationPhases(outInOperation);
-        }
-        ServiceGroupContext sgc = new ServiceGroupContext(cc,
-                (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
-        ServiceContext sc =
-                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
-
-        MessageContext mc = new MessageContext();
-        mc.setConfigurationContext(sc.getConfigurationContext());
-        ///////////////////////////////////////////////////////////////////////
-        // filtering properties
-        if (smc.getSoapAction() != null)
-            mc.setSoapAction(smc.getSoapAction());
-        if (smc.getWSAAction() != null)
-            mc.setWSAAction(smc.getWSAAction());
-        if (smc.getFrom() != null)
-            mc.setFrom(smc.getFrom());
-        if (smc.getMessageID() != null)
-            mc.setMessageID(smc.getMessageID());
-        else
-            mc.setMessageID(String.valueOf("uuid:"
-                    + UUIDGenerator.getUUID()));
-        if (smc.getReplyTo() != null)
-            mc.setReplyTo(smc.getReplyTo());
-        if (smc.getRelatesTo() != null)
-            mc.setRelatesTo(smc.getRelatesTo());
-        if (smc.getTo() != null) {
-            mc.setTo(smc.getTo());
-        } else {
-            throw new AxisFault(
-                    "To canno't be null, if null Synapse can't infer the transport");
-        }
-        if (smc.isDoingREST()) {
-            mc.setDoingREST(true);
-        }
-
-        // handling the outbound message with addressing
-        AxisModule module = ac.getModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-        if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) ||
-                (smc.getProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)){
-            if (!ac.getService("__ANONYMOUS_SERVICE__")
-                    .isEngaged(module.getName())) {
-                ac.getService("__ANONYMOUS_SERVICE__").engageModule(module, ac);
-            }
-        }
-
-
-        //TODO; following line needed to be removed
-
-        mc.setEnvelope(outEnvelopeConfiguration(smc));
-
-        AxisOperation axisAnonymousOperation =
-                ac.getService("__ANONYMOUS_SERVICE__")
-                        .getOperation(new QName("__OPERATION_OUT_IN__"));
-
-        //Options class from Axis2 holds client side settings
-        Options options = new Options();
-        OperationClient mepClient =
-                axisAnonymousOperation.createClient(sc, options);
-        mepClient.addMessageContext(mc);
-        mepClient.execute(true);
-        MessageContext response = mepClient
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-        response.setProperty(MessageContext.TRANSPORT_OUT,
-                smc.getProperty(MessageContext.TRANSPORT_OUT));
-        response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                smc.getProperty(
-                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-
-
-        // If request is REST we assume the response is REST, so set the
-        // variable
-        response.setDoingREST(smc.isDoingREST());
-        response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
-
-        if (ac.getService("__ANONYMOUS_SERVICE__")
-                .isEngaged(module.getName())) {
-            ac.getService("__ANONYMOUS_SERVICE__")
-                    .disEngageModule(ac.getModule(module.getName()));
-        }
-        return response;
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(working copy)
@@ -1,114 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportInDescription;
-
-import org.apache.axis2.engine.AxisEngine;
-
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-
-
-/**
- * This class helps the Axis2SynapseEnvironment implement the send method
- */
-public class Axis2Sender {
-
-    public static void sendOn(SynapseMessage smc) {
-
-        try {
-
-            MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                    .getMessageContext();
-            // At any time any QOS is disengaged. It's engaged iff, a flag is
-            // set in execution chain.
-            // ex: addressing will be engage in outpath iff ADDRESSING_PROCESSED
-            // is set.
-
-            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null)
-            {
-
-                messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
-
-            }
-            //Now hadle the outbound message with addressing
-            if (smc.getProperty(
-                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
-                messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
-                        Boolean.TRUE);
-
-            }
-
-            MessageContext outMsgContext = Axis2FlexibleMEPClient
-                    .send(messageContext);
-
-            // run all rules on response
-
-            smc.setResponse(true);//
-
-            outMsgContext.setServerSide(true);
-
-            Object os = messageContext
-                    .getProperty(MessageContext.TRANSPORT_OUT);
-            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
-            TransportInDescription ti = messageContext.getTransportIn();
-
-            outMsgContext.setTransportIn(ti);
-
-            if (smc.getSynapseEnvironment() == null) {
-                throw new SynapseException("no Synapse Env set on message");
-            }
-            smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
-                    outMsgContext, smc.getSynapseEnvironment()));
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new SynapseException(e);
-        }
-    }
-
-    public static void sendBack(SynapseMessage smc) {
-        MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                .getMessageContext();
-        AxisEngine ae =
-                new AxisEngine(messageContext.getConfigurationContext());
-        try {
-//
-
-
-            messageContext
-                    .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
-            // check for addressing is alredy engaged for this message.
-            // if engage we should use the address enable Configuraion context.
-//
-
-            ae.send(messageContext);
-        } catch (AxisFault e) {
-            throw new SynapseException(e);
-
-        }
-
-    }
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java	(working copy)
@@ -1,189 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-import org.apache.synapse.Metrics;
-import org.apache.synapse.MetricsFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
-//import org.apache.synapse.resources.ResourceHelperFactory;
-//import org.apache.synapse.resources.ResourceHelper;
-//import org.apache.synapse.resources.xml.ResourceMediator;
-
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-
-/**
- *
- *
- *
- * <p> This is the Axis2 implementation of the SynapseEnvironment
- *
- */
-public class Axis2SynapseEnvironment implements SynapseEnvironment {
-	
-    private Mediator mainmediator = null;
-
-    private ClassLoader cl = null;
-    private Map properties = new HashMap();
-    private Map mediators = new HashMap();
-
-    private Log log = LogFactory.getLog(getClass());
-
-    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
-                                   ClassLoader cl) {
-        super();
-        this.cl = cl;
-        if (synapseConfiguration!=null)
-            mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
-    }
-
-    /**
-     * Retrieves an object given a key.
-     *
-     * @param key - if not found, will return null
-     * @return Returns the property.
-     */
-
-    public Object getProperty(String key) {
-        Object obj = null;
-
-        obj = properties.get(key);
-
-
-        return obj;
-    }
-    
-    /**
-     * Store a property for message context
-     *
-     * @param key
-     * @param value
-     */
-    public void setProperty(String key, Object value) {
-        properties.put(key, value);
-    }
-
-    
-    public void injectMessage(SynapseMessage smc) {
-    	smc.setSynapseEnvironment(this);
-    	mainmediator.mediate(smc);
-    }
-
-    public ClassLoader getClassLoader() {
-        return cl;
-    }
-
-    public void setClassLoader(ClassLoader cl) {
-        this.cl = cl;
-    }
-
-    public void send(SynapseMessage sm) {
-        if (sm.isResponse())
-            Axis2Sender.sendBack(sm);
-        else
-            Axis2Sender.sendOn(sm);
-    }
-
-
-    public Mediator lookupMediator(String name) {
-        return (Mediator) mediators.get(name);
-    }
-
-    public void addMediator(String name, Mediator m) {
-        log.debug("adding mediator with name " + name);
-        if (mediators.containsKey(name))
-            log.warn("name " + name + "already present");
-        mediators.put(name, m);
-    }
-
-    public Mediator getMasterMediator() {
-        return mainmediator;
-    }
-
-    public void setMasterMediator(Mediator m) {
-        mainmediator = m;
-    }
-
-	public Registry getRegistry() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setRegistry(Registry reg) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public Metrics getMetrics(String URI) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Metrics getMetrics(EndpointReference epr) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setMetricsFactory(MetricsFactory mf) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void publish(OMElement element) {
-		// TODO Auto-generated method stub
-		
-	}
-
-    // lookup methods for resources handling
- //   public Mediator lookupResourceMediator(String uriRoot) {
-   //     return (Mediator) fac.getResourceMediator(uriRoot);
-   // }
-
-  //  public void addResourceMediator(String uri, Mediator m) {
-   //     log.debug("adding "+uri+" with "+m.getClass());
-    	
-    	/*if (resourceMediators.containsKey(uri)) {
-            throw new SynapseException(
-                    "Uri Root is already exists. Not acceptable");
-        }*/
-        
-   //     fac.addResourceMediator(uri, (ResourceMediator)m);
-   // }
-
-   // public ResourceHelper getResourceHelper() {
-        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
-        //fac.setResourceProcessorsMap(this.resourceMediators);
-        //log.debug("size in env is "+this.resourceMediators.size());
-    //    return fac.createResourceHelper();
-   // }
-
-
-
-	
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java	(working copy)
@@ -1,97 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Constants;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * <p/>
- * The SynapseEnvironment needs to be set up and then is used by the SynapseMessageReceiver to inject messages.
- * This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
- */
-public class Axis2SynapseEnvironmentFinder implements Constants {
-	private static Log log = LogFactory.getLog(Axis2SynapseEnvironmentFinder.class);
-    public static synchronized SynapseEnvironment getSynapseEnvironment(
-            MessageContext mc) {
-        AxisConfiguration ac =
-                mc.getConfigurationContext().getAxisConfiguration();
-        Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
-        if (synapseEnvParam == null) {
-        	log.debug("synapse env not available - creating");
-            Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
-            if (param == null) {
-                throw new SynapseException("no parameter '"
-                        + SYNAPSECONFIGURATION + "' in axis2.xml");
-            }
-            String synapseConfig = (String) param.getValue();
-            InputStream is = mc.getAxisService().getClassLoader()
-                    .getResourceAsStream(synapseConfig.trim());
-
-            StAXOMBuilder builder;
-            try {
-                builder = new StAXOMBuilder(is);
-
-            } catch (XMLStreamException e1) {
-                throw new SynapseException(
-                        "Trouble parsing Synapse Configuration ", e1);
-
-            }
-            OMElement config = builder.getDocumentElement();
-            config.build();
-            Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc
-                    .getAxisService().getClassLoader());
-
-            synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
-            synapseEnvParam.setValue(se);
-            try {
-                ac.addParameter(synapseEnvParam);
-            } catch (AxisFault e) {
-                throw new SynapseException(e);
-            }
-        }
-        return (SynapseEnvironment) synapseEnvParam.getValue();
-
-    }
-    public static synchronized void setSynapseEnvironment(MessageContext mc, SynapseEnvironment se) {
-    	  AxisConfiguration ac =
-              mc.getConfigurationContext().getAxisConfiguration();
-    	  Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
-          synapseEnvParam.setValue(se);
-    	  try {
-			ac.addParameter(synapseEnvParam);
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-		}
-    	
-    }
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java	(working copy)
@@ -1,228 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-/**
- *
- * 
- * <p>
- * A wrapper on Axis2's Message Context that implements the SynapseMessage interface
- *
- */
-public class Axis2SynapseMessage implements SynapseMessage {
-
-    private MessageContext mc = null;
-
-    private Map props = new HashMap();
-
-    private boolean response = false;
-
-    private boolean faultResponse = false;
-
-    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se) {
-        setMessageContext(mc);
-        setSynapseEnvironment(se);
-    }
-
-    public EndpointReference getFaultTo() {
-        return mc.getFaultTo();
-    }
-
-    public void setFaultTo(EndpointReference reference) {
-        mc.setFaultTo(reference);
-    }
-
-    public EndpointReference getFrom() {
-        return mc.getFrom();
-    }
-
-    public void setFrom(EndpointReference reference) {
-        mc.setFrom(reference);
-
-    }
-
-    public SOAPEnvelope getEnvelope() {
-
-        return mc.getEnvelope();
-    }
-
-    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
-        mc.setEnvelope(envelope);
-
-    }
-
-    public String getMessageID() {
-        return mc.getMessageID();
-    }
-
-    public void setMessageID(String string) {
-        mc.setMessageID(string);
-
-    }
-
-    public RelatesTo getRelatesTo() {
-        return mc.getRelatesTo();
-
-    }
-
-    public void setRelatesTo(RelatesTo reference) {
-        mc.setRelatesTo(reference);
-
-    }
-
-    public EndpointReference getReplyTo() {
-        return mc.getReplyTo();
-
-    }
-
-    public void setReplyTo(EndpointReference reference) {
-        mc.setReplyTo(reference);
-
-    }
-
-    public EndpointReference getTo() {
-        return mc.getTo();
-
-    }
-
-    public void setTo(EndpointReference reference) {
-        mc.setTo(reference);
-
-    }
-
-    public void setWSAAction(String actionURI) {
-        mc.setWSAAction(actionURI);
-
-    }
-
-    public String getWSAAction() {
-
-        return mc.getWSAAction();
-    }
-
-    public void setMessageId(String messageID) {
-        mc.setWSAMessageId(messageID);
-
-    }
-
-    public String getMessageId() {
-        return mc.getMessageID();
-    }
-
-    public Object getProperty(String key) {
-        Object obj = props.get(key);
-        if ( obj == null) {
-            obj = mc.getProperty(key);
-        }
-        return obj;
-
-    }
-
-    public void setProperty(String key, Object value) {
-        props.put(key, value);
-    }
-
-    public Iterator getPropertyNames() {
-        return props.keySet().iterator();
-    }
-
-    public String getSoapAction() {
-        return mc.getSoapAction();
-    }
-
-    public void setSoapAction(String string) {
-        mc.setSoapAction(string);
-
-    }
-
-    public boolean isDoingMTOM() {
-
-        return mc.isDoingMTOM();
-    }
-
-    public void setDoingMTOM(boolean b) {
-        mc.setDoingMTOM(b);
-
-    }
-
-    public boolean isDoingREST() {
-
-        return mc.isDoingREST();
-    }
-
-    public void setDoingREST(boolean b) {
-        mc.setDoingREST(b);
-
-    }
-
-    public boolean isSOAP11() {
-
-        return mc.isSOAP11();
-    }
-
-    public MessageContext getMessageContext() {
-        return mc;
-    }
-
-    public void setMessageContext(MessageContext mc) {
-        this.mc = mc;
-        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
-        if (resp != null)
-            response = resp.booleanValue();
-    }
-
-    public void setResponse(boolean b) {
-        response = b;
-        mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf(b));
-    }
-
-    public boolean isResponse() {
-        return response;
-    }
-
-    public void setFaultResponse(boolean b) {
-        this.faultResponse = b;
-    }
-
-    public boolean isFaultResponse() {
-        return this.faultResponse;
-    }
-
-	public SynapseEnvironment getSynapseEnvironment() {
-		return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
-	}
-
-	public void setSynapseEnvironment(SynapseEnvironment env) {
-		Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
-		return;
-	}
-	
-	
-
-}
Index: modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java	(working copy)
@@ -1,177 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.ClientUtils;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.synapse.SynapseException;
-
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-
-/**
- * DynamicAxisOperation which switch dynamically between MEPs
- */
-public class DynamicAxisOperation extends InOutAxisOperation {
-    public DynamicAxisOperation() {
-        super();
-    }
-
-    public DynamicAxisOperation(QName name) {
-        super(name);
-    }
-
-    public void addMessageContext(MessageContext msgContext,
-                                  OperationContext opContext) throws AxisFault {
-        HashMap mep = opContext.getMessageContexts();
-        MessageContext immsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_IN_VALUE);
-        MessageContext outmsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_OUT_VALUE);
-
-        if ((immsgContext != null) && (outmsgContext != null)) {
-            throw new AxisFault(
-                    "Invalid message addition , operation context completed");
-        }
-
-        if (outmsgContext == null) {
-            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
-        } else {
-            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
-            opContext.setComplete(true);
-        }
-    }
-
-
-    public OperationClient createClient(ServiceContext sc, Options options) {
-        return new DynamicOperationClient(this,sc,options);
-    }
-
-}
-
-class DynamicOperationClient implements OperationClient {
-    private DynamicAxisOperation axisOp;
-    private ServiceContext sc;
-    private OperationContext oc;
-    private Options options;
-
-    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
-        this.options = options;
-        this.axisOp = axisOp;
-        this.sc = sc;
-        this.oc = new OperationContext(axisOp,sc);
-        this.oc.setParent(this.sc);
-    }
-
-    public void setOptions(Options options) {
-        // Not supported
-    }
-
-    public Options getOptions() {
-        throw new SynapseException("Not Supported");
-    }
-
-    public void addMessageContext(MessageContext mc) throws AxisFault {
-        mc.setServiceContext(sc);
-        axisOp.registerOperationContext(mc, oc);
-    }
-
-    public MessageContext getMessageContext(String messageLabel) throws AxisFault {
-        return oc.getMessageContext(messageLabel);
-    }
-
-    public void setCallback(Callback callback) {
-        // Not supported
-    }
-
-    public void execute(boolean block) throws AxisFault {
-        if (block) {
-            ConfigurationContext cc = sc.getConfigurationContext();
-
-            // copy interesting info from options to message context.
-            MessageContext mc = oc
-                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-            if (mc == null) {
-                throw new AxisFault(
-                        "Out message context is null ,"
-                                + " please set the out message context before calling this method");
-            }
-
-            EndpointReference toEPR = mc.getTo();
-
-            TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
-            mc.setTransportOut(transportOut);
-
-            /*
-            Options need to Infer TransportInDescription
-            */
-            if (mc.getTransportIn() == null) {
-                TransportInDescription transportIn = options.getTransportIn();
-                if (transportIn == null) {
-                    mc.setTransportIn(ClientUtils.inferInTransport(cc
-                            .getAxisConfiguration(), options, mc));
-                } else {
-                    mc.setTransportIn(transportIn);
-                }
-            }
-
-            if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
-                Parameter soapaction = axisOp.getParameter(AxisOperation.SOAP_ACTION);
-                if (soapaction != null) {
-                    mc.setSoapAction((String) soapaction.getValue());
-                }
-            }
-
-            oc.addMessageContext(mc);
-            // ship it out
-            AxisEngine engine = new AxisEngine(cc);
-            engine.send(mc);
-        }
-
-    }
-    public OperationContext getOperationContext() {
-    	return oc;
-    }
-
-    public void reset() throws AxisFault {
-        // Not supported
-    }
-
-    public void complete(MessageContext msgCtxt) throws AxisFault {
-        // Not supported
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java	(working copy)
@@ -1,37 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.synapse.Constants;
-
-/**
- *
- * <p>Does nothing! Used as an endpoint so we can engage modules
- *
- */
-public class EmptyMessageReceiver implements MessageReceiver {
-
-	public void receive(MessageContext mc) throws AxisFault {
-		mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
-				.valueOf(true));
-	}
-
-}
Index: modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-
-public class ServiceMediatorMessageReceiver extends AbstractMessageReceiver {
-    public void receive(MessageContext messageContext) throws AxisFault {
-        Object obj = makeNewServiceObject(messageContext);
-
-        Mediator mediator = (Mediator) obj;
-/*
-        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
-            SynapseEnvironment se = (SynapseEnvironment) messageContext
-                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
-            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
-            ((EnvironmentAware) mediator).setClassLoader(
-                    messageContext.getAxisService().getClassLoader());
-        }
-        
-*/
-        SynapseMessage smc = new Axis2SynapseMessage(messageContext, Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
-        boolean returnValue = mediator.mediate(smc);
-        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
-                new Boolean(returnValue));
-    }
-}
Index: modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java	(working copy)
@@ -1,63 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.axis2;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.engine.AbstractDispatcher;
-import org.apache.axis2.engine.AxisConfiguration;
-
-/**
- *
- * 
- * This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
- *
- */
-public class SynapseDispatcher extends AbstractDispatcher {
-	// FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
-
-	private static final long serialVersionUID = -6970206989111592645L;
-
-	private static final String SYNAPSE_SERVICE_NAME = "synapse";
-
-	private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
-
-	public void initDispatcher() {
-		QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
-		HandlerDescription hd = new HandlerDescription(qn);
-		super.init(hd);
-
-	}
-
-	public AxisService findService(MessageContext mc) throws AxisFault {
-		AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-		AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
-		return as;
-	}
-
-	public AxisOperation findOperation(AxisService svc, MessageContext mc)
-			throws AxisFault {
-
-		AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
-		return ao;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(working copy)
@@ -1,68 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.axis2;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.MessageContext;
-
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-
-/**
- * <p/>
- * <p/>
- * This is used to "catch" messages in Axis2 and pass them to Synapse for processing.
- */
-public class SynapseMessageReceiver implements MessageReceiver {
-
-    private Log log = LogFactory.getLog(getClass());
-
-    public void receive(MessageContext mc) throws AxisFault {
-        log.debug("receiving message");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-                .getSynapseEnvironment(mc);
-        ////////////////////////////////////////////////////////////////////////
-        // SynapseEnvironment is set as a property in MessageContext. This is due
-        // use we can expect in ServiceMediatorProcessor and many extensions yet to come
-        // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
-        
-        ////////////////////////////////////////////////////////////////////////
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
-
-        ///////////////////////////////////////////////////////////////////////
-        // Response handling mechanism for 200/202 and 5XX
-        // smc.isResponse =true then the response will be handle with 200 OK
-        // else, response will be 202 OK without no http body
-        // smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
-        if (smc.isResponse()) {
-            mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
-                    Constants.VALUE_TRUE);
-        }
-        if (smc.isFaultResponse()) {
-            // todo: a good way to inject faultSoapEnv to the Axis2 Transport 
-            throw new AxisFault(
-                    "Synapse Encounters an Error - Please See Log for More Details");
-        }
-        ///////////////////////////////////////////////////////////////////////
-    }
-}
Index: modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SynapseConfiguration.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/SynapseConfiguration.java	(revision 0)
@@ -0,0 +1,54 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config;
+
+import org.apache.synapse.api.Mediator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SynapseConfiguration {
+
+    private Map namedSequences = new HashMap();
+    private Map namedEndpoints = new HashMap();
+    private Map globalProps = new HashMap();
+
+    private Mediator mainMediator = null;
+
+    public void addNamedMediator(String name, Mediator m) {
+        namedSequences.put(name, m);
+    }
+
+    public Mediator getNamedMediator(String name) {
+        return (Mediator) namedSequences.get(name);
+    }
+
+    public Mediator getMainMediator() {
+        return mainMediator;
+    }
+
+    public void setMainMediator(Mediator mainMediator) {
+        this.mainMediator = mainMediator;
+    }
+
+    public void addProperty(String name, String value) {
+        globalProps.put(name, value);
+    }
+
+    public String getProperty(String name) {
+        return (String) globalProps.get(name);
+    }
+}
Index: modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SynapseConfiguration.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/SynapseConfiguration.java	(revision 0)
@@ -0,0 +1,54 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config;
+
+import org.apache.synapse.api.Mediator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SynapseConfiguration {
+
+    private Map namedSequences = new HashMap();
+    private Map namedEndpoints = new HashMap();
+    private Map globalProps = new HashMap();
+
+    private Mediator mainMediator = null;
+
+    public void addNamedMediator(String name, Mediator m) {
+        namedSequences.put(name, m);
+    }
+
+    public Mediator getNamedMediator(String name) {
+        return (Mediator) namedSequences.get(name);
+    }
+
+    public Mediator getMainMediator() {
+        return mainMediator;
+    }
+
+    public void setMainMediator(Mediator mainMediator) {
+        this.mainMediator = mainMediator;
+    }
+
+    public void addProperty(String name, String value) {
+        globalProps.put(name, value);
+    }
+
+    public String getProperty(String name) {
+        return (String) globalProps.get(name);
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java	(revision 0)
@@ -0,0 +1,106 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.mediators.MediatorProperty;
+import org.apache.synapse.SynapseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * A utility class capable of creating instances of MediatorProperty objects by reading
+ * through a given XML configuration
+ *
+ * <element>
+ *    <property name="string" (value="literal" | expression="xpath")/>*
+ * </element>
+ */
+public class MediatorPropertyFactory {
+
+    private static final Log log = LogFactory.getLog(MediatorPropertyFactory.class);
+
+    public static List getMediatorProperties(OMElement elem) {
+
+        List propertyList = new ArrayList();
+
+        Iterator iter = elem.getChildrenWithName(new QName(Constants.NULL_NAMESPACE, "property"));
+        while (iter.hasNext()) {
+
+            OMElement propEle = (OMElement) iter.next();
+            OMAttribute attName  = propEle.getAttribute(MediatorProperty.ATT_NAME_Q);
+            OMAttribute attValue = propEle.getAttribute(MediatorProperty.ATT_VALUE_Q);
+            OMAttribute attExpr  = propEle.getAttribute(MediatorProperty.ATT_EXPR_Q);
+
+            MediatorProperty prop = new MediatorProperty();
+
+            if (attName == null || attName.getAttributeValue() == null ||
+                attName.getAttributeValue().trim().length() == 0) {
+                String msg = "Property name is a required attribute for a Log property";
+                log.error(msg);
+                throw new SynapseException(msg);
+            } else {
+                prop.setName(attName.getAttributeValue());
+            }
+
+            // if a value is specified, use it, else look for an expression
+            if (attValue != null) {
+                if (attValue.getAttributeValue() == null || attValue.getAttributeValue().trim().length() == 0) {
+                    String msg = "Property attribute value (if specified) is required for a Log property";
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                } else {
+                    prop.setValue(attValue.getAttributeValue());
+                }
+
+            } else if (attExpr != null) {
+
+                if (attExpr.getAttributeValue() == null || attExpr.getAttributeValue().trim().length() == 0) {
+                    String msg = "Property attribute expression (if specified) is required for a mediator property";
+                    log.error(msg);
+                    throw new SynapseException(msg);
+
+                } else {
+                    try {
+                        prop.setExpression(new AXIOMXPath(attExpr.getAttributeValue()));
+
+                    } catch (JaxenException e) {
+                        String msg = "Invalid XPapth expression : " + attExpr.getAttributeValue();
+                        log.error(msg);
+                        throw new SynapseException(msg, e);
+                    }
+                }
+
+            } else {
+                String msg = "Property attribute value OR expression must be specified for a mediator property";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+            propertyList.add(prop);
+        }
+
+        return propertyList;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java	(revision 0)
@@ -0,0 +1,77 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.builtin.PropertyMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Creates a set-property mediator through the supplied XML configuration
+ *
+ * <set-property name="string" (value="literal" | expression="xpath")/>
+ */
+public class PropertyMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+    private static final QName PROP_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "set-property");
+
+    public Mediator createMediator(OMElement elem) {
+
+        PropertyMediator propMediator = new PropertyMediator();
+        OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        OMAttribute expression = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
+
+        if (name == null) {
+            String msg = "The 'name' attribute is required for the configuration of a property mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else if (value == null && expression == null) {
+            String msg = "Either an 'value' or 'expression' attribute is required for a property mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        propMediator.setName(name.getAttributeValue());
+        if (value != null) {
+            propMediator.setValue(value.getAttributeValue());
+        } else {
+            try {
+                propMediator.setExpression(new AXIOMXPath(expression.getAttributeValue()));
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath expression for attribute 'expression' : " + expression.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+        }
+
+        return propMediator;
+    }
+
+    public QName getTagQName() {
+        return PROP_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java	(working copy)
@@ -14,33 +14,57 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
 
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.SendMediator;
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * The Send mediator factory parses a Send element and creates an instance of the mediator
+ *
+ * //TODO support endpoints, failover and loadbalacing
+ *
+ * The <send> element is used to send messages out of Synapse to some endpoint. In the simplest case,
+ * the place to send the message to is implicit in the message (via a property of the message itself)-
+ * that is indicated by the following
+ *  <send/>
+ *
+ * If the message is to be sent to one or more endpoints, then the following is used:
+ *  <send>
+ *   (endpointref | endpoint)+
+ *  </send>
+ * where the endpointref token refers to the following:
+ * <endpoint ref="name"/>
+ * and the endpoint token refers to an anonymous endpoint defined inline:
+ *  <endpoint address="url"/>
+ * If the message is to be sent to an endpoint selected by load balancing across a set of endpoints,
+ * then it is indicated by the following:
+ * <send>
+ *   <load-balance algorithm="uri">
+ *     (endpointref | endpoint)+
+ *   </load-balance>
+ * </send>
+ * Similarly, if the message is to be sent to an endpoint with failover semantics, then it is indicated by the following:
+ * <send>
+ *   <failover>
+ *     (endpointref | endpoint)+
+ *   </failover>
+ * </send>
+ */
 public class SendMediatorFactory extends AbstractMediatorFactory {
 
+    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE, "send");
 
-    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "send");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(OMElement el) {
         SendMediator sm =  new SendMediator();
-        super.setNameOnMediator(se, el,sm);
         return sm;
-
     }
 
     public QName getTagQName() {
-
         return SEND_Q;
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(revision 0)
@@ -0,0 +1,88 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.builtin.ValidateMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Creates a validation mediator from the XML configuration
+ *
+ * <validate schema="url" [source="xpath"]>
+ *   <on-fail>
+ *     mediator+
+ *   </on-fail>
+ * </validate>
+ */
+public class ValidateMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+    private static final QName VALIDATE_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "validate");
+
+    public Mediator createMediator(OMElement elem) {
+
+        ValidateMediator validateMediator = new ValidateMediator();
+        OMAttribute attSchema = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "schema"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+
+        if (attSchema != null) {
+            validateMediator.setSchemaUrl(attSchema.getAttributeValue());
+        } else {
+            String msg = "The 'schema' attribute is required for the validate mediator configuration";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (attSource != null) {
+            try {
+                AXIOMXPath xp = new AXIOMXPath(attSource.getAttributeValue());
+                validateMediator.setSource(xp);
+                addNameSpaces(elem, xp, log);
+
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath expression specified for attribute 'source'";
+                log.error(msg);
+                throw new SynapseException(msg, e);
+            }
+        }
+
+        OMElement onFail = elem.getFirstElement();
+        if (new QName(Constants.SYNAPSE_NAMESPACE, "on-fail").equals(onFail.getQName()) &&
+            onFail.getChildElements().hasNext()) {
+            super.addChildren(onFail, validateMediator);
+
+        } else {
+            String msg = "A non-empty on-fail element is required for the validate mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        return validateMediator;
+    }
+
+    public QName getTagQName() {
+        return VALIDATE_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/Constants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/Constants.java	(working copy)
@@ -13,13 +13,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
+import javax.xml.namespace.QName;
+
 /**
  * <p/>
  * Constants used in the XML processing
  */
 public interface Constants {
-    String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
-    String SYNAPSE = "synapse";
+    public static final QName DEFINITIONS_ELT = new QName("definitions");
+    public static final QName SEQUENCE_ELT = new QName("sequence");
+    public static final QName ENDPOINT_ELT = new QName("endpoint");
+    public static final QName PROPERTY_ELT = new QName("set-property");
+
+    public static final QName RULES_ELT = new QName("rules");
+
+    public static final String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
+    public static final String SYNAPSE = "synapse";
+    public static final String NULL_NAMESPACE = "";
 }
Index: modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java	(working copy)
@@ -14,21 +14,25 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.DropMediator;
 import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
 
-
+/**
+ * This creates a drop mediator instance
+ *
+ * <drop/>
+ */
 public class DropMediatorFactory extends AbstractMediatorFactory {
 
-    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"drop");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE, "drop");
+
+    public Mediator createMediator(OMElement el) {
         return new DropMediator();
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java	(revision 0)
@@ -0,0 +1,135 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.mediators.base.SynapseMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Iterator;
+
+
+/**
+ * Builds a Synapse Configuration model from an XML input stream.
+ */
+public class SynapseConfigurationBuilder {
+
+    private static Log log = LogFactory.getLog(SynapseConfigurationBuilder.class);
+    private SynapseConfiguration config = new SynapseConfiguration();
+
+    public SynapseConfigurationBuilder() {}
+
+    public SynapseConfiguration getConfig() {
+        return config;
+    }
+
+    public void setConfiguration(InputStream is) {
+
+        OMElement root = null;
+        try {
+            root = new StAXOMBuilder(is).getDocumentElement();
+        } catch (XMLStreamException e) {
+            String msg = "Error parsing Synapse configuration : " + e.getMessage();
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        root.build();
+
+        // digest defined Sequences
+        OMContainer definitions = root.getFirstChildWithName(Constants.DEFINITIONS_ELT);
+        if (definitions != null) {
+            Iterator iter = definitions.getChildrenWithName(Constants.SEQUENCE_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                defineSequence(elt);
+            }
+        }
+
+        // digest defined Endpoints
+        OMContainer endpoints = root.getFirstChildWithName(Constants.ENDPOINT_ELT);
+        if (endpoints != null) {
+            Iterator iter = endpoints.getChildrenWithName(Constants.ENDPOINT_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                //defineEndpoint(synCfg, elt); //TODO process Endpoints
+            }
+        }
+
+        // digest defined Global properties
+        OMContainer properties = root.getFirstChildWithName(Constants.PROPERTY_ELT);
+        if (properties != null) {
+            Iterator iter = properties.getChildrenWithName(Constants.PROPERTY_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                defineProperty(elt);
+            }
+        }
+
+        OMElement elem = root.getFirstChildWithName(Constants.RULES_ELT);
+        if (elem == null) {
+            String msg = "A valid Synapse configuration MUST specify the main mediator using the <rules> element";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else {
+            SynapseMediator sm = (SynapseMediator) MediatorFactoryFinder.getInstance().getMediator(elem);
+            if (sm.getList().isEmpty()) {
+                String msg = "Invalid configuration, the main mediator specified by the <rules> element is empty";
+                log.error(msg);
+                throw new SynapseException(msg);
+            } else {
+                config.setMainMediator(sm);
+            }
+        }
+
+        if (is != null) {
+            try {
+                is.close();
+            } catch (IOException e) {}
+        }
+    }
+
+    /**
+     * <set-property name="string" value="string"/>
+     * @param elem
+     */
+    private void defineProperty(OMElement elem) {
+        OMAttribute name  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        if (name == null || value == null) {
+            String msg = "The 'name' and 'value' attributes are required";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        config.addProperty(name.getAttributeValue(), value.getAttributeValue());
+    }
+
+    private void defineSequence(OMElement ele) {
+        SequenceMediator seq = (SequenceMediator) MediatorFactoryFinder.getInstance().getMediator(ele);
+        config.addNamedMediator(seq.getName(), seq);
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java	(working copy)
@@ -15,7 +15,7 @@
  */
 
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -27,14 +27,10 @@
 import org.apache.commons.logging.LogFactory;
 
 
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.resources.xml.PropertyMediatorFactory;
-import org.apache.synapse.resources.xml.ResourceMediatorFactory;
+import org.apache.synapse.config.xml.MediatorFactory;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
 
 import sun.misc.Service;
 
@@ -47,90 +43,104 @@
 
 public class MediatorFactoryFinder {
 
-	private static Map lookup = null;
+    private static Map factoryMap = new HashMap();
+	private static final Log log = LogFactory.getLog(MediatorFactoryFinder.class);
 
-	private static Log log = LogFactory
-			.getLog(MediatorFactoryFinder.class);
+	private static final Class[] mediatorFactories = {
+        SequenceMediatorFactory.class,
+        LogMediatorFactory.class,
+        SendMediatorFactory.class,
+        FilterMediatorFactory.class,
+        SynapseMediatorFactory.class,
+        DropMediatorFactory.class,
+        HeaderMediatorFactory.class,
+        FaultMediatorFactory.class,
+        TransformMediatorFactory.class,
+        ValidateMediatorFactory.class,
+        PropertyMediatorFactory.class,
+        SwitchMediatorFactory.class,
+        SwitchCaseMediatorFactory.class,
+        SwitchCaseDefaultMediatorFactory.class
+      };
 
-	private static Class[] mediatorFactories = {
-			SynapseMediatorFactory.class,
-			StageMediatorFactory.class, RegexMediatorFactory.class,
-			XPathMediatorFactory.class,
-			HeaderMediatorFactory.class,
-			ClassMediatorFactory.class,
-			ServiceMediatorFactory.class,
-			LogMediatorFactory.class, SendMediatorFactory.class,
-			FaultMediatorFactory.class,
-			AddressingInMediatorFactory.class,
-			AddressingOutMediatorFactory.class,
-			InMediatorFactory.class, OutMediatorFactory.class,
-			NeverMediatorFactory.class, RefMediatorFactory.class,
-            XSLTMediatorFactory.class,DefineMediatorFactory.class,
-            SendNowMediatorFactory.class,SendMediatorFactory.class,
-            DropMediatorFactory.class,
-            RefDefineMediatorFactory.class, ExactlyOneMediatorFactory.class,
-            DefaultMediatorFactory.class,
-            PropertyMediatorFactory.class, ResourceMediatorFactory.class,
-            };
+    private static MediatorFactoryFinder instance = null;
 
-	private static void initialise() {
+    public static synchronized MediatorFactoryFinder getInstance() {
+        if (instance == null) {
+            instance = new MediatorFactoryFinder();
+        }
+        return instance;
+    }
 
-		if (lookup != null)
-			return;
-		lookup = new HashMap();
+    /**
+     * Force re initialization next time
+     */
+    public synchronized void reset() {
+        factoryMap.clear();
+        instance = null;
+    }
 
+    private MediatorFactoryFinder() {
+
+		factoryMap = new HashMap();
 		for (int i = 0; i < mediatorFactories.length; i++) {
 			Class c = mediatorFactories[i];
 			try {
-				lookup.put(((MediatorFactory) c.newInstance())
-						.getTagQName(), c);
+				factoryMap.put(((MediatorFactory) c.newInstance()).getTagQName(), c);
 			} catch (Exception e) {
-				throw new SynapseException("problem instantiating "+c.getName(), e);
+				throw new SynapseException("Error instantiating " + c.getName(), e);
 			}
 		}
-		log.debug("registering extensions");
-		log.debug(System.getProperty("java.class.path"));
-		// now try additional processors
-		Iterator it = Service.providers(MediatorFactory.class);
-		while (it.hasNext()) {
-			MediatorFactory mf = (MediatorFactory) it.next();
-			QName tag = mf.getTagQName();
-			lookup.put(tag, mf.getClass());
-			log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
-		}
-	}
+        // TODO revisit later registerExtensions();
+    }
 
-                            	/**
-	 * @param qn
-	 * @return the class which implements the Processor for the given QName
-	 */
-	public static Class find(QName qn) {
-		initialise();
-		return (Class) lookup.get(qn);
-	}
-	
+    //TODO revist later
+    private void registerExtensions() {
+        log.debug("registering extensions");
+        log.debug(System.getProperty("java.class.path"));
+        // now try additional processors
+        Iterator it = Service.providers(MediatorFactory.class);
+        while (it.hasNext()) {
+            MediatorFactory mf = (MediatorFactory) it.next();
+            QName tag = mf.getTagQName();
+            factoryMap.put(tag, mf.getClass());
+            log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
+        }
+    }
+
 	/**
 	 * This method returns a Processor given an OMElement. This will be used
 	 * recursively by the elements which contain processor elements themselves
 	 * (e.g. rules)
 	 * 
-	 * @param synapseEnv
 	 * @param element
-	 * @return Processor
+     * @return Processor
 	 */
-	public static Mediator getMediator(SynapseEnvironment synapseEnv, OMElement element) {
-		OMNamespace n = element.getNamespace();
-		
-		Class cls = find(new QName(n.getName(), element
-				.getLocalName()));
-		try {
+	public Mediator getMediator(OMElement element) {
+
+		QName qName = new QName(element.getNamespace().getName(), element.getLocalName());
+        log.debug("getMediator(" + qName + ")");
+        Class cls = (Class) factoryMap.get(qName);
+
+        if (cls == null) {
+            String msg = "Unknown mediator referenced by configuration element : " + qName;
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        try {
 			MediatorFactory mf = (MediatorFactory) cls.newInstance();
-			Mediator m = mf.createMediator(synapseEnv, element);
-			return m;
-		} catch (InstantiationException e) {
-			throw new SynapseException(e);
-		} catch (IllegalAccessException e) {
-			throw new SynapseException(e);
+			return mf.createMediator(element);
+
+        } catch (InstantiationException e) {
+            String msg = "Error initializing mediator factory : " + cls;
+            log.error(msg);
+            throw new SynapseException(msg, e);
+
+        } catch (IllegalAccessException e) {
+            String msg = "Error initializing mediator factory : " + cls;
+            log.error(msg);
+            throw new SynapseException(msg, e);
 		}
 	}
 }
Index: modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java	(revision 0)
@@ -0,0 +1,73 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Builds an instance of a Sequence mediator through the Synapse configuration. It follows the following
+ *
+ * <sequence name="string">
+ *   mediator+
+ * </sequence>
+ *
+ * OR
+ *
+ * <sequence ref="name"/>
+ */
+public class SequenceMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SequenceMediatorFactory.class);
+
+    private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
+
+    public QName getTagQName() {
+        return SEQUENCE_Q;
+    }
+
+    public Mediator createMediator(OMElement elem) {
+
+        SequenceMediator seqMediator = new SequenceMediator();
+
+        OMAttribute n = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        if (n != null) {
+            seqMediator.setName(n.getAttributeValue());
+            super.addChildren(elem, seqMediator);
+
+        } else {
+            n = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "ref"));
+            if (n != null) {
+                seqMediator.setRef(n.getAttributeValue());
+                
+            } else {
+                String msg = "A sequence mediator should be a named sequence or a reference to another sequence " +
+                    "(i.e. a name attribute or ref attribute is required.";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+        }
+        return seqMediator;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java	(revision 0)
@@ -0,0 +1,94 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.transform.TransformMediator;
+import org.apache.synapse.api.Mediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * Creates a transform mediator from the given XML
+ *
+ * <transform xslt|xquery="url" [source="xpath"]>
+ *   <property name="string" (value="literal" | expression="xpath")/>*
+ * </transform>
+ */
+public class TransformMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+    private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "transform");
+
+    public QName getTagQName() {
+        return LOG_Q;
+    }
+
+    public Mediator createMediator(OMElement elem) {
+
+        TransformMediator transformMediator = new TransformMediator();
+
+        OMAttribute attXslt   = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xslt"));
+        OMAttribute attXQuery = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xquery"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+
+        if (attXslt != null) {
+            try {
+                transformMediator.setXsltUrl(new URL(attXslt.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xslt attribute : " + attXslt.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else  if (attXQuery != null) {
+            try {
+                transformMediator.setXQueryUrl(new URL(attXQuery.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xquery attribute : " + attXQuery.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else {
+            String msg = "The 'xslt' or 'xquery' attributes are required for the Transform mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (attSource != null) {
+            try {
+                transformMediator.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath specified for the source attribute : " + attSource.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        }
+
+        return transformMediator;
+    }
+
+}
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java	(working copy)
@@ -14,15 +14,30 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * A mediator factory capable of creating an instance of a mediator through a given
+ * XML should implement this interface
+ */
 public interface MediatorFactory {
-    public Mediator createMediator(SynapseEnvironment se, OMElement el);
+    /**
+     * Creates an instance of the mediator using the OMElement
+     * @param elem
+     * @return the created mediator
+     */
+    public Mediator createMediator(OMElement elem);
+
+    /**
+     * The QName of this mediator element in the XML config
+     * @return QName of the mediator element
+     */
     public QName getTagQName();
 }
Index: modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java	(working copy)
@@ -14,39 +14,72 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.LogMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
 
+import java.util.Iterator;
+import java.util.List;
+
 /**
+ * Created a Log mediator that logs messages using commons-logging.
  *
- * 
- * <p>
- * Logs messages using Commons-logging. 
- * 
- * <xmp><log name="optional"/></xmp>
- * TODO add support for simple one-line log entry (doesn't cause body parsing)
- *
+ * <log [level="simple|headers|full|custom"]>
+ *      <property> *
+ * </log>
  */
 public class LogMediatorFactory extends AbstractMediatorFactory {
-    private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "log");
 
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
 
+    private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "log");
+    private static final String SIMPLE  = "simple";
+    private static final String HEADERS = "headers";
+    private static final String FULL    = "full";
+    private static final String CUSTOM  = "custom";
+
     public QName getTagQName() {
         return LOG_Q;
     }
 
+    public Mediator createMediator(OMElement elem) {
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        LogMediator lm = new LogMediator();
-        super.setNameOnMediator(se,el,lm);
-        return lm;
+        LogMediator logMediator = new LogMediator();
+
+        // Set the high level set of properties to be logged (i.e. log level)
+        OMAttribute level = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "level"));
+        if (level != null) {
+            if (SIMPLE.equals(level)) {
+                logMediator.setLogLevel(LogMediator.SIMPLE);
+            } else if (HEADERS.equals(level)) {
+                logMediator.setLogLevel(LogMediator.HEADERS);
+            } else if (FULL.equals(level)) {
+                logMediator.setLogLevel(LogMediator.FULL);
+            } else if (CUSTOM.equals(level)) {
+                logMediator.setLogLevel(LogMediator.CUSTOM);
+            }
+        }
+
+        // check if a custom seperator has been supplied, if so use it
+        OMAttribute seperator = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "seperator"));
+        if (seperator != null) {
+            logMediator.setSeperator(seperator.getAttributeValue());
+        }
+
+        logMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+        return logMediator;
     }
 
 }
Index: modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java	(working copy)
@@ -14,28 +14,33 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.base.SynapseMediator;
 import org.apache.axiom.om.OMElement;
 
-public class SynapseMediatorFactory extends
-        AbstractListMediatorFactory {
+/**
+ * Builds the main mediator (@see SynapseConfiguration) of the Synapse instance
+ *
+ * <rules>
+ *   mediator+
+ * <rules>
+ */
+public class SynapseMediatorFactory extends AbstractListMediatorFactory {
 
-    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE,
-            "synapse");
+    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE, "rules");
 
     public QName getTagQName() {
         return tagname;
     }
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(OMElement elem) {
         SynapseMediator sm = new SynapseMediator();
-        super.addChildrenAndSetName(se, el, sm);
+        super.addChildren(elem, sm);
         return sm;
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java	(revision 0)
@@ -0,0 +1,111 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.filters.FilterMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import java.util.Iterator;
+
+/**
+ * Creates a filter mediator instance
+ *
+ * <filter (source="xpath" regex="string") | xpath="xpath">
+ *   mediator+
+ * </filter>
+ */
+public class FilterMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
+
+    private static final QName FILTER_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
+
+    public Mediator createMediator(OMElement elem) {
+        FilterMediator filter = new FilterMediator();
+        super.addChildren(elem, filter);
+
+        OMAttribute attXpath  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xpath"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+        OMAttribute attRegex  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
+
+        if (attXpath != null) {
+            if (attXpath.getAttributeValue() != null && attXpath.getAttributeValue().trim().length() == 0) {
+                String msg = "Invalid attribute value specified for xpath";
+                log.error(msg);
+                throw new SynapseException(msg);
+
+            } else {
+                try {
+                    filter.setXpath(new AXIOMXPath(attXpath.getAttributeValue()));
+                } catch (JaxenException e) {
+                    String msg = "Invalid XPath expression for attribute xpath : " + attXpath.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+            }
+            addNameSpaces(elem, filter.getXpath(), log);
+
+        } else if (attSource != null && attRegex != null) {
+
+            if (
+                (attSource.getAttributeValue() != null && attSource.getAttributeValue().trim().length() == 0) ||
+                (attRegex.getAttributeValue()  != null && attRegex.getAttributeValue().trim().length() == 0) ){
+                String msg = "Invalid attribute values for source and/or regex specified";
+                log.error(msg);
+                throw new SynapseException(msg);
+
+            } else {
+                try {
+                    filter.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+                } catch (JaxenException e) {
+                    String msg = "Invalid XPath expression for attribute source : " + attSource.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+                try {
+                    filter.setRegex(Pattern.compile(attRegex.getAttributeValue()));
+                } catch (PatternSyntaxException pse) {
+                    String msg = "Invalid Regular Expression for attribute regex : " + attRegex.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+            }
+            addNameSpaces(elem, filter.getSource(), log);
+
+        } else {
+            String msg = "An xpath or (source, regex) attributes are required for a filter";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        return filter;
+    }
+
+    public QName getTagQName() {
+        return FILTER_Q;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java	(working copy)
@@ -13,45 +13,83 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.HeaderMediator;
+import org.apache.synapse.mediators.transform.HeaderMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
 
 /**
+ * This builds a Header Mediator parsing the XML configuration supplied
  *
- *         <p>
- *         <xmp><synapse:header name="optional" type="to|from|faultto|replyto|action"
- *         value="newvalue"/> </xmp>
- * 
- * 
+ * Set header
+ *   <header name="qname" (value="literal" | expression="xpath")/>
+ *
+ * Remove header
+ *   <header name="qname" action="remove"/>
  */
 public class HeaderMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "header");
 
+    private static final Log log = LogFactory.getLog(HeaderMediatorFactory.class);
 
-        private static final QName TYPE_ATT_Q = new QName("type"),
-            VALUE_ATT_Q = new QName("value");
+    private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "header");
 
-        public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-            HeaderMediator hm = new HeaderMediator();
-            super.setNameOnMediator(se, el, hm);
-            OMAttribute val = el.getAttribute(VALUE_ATT_Q);
-            OMAttribute type = el.getAttribute(TYPE_ATT_Q);
-            if (val == null || type == null) {
-                throw new SynapseException("<header> must have both " + VALUE_ATT_Q
-                    + " and " + TYPE_ATT_Q + " attributes: " + el.toString());
+    public Mediator createMediator(OMElement elem) {
+
+        HeaderMediator headerMediator = new HeaderMediator();
+        OMAttribute name   = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        OMAttribute exprn  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
+        OMAttribute action = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "action"));
+
+        if (name == null || name.getAttributeValue() == null) {
+            String msg = "A valid name attribute is required for the header mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else {
+            headerMediator.setName(name.getAttributeValue());
+        }
+
+        // The action attribute is optional, if provided and equals to 'remove' the
+        // header mediator will act as a header remove mediator
+        if (action != null && "remove".equals(action.getAttributeValue())) {
+            headerMediator.setAction(HeaderMediator.ACTION_REMOVE);
+        }
+
+        if (value == null && exprn == null) {
+            String msg = "A 'value' or 'expression' attribute is required for a header mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (value != null && value.getAttributeValue() != null) {
+            headerMediator.setValue(value.getAttributeValue());
+
+        } else if (exprn != null && exprn.getAttributeValue() != null) {
+            try {
+                headerMediator.setExpression(new AXIOMXPath(exprn.getAttributeValue()));
+            } catch (JaxenException je) {
+                String msg = "Invalid XPath expression : " + exprn.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg, je);
             }
-            hm.setHeaderType(type.getAttributeValue());
-            hm.setValue( val.getAttributeValue());
-            return hm;
+            
+        } else {
+            String msg = "Invalid attribute value for the attribute 'expression' or 'value'";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        return headerMediator;
     }
 
     public QName getTagQName() {
Index: modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java	(revision 0)
@@ -0,0 +1,61 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class SwitchCaseMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchCaseMediatorFactory.class);
+
+    private final QName SWITCH_CASE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "case");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchCaseMediator switchCaseMediator = new SwitchCaseMediator();
+        OMAttribute regex = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
+        if (regex == null) {
+            String msg = "The 'regex' attribute is required for a switch case definition";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        try {
+            switchCaseMediator.setRegex(Pattern.compile(regex.getAttributeValue()));
+        } catch (PatternSyntaxException pse) {
+            String msg = "Invalid Regular Expression for attribute 'regex' : " + regex.getAttributeValue();
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        super.addChildren(elem, switchCaseMediator);
+        return switchCaseMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_CASE_Q;
+    }
+}
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java	(working copy)
@@ -13,50 +13,40 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
 
 
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.ListMediator;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
- *
- * 
- * <p> This is the abstract parent of any tag which is a "Node" - so &ltstage>, &ltin>&ltout> and &ltnever> all fit this model
- * <p>It recursively creates a list of processors from the children. 
- *
+ * This implements the basic logic to build a list mediator from a given XML
+ * configuration. It recursively builds the child mediators of the list.
  */
 public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
 
-    Log log = LogFactory.getLog(getClass());
+    private static final Log log = LogFactory.getLog(AbstractListMediatorFactory.class);
 
-    public void addChildrenAndSetName(SynapseEnvironment se, OMElement el, ListMediator m)
+    public void addChildren(OMElement el, ListMediator m)
     {
-        super.setNameOnMediator(se, el, m);
-
         Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
         while (it.hasNext()) {
             OMElement child = (OMElement) it.next();
-            Mediator med = MediatorFactoryFinder.getMediator(se, child);
-            if (med != null)
-                mediators.add(med);
-            else
-                log.info("Unknown child of all" + child.getLocalName());
+            Mediator med = MediatorFactoryFinder.getInstance().getMediator(child);
+            if (med != null) {
+                m.addChild(med);
+            } else {
+                String msg = "Unknown mediator : " + child.getLocalName();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
         }
-        m.setList(mediators);
-
     }
-
-
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java	(revision 0)
@@ -0,0 +1,70 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchMediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Constructs a Switch mediator instance from the given XML configuration
+ *
+ * <switch source="xpath">
+ *   <case regex="string">
+ *     mediator+
+ *   </case>+
+ *   <default>
+ *     mediator+
+ *   </default>?
+ * </switch>
+ */
+public class SwitchMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchMediatorFactory.class);
+
+    private static final QName SWITCH_Q  = new QName(Constants.SYNAPSE_NAMESPACE, "switch");
+    private static final QName CASE_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "case");
+    private static final QName DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "default");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchMediator switchMediator = new SwitchMediator();
+        Iterator iter = elem.getChildrenWithName(CASE_Q);
+        while (iter.hasNext()) {
+            switchMediator.addCase((SwitchCaseMediator)
+                MediatorFactoryFinder.getInstance().getMediator((OMElement) iter.next()));
+        }
+
+        iter = elem.getChildrenWithName(DEFAULT_Q);
+        while (iter.hasNext()) {
+            switchMediator.addCase((SwitchCaseMediator)
+                MediatorFactoryFinder.getInstance().getMediator((OMElement) iter.next()));
+            break; // add only the *first* default if multiple are specified, ignore rest if any
+        }
+
+        return switchMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java	(revision 0)
@@ -0,0 +1,47 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Create an instance of a Switch mediators' default case (i.e. a SwitchCaseMedaitor
+ * which returns isDefault() true
+ */
+public class SwitchCaseDefaultMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchCaseDefaultMediatorFactory.class);
+
+    private final QName SWITCH_CASE_DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "default");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchCaseMediator switchCaseMediator = new SwitchCaseMediator();
+        switchCaseMediator.setDefaultCase(true);
+        super.addChildren(elem, switchCaseMediator);
+        return switchCaseMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_CASE_DEFAULT_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java	(working copy)
@@ -13,41 +13,33 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
-import javax.xml.namespace.QName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.SynapseException;
+import org.jaxen.JaxenException;
 
+import java.util.Iterator;
+
 /**
- *
- * 
- * <p> This is the abstract superclass of any tag that isn't a "node". I.e. mediators or builtin
- * mediators like log
- *
+ * Is the abstract superclass of MediatorFactory's
  */
 public abstract class AbstractMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-   
-    public void setNameOnMediator(SynapseEnvironment se, OMElement el, Mediator m) {
-
-        OMAttribute nm = el.getAttribute(new QName("name"));
-        String name =null;
-        if (nm != null) {
-             name = nm.getAttributeValue().trim();
-            //m.setName(name);
-            se.addMediator(name, m);
+    public void addNameSpaces(OMElement elem, AXIOMXPath xp, Log log) {
+        try {
+            Iterator it = elem.getAllDeclaredNamespaces();
+            while (it.hasNext()) {
+                OMNamespace n = (OMNamespace) it.next();
+                xp.addNamespace(n.getPrefix(), n.getName());
+            }
+        } catch (JaxenException je) {
+            String msg = "Error adding declared name spaces of " + elem + " to the XPath : " + xp;
+            log.error(msg);
+            throw new SynapseException(msg, je);
         }
-        log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
-
     }
-
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java	(working copy)
@@ -13,47 +13,61 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.ClassMediator;
+import org.apache.synapse.mediators.ext.ClassMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
+import java.util.Iterator;
+
 /**
+ * Creates an instance of a Class mediator using XML configuration specified
  *
- * <xmp><synapse:classmediator name="nm" class="org.fremantle.mediator"</synapse:classmediator></xmp>
- * TODO add ability to configure properties with Strings/OMElements based on children.
+ * <class name="class-name">
+ *   <property name="string" (value="literal" | expression="xpath")/>*
+ * </class>
  */
 public class ClassMediatorFactory extends AbstractMediatorFactory {
-    private static final QName CLM_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "classmediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ClassMediator cmp = new ClassMediator();
-        super.setNameOnMediator(se, el, cmp);
 
-        OMAttribute clsName = el.getAttribute(new QName("class"));
-        if (clsName == null)
-            throw new SynapseException("missing class attribute on element"
-                    + el.toString());
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+    private static final QName CLASS_Q = new QName(Constants.SYNAPSE_NAMESPACE, "class");
+
+    public Mediator createMediator(OMElement elem) {
+
+        ClassMediator classMediator = new ClassMediator();
+
+        OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        if (name == null) {
+            String msg = "The name of the actual mediator class is a required attribute";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
         try {
-            Class clazz = se.getClassLoader().loadClass(clsName.getAttributeValue());
-            cmp.setClazz(clazz);
+            Class clazz = getClass().getClassLoader().loadClass(name.getAttributeValue());
+            classMediator.setClazz(clazz);
         } catch (ClassNotFoundException e) {
-            throw new SynapseException("class loading error", e);
+            String msg = "Cannot find class : " + name.getAttributeValue();
+            log.error(msg, e);
+            throw new SynapseException(msg, e);
         }
-        return cmp;
 
+        classMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+        return classMediator;
     }
 
 
     public QName getTagQName() {
-        return CLM_Q;
+        return CLASS_Q;
     }
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java	(working copy)
@@ -13,44 +13,81 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.FaultMediator;
+import org.apache.synapse.mediators.transform.FaultMediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
 
 /**
+ * Creates a fault mediator instance
  *
- *         <p>
- *         <xmp><synapse:fault name="optional"/> </xmp>
- * 	TODO add the ability to configure the fault codes, etc
- * 
+ * <makefault [version="soap11|soap12"]>
+ *   <code (value="literal" | expression="xpath")/>
+ *   <reason (value="literal" | expression="xpath")>
+ *   <node>?
+ *   <role>?
+ *   <detail>?
+ * </makefault>
  */
 public class FaultMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "fault");
 
-    private static final QName FAULTCODE = new QName(
-            Constants.SYNAPSE_NAMESPACE, "faultCode");
-    private static final QName REASON = new QName(
-            Constants.SYNAPSE_NAMESPACE, "reason");
+    private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "makefault");
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        FaultMediator fp = new FaultMediator();
+    private static final QName ATT_VERSION_Q = new QName(Constants.NULL_NAMESPACE, "version");
+    private static final QName CODE_Q        = new QName(Constants.SYNAPSE_NAMESPACE, "code");
+    private static final QName REASON_Q      = new QName(Constants.SYNAPSE_NAMESPACE, "reason");
 
-        OMElement code = el.getFirstChildWithName(FAULTCODE);
+    private static final QName ATT_VALUE_Q = new QName(Constants.NULL_NAMESPACE, "name");
+    private static final QName ATT_EXPR_Q  = new QName(Constants.NULL_NAMESPACE, "expression");
+
+    private static final String SOAP11 = "soap11";
+    private static final String SOAP12 = "soap12";
+
+    public Mediator createMediator(OMElement elem) {
+
+        FaultMediator faultMediator = new FaultMediator();
+
+        OMAttribute version = elem.getAttribute(ATT_VERSION_Q);
+        if (version != null) {
+            if (SOAP11.equals(version.getAttributeValue())) {
+                faultMediator.setSoapVersion(FaultMediator.SOAP11);
+            } else if (SOAP12.equals(version.getAttributeValue())) {
+                faultMediator.setSoapVersion(FaultMediator.SOAP12);
+            }
+        }
+
+/*      TODO revisit later!
+        OMElement code = elem.getFirstChildWithName(CODE_Q);
         if (code != null) {
-            fp.setFaultCode(code.getTextAsQName());
+            OMAttribute value = code.getAttribute(ATT_VALUE_Q);
+            OMAttribute expression = code.getAttribute(ATT_EXPR_Q);
+
+            if (value != null) {
+                faultMediator.setCode(new QName(value.getAttributeValue()));
+            } else if (expression != null) {
+                //faultMediator.setCode();
+            } else {
+                //TODO throw exception
+            }
+
+        } else {
+            //TODO exception
         }
-        OMElement reason = el.getFirstChildWithName(REASON);
+*/
+
+        OMElement reason = elem.getFirstChildWithName(REASON_Q);
         if (reason != null) {
-            fp.setReason(reason.getText());
+            faultMediator.setReason(reason.getText());
+        }else {
+            //TODO exception
         }
-        super.setNameOnMediator(se, el, fp);
-        return fp;
+
+        return faultMediator;
     }
 
     public QName getTagQName() {
Index: modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java	(working copy)
@@ -13,50 +13,40 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
 
 
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.ListMediator;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
- *
- * 
- * <p> This is the abstract parent of any tag which is a "Node" - so &ltstage>, &ltin>&ltout> and &ltnever> all fit this model
- * <p>It recursively creates a list of processors from the children. 
- *
+ * This implements the basic logic to build a list mediator from a given XML
+ * configuration. It recursively builds the child mediators of the list.
  */
 public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
 
-    Log log = LogFactory.getLog(getClass());
+    private static final Log log = LogFactory.getLog(AbstractListMediatorFactory.class);
 
-    public void addChildrenAndSetName(SynapseEnvironment se, OMElement el, ListMediator m)
+    public void addChildren(OMElement el, ListMediator m)
     {
-        super.setNameOnMediator(se, el, m);
-
         Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
         while (it.hasNext()) {
             OMElement child = (OMElement) it.next();
-            Mediator med = MediatorFactoryFinder.getMediator(se, child);
-            if (med != null)
-                mediators.add(med);
-            else
-                log.info("Unknown child of all" + child.getLocalName());
+            Mediator med = MediatorFactoryFinder.getInstance().getMediator(child);
+            if (med != null) {
+                m.addChild(med);
+            } else {
+                String msg = "Unknown mediator : " + child.getLocalName();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
         }
-        m.setList(mediators);
-
     }
-
-
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java	(working copy)
@@ -13,41 +13,33 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
-import javax.xml.namespace.QName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.SynapseException;
+import org.jaxen.JaxenException;
 
+import java.util.Iterator;
+
 /**
- *
- * 
- * <p> This is the abstract superclass of any tag that isn't a "node". I.e. mediators or builtin
- * mediators like log
- *
+ * Is the abstract superclass of MediatorFactory's
  */
 public abstract class AbstractMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-   
-    public void setNameOnMediator(SynapseEnvironment se, OMElement el, Mediator m) {
-
-        OMAttribute nm = el.getAttribute(new QName("name"));
-        String name =null;
-        if (nm != null) {
-             name = nm.getAttributeValue().trim();
-            //m.setName(name);
-            se.addMediator(name, m);
+    public void addNameSpaces(OMElement elem, AXIOMXPath xp, Log log) {
+        try {
+            Iterator it = elem.getAllDeclaredNamespaces();
+            while (it.hasNext()) {
+                OMNamespace n = (OMNamespace) it.next();
+                xp.addNamespace(n.getPrefix(), n.getName());
+            }
+        } catch (JaxenException je) {
+            String msg = "Error adding declared name spaces of " + elem + " to the XPath : " + xp;
+            log.error(msg);
+            throw new SynapseException(msg, je);
         }
-        log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
-
     }
-
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java	(working copy)
@@ -13,47 +13,61 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.ClassMediator;
+import org.apache.synapse.mediators.ext.ClassMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
+import java.util.Iterator;
+
 /**
+ * Creates an instance of a Class mediator using XML configuration specified
  *
- * <xmp><synapse:classmediator name="nm" class="org.fremantle.mediator"</synapse:classmediator></xmp>
- * TODO add ability to configure properties with Strings/OMElements based on children.
+ * <class name="class-name">
+ *   <property name="string" (value="literal" | expression="xpath")/>*
+ * </class>
  */
 public class ClassMediatorFactory extends AbstractMediatorFactory {
-    private static final QName CLM_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "classmediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ClassMediator cmp = new ClassMediator();
-        super.setNameOnMediator(se, el, cmp);
 
-        OMAttribute clsName = el.getAttribute(new QName("class"));
-        if (clsName == null)
-            throw new SynapseException("missing class attribute on element"
-                    + el.toString());
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+    private static final QName CLASS_Q = new QName(Constants.SYNAPSE_NAMESPACE, "class");
+
+    public Mediator createMediator(OMElement elem) {
+
+        ClassMediator classMediator = new ClassMediator();
+
+        OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        if (name == null) {
+            String msg = "The name of the actual mediator class is a required attribute";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
         try {
-            Class clazz = se.getClassLoader().loadClass(clsName.getAttributeValue());
-            cmp.setClazz(clazz);
+            Class clazz = getClass().getClassLoader().loadClass(name.getAttributeValue());
+            classMediator.setClazz(clazz);
         } catch (ClassNotFoundException e) {
-            throw new SynapseException("class loading error", e);
+            String msg = "Cannot find class : " + name.getAttributeValue();
+            log.error(msg, e);
+            throw new SynapseException(msg, e);
         }
-        return cmp;
 
+        classMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+        return classMediator;
     }
 
 
     public QName getTagQName() {
-        return CLM_Q;
+        return CLASS_Q;
     }
-
 }
Index: modules/core/src/org/apache/synapse/config/xml/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/Constants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/Constants.java	(working copy)
@@ -13,13 +13,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
+import javax.xml.namespace.QName;
+
 /**
  * <p/>
  * Constants used in the XML processing
  */
 public interface Constants {
-    String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
-    String SYNAPSE = "synapse";
+    public static final QName DEFINITIONS_ELT = new QName("definitions");
+    public static final QName SEQUENCE_ELT = new QName("sequence");
+    public static final QName ENDPOINT_ELT = new QName("endpoint");
+    public static final QName PROPERTY_ELT = new QName("set-property");
+
+    public static final QName RULES_ELT = new QName("rules");
+
+    public static final String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
+    public static final String SYNAPSE = "synapse";
+    public static final String NULL_NAMESPACE = "";
 }
Index: modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java	(working copy)
@@ -14,21 +14,25 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.DropMediator;
 import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
 
-
+/**
+ * This creates a drop mediator instance
+ *
+ * <drop/>
+ */
 public class DropMediatorFactory extends AbstractMediatorFactory {
 
-    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"drop");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE, "drop");
+
+    public Mediator createMediator(OMElement el) {
         return new DropMediator();
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java	(working copy)
@@ -13,44 +13,81 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.FaultMediator;
+import org.apache.synapse.mediators.transform.FaultMediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
 
 /**
+ * Creates a fault mediator instance
  *
- *         <p>
- *         <xmp><synapse:fault name="optional"/> </xmp>
- * 	TODO add the ability to configure the fault codes, etc
- * 
+ * <makefault [version="soap11|soap12"]>
+ *   <code (value="literal" | expression="xpath")/>
+ *   <reason (value="literal" | expression="xpath")>
+ *   <node>?
+ *   <role>?
+ *   <detail>?
+ * </makefault>
  */
 public class FaultMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "fault");
 
-    private static final QName FAULTCODE = new QName(
-            Constants.SYNAPSE_NAMESPACE, "faultCode");
-    private static final QName REASON = new QName(
-            Constants.SYNAPSE_NAMESPACE, "reason");
+    private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "makefault");
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        FaultMediator fp = new FaultMediator();
+    private static final QName ATT_VERSION_Q = new QName(Constants.NULL_NAMESPACE, "version");
+    private static final QName CODE_Q        = new QName(Constants.SYNAPSE_NAMESPACE, "code");
+    private static final QName REASON_Q      = new QName(Constants.SYNAPSE_NAMESPACE, "reason");
 
-        OMElement code = el.getFirstChildWithName(FAULTCODE);
+    private static final QName ATT_VALUE_Q = new QName(Constants.NULL_NAMESPACE, "name");
+    private static final QName ATT_EXPR_Q  = new QName(Constants.NULL_NAMESPACE, "expression");
+
+    private static final String SOAP11 = "soap11";
+    private static final String SOAP12 = "soap12";
+
+    public Mediator createMediator(OMElement elem) {
+
+        FaultMediator faultMediator = new FaultMediator();
+
+        OMAttribute version = elem.getAttribute(ATT_VERSION_Q);
+        if (version != null) {
+            if (SOAP11.equals(version.getAttributeValue())) {
+                faultMediator.setSoapVersion(FaultMediator.SOAP11);
+            } else if (SOAP12.equals(version.getAttributeValue())) {
+                faultMediator.setSoapVersion(FaultMediator.SOAP12);
+            }
+        }
+
+/*      TODO revisit later!
+        OMElement code = elem.getFirstChildWithName(CODE_Q);
         if (code != null) {
-            fp.setFaultCode(code.getTextAsQName());
+            OMAttribute value = code.getAttribute(ATT_VALUE_Q);
+            OMAttribute expression = code.getAttribute(ATT_EXPR_Q);
+
+            if (value != null) {
+                faultMediator.setCode(new QName(value.getAttributeValue()));
+            } else if (expression != null) {
+                //faultMediator.setCode();
+            } else {
+                //TODO throw exception
+            }
+
+        } else {
+            //TODO exception
         }
-        OMElement reason = el.getFirstChildWithName(REASON);
+*/
+
+        OMElement reason = elem.getFirstChildWithName(REASON_Q);
         if (reason != null) {
-            fp.setReason(reason.getText());
+            faultMediator.setReason(reason.getText());
+        }else {
+            //TODO exception
         }
-        super.setNameOnMediator(se, el, fp);
-        return fp;
+
+        return faultMediator;
     }
 
     public QName getTagQName() {
Index: modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java	(revision 0)
@@ -0,0 +1,111 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.filters.FilterMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import java.util.Iterator;
+
+/**
+ * Creates a filter mediator instance
+ *
+ * <filter (source="xpath" regex="string") | xpath="xpath">
+ *   mediator+
+ * </filter>
+ */
+public class FilterMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
+
+    private static final QName FILTER_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
+
+    public Mediator createMediator(OMElement elem) {
+        FilterMediator filter = new FilterMediator();
+        super.addChildren(elem, filter);
+
+        OMAttribute attXpath  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xpath"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+        OMAttribute attRegex  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
+
+        if (attXpath != null) {
+            if (attXpath.getAttributeValue() != null && attXpath.getAttributeValue().trim().length() == 0) {
+                String msg = "Invalid attribute value specified for xpath";
+                log.error(msg);
+                throw new SynapseException(msg);
+
+            } else {
+                try {
+                    filter.setXpath(new AXIOMXPath(attXpath.getAttributeValue()));
+                } catch (JaxenException e) {
+                    String msg = "Invalid XPath expression for attribute xpath : " + attXpath.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+            }
+            addNameSpaces(elem, filter.getXpath(), log);
+
+        } else if (attSource != null && attRegex != null) {
+
+            if (
+                (attSource.getAttributeValue() != null && attSource.getAttributeValue().trim().length() == 0) ||
+                (attRegex.getAttributeValue()  != null && attRegex.getAttributeValue().trim().length() == 0) ){
+                String msg = "Invalid attribute values for source and/or regex specified";
+                log.error(msg);
+                throw new SynapseException(msg);
+
+            } else {
+                try {
+                    filter.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+                } catch (JaxenException e) {
+                    String msg = "Invalid XPath expression for attribute source : " + attSource.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+                try {
+                    filter.setRegex(Pattern.compile(attRegex.getAttributeValue()));
+                } catch (PatternSyntaxException pse) {
+                    String msg = "Invalid Regular Expression for attribute regex : " + attRegex.getAttributeValue();
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                }
+            }
+            addNameSpaces(elem, filter.getSource(), log);
+
+        } else {
+            String msg = "An xpath or (source, regex) attributes are required for a filter";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        return filter;
+    }
+
+    public QName getTagQName() {
+        return FILTER_Q;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java	(working copy)
@@ -13,45 +13,83 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.HeaderMediator;
+import org.apache.synapse.mediators.transform.HeaderMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
 
 /**
+ * This builds a Header Mediator parsing the XML configuration supplied
  *
- *         <p>
- *         <xmp><synapse:header name="optional" type="to|from|faultto|replyto|action"
- *         value="newvalue"/> </xmp>
- * 
- * 
+ * Set header
+ *   <header name="qname" (value="literal" | expression="xpath")/>
+ *
+ * Remove header
+ *   <header name="qname" action="remove"/>
  */
 public class HeaderMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "header");
 
+    private static final Log log = LogFactory.getLog(HeaderMediatorFactory.class);
 
-        private static final QName TYPE_ATT_Q = new QName("type"),
-            VALUE_ATT_Q = new QName("value");
+    private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "header");
 
-        public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-            HeaderMediator hm = new HeaderMediator();
-            super.setNameOnMediator(se, el, hm);
-            OMAttribute val = el.getAttribute(VALUE_ATT_Q);
-            OMAttribute type = el.getAttribute(TYPE_ATT_Q);
-            if (val == null || type == null) {
-                throw new SynapseException("<header> must have both " + VALUE_ATT_Q
-                    + " and " + TYPE_ATT_Q + " attributes: " + el.toString());
+    public Mediator createMediator(OMElement elem) {
+
+        HeaderMediator headerMediator = new HeaderMediator();
+        OMAttribute name   = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        OMAttribute exprn  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
+        OMAttribute action = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "action"));
+
+        if (name == null || name.getAttributeValue() == null) {
+            String msg = "A valid name attribute is required for the header mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else {
+            headerMediator.setName(name.getAttributeValue());
+        }
+
+        // The action attribute is optional, if provided and equals to 'remove' the
+        // header mediator will act as a header remove mediator
+        if (action != null && "remove".equals(action.getAttributeValue())) {
+            headerMediator.setAction(HeaderMediator.ACTION_REMOVE);
+        }
+
+        if (value == null && exprn == null) {
+            String msg = "A 'value' or 'expression' attribute is required for a header mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (value != null && value.getAttributeValue() != null) {
+            headerMediator.setValue(value.getAttributeValue());
+
+        } else if (exprn != null && exprn.getAttributeValue() != null) {
+            try {
+                headerMediator.setExpression(new AXIOMXPath(exprn.getAttributeValue()));
+            } catch (JaxenException je) {
+                String msg = "Invalid XPath expression : " + exprn.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg, je);
             }
-            hm.setHeaderType(type.getAttributeValue());
-            hm.setValue( val.getAttributeValue());
-            return hm;
+            
+        } else {
+            String msg = "Invalid attribute value for the attribute 'expression' or 'value'";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        return headerMediator;
     }
 
     public QName getTagQName() {
Index: modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java	(working copy)
@@ -14,39 +14,72 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.LogMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
 
+import java.util.Iterator;
+import java.util.List;
+
 /**
+ * Created a Log mediator that logs messages using commons-logging.
  *
- * 
- * <p>
- * Logs messages using Commons-logging. 
- * 
- * <xmp><log name="optional"/></xmp>
- * TODO add support for simple one-line log entry (doesn't cause body parsing)
- *
+ * <log [level="simple|headers|full|custom"]>
+ *      <property> *
+ * </log>
  */
 public class LogMediatorFactory extends AbstractMediatorFactory {
-    private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "log");
 
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
 
+    private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "log");
+    private static final String SIMPLE  = "simple";
+    private static final String HEADERS = "headers";
+    private static final String FULL    = "full";
+    private static final String CUSTOM  = "custom";
+
     public QName getTagQName() {
         return LOG_Q;
     }
 
+    public Mediator createMediator(OMElement elem) {
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        LogMediator lm = new LogMediator();
-        super.setNameOnMediator(se,el,lm);
-        return lm;
+        LogMediator logMediator = new LogMediator();
+
+        // Set the high level set of properties to be logged (i.e. log level)
+        OMAttribute level = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "level"));
+        if (level != null) {
+            if (SIMPLE.equals(level)) {
+                logMediator.setLogLevel(LogMediator.SIMPLE);
+            } else if (HEADERS.equals(level)) {
+                logMediator.setLogLevel(LogMediator.HEADERS);
+            } else if (FULL.equals(level)) {
+                logMediator.setLogLevel(LogMediator.FULL);
+            } else if (CUSTOM.equals(level)) {
+                logMediator.setLogLevel(LogMediator.CUSTOM);
+            }
+        }
+
+        // check if a custom seperator has been supplied, if so use it
+        OMAttribute seperator = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "seperator"));
+        if (seperator != null) {
+            logMediator.setSeperator(seperator.getAttributeValue());
+        }
+
+        logMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+        return logMediator;
     }
 
 }
Index: modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java	(working copy)
@@ -14,15 +14,30 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * A mediator factory capable of creating an instance of a mediator through a given
+ * XML should implement this interface
+ */
 public interface MediatorFactory {
-    public Mediator createMediator(SynapseEnvironment se, OMElement el);
+    /**
+     * Creates an instance of the mediator using the OMElement
+     * @param elem
+     * @return the created mediator
+     */
+    public Mediator createMediator(OMElement elem);
+
+    /**
+     * The QName of this mediator element in the XML config
+     * @return QName of the mediator element
+     */
     public QName getTagQName();
 }
Index: modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java	(working copy)
@@ -15,7 +15,7 @@
  */
 
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -27,14 +27,10 @@
 import org.apache.commons.logging.LogFactory;
 
 
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.resources.xml.PropertyMediatorFactory;
-import org.apache.synapse.resources.xml.ResourceMediatorFactory;
+import org.apache.synapse.config.xml.MediatorFactory;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
 
 import sun.misc.Service;
 
@@ -47,90 +43,104 @@
 
 public class MediatorFactoryFinder {
 
-	private static Map lookup = null;
+    private static Map factoryMap = new HashMap();
+	private static final Log log = LogFactory.getLog(MediatorFactoryFinder.class);
 
-	private static Log log = LogFactory
-			.getLog(MediatorFactoryFinder.class);
+	private static final Class[] mediatorFactories = {
+        SequenceMediatorFactory.class,
+        LogMediatorFactory.class,
+        SendMediatorFactory.class,
+        FilterMediatorFactory.class,
+        SynapseMediatorFactory.class,
+        DropMediatorFactory.class,
+        HeaderMediatorFactory.class,
+        FaultMediatorFactory.class,
+        TransformMediatorFactory.class,
+        ValidateMediatorFactory.class,
+        PropertyMediatorFactory.class,
+        SwitchMediatorFactory.class,
+        SwitchCaseMediatorFactory.class,
+        SwitchCaseDefaultMediatorFactory.class
+      };
 
-	private static Class[] mediatorFactories = {
-			SynapseMediatorFactory.class,
-			StageMediatorFactory.class, RegexMediatorFactory.class,
-			XPathMediatorFactory.class,
-			HeaderMediatorFactory.class,
-			ClassMediatorFactory.class,
-			ServiceMediatorFactory.class,
-			LogMediatorFactory.class, SendMediatorFactory.class,
-			FaultMediatorFactory.class,
-			AddressingInMediatorFactory.class,
-			AddressingOutMediatorFactory.class,
-			InMediatorFactory.class, OutMediatorFactory.class,
-			NeverMediatorFactory.class, RefMediatorFactory.class,
-            XSLTMediatorFactory.class,DefineMediatorFactory.class,
-            SendNowMediatorFactory.class,SendMediatorFactory.class,
-            DropMediatorFactory.class,
-            RefDefineMediatorFactory.class, ExactlyOneMediatorFactory.class,
-            DefaultMediatorFactory.class,
-            PropertyMediatorFactory.class, ResourceMediatorFactory.class,
-            };
+    private static MediatorFactoryFinder instance = null;
 
-	private static void initialise() {
+    public static synchronized MediatorFactoryFinder getInstance() {
+        if (instance == null) {
+            instance = new MediatorFactoryFinder();
+        }
+        return instance;
+    }
 
-		if (lookup != null)
-			return;
-		lookup = new HashMap();
+    /**
+     * Force re initialization next time
+     */
+    public synchronized void reset() {
+        factoryMap.clear();
+        instance = null;
+    }
 
+    private MediatorFactoryFinder() {
+
+		factoryMap = new HashMap();
 		for (int i = 0; i < mediatorFactories.length; i++) {
 			Class c = mediatorFactories[i];
 			try {
-				lookup.put(((MediatorFactory) c.newInstance())
-						.getTagQName(), c);
+				factoryMap.put(((MediatorFactory) c.newInstance()).getTagQName(), c);
 			} catch (Exception e) {
-				throw new SynapseException("problem instantiating "+c.getName(), e);
+				throw new SynapseException("Error instantiating " + c.getName(), e);
 			}
 		}
-		log.debug("registering extensions");
-		log.debug(System.getProperty("java.class.path"));
-		// now try additional processors
-		Iterator it = Service.providers(MediatorFactory.class);
-		while (it.hasNext()) {
-			MediatorFactory mf = (MediatorFactory) it.next();
-			QName tag = mf.getTagQName();
-			lookup.put(tag, mf.getClass());
-			log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
-		}
-	}
+        // TODO revisit later registerExtensions();
+    }
 
-                            	/**
-	 * @param qn
-	 * @return the class which implements the Processor for the given QName
-	 */
-	public static Class find(QName qn) {
-		initialise();
-		return (Class) lookup.get(qn);
-	}
-	
+    //TODO revist later
+    private void registerExtensions() {
+        log.debug("registering extensions");
+        log.debug(System.getProperty("java.class.path"));
+        // now try additional processors
+        Iterator it = Service.providers(MediatorFactory.class);
+        while (it.hasNext()) {
+            MediatorFactory mf = (MediatorFactory) it.next();
+            QName tag = mf.getTagQName();
+            factoryMap.put(tag, mf.getClass());
+            log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
+        }
+    }
+
 	/**
 	 * This method returns a Processor given an OMElement. This will be used
 	 * recursively by the elements which contain processor elements themselves
 	 * (e.g. rules)
 	 * 
-	 * @param synapseEnv
 	 * @param element
-	 * @return Processor
+     * @return Processor
 	 */
-	public static Mediator getMediator(SynapseEnvironment synapseEnv, OMElement element) {
-		OMNamespace n = element.getNamespace();
-		
-		Class cls = find(new QName(n.getName(), element
-				.getLocalName()));
-		try {
+	public Mediator getMediator(OMElement element) {
+
+		QName qName = new QName(element.getNamespace().getName(), element.getLocalName());
+        log.debug("getMediator(" + qName + ")");
+        Class cls = (Class) factoryMap.get(qName);
+
+        if (cls == null) {
+            String msg = "Unknown mediator referenced by configuration element : " + qName;
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        try {
 			MediatorFactory mf = (MediatorFactory) cls.newInstance();
-			Mediator m = mf.createMediator(synapseEnv, element);
-			return m;
-		} catch (InstantiationException e) {
-			throw new SynapseException(e);
-		} catch (IllegalAccessException e) {
-			throw new SynapseException(e);
+			return mf.createMediator(element);
+
+        } catch (InstantiationException e) {
+            String msg = "Error initializing mediator factory : " + cls;
+            log.error(msg);
+            throw new SynapseException(msg, e);
+
+        } catch (IllegalAccessException e) {
+            String msg = "Error initializing mediator factory : " + cls;
+            log.error(msg);
+            throw new SynapseException(msg, e);
 		}
 	}
 }
Index: modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/MediatorPropertyFactory.java	(revision 0)
@@ -0,0 +1,106 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.mediators.MediatorProperty;
+import org.apache.synapse.SynapseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * A utility class capable of creating instances of MediatorProperty objects by reading
+ * through a given XML configuration
+ *
+ * <element>
+ *    <property name="string" (value="literal" | expression="xpath")/>*
+ * </element>
+ */
+public class MediatorPropertyFactory {
+
+    private static final Log log = LogFactory.getLog(MediatorPropertyFactory.class);
+
+    public static List getMediatorProperties(OMElement elem) {
+
+        List propertyList = new ArrayList();
+
+        Iterator iter = elem.getChildrenWithName(new QName(Constants.NULL_NAMESPACE, "property"));
+        while (iter.hasNext()) {
+
+            OMElement propEle = (OMElement) iter.next();
+            OMAttribute attName  = propEle.getAttribute(MediatorProperty.ATT_NAME_Q);
+            OMAttribute attValue = propEle.getAttribute(MediatorProperty.ATT_VALUE_Q);
+            OMAttribute attExpr  = propEle.getAttribute(MediatorProperty.ATT_EXPR_Q);
+
+            MediatorProperty prop = new MediatorProperty();
+
+            if (attName == null || attName.getAttributeValue() == null ||
+                attName.getAttributeValue().trim().length() == 0) {
+                String msg = "Property name is a required attribute for a Log property";
+                log.error(msg);
+                throw new SynapseException(msg);
+            } else {
+                prop.setName(attName.getAttributeValue());
+            }
+
+            // if a value is specified, use it, else look for an expression
+            if (attValue != null) {
+                if (attValue.getAttributeValue() == null || attValue.getAttributeValue().trim().length() == 0) {
+                    String msg = "Property attribute value (if specified) is required for a Log property";
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                } else {
+                    prop.setValue(attValue.getAttributeValue());
+                }
+
+            } else if (attExpr != null) {
+
+                if (attExpr.getAttributeValue() == null || attExpr.getAttributeValue().trim().length() == 0) {
+                    String msg = "Property attribute expression (if specified) is required for a mediator property";
+                    log.error(msg);
+                    throw new SynapseException(msg);
+
+                } else {
+                    try {
+                        prop.setExpression(new AXIOMXPath(attExpr.getAttributeValue()));
+
+                    } catch (JaxenException e) {
+                        String msg = "Invalid XPapth expression : " + attExpr.getAttributeValue();
+                        log.error(msg);
+                        throw new SynapseException(msg, e);
+                    }
+                }
+
+            } else {
+                String msg = "Property attribute value OR expression must be specified for a mediator property";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+            propertyList.add(prop);
+        }
+
+        return propertyList;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/PropertyMediatorFactory.java	(revision 0)
@@ -0,0 +1,77 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.builtin.PropertyMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Creates a set-property mediator through the supplied XML configuration
+ *
+ * <set-property name="string" (value="literal" | expression="xpath")/>
+ */
+public class PropertyMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+    private static final QName PROP_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "set-property");
+
+    public Mediator createMediator(OMElement elem) {
+
+        PropertyMediator propMediator = new PropertyMediator();
+        OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        OMAttribute expression = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
+
+        if (name == null) {
+            String msg = "The 'name' attribute is required for the configuration of a property mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else if (value == null && expression == null) {
+            String msg = "Either an 'value' or 'expression' attribute is required for a property mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        propMediator.setName(name.getAttributeValue());
+        if (value != null) {
+            propMediator.setValue(value.getAttributeValue());
+        } else {
+            try {
+                propMediator.setExpression(new AXIOMXPath(expression.getAttributeValue()));
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath expression for attribute 'expression' : " + expression.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+        }
+
+        return propMediator;
+    }
+
+    public QName getTagQName() {
+        return PROP_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java	(working copy)
@@ -14,33 +14,57 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
 
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.SendMediator;
-import org.apache.synapse.SynapseEnvironment;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * The Send mediator factory parses a Send element and creates an instance of the mediator
+ *
+ * //TODO support endpoints, failover and loadbalacing
+ *
+ * The <send> element is used to send messages out of Synapse to some endpoint. In the simplest case,
+ * the place to send the message to is implicit in the message (via a property of the message itself)-
+ * that is indicated by the following
+ *  <send/>
+ *
+ * If the message is to be sent to one or more endpoints, then the following is used:
+ *  <send>
+ *   (endpointref | endpoint)+
+ *  </send>
+ * where the endpointref token refers to the following:
+ * <endpoint ref="name"/>
+ * and the endpoint token refers to an anonymous endpoint defined inline:
+ *  <endpoint address="url"/>
+ * If the message is to be sent to an endpoint selected by load balancing across a set of endpoints,
+ * then it is indicated by the following:
+ * <send>
+ *   <load-balance algorithm="uri">
+ *     (endpointref | endpoint)+
+ *   </load-balance>
+ * </send>
+ * Similarly, if the message is to be sent to an endpoint with failover semantics, then it is indicated by the following:
+ * <send>
+ *   <failover>
+ *     (endpointref | endpoint)+
+ *   </failover>
+ * </send>
+ */
 public class SendMediatorFactory extends AbstractMediatorFactory {
 
+    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE, "send");
 
-    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "send");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(OMElement el) {
         SendMediator sm =  new SendMediator();
-        super.setNameOnMediator(se, el,sm);
         return sm;
-
     }
 
     public QName getTagQName() {
-
         return SEND_Q;
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java	(revision 0)
@@ -0,0 +1,73 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Builds an instance of a Sequence mediator through the Synapse configuration. It follows the following
+ *
+ * <sequence name="string">
+ *   mediator+
+ * </sequence>
+ *
+ * OR
+ *
+ * <sequence ref="name"/>
+ */
+public class SequenceMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SequenceMediatorFactory.class);
+
+    private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
+
+    public QName getTagQName() {
+        return SEQUENCE_Q;
+    }
+
+    public Mediator createMediator(OMElement elem) {
+
+        SequenceMediator seqMediator = new SequenceMediator();
+
+        OMAttribute n = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        if (n != null) {
+            seqMediator.setName(n.getAttributeValue());
+            super.addChildren(elem, seqMediator);
+
+        } else {
+            n = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "ref"));
+            if (n != null) {
+                seqMediator.setRef(n.getAttributeValue());
+                
+            } else {
+                String msg = "A sequence mediator should be a named sequence or a reference to another sequence " +
+                    "(i.e. a name attribute or ref attribute is required.";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+        }
+        return seqMediator;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchCaseDefaultMediatorFactory.java	(revision 0)
@@ -0,0 +1,47 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Create an instance of a Switch mediators' default case (i.e. a SwitchCaseMedaitor
+ * which returns isDefault() true
+ */
+public class SwitchCaseDefaultMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchCaseDefaultMediatorFactory.class);
+
+    private final QName SWITCH_CASE_DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "default");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchCaseMediator switchCaseMediator = new SwitchCaseMediator();
+        switchCaseMediator.setDefaultCase(true);
+        super.addChildren(elem, switchCaseMediator);
+        return switchCaseMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_CASE_DEFAULT_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchCaseMediatorFactory.java	(revision 0)
@@ -0,0 +1,61 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class SwitchCaseMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchCaseMediatorFactory.class);
+
+    private final QName SWITCH_CASE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "case");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchCaseMediator switchCaseMediator = new SwitchCaseMediator();
+        OMAttribute regex = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
+        if (regex == null) {
+            String msg = "The 'regex' attribute is required for a switch case definition";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        try {
+            switchCaseMediator.setRegex(Pattern.compile(regex.getAttributeValue()));
+        } catch (PatternSyntaxException pse) {
+            String msg = "Invalid Regular Expression for attribute 'regex' : " + regex.getAttributeValue();
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        super.addChildren(elem, switchCaseMediator);
+        return switchCaseMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_CASE_Q;
+    }
+}
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SwitchMediatorFactory.java	(revision 0)
@@ -0,0 +1,70 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.filters.SwitchMediator;
+import org.apache.synapse.mediators.filters.SwitchCaseMediator;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Constructs a Switch mediator instance from the given XML configuration
+ *
+ * <switch source="xpath">
+ *   <case regex="string">
+ *     mediator+
+ *   </case>+
+ *   <default>
+ *     mediator+
+ *   </default>?
+ * </switch>
+ */
+public class SwitchMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SwitchMediatorFactory.class);
+
+    private static final QName SWITCH_Q  = new QName(Constants.SYNAPSE_NAMESPACE, "switch");
+    private static final QName CASE_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "case");
+    private static final QName DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "default");
+
+    public Mediator createMediator(OMElement elem) {
+
+        SwitchMediator switchMediator = new SwitchMediator();
+        Iterator iter = elem.getChildrenWithName(CASE_Q);
+        while (iter.hasNext()) {
+            switchMediator.addCase((SwitchCaseMediator)
+                MediatorFactoryFinder.getInstance().getMediator((OMElement) iter.next()));
+        }
+
+        iter = elem.getChildrenWithName(DEFAULT_Q);
+        while (iter.hasNext()) {
+            switchMediator.addCase((SwitchCaseMediator)
+                MediatorFactoryFinder.getInstance().getMediator((OMElement) iter.next()));
+            break; // add only the *first* default if multiple are specified, ignore rest if any
+        }
+
+        return switchMediator;
+    }
+
+    public QName getTagQName() {
+        return SWITCH_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java	(revision 0)
@@ -0,0 +1,135 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.mediators.base.SynapseMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Iterator;
+
+
+/**
+ * Builds a Synapse Configuration model from an XML input stream.
+ */
+public class SynapseConfigurationBuilder {
+
+    private static Log log = LogFactory.getLog(SynapseConfigurationBuilder.class);
+    private SynapseConfiguration config = new SynapseConfiguration();
+
+    public SynapseConfigurationBuilder() {}
+
+    public SynapseConfiguration getConfig() {
+        return config;
+    }
+
+    public void setConfiguration(InputStream is) {
+
+        OMElement root = null;
+        try {
+            root = new StAXOMBuilder(is).getDocumentElement();
+        } catch (XMLStreamException e) {
+            String msg = "Error parsing Synapse configuration : " + e.getMessage();
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        root.build();
+
+        // digest defined Sequences
+        OMContainer definitions = root.getFirstChildWithName(Constants.DEFINITIONS_ELT);
+        if (definitions != null) {
+            Iterator iter = definitions.getChildrenWithName(Constants.SEQUENCE_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                defineSequence(elt);
+            }
+        }
+
+        // digest defined Endpoints
+        OMContainer endpoints = root.getFirstChildWithName(Constants.ENDPOINT_ELT);
+        if (endpoints != null) {
+            Iterator iter = endpoints.getChildrenWithName(Constants.ENDPOINT_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                //defineEndpoint(synCfg, elt); //TODO process Endpoints
+            }
+        }
+
+        // digest defined Global properties
+        OMContainer properties = root.getFirstChildWithName(Constants.PROPERTY_ELT);
+        if (properties != null) {
+            Iterator iter = properties.getChildrenWithName(Constants.PROPERTY_ELT);
+            while (iter.hasNext()) {
+                OMElement elt = (OMElement) iter.next();
+                defineProperty(elt);
+            }
+        }
+
+        OMElement elem = root.getFirstChildWithName(Constants.RULES_ELT);
+        if (elem == null) {
+            String msg = "A valid Synapse configuration MUST specify the main mediator using the <rules> element";
+            log.error(msg);
+            throw new SynapseException(msg);
+        } else {
+            SynapseMediator sm = (SynapseMediator) MediatorFactoryFinder.getInstance().getMediator(elem);
+            if (sm.getList().isEmpty()) {
+                String msg = "Invalid configuration, the main mediator specified by the <rules> element is empty";
+                log.error(msg);
+                throw new SynapseException(msg);
+            } else {
+                config.setMainMediator(sm);
+            }
+        }
+
+        if (is != null) {
+            try {
+                is.close();
+            } catch (IOException e) {}
+        }
+    }
+
+    /**
+     * <set-property name="string" value="string"/>
+     * @param elem
+     */
+    private void defineProperty(OMElement elem) {
+        OMAttribute name  = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+        OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+        if (name == null || value == null) {
+            String msg = "The 'name' and 'value' attributes are required";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+        config.addProperty(name.getAttributeValue(), value.getAttributeValue());
+    }
+
+    private void defineSequence(OMElement ele) {
+        SequenceMediator seq = (SequenceMediator) MediatorFactoryFinder.getInstance().getMediator(ele);
+        config.addNamedMediator(seq.getName(), seq);
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java	(working copy)
@@ -14,28 +14,33 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.base.SynapseMediator;
 import org.apache.axiom.om.OMElement;
 
-public class SynapseMediatorFactory extends
-        AbstractListMediatorFactory {
+/**
+ * Builds the main mediator (@see SynapseConfiguration) of the Synapse instance
+ *
+ * <rules>
+ *   mediator+
+ * <rules>
+ */
+public class SynapseMediatorFactory extends AbstractListMediatorFactory {
 
-    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE,
-            "synapse");
+    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE, "rules");
 
     public QName getTagQName() {
         return tagname;
     }
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(OMElement elem) {
         SynapseMediator sm = new SynapseMediator();
-        super.addChildrenAndSetName(se, el, sm);
+        super.addChildren(elem, sm);
         return sm;
     }
 
Index: modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java	(revision 0)
@@ -0,0 +1,94 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.transform.TransformMediator;
+import org.apache.synapse.api.Mediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * Creates a transform mediator from the given XML
+ *
+ * <transform xslt|xquery="url" [source="xpath"]>
+ *   <property name="string" (value="literal" | expression="xpath")/>*
+ * </transform>
+ */
+public class TransformMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+    private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "transform");
+
+    public QName getTagQName() {
+        return LOG_Q;
+    }
+
+    public Mediator createMediator(OMElement elem) {
+
+        TransformMediator transformMediator = new TransformMediator();
+
+        OMAttribute attXslt   = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xslt"));
+        OMAttribute attXQuery = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xquery"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+
+        if (attXslt != null) {
+            try {
+                transformMediator.setXsltUrl(new URL(attXslt.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xslt attribute : " + attXslt.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else  if (attXQuery != null) {
+            try {
+                transformMediator.setXQueryUrl(new URL(attXQuery.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xquery attribute : " + attXQuery.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else {
+            String msg = "The 'xslt' or 'xquery' attributes are required for the Transform mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (attSource != null) {
+            try {
+                transformMediator.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath specified for the source attribute : " + attSource.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        }
+
+        return transformMediator;
+    }
+
+}
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(revision 0)
@@ -0,0 +1,88 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.builtin.ValidateMediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Creates a validation mediator from the XML configuration
+ *
+ * <validate schema="url" [source="xpath"]>
+ *   <on-fail>
+ *     mediator+
+ *   </on-fail>
+ * </validate>
+ */
+public class ValidateMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+    private static final QName VALIDATE_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "validate");
+
+    public Mediator createMediator(OMElement elem) {
+
+        ValidateMediator validateMediator = new ValidateMediator();
+        OMAttribute attSchema = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "schema"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+
+        if (attSchema != null) {
+            validateMediator.setSchemaUrl(attSchema.getAttributeValue());
+        } else {
+            String msg = "The 'schema' attribute is required for the validate mediator configuration";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (attSource != null) {
+            try {
+                AXIOMXPath xp = new AXIOMXPath(attSource.getAttributeValue());
+                validateMediator.setSource(xp);
+                addNameSpaces(elem, xp, log);
+
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath expression specified for attribute 'source'";
+                log.error(msg);
+                throw new SynapseException(msg, e);
+            }
+        }
+
+        OMElement onFail = elem.getFirstElement();
+        if (new QName(Constants.SYNAPSE_NAMESPACE, "on-fail").equals(onFail.getQName()) &&
+            onFail.getChildElements().hasNext()) {
+            super.addChildren(onFail, validateMediator);
+
+        } else {
+            String msg = "A non-empty on-fail element is required for the validate mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        return validateMediator;
+    }
+
+    public QName getTagQName() {
+        return VALIDATE_Q;
+    }
+}
Index: modules/core/src/org/apache/synapse/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/Constants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/Constants.java	(working copy)
@@ -17,45 +17,39 @@
 
 import javax.xml.namespace.QName;
 
-
-
 /**
- *
- * 
  * <p> Global constants for the Synapse project
- *
  */
 public interface Constants {
-	
 
-	String CLASSMEDIATOR = "classmediator";
+    String CLASSMEDIATOR = "classmediator";
 
-	QName MEDIATE_OPERATION_NAME = new QName("mediate");
+    QName MEDIATE_OPERATION_NAME = new QName("mediate");
 
-	String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
-	String MEDIATOR_SYNAPSE_ENV_PROPERTY = "synapse.mediator.environment";
+    String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
 
-	String ISRESPONSE_PROPERTY = "synapse.isresponse";
+    String MEDIATOR_SYNAPSE_CTX_PROPERTY = "synapse.mediator.environment";
 
-	String EMPTYMEDIATOR = "emptymediator";
+    String ISRESPONSE_PROPERTY = "synapse.isresponse";
 
-    //this is for the synapse.xml config
-    String SYNAPSECONFIGURATION = "SynapseConfiguration";
+    String EMPTYMEDIATOR = "emptymediator";
 
-	String SYNAPSE_ENVIRONMENT = "synapse.environment";
+    //this is for the synapse.config config
+    String SYNAPSE_CONFIGURATION = "SynapseConfiguration";
 
-	String ADD_ADDRESSING = "synapse.send.useaddressing";
+    String SYNAPSE_CONFIG = "synapse.config";
 
-    // for security supporting
+    String SYNAPSE_ENV = "synapse.env";
 
+    String ADD_ADDRESSING = "synapse.send.useaddressing";
+
+    // for security supporting
     String SECURITY_QOS = "synapse_security";
+
     String ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT = "addressing_processed_configurationContext";
 
     // addressing properites handling
-
     String ENGAGE_ADDRESSING_IN_MESSAGE = "__ENGAGE_ADDRESSING_IN_MESSAGE__";
 
-    String  ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE = "__ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE__";
-
-
+    String ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE = "__ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE__";
 }
Index: modules/core/src/org/apache/synapse/core/SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/core/SynapseEnvironment.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/SynapseEnvironment.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.core;
+
+import org.apache.synapse.SynapseContext;
+
+/**
+ * The SynapseEnvironment allows access into the the host SOAP engine. It allows
+ * the sending of messages, classloader access etc.
+ */
+public interface SynapseEnvironment {
+
+    /**
+     * This method injects a new message into the Synapse engine. This is used by
+     * the underlying SOAP engine to inject messages into Synapse for mediation.
+     * e.g. The SynapseMessageReceiver used by Axis2 invokes this to inject new messages
+     */
+    public void injectMessage(SynapseContext smc);
+
+    /**
+     * Mediators may get access to the relevant classloader through this
+     */
+    public ClassLoader getClassLoader();
+
+    /**
+     * This method allows a message to be sent through the underlying SOAP engine.
+     * <p/>
+     * This will send request messages on (forward), and send the response messages back to the client
+     */
+    public void send(SynapseContext smc);
+}
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java	(working copy)
@@ -14,33 +14,30 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
-
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-
 import org.apache.synapse.Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
 
-
 import javax.xml.namespace.QName;
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Iterator;
 
 
 /**
@@ -54,13 +51,13 @@
         ArrayList addressingHeaders;
         if (soapHeader != null) {
             addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                    AddressingConstants.Submission.WSA_NAMESPACE);
+                AddressingConstants.Submission.WSA_NAMESPACE);
             if (addressingHeaders != null && addressingHeaders.size() != 0) {
                 detachAddressingInformation(addressingHeaders);
 
             } else {
                 addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                        AddressingConstants.Final.WSA_NAMESPACE);
+                    AddressingConstants.Final.WSA_NAMESPACE);
                 if (addressingHeaders != null && addressingHeaders.size() != 0) {
                     detachAddressingInformation(addressingHeaders);
                 }
@@ -70,7 +67,6 @@
     }
 
     /**
-     *
      * @param headerInformation
      */
     private static void detachAddressingInformation(ArrayList headerInformation) {
@@ -97,18 +93,18 @@
         if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
             // Lets default be OUT_IN
             OutInAxisOperation outInOperation =
-                    new OutInAxisOperation(new QName(
-                            "__OPERATION_OUT_IN__"));
+                new OutInAxisOperation(new QName(
+                    "__OPERATION_OUT_IN__"));
             AxisService axisAnonymousService =
-                    new AxisService("__ANONYMOUS_SERVICE__");
+                new AxisService("__ANONYMOUS_SERVICE__");
             axisAnonymousService.addOperation(outInOperation);
             ac.addService(axisAnonymousService);
             phasesInfo.setOperationPhases(outInOperation);
         }
         ServiceGroupContext sgc = new ServiceGroupContext(cc,
-                (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
+            (AxisServiceGroup) ac.getService("__ANONYMOUS_SERVICE__").getParent());
         ServiceContext sc =
-                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
+            sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
 
         MessageContext mc = new MessageContext();
         mc.setConfigurationContext(sc.getConfigurationContext());
@@ -124,17 +120,17 @@
             mc.setMessageID(smc.getMessageID());
         else
             mc.setMessageID(String.valueOf("uuid:"
-                    + UUIDGenerator.getUUID()));
+                + UUIDGenerator.getUUID()));
         if (smc.getReplyTo() != null)
             mc.setReplyTo(smc.getReplyTo());
-        if (smc.getRelatesTo() != null)
-            mc.setRelatesTo(smc.getRelatesTo());
-        if (smc.getTo() != null) {
-            mc.setTo(smc.getTo());
-        } else {
-            throw new AxisFault(
+        //if (smc.getRelatesTo() != null)
+            //mc.setRelatesTo(smc.getRelatesTo());
+            if (smc.getTo() != null) {
+                mc.setTo(smc.getTo());
+            } else {
+                throw new AxisFault(
                     "To canno't be null, if null Synapse can't infer the transport");
-        }
+            }
         if (smc.isDoingREST()) {
             mc.setDoingREST(true);
         }
@@ -142,47 +138,45 @@
         // handling the outbound message with addressing
         AxisModule module = ac.getModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
         if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) ||
-                (smc.getProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)){
+            (smc.getProperty(
+                Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)) {
             if (!ac.getService("__ANONYMOUS_SERVICE__")
-                    .isEngaged(module.getName())) {
+                .isEngaged(module.getName())) {
                 ac.getService("__ANONYMOUS_SERVICE__").engageModule(module, ac);
             }
         }
 
-
         //TODO; following line needed to be removed
 
         mc.setEnvelope(outEnvelopeConfiguration(smc));
 
         AxisOperation axisAnonymousOperation =
-                ac.getService("__ANONYMOUS_SERVICE__")
-                        .getOperation(new QName("__OPERATION_OUT_IN__"));
+            ac.getService("__ANONYMOUS_SERVICE__")
+                .getOperation(new QName("__OPERATION_OUT_IN__"));
 
         //Options class from Axis2 holds client side settings
         Options options = new Options();
         OperationClient mepClient =
-                axisAnonymousOperation.createClient(sc, options);
+            axisAnonymousOperation.createClient(sc, options);
         mepClient.addMessageContext(mc);
         mepClient.execute(true);
         MessageContext response = mepClient
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+            .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
         response.setProperty(MessageContext.TRANSPORT_OUT,
-                smc.getProperty(MessageContext.TRANSPORT_OUT));
+            smc.getProperty(MessageContext.TRANSPORT_OUT));
         response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                smc.getProperty(
-                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
+            smc.getProperty(
+                org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
 
-
         // If request is REST we assume the response is REST, so set the
         // variable
         response.setDoingREST(smc.isDoingREST());
         response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
 
         if (ac.getService("__ANONYMOUS_SERVICE__")
-                .isEngaged(module.getName())) {
+            .isEngaged(module.getName())) {
             ac.getService("__ANONYMOUS_SERVICE__")
-                    .disEngageModule(ac.getModule(module.getName()));
+                .disEngageModule(ac.getModule(module.getName()));
         }
         return response;
     }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java	(revision 0)
@@ -0,0 +1,64 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.core.axis2;
+
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.apache.synapse.config.SynapseConfiguration;
+
+import java.util.Map;
+import java.util.HashMap;
+
+public class Axis2SynapseMessageContext implements SynapseContext {
+
+    private SynapseConfiguration cfg = null;
+    private SynapseEnvironment   env = null;
+    private SynapseMessage       msg = null;
+    private Map properties = new HashMap();
+
+    public SynapseConfiguration getConfiguration() {
+        return cfg;
+    }
+
+    public void setConfiguration(SynapseConfiguration cfg) {
+        this.cfg = cfg;
+    }
+
+    public SynapseEnvironment getSynapseEnvironment() {
+        return env;
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment env) {
+        this.env = env;
+    }
+
+    public void setSynapseMessage(SynapseMessage msg) {
+        this.msg = msg;
+    }
+
+    public SynapseMessage getSynapseMessage() {
+        return msg;
+    }
+
+    public Object getProperty(String key) {
+        return properties.get(key);
+    }
+
+    public void setProperty(String key, Object value) {
+        properties.put(key, value);
+    }
+}
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java	(revision 0)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.core.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.apache.synapse.config.xml.SynapseConfigurationBuilder;
+import org.apache.synapse.config.SynapseConfiguration;
+
+import java.io.InputStream;
+
+/**
+ * <p/>
+ * The SynapseContext needs to be set up and then is used by the SynapseMessageReceiver to inject messages.
+ * This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
+ */
+public class Axis2SynapseContextFinder implements Constants {
+
+    private static Log log = LogFactory.getLog(Axis2SynapseContextFinder.class);
+
+    public static synchronized SynapseContext getSynapseContext(MessageContext mc) {
+
+        SynapseConfiguration synCfg = getSynapseConfig(mc);
+        SynapseEnvironment   synEnv = getSynapseEnvironment(mc);
+
+        if (synCfg == null || synEnv == null) {
+            initializeSynapse(mc);
+            synCfg = getSynapseConfig(mc);
+            synEnv = getSynapseEnvironment(mc);
+        }
+
+        if (synCfg == null || synEnv == null) {
+            String msg = "Synapse could/has not been properly initialized";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        SynapseContext synCtx = new Axis2SynapseMessageContext();
+        synCtx.setSynapseEnvironment(synEnv);
+        synCtx.setConfiguration(synCfg);
+        synCtx.setSynapseMessage(new Axis2SynapseMessage(mc, synCtx));
+        return synCtx;        
+    }
+
+    /**
+     * Create the SynapseConfiguration and SynapseEnvironment objects and set them into the Axis2 configuration
+     * for reuse
+     * @param mc the current Axis2 message context
+     */
+    private static synchronized void initializeSynapse(MessageContext mc) {
+
+        if (getSynapseConfig(mc) != null && getSynapseEnvironment(mc) != null) {
+            // is this a second thread which came in just after initialization?
+            return;
+        }
+
+        log.debug("Synapse Config not available. Creating...");
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter param = ac.getParameter(SYNAPSE_CONFIGURATION);
+        if (param == null) {
+            throw new SynapseException(
+                "Axis2 configuration does not specify a '" + SYNAPSE_CONFIGURATION + "' parameter");
+        }
+        InputStream is = mc.getAxisService().getClassLoader().getResourceAsStream(((String) param.getValue()).trim());
+
+        SynapseConfigurationBuilder cfgBuilder = new SynapseConfigurationBuilder();
+        cfgBuilder.setConfiguration(is);
+
+        Parameter synapseCtxParam = new Parameter(SYNAPSE_CONFIG, null);
+        synapseCtxParam.setValue(cfgBuilder.getConfig());
+
+        Parameter synapseEnvParam = new Parameter(SYNAPSE_ENV, null);
+        synapseEnvParam.setValue(new Axis2SynapseEnvironment(mc.getAxisService().getClassLoader()));
+
+        try {
+            ac.addParameter(synapseCtxParam);
+            ac.addParameter(synapseEnvParam);
+
+        } catch (AxisFault e) {
+            String msg = "Could not set parameters '" + SYNAPSE_CONFIG + "' and/or '" + SYNAPSE_ENV +
+                "'to the Axis2 configuration";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+    private static SynapseConfiguration getSynapseConfig(MessageContext mc) {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synConfigParam = ac.getParameter(SYNAPSE_CONFIG);
+        if (synConfigParam != null) {
+            return (SynapseConfiguration) synConfigParam.getValue();
+        }
+        return null;
+    }
+
+    private static SynapseEnvironment getSynapseEnvironment(MessageContext mc) {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synEnvParam = ac.getParameter(SYNAPSE_ENV);
+        if (synEnvParam != null) {
+            return (SynapseEnvironment) synEnvParam.getValue();
+        }
+        return null;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java	(working copy)
@@ -14,91 +14,83 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
-
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.TransportInDescription;
-
 import org.apache.axis2.engine.AxisEngine;
-
 import org.apache.synapse.Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
 
 
-
 /**
  * This class helps the Axis2SynapseEnvironment implement the send method
  */
 public class Axis2Sender {
 
-    public static void sendOn(SynapseMessage smc) {
+    public static void sendOn(SynapseContext smc) {
 
         try {
 
-            MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                    .getMessageContext();
+            MessageContext messageContext = ((Axis2SynapseMessage) smc.getSynapseMessage()).getMessageContext();
             // At any time any QOS is disengaged. It's engaged iff, a flag is
             // set in execution chain.
             // ex: addressing will be engage in outpath iff ADDRESSING_PROCESSED
             // is set.
 
-            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null)
-            {
+            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) {
 
                 messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
+                    Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
 
             }
             //Now hadle the outbound message with addressing
             if (smc.getProperty(
-                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
+                Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
                 messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
-                        Boolean.TRUE);
+                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
+                    Boolean.TRUE);
 
             }
 
             MessageContext outMsgContext = Axis2FlexibleMEPClient
-                    .send(messageContext);
+                .send(messageContext);
 
             // run all rules on response
 
-            smc.setResponse(true);//
+            smc.getSynapseMessage().setResponse(true);//
 
             outMsgContext.setServerSide(true);
 
             Object os = messageContext
-                    .getProperty(MessageContext.TRANSPORT_OUT);
+                .getProperty(MessageContext.TRANSPORT_OUT);
             outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
             TransportInDescription ti = messageContext.getTransportIn();
 
             outMsgContext.setTransportIn(ti);
 
-            if (smc.getSynapseEnvironment() == null) {
-                throw new SynapseException("no Synapse Env set on message");
-            }
-            smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
-                    outMsgContext, smc.getSynapseEnvironment()));
+            smc.setSynapseMessage(new Axis2SynapseMessage(outMsgContext, smc));
+            smc.getSynapseEnvironment().injectMessage(smc);
+
         } catch (Exception e) {
             e.printStackTrace();
             throw new SynapseException(e);
         }
     }
 
-    public static void sendBack(SynapseMessage smc) {
-        MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                .getMessageContext();
+    public static void sendBack(SynapseContext smc) {
+        MessageContext messageContext = ((Axis2SynapseMessage) smc.getSynapseMessage()).getMessageContext();
         AxisEngine ae =
-                new AxisEngine(messageContext.getConfigurationContext());
+            new AxisEngine(messageContext.getConfigurationContext());
         try {
 //
 
 
             messageContext
-                    .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
+                .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
             // check for addressing is alredy engaged for this message.
             // if engage we should use the address enable Configuraion context.
 //
Index: modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java	(working copy)
@@ -14,24 +14,21 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.synapse.Constants;
 
 /**
- *
  * <p>Does nothing! Used as an endpoint so we can engage modules
- *
  */
 public class EmptyMessageReceiver implements MessageReceiver {
 
-	public void receive(MessageContext mc) throws AxisFault {
-		mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
-				.valueOf(true));
-	}
+    public void receive(MessageContext mc) throws AxisFault {
+        mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
+            .valueOf(true));
+    }
 
 }
Index: modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java	(working copy)
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import javax.xml.namespace.QName;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
@@ -25,39 +23,38 @@
 import org.apache.axis2.engine.AbstractDispatcher;
 import org.apache.axis2.engine.AxisConfiguration;
 
+import javax.xml.namespace.QName;
+
 /**
- *
- * 
  * This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
- *
  */
 public class SynapseDispatcher extends AbstractDispatcher {
-	// FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
+    // FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
 
-	private static final long serialVersionUID = -6970206989111592645L;
+    private static final long serialVersionUID = -6970206989111592645L;
 
-	private static final String SYNAPSE_SERVICE_NAME = "synapse";
+    private static final String SYNAPSE_SERVICE_NAME = "synapse";
 
-	private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
+    private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
 
-	public void initDispatcher() {
-		QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
-		HandlerDescription hd = new HandlerDescription(qn);
-		super.init(hd);
+    public void initDispatcher() {
+        QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
+        HandlerDescription hd = new HandlerDescription(qn);
+        super.init(hd);
 
-	}
+    }
 
-	public AxisService findService(MessageContext mc) throws AxisFault {
-		AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-		AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
-		return as;
-	}
+    public AxisService findService(MessageContext mc) throws AxisFault {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
+        return as;
+    }
 
-	public AxisOperation findOperation(AxisService svc, MessageContext mc)
-			throws AxisFault {
+    public AxisOperation findOperation(AxisService svc, MessageContext mc)
+        throws AxisFault {
 
-		AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
-		return ao;
-	}
+        AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
+        return ao;
+    }
 
 }
Index: modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java	(working copy)
@@ -14,29 +14,23 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.ClientUtils;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.synapse.SynapseException;
 
-
 import javax.xml.namespace.QName;
 import java.util.HashMap;
 
@@ -56,13 +50,13 @@
                                   OperationContext opContext) throws AxisFault {
         HashMap mep = opContext.getMessageContexts();
         MessageContext immsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_IN_VALUE);
+            .get(MESSAGE_LABEL_IN_VALUE);
         MessageContext outmsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_OUT_VALUE);
+            .get(MESSAGE_LABEL_OUT_VALUE);
 
         if ((immsgContext != null) && (outmsgContext != null)) {
             throw new AxisFault(
-                    "Invalid message addition , operation context completed");
+                "Invalid message addition , operation context completed");
         }
 
         if (outmsgContext == null) {
@@ -75,7 +69,7 @@
 
 
     public OperationClient createClient(ServiceContext sc, Options options) {
-        return new DynamicOperationClient(this,sc,options);
+        return new DynamicOperationClient(this, sc, options);
     }
 
 }
@@ -86,11 +80,11 @@
     private OperationContext oc;
     private Options options;
 
-    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
+    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options) {
         this.options = options;
         this.axisOp = axisOp;
         this.sc = sc;
-        this.oc = new OperationContext(axisOp,sc);
+        this.oc = new OperationContext(axisOp, sc);
         this.oc.setParent(this.sc);
     }
 
@@ -121,17 +115,17 @@
 
             // copy interesting info from options to message context.
             MessageContext mc = oc
-                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
             if (mc == null) {
                 throw new AxisFault(
-                        "Out message context is null ,"
-                                + " please set the out message context before calling this method");
+                    "Out message context is null ,"
+                        + " please set the out message context before calling this method");
             }
 
             EndpointReference toEPR = mc.getTo();
 
             TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
+                .getAxisConfiguration(), toEPR, mc);
             mc.setTransportOut(transportOut);
 
             /*
@@ -141,7 +135,7 @@
                 TransportInDescription transportIn = options.getTransportIn();
                 if (transportIn == null) {
                     mc.setTransportIn(ClientUtils.inferInTransport(cc
-                            .getAxisConfiguration(), options, mc));
+                        .getAxisConfiguration(), options, mc));
                 } else {
                     mc.setTransportIn(transportIn);
                 }
@@ -161,8 +155,9 @@
         }
 
     }
+
     public OperationContext getOperationContext() {
-    	return oc;
+        return oc;
     }
 
     public void reset() throws AxisFault {
Index: modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java	(working copy)
@@ -13,41 +13,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
 
 /**
- * <p/>
- * <p/>
- * This is used to "catch" messages in Axis2 and pass them to Synapse for processing.
+ * This message receiver should be configured in the Axis2 configuration as the
+ * default message receiver, which will handle all incoming messages through the
+ * synapse mediation
  */
 public class SynapseMessageReceiver implements MessageReceiver {
 
-    private Log log = LogFactory.getLog(getClass());
+    private static final Log log = LogFactory.getLog(SynapseMessageReceiver.class);
 
     public void receive(MessageContext mc) throws AxisFault {
-        log.debug("receiving message");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-                .getSynapseEnvironment(mc);
+
+        log.debug("Synapse received message");
+        SynapseContext synCtx = Axis2SynapseContextFinder.getSynapseContext(mc);
         ////////////////////////////////////////////////////////////////////////
-        // SynapseEnvironment is set as a property in MessageContext. This is due
+        // SynapseContext is set as a property in MessageContext. This is due
         // use we can expect in ServiceMediatorProcessor and many extensions yet to come
         // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
-        
+
         ////////////////////////////////////////////////////////////////////////
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
+        SynapseMessage smc = new Axis2SynapseMessage(mc, synCtx);
+        synCtx.getSynapseEnvironment().injectMessage(synCtx);
 
         ///////////////////////////////////////////////////////////////////////
         // Response handling mechanism for 200/202 and 5XX
@@ -56,12 +53,12 @@
         // smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
         if (smc.isResponse()) {
             mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
-                    Constants.VALUE_TRUE);
+                Constants.VALUE_TRUE);
         }
         if (smc.isFaultResponse()) {
             // todo: a good way to inject faultSoapEnv to the Axis2 Transport 
             throw new AxisFault(
-                    "Synapse Encounters an Error - Please See Log for More Details");
+                "Synapse Encounters an Error - Please See Log for More Details");
         }
         ///////////////////////////////////////////////////////////////////////
     }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java	(working copy)
@@ -14,85 +14,36 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.core.SynapseEnvironment;
 
-
-import org.apache.synapse.Metrics;
-import org.apache.synapse.MetricsFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
-//import org.apache.synapse.resources.ResourceHelperFactory;
-//import org.apache.synapse.resources.ResourceHelper;
-//import org.apache.synapse.resources.xml.ResourceMediator;
-
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-
 /**
- *
- *
- *
- * <p> This is the Axis2 implementation of the SynapseEnvironment
- *
+ * <p> This is the Axis2 implementation of the SynapseContext
  */
 public class Axis2SynapseEnvironment implements SynapseEnvironment {
-	
-    private Mediator mainmediator = null;
 
     private ClassLoader cl = null;
-    private Map properties = new HashMap();
-    private Map mediators = new HashMap();
+    private static final Log log = LogFactory.getLog(Axis2SynapseEnvironment.class);
 
-    private Log log = LogFactory.getLog(getClass());
-
-    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
-                                   ClassLoader cl) {
+    public Axis2SynapseEnvironment(ClassLoader cl) {
         super();
         this.cl = cl;
-        if (synapseConfiguration!=null)
-            mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
     }
 
-    /**
-     * Retrieves an object given a key.
-     *
-     * @param key - if not found, will return null
-     * @return Returns the property.
-     */
-
-    public Object getProperty(String key) {
-        Object obj = null;
-
-        obj = properties.get(key);
-
-
-        return obj;
+    public void injectMessage(SynapseContext synCtx) {
+        synCtx.setSynapseEnvironment(this);
+        synCtx.getConfiguration().getMainMediator().mediate(synCtx);
     }
-    
-    /**
-     * Store a property for message context
-     *
-     * @param key
-     * @param value
-     */
-    public void setProperty(String key, Object value) {
-        properties.put(key, value);
-    }
 
-    
-    public void injectMessage(SynapseMessage smc) {
-    	smc.setSynapseEnvironment(this);
-    	mainmediator.mediate(smc);
+    public void send(SynapseContext synCtx) {
+        if (synCtx.getSynapseMessage().isResponse())
+            Axis2Sender.sendBack(synCtx);
+        else
+            Axis2Sender.sendOn(synCtx);
     }
 
     public ClassLoader getClassLoader() {
@@ -103,87 +54,4 @@
         this.cl = cl;
     }
 
-    public void send(SynapseMessage sm) {
-        if (sm.isResponse())
-            Axis2Sender.sendBack(sm);
-        else
-            Axis2Sender.sendOn(sm);
-    }
-
-
-    public Mediator lookupMediator(String name) {
-        return (Mediator) mediators.get(name);
-    }
-
-    public void addMediator(String name, Mediator m) {
-        log.debug("adding mediator with name " + name);
-        if (mediators.containsKey(name))
-            log.warn("name " + name + "already present");
-        mediators.put(name, m);
-    }
-
-    public Mediator getMasterMediator() {
-        return mainmediator;
-    }
-
-    public void setMasterMediator(Mediator m) {
-        mainmediator = m;
-    }
-
-	public Registry getRegistry() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setRegistry(Registry reg) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public Metrics getMetrics(String URI) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Metrics getMetrics(EndpointReference epr) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setMetricsFactory(MetricsFactory mf) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void publish(OMElement element) {
-		// TODO Auto-generated method stub
-		
-	}
-
-    // lookup methods for resources handling
- //   public Mediator lookupResourceMediator(String uriRoot) {
-   //     return (Mediator) fac.getResourceMediator(uriRoot);
-   // }
-
-  //  public void addResourceMediator(String uri, Mediator m) {
-   //     log.debug("adding "+uri+" with "+m.getClass());
-    	
-    	/*if (resourceMediators.containsKey(uri)) {
-            throw new SynapseException(
-                    "Uri Root is already exists. Not acceptable");
-        }*/
-        
-   //     fac.addResourceMediator(uri, (ResourceMediator)m);
-   // }
-
-   // public ResourceHelper getResourceHelper() {
-        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
-        //fac.setResourceProcessorsMap(this.resourceMediators);
-        //log.debug("size in env is "+this.resourceMediators.size());
-    //    return fac.createResourceHelper();
-   // }
-
-
-
-	
 }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java	(working copy)
@@ -14,40 +14,40 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.context.MessageContext;
 import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.soap.SOAPEnvelope;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 /**
- *
- * 
- * <p>
+ * <p/>
  * A wrapper on Axis2's Message Context that implements the SynapseMessage interface
- *
  */
 public class Axis2SynapseMessage implements SynapseMessage {
 
+    /** The Axis2 MessageContext reference */
     private MessageContext mc = null;
 
-    private Map props = new HashMap();
+    /** The Synapse Context reference*/
+    private SynapseContext synCtx = null;
 
     private boolean response = false;
 
     private boolean faultResponse = false;
 
-    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se) {
+    public Axis2SynapseMessage(MessageContext mc, SynapseContext synCtx) {
         setMessageContext(mc);
-        setSynapseEnvironment(se);
+        setSynapseContext(synCtx);
     }
 
     public EndpointReference getFaultTo() {
@@ -64,17 +64,14 @@
 
     public void setFrom(EndpointReference reference) {
         mc.setFrom(reference);
-
     }
 
     public SOAPEnvelope getEnvelope() {
-
         return mc.getEnvelope();
     }
 
     public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
         mc.setEnvelope(envelope);
-
     }
 
     public String getMessageID() {
@@ -83,120 +80,76 @@
 
     public void setMessageID(String string) {
         mc.setMessageID(string);
-
     }
 
     public RelatesTo getRelatesTo() {
         return mc.getRelatesTo();
-
     }
 
-    public void setRelatesTo(RelatesTo reference) {
-        mc.setRelatesTo(reference);
-
+    public void setRelatesTo(RelatesTo[] reference) {
+        mc.setRelationships(reference);
     }
 
     public EndpointReference getReplyTo() {
         return mc.getReplyTo();
-
     }
 
     public void setReplyTo(EndpointReference reference) {
         mc.setReplyTo(reference);
-
     }
 
     public EndpointReference getTo() {
         return mc.getTo();
-
     }
 
     public void setTo(EndpointReference reference) {
         mc.setTo(reference);
-
     }
 
     public void setWSAAction(String actionURI) {
         mc.setWSAAction(actionURI);
-
     }
 
     public String getWSAAction() {
-
         return mc.getWSAAction();
     }
 
     public void setMessageId(String messageID) {
         mc.setWSAMessageId(messageID);
-
     }
 
     public String getMessageId() {
         return mc.getMessageID();
     }
 
-    public Object getProperty(String key) {
-        Object obj = props.get(key);
-        if ( obj == null) {
-            obj = mc.getProperty(key);
-        }
-        return obj;
-
-    }
-
-    public void setProperty(String key, Object value) {
-        props.put(key, value);
-    }
-
-    public Iterator getPropertyNames() {
-        return props.keySet().iterator();
-    }
-
     public String getSoapAction() {
         return mc.getSoapAction();
     }
 
     public void setSoapAction(String string) {
         mc.setSoapAction(string);
-
     }
 
     public boolean isDoingMTOM() {
-
         return mc.isDoingMTOM();
     }
 
     public void setDoingMTOM(boolean b) {
         mc.setDoingMTOM(b);
-
     }
 
     public boolean isDoingREST() {
-
         return mc.isDoingREST();
     }
 
     public void setDoingREST(boolean b) {
         mc.setDoingREST(b);
-
     }
 
     public boolean isSOAP11() {
-
         return mc.isSOAP11();
     }
 
-    public MessageContext getMessageContext() {
-        return mc;
-    }
-
-    public void setMessageContext(MessageContext mc) {
-        this.mc = mc;
-        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
-        if (resp != null)
-            response = resp.booleanValue();
-    }
-
     public void setResponse(boolean b) {
         response = b;
         mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf(b));
@@ -214,15 +167,23 @@
         return this.faultResponse;
     }
 
-	public SynapseEnvironment getSynapseEnvironment() {
-		return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
-	}
+    public SynapseContext getSynapseContext() {
+        return synCtx;
+    }
 
-	public void setSynapseEnvironment(SynapseEnvironment env) {
-		Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
-		return;
-	}
-	
-	
+    public void setSynapseContext(SynapseContext synCtx) {
+        this.synCtx = synCtx;
+    }
 
+    public MessageContext getMessageContext() {
+        return mc;
+    }
+
+    public void setMessageContext(MessageContext mc) {
+        this.mc = mc;
+        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
+        if (resp != null)
+            response = resp.booleanValue();
+    }
+
 }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java	(working copy)
@@ -14,33 +14,30 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
-
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-
 import org.apache.synapse.Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
 
-
 import javax.xml.namespace.QName;
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Iterator;
 
 
 /**
@@ -54,13 +51,13 @@
         ArrayList addressingHeaders;
         if (soapHeader != null) {
             addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                    AddressingConstants.Submission.WSA_NAMESPACE);
+                AddressingConstants.Submission.WSA_NAMESPACE);
             if (addressingHeaders != null && addressingHeaders.size() != 0) {
                 detachAddressingInformation(addressingHeaders);
 
             } else {
                 addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
-                        AddressingConstants.Final.WSA_NAMESPACE);
+                    AddressingConstants.Final.WSA_NAMESPACE);
                 if (addressingHeaders != null && addressingHeaders.size() != 0) {
                     detachAddressingInformation(addressingHeaders);
                 }
@@ -70,7 +67,6 @@
     }
 
     /**
-     *
      * @param headerInformation
      */
     private static void detachAddressingInformation(ArrayList headerInformation) {
@@ -97,18 +93,18 @@
         if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
             // Lets default be OUT_IN
             OutInAxisOperation outInOperation =
-                    new OutInAxisOperation(new QName(
-                            "__OPERATION_OUT_IN__"));
+                new OutInAxisOperation(new QName(
+                    "__OPERATION_OUT_IN__"));
             AxisService axisAnonymousService =
-                    new AxisService("__ANONYMOUS_SERVICE__");
+                new AxisService("__ANONYMOUS_SERVICE__");
             axisAnonymousService.addOperation(outInOperation);
             ac.addService(axisAnonymousService);
             phasesInfo.setOperationPhases(outInOperation);
         }
         ServiceGroupContext sgc = new ServiceGroupContext(cc,
-                (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
+            (AxisServiceGroup) ac.getService("__ANONYMOUS_SERVICE__").getParent());
         ServiceContext sc =
-                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
+            sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
 
         MessageContext mc = new MessageContext();
         mc.setConfigurationContext(sc.getConfigurationContext());
@@ -124,17 +120,17 @@
             mc.setMessageID(smc.getMessageID());
         else
             mc.setMessageID(String.valueOf("uuid:"
-                    + UUIDGenerator.getUUID()));
+                + UUIDGenerator.getUUID()));
         if (smc.getReplyTo() != null)
             mc.setReplyTo(smc.getReplyTo());
-        if (smc.getRelatesTo() != null)
-            mc.setRelatesTo(smc.getRelatesTo());
-        if (smc.getTo() != null) {
-            mc.setTo(smc.getTo());
-        } else {
-            throw new AxisFault(
+        //if (smc.getRelatesTo() != null)
+            //mc.setRelatesTo(smc.getRelatesTo());
+            if (smc.getTo() != null) {
+                mc.setTo(smc.getTo());
+            } else {
+                throw new AxisFault(
                     "To canno't be null, if null Synapse can't infer the transport");
-        }
+            }
         if (smc.isDoingREST()) {
             mc.setDoingREST(true);
         }
@@ -142,47 +138,45 @@
         // handling the outbound message with addressing
         AxisModule module = ac.getModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
         if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) ||
-                (smc.getProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)){
+            (smc.getProperty(
+                Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)) {
             if (!ac.getService("__ANONYMOUS_SERVICE__")
-                    .isEngaged(module.getName())) {
+                .isEngaged(module.getName())) {
                 ac.getService("__ANONYMOUS_SERVICE__").engageModule(module, ac);
             }
         }
 
-
         //TODO; following line needed to be removed
 
         mc.setEnvelope(outEnvelopeConfiguration(smc));
 
         AxisOperation axisAnonymousOperation =
-                ac.getService("__ANONYMOUS_SERVICE__")
-                        .getOperation(new QName("__OPERATION_OUT_IN__"));
+            ac.getService("__ANONYMOUS_SERVICE__")
+                .getOperation(new QName("__OPERATION_OUT_IN__"));
 
         //Options class from Axis2 holds client side settings
         Options options = new Options();
         OperationClient mepClient =
-                axisAnonymousOperation.createClient(sc, options);
+            axisAnonymousOperation.createClient(sc, options);
         mepClient.addMessageContext(mc);
         mepClient.execute(true);
         MessageContext response = mepClient
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+            .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
         response.setProperty(MessageContext.TRANSPORT_OUT,
-                smc.getProperty(MessageContext.TRANSPORT_OUT));
+            smc.getProperty(MessageContext.TRANSPORT_OUT));
         response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                smc.getProperty(
-                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
+            smc.getProperty(
+                org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
 
-
         // If request is REST we assume the response is REST, so set the
         // variable
         response.setDoingREST(smc.isDoingREST());
         response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
 
         if (ac.getService("__ANONYMOUS_SERVICE__")
-                .isEngaged(module.getName())) {
+            .isEngaged(module.getName())) {
             ac.getService("__ANONYMOUS_SERVICE__")
-                    .disEngageModule(ac.getModule(module.getName()));
+                .disEngageModule(ac.getModule(module.getName()));
         }
         return response;
     }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java	(working copy)
@@ -14,91 +14,83 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
-
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.TransportInDescription;
-
 import org.apache.axis2.engine.AxisEngine;
-
 import org.apache.synapse.Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
 
 
-
 /**
  * This class helps the Axis2SynapseEnvironment implement the send method
  */
 public class Axis2Sender {
 
-    public static void sendOn(SynapseMessage smc) {
+    public static void sendOn(SynapseContext smc) {
 
         try {
 
-            MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                    .getMessageContext();
+            MessageContext messageContext = ((Axis2SynapseMessage) smc.getSynapseMessage()).getMessageContext();
             // At any time any QOS is disengaged. It's engaged iff, a flag is
             // set in execution chain.
             // ex: addressing will be engage in outpath iff ADDRESSING_PROCESSED
             // is set.
 
-            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null)
-            {
+            if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) {
 
                 messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
+                    Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
 
             }
             //Now hadle the outbound message with addressing
             if (smc.getProperty(
-                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
+                Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
                 messageContext.setProperty(
-                        Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
-                        Boolean.TRUE);
+                    Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
+                    Boolean.TRUE);
 
             }
 
             MessageContext outMsgContext = Axis2FlexibleMEPClient
-                    .send(messageContext);
+                .send(messageContext);
 
             // run all rules on response
 
-            smc.setResponse(true);//
+            smc.getSynapseMessage().setResponse(true);//
 
             outMsgContext.setServerSide(true);
 
             Object os = messageContext
-                    .getProperty(MessageContext.TRANSPORT_OUT);
+                .getProperty(MessageContext.TRANSPORT_OUT);
             outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
             TransportInDescription ti = messageContext.getTransportIn();
 
             outMsgContext.setTransportIn(ti);
 
-            if (smc.getSynapseEnvironment() == null) {
-                throw new SynapseException("no Synapse Env set on message");
-            }
-            smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
-                    outMsgContext, smc.getSynapseEnvironment()));
+            smc.setSynapseMessage(new Axis2SynapseMessage(outMsgContext, smc));
+            smc.getSynapseEnvironment().injectMessage(smc);
+
         } catch (Exception e) {
             e.printStackTrace();
             throw new SynapseException(e);
         }
     }
 
-    public static void sendBack(SynapseMessage smc) {
-        MessageContext messageContext = ((Axis2SynapseMessage) smc)
-                .getMessageContext();
+    public static void sendBack(SynapseContext smc) {
+        MessageContext messageContext = ((Axis2SynapseMessage) smc.getSynapseMessage()).getMessageContext();
         AxisEngine ae =
-                new AxisEngine(messageContext.getConfigurationContext());
+            new AxisEngine(messageContext.getConfigurationContext());
         try {
 //
 
 
             messageContext
-                    .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
+                .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
             // check for addressing is alredy engaged for this message.
             // if engage we should use the address enable Configuraion context.
 //
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseContextFinder.java	(revision 0)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.core.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.apache.synapse.config.xml.SynapseConfigurationBuilder;
+import org.apache.synapse.config.SynapseConfiguration;
+
+import java.io.InputStream;
+
+/**
+ * <p/>
+ * The SynapseContext needs to be set up and then is used by the SynapseMessageReceiver to inject messages.
+ * This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
+ */
+public class Axis2SynapseContextFinder implements Constants {
+
+    private static Log log = LogFactory.getLog(Axis2SynapseContextFinder.class);
+
+    public static synchronized SynapseContext getSynapseContext(MessageContext mc) {
+
+        SynapseConfiguration synCfg = getSynapseConfig(mc);
+        SynapseEnvironment   synEnv = getSynapseEnvironment(mc);
+
+        if (synCfg == null || synEnv == null) {
+            initializeSynapse(mc);
+            synCfg = getSynapseConfig(mc);
+            synEnv = getSynapseEnvironment(mc);
+        }
+
+        if (synCfg == null || synEnv == null) {
+            String msg = "Synapse could/has not been properly initialized";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        SynapseContext synCtx = new Axis2SynapseMessageContext();
+        synCtx.setSynapseEnvironment(synEnv);
+        synCtx.setConfiguration(synCfg);
+        synCtx.setSynapseMessage(new Axis2SynapseMessage(mc, synCtx));
+        return synCtx;        
+    }
+
+    /**
+     * Create the SynapseConfiguration and SynapseEnvironment objects and set them into the Axis2 configuration
+     * for reuse
+     * @param mc the current Axis2 message context
+     */
+    private static synchronized void initializeSynapse(MessageContext mc) {
+
+        if (getSynapseConfig(mc) != null && getSynapseEnvironment(mc) != null) {
+            // is this a second thread which came in just after initialization?
+            return;
+        }
+
+        log.debug("Synapse Config not available. Creating...");
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter param = ac.getParameter(SYNAPSE_CONFIGURATION);
+        if (param == null) {
+            throw new SynapseException(
+                "Axis2 configuration does not specify a '" + SYNAPSE_CONFIGURATION + "' parameter");
+        }
+        InputStream is = mc.getAxisService().getClassLoader().getResourceAsStream(((String) param.getValue()).trim());
+
+        SynapseConfigurationBuilder cfgBuilder = new SynapseConfigurationBuilder();
+        cfgBuilder.setConfiguration(is);
+
+        Parameter synapseCtxParam = new Parameter(SYNAPSE_CONFIG, null);
+        synapseCtxParam.setValue(cfgBuilder.getConfig());
+
+        Parameter synapseEnvParam = new Parameter(SYNAPSE_ENV, null);
+        synapseEnvParam.setValue(new Axis2SynapseEnvironment(mc.getAxisService().getClassLoader()));
+
+        try {
+            ac.addParameter(synapseCtxParam);
+            ac.addParameter(synapseEnvParam);
+
+        } catch (AxisFault e) {
+            String msg = "Could not set parameters '" + SYNAPSE_CONFIG + "' and/or '" + SYNAPSE_ENV +
+                "'to the Axis2 configuration";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+    private static SynapseConfiguration getSynapseConfig(MessageContext mc) {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synConfigParam = ac.getParameter(SYNAPSE_CONFIG);
+        if (synConfigParam != null) {
+            return (SynapseConfiguration) synConfigParam.getValue();
+        }
+        return null;
+    }
+
+    private static SynapseEnvironment getSynapseEnvironment(MessageContext mc) {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synEnvParam = ac.getParameter(SYNAPSE_ENV);
+        if (synEnvParam != null) {
+            return (SynapseEnvironment) synEnvParam.getValue();
+        }
+        return null;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java	(working copy)
@@ -14,85 +14,36 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.core.SynapseEnvironment;
 
-
-import org.apache.synapse.Metrics;
-import org.apache.synapse.MetricsFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
-//import org.apache.synapse.resources.ResourceHelperFactory;
-//import org.apache.synapse.resources.ResourceHelper;
-//import org.apache.synapse.resources.xml.ResourceMediator;
-
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-
 /**
- *
- *
- *
- * <p> This is the Axis2 implementation of the SynapseEnvironment
- *
+ * <p> This is the Axis2 implementation of the SynapseContext
  */
 public class Axis2SynapseEnvironment implements SynapseEnvironment {
-	
-    private Mediator mainmediator = null;
 
     private ClassLoader cl = null;
-    private Map properties = new HashMap();
-    private Map mediators = new HashMap();
+    private static final Log log = LogFactory.getLog(Axis2SynapseEnvironment.class);
 
-    private Log log = LogFactory.getLog(getClass());
-
-    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
-                                   ClassLoader cl) {
+    public Axis2SynapseEnvironment(ClassLoader cl) {
         super();
         this.cl = cl;
-        if (synapseConfiguration!=null)
-            mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
     }
 
-    /**
-     * Retrieves an object given a key.
-     *
-     * @param key - if not found, will return null
-     * @return Returns the property.
-     */
-
-    public Object getProperty(String key) {
-        Object obj = null;
-
-        obj = properties.get(key);
-
-
-        return obj;
+    public void injectMessage(SynapseContext synCtx) {
+        synCtx.setSynapseEnvironment(this);
+        synCtx.getConfiguration().getMainMediator().mediate(synCtx);
     }
-    
-    /**
-     * Store a property for message context
-     *
-     * @param key
-     * @param value
-     */
-    public void setProperty(String key, Object value) {
-        properties.put(key, value);
-    }
 
-    
-    public void injectMessage(SynapseMessage smc) {
-    	smc.setSynapseEnvironment(this);
-    	mainmediator.mediate(smc);
+    public void send(SynapseContext synCtx) {
+        if (synCtx.getSynapseMessage().isResponse())
+            Axis2Sender.sendBack(synCtx);
+        else
+            Axis2Sender.sendOn(synCtx);
     }
 
     public ClassLoader getClassLoader() {
@@ -103,87 +54,4 @@
         this.cl = cl;
     }
 
-    public void send(SynapseMessage sm) {
-        if (sm.isResponse())
-            Axis2Sender.sendBack(sm);
-        else
-            Axis2Sender.sendOn(sm);
-    }
-
-
-    public Mediator lookupMediator(String name) {
-        return (Mediator) mediators.get(name);
-    }
-
-    public void addMediator(String name, Mediator m) {
-        log.debug("adding mediator with name " + name);
-        if (mediators.containsKey(name))
-            log.warn("name " + name + "already present");
-        mediators.put(name, m);
-    }
-
-    public Mediator getMasterMediator() {
-        return mainmediator;
-    }
-
-    public void setMasterMediator(Mediator m) {
-        mainmediator = m;
-    }
-
-	public Registry getRegistry() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setRegistry(Registry reg) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public Metrics getMetrics(String URI) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Metrics getMetrics(EndpointReference epr) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setMetricsFactory(MetricsFactory mf) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void publish(OMElement element) {
-		// TODO Auto-generated method stub
-		
-	}
-
-    // lookup methods for resources handling
- //   public Mediator lookupResourceMediator(String uriRoot) {
-   //     return (Mediator) fac.getResourceMediator(uriRoot);
-   // }
-
-  //  public void addResourceMediator(String uri, Mediator m) {
-   //     log.debug("adding "+uri+" with "+m.getClass());
-    	
-    	/*if (resourceMediators.containsKey(uri)) {
-            throw new SynapseException(
-                    "Uri Root is already exists. Not acceptable");
-        }*/
-        
-   //     fac.addResourceMediator(uri, (ResourceMediator)m);
-   // }
-
-   // public ResourceHelper getResourceHelper() {
-        //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
-        //fac.setResourceProcessorsMap(this.resourceMediators);
-        //log.debug("size in env is "+this.resourceMediators.size());
-    //    return fac.createResourceHelper();
-   // }
-
-
-
-	
 }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessage.java	(working copy)
@@ -14,40 +14,40 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.context.MessageContext;
 import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.soap.SOAPEnvelope;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 /**
- *
- * 
- * <p>
+ * <p/>
  * A wrapper on Axis2's Message Context that implements the SynapseMessage interface
- *
  */
 public class Axis2SynapseMessage implements SynapseMessage {
 
+    /** The Axis2 MessageContext reference */
     private MessageContext mc = null;
 
-    private Map props = new HashMap();
+    /** The Synapse Context reference*/
+    private SynapseContext synCtx = null;
 
     private boolean response = false;
 
     private boolean faultResponse = false;
 
-    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se) {
+    public Axis2SynapseMessage(MessageContext mc, SynapseContext synCtx) {
         setMessageContext(mc);
-        setSynapseEnvironment(se);
+        setSynapseContext(synCtx);
     }
 
     public EndpointReference getFaultTo() {
@@ -64,17 +64,14 @@
 
     public void setFrom(EndpointReference reference) {
         mc.setFrom(reference);
-
     }
 
     public SOAPEnvelope getEnvelope() {
-
         return mc.getEnvelope();
     }
 
     public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
         mc.setEnvelope(envelope);
-
     }
 
     public String getMessageID() {
@@ -83,120 +80,76 @@
 
     public void setMessageID(String string) {
         mc.setMessageID(string);
-
     }
 
     public RelatesTo getRelatesTo() {
         return mc.getRelatesTo();
-
     }
 
-    public void setRelatesTo(RelatesTo reference) {
-        mc.setRelatesTo(reference);
-
+    public void setRelatesTo(RelatesTo[] reference) {
+        mc.setRelationships(reference);
     }
 
     public EndpointReference getReplyTo() {
         return mc.getReplyTo();
-
     }
 
     public void setReplyTo(EndpointReference reference) {
         mc.setReplyTo(reference);
-
     }
 
     public EndpointReference getTo() {
         return mc.getTo();
-
     }
 
     public void setTo(EndpointReference reference) {
         mc.setTo(reference);
-
     }
 
     public void setWSAAction(String actionURI) {
         mc.setWSAAction(actionURI);
-
     }
 
     public String getWSAAction() {
-
         return mc.getWSAAction();
     }
 
     public void setMessageId(String messageID) {
         mc.setWSAMessageId(messageID);
-
     }
 
     public String getMessageId() {
         return mc.getMessageID();
     }
 
-    public Object getProperty(String key) {
-        Object obj = props.get(key);
-        if ( obj == null) {
-            obj = mc.getProperty(key);
-        }
-        return obj;
-
-    }
-
-    public void setProperty(String key, Object value) {
-        props.put(key, value);
-    }
-
-    public Iterator getPropertyNames() {
-        return props.keySet().iterator();
-    }
-
     public String getSoapAction() {
         return mc.getSoapAction();
     }
 
     public void setSoapAction(String string) {
         mc.setSoapAction(string);
-
     }
 
     public boolean isDoingMTOM() {
-
         return mc.isDoingMTOM();
     }
 
     public void setDoingMTOM(boolean b) {
         mc.setDoingMTOM(b);
-
     }
 
     public boolean isDoingREST() {
-
         return mc.isDoingREST();
     }
 
     public void setDoingREST(boolean b) {
         mc.setDoingREST(b);
-
     }
 
     public boolean isSOAP11() {
-
         return mc.isSOAP11();
     }
 
-    public MessageContext getMessageContext() {
-        return mc;
-    }
-
-    public void setMessageContext(MessageContext mc) {
-        this.mc = mc;
-        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
-        if (resp != null)
-            response = resp.booleanValue();
-    }
-
     public void setResponse(boolean b) {
         response = b;
         mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf(b));
@@ -214,15 +167,23 @@
         return this.faultResponse;
     }
 
-	public SynapseEnvironment getSynapseEnvironment() {
-		return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
-	}
+    public SynapseContext getSynapseContext() {
+        return synCtx;
+    }
 
-	public void setSynapseEnvironment(SynapseEnvironment env) {
-		Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
-		return;
-	}
-	
-	
+    public void setSynapseContext(SynapseContext synCtx) {
+        this.synCtx = synCtx;
+    }
 
+    public MessageContext getMessageContext() {
+        return mc;
+    }
+
+    public void setMessageContext(MessageContext mc) {
+        this.mc = mc;
+        Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
+        if (resp != null)
+            response = resp.booleanValue();
+    }
+
 }
Index: modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/axis2/Axis2SynapseMessageContext.java	(revision 0)
@@ -0,0 +1,64 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.core.axis2;
+
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.apache.synapse.config.SynapseConfiguration;
+
+import java.util.Map;
+import java.util.HashMap;
+
+public class Axis2SynapseMessageContext implements SynapseContext {
+
+    private SynapseConfiguration cfg = null;
+    private SynapseEnvironment   env = null;
+    private SynapseMessage       msg = null;
+    private Map properties = new HashMap();
+
+    public SynapseConfiguration getConfiguration() {
+        return cfg;
+    }
+
+    public void setConfiguration(SynapseConfiguration cfg) {
+        this.cfg = cfg;
+    }
+
+    public SynapseEnvironment getSynapseEnvironment() {
+        return env;
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment env) {
+        this.env = env;
+    }
+
+    public void setSynapseMessage(SynapseMessage msg) {
+        this.msg = msg;
+    }
+
+    public SynapseMessage getSynapseMessage() {
+        return msg;
+    }
+
+    public Object getProperty(String key) {
+        return properties.get(key);
+    }
+
+    public void setProperty(String key, Object value) {
+        properties.put(key, value);
+    }
+}
Index: modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/DynamicAxisOperation.java	(working copy)
@@ -14,29 +14,23 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.ClientUtils;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.synapse.SynapseException;
 
-
 import javax.xml.namespace.QName;
 import java.util.HashMap;
 
@@ -56,13 +50,13 @@
                                   OperationContext opContext) throws AxisFault {
         HashMap mep = opContext.getMessageContexts();
         MessageContext immsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_IN_VALUE);
+            .get(MESSAGE_LABEL_IN_VALUE);
         MessageContext outmsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_OUT_VALUE);
+            .get(MESSAGE_LABEL_OUT_VALUE);
 
         if ((immsgContext != null) && (outmsgContext != null)) {
             throw new AxisFault(
-                    "Invalid message addition , operation context completed");
+                "Invalid message addition , operation context completed");
         }
 
         if (outmsgContext == null) {
@@ -75,7 +69,7 @@
 
 
     public OperationClient createClient(ServiceContext sc, Options options) {
-        return new DynamicOperationClient(this,sc,options);
+        return new DynamicOperationClient(this, sc, options);
     }
 
 }
@@ -86,11 +80,11 @@
     private OperationContext oc;
     private Options options;
 
-    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
+    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options) {
         this.options = options;
         this.axisOp = axisOp;
         this.sc = sc;
-        this.oc = new OperationContext(axisOp,sc);
+        this.oc = new OperationContext(axisOp, sc);
         this.oc.setParent(this.sc);
     }
 
@@ -121,17 +115,17 @@
 
             // copy interesting info from options to message context.
             MessageContext mc = oc
-                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
             if (mc == null) {
                 throw new AxisFault(
-                        "Out message context is null ,"
-                                + " please set the out message context before calling this method");
+                    "Out message context is null ,"
+                        + " please set the out message context before calling this method");
             }
 
             EndpointReference toEPR = mc.getTo();
 
             TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
+                .getAxisConfiguration(), toEPR, mc);
             mc.setTransportOut(transportOut);
 
             /*
@@ -141,7 +135,7 @@
                 TransportInDescription transportIn = options.getTransportIn();
                 if (transportIn == null) {
                     mc.setTransportIn(ClientUtils.inferInTransport(cc
-                            .getAxisConfiguration(), options, mc));
+                        .getAxisConfiguration(), options, mc));
                 } else {
                     mc.setTransportIn(transportIn);
                 }
@@ -161,8 +155,9 @@
         }
 
     }
+
     public OperationContext getOperationContext() {
-    	return oc;
+        return oc;
     }
 
     public void reset() throws AxisFault {
Index: modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/EmptyMessageReceiver.java	(working copy)
@@ -14,24 +14,21 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.synapse.Constants;
 
 /**
- *
  * <p>Does nothing! Used as an endpoint so we can engage modules
- *
  */
 public class EmptyMessageReceiver implements MessageReceiver {
 
-	public void receive(MessageContext mc) throws AxisFault {
-		mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
-				.valueOf(true));
-	}
+    public void receive(MessageContext mc) throws AxisFault {
+        mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
+            .valueOf(true));
+    }
 
 }
Index: modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/SynapseDispatcher.java	(working copy)
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
-import javax.xml.namespace.QName;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
@@ -25,39 +23,38 @@
 import org.apache.axis2.engine.AbstractDispatcher;
 import org.apache.axis2.engine.AxisConfiguration;
 
+import javax.xml.namespace.QName;
+
 /**
- *
- * 
  * This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
- *
  */
 public class SynapseDispatcher extends AbstractDispatcher {
-	// FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
+    // FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
 
-	private static final long serialVersionUID = -6970206989111592645L;
+    private static final long serialVersionUID = -6970206989111592645L;
 
-	private static final String SYNAPSE_SERVICE_NAME = "synapse";
+    private static final String SYNAPSE_SERVICE_NAME = "synapse";
 
-	private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
+    private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
 
-	public void initDispatcher() {
-		QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
-		HandlerDescription hd = new HandlerDescription(qn);
-		super.init(hd);
+    public void initDispatcher() {
+        QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
+        HandlerDescription hd = new HandlerDescription(qn);
+        super.init(hd);
 
-	}
+    }
 
-	public AxisService findService(MessageContext mc) throws AxisFault {
-		AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-		AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
-		return as;
-	}
+    public AxisService findService(MessageContext mc) throws AxisFault {
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
+        return as;
+    }
 
-	public AxisOperation findOperation(AxisService svc, MessageContext mc)
-			throws AxisFault {
+    public AxisOperation findOperation(AxisService svc, MessageContext mc)
+        throws AxisFault {
 
-		AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
-		return ao;
-	}
+        AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
+        return ao;
+    }
 
 }
Index: modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/core/axis2/SynapseMessageReceiver.java	(working copy)
@@ -13,41 +13,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.axis2;
+package org.apache.synapse.core.axis2;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
 
 /**
- * <p/>
- * <p/>
- * This is used to "catch" messages in Axis2 and pass them to Synapse for processing.
+ * This message receiver should be configured in the Axis2 configuration as the
+ * default message receiver, which will handle all incoming messages through the
+ * synapse mediation
  */
 public class SynapseMessageReceiver implements MessageReceiver {
 
-    private Log log = LogFactory.getLog(getClass());
+    private static final Log log = LogFactory.getLog(SynapseMessageReceiver.class);
 
     public void receive(MessageContext mc) throws AxisFault {
-        log.debug("receiving message");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-                .getSynapseEnvironment(mc);
+
+        log.debug("Synapse received message");
+        SynapseContext synCtx = Axis2SynapseContextFinder.getSynapseContext(mc);
         ////////////////////////////////////////////////////////////////////////
-        // SynapseEnvironment is set as a property in MessageContext. This is due
+        // SynapseContext is set as a property in MessageContext. This is due
         // use we can expect in ServiceMediatorProcessor and many extensions yet to come
         // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
-        
+
         ////////////////////////////////////////////////////////////////////////
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
+        SynapseMessage smc = new Axis2SynapseMessage(mc, synCtx);
+        synCtx.getSynapseEnvironment().injectMessage(synCtx);
 
         ///////////////////////////////////////////////////////////////////////
         // Response handling mechanism for 200/202 and 5XX
@@ -56,12 +53,12 @@
         // smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
         if (smc.isResponse()) {
             mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
-                    Constants.VALUE_TRUE);
+                Constants.VALUE_TRUE);
         }
         if (smc.isFaultResponse()) {
             // todo: a good way to inject faultSoapEnv to the Axis2 Transport 
             throw new AxisFault(
-                    "Synapse Encounters an Error - Please See Log for More Details");
+                "Synapse Encounters an Error - Please See Log for More Details");
         }
         ///////////////////////////////////////////////////////////////////////
     }
Index: modules/core/src/org/apache/synapse/core/SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/core/SynapseEnvironment.java	(revision 0)
+++ modules/core/src/org/apache/synapse/core/SynapseEnvironment.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.core;
+
+import org.apache.synapse.SynapseContext;
+
+/**
+ * The SynapseEnvironment allows access into the the host SOAP engine. It allows
+ * the sending of messages, classloader access etc.
+ */
+public interface SynapseEnvironment {
+
+    /**
+     * This method injects a new message into the Synapse engine. This is used by
+     * the underlying SOAP engine to inject messages into Synapse for mediation.
+     * e.g. The SynapseMessageReceiver used by Axis2 invokes this to inject new messages
+     */
+    public void injectMessage(SynapseContext smc);
+
+    /**
+     * Mediators may get access to the relevant classloader through this
+     */
+    public ClassLoader getClassLoader();
+
+    /**
+     * This method allows a message to be sent through the underlying SOAP engine.
+     * <p/>
+     * This will send request messages on (forward), and send the response messages back to the client
+     */
+    public void send(SynapseContext smc);
+}
Index: modules/core/src/org/apache/synapse/HeaderType.java
===================================================================
--- modules/core/src/org/apache/synapse/HeaderType.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/HeaderType.java	(working copy)
@@ -17,114 +17,117 @@
 package org.apache.synapse;
 
 import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axiom.soap.SOAPHeaderBlock;
 
 /**
+ * This is a convenience class used to manipulate common headers. The convenience string names this defines could be
+ * used to configure the header mediator. Once an instance of this class exists, it could be given a value and
+ * a synapse message instance, and asked to set given value as the header value to the given message. i.e. setHeader()
  *
- * <p> This class encapsulates access to headers. It has a set of "logical names" (e.g. strings) 
- * Once you have set the logical name you can read and write that header on a SynapseMessage
- * It is used by the RegexProcessor and the HeaderProcessor classes.
- *
+ * Support for additional headers may be added later
  */
 public class HeaderType {
 
-	private final static int TO = 1, FROM = 2, FAULT = 3, ACTION = 4,
-			REPLYTO = 5;
+    private final static int TO = 1, FROM = 2, FAULT = 3, ACTION = 4, REPLYTO = 5;
 
-	public final static String STRTO = "to", STRFROM = "from",
-			STRFAULT = "faultto", STRACTION = "action", STRREPLYTO = "replyto";
+    /** Refers the To header */
+    public final static String STRTO = "To";
+    /** Refers the From header */
+    public final static String STRFROM = "From";
+    /** Refers the FaultTo header */
+    public final static String STRFAULT = "FaultTo";
+    /** Refers the Action header */
+    public final static String STRACTION = "Action";
+    /** Refers the ReplyTo header */
+    public final static String STRREPLYTO = "ReplyTo";
 
-	private int headerType = 0;
+    private int headerType = 0;
 
-	public void setHeaderType(String header) {
-		if (header.equalsIgnoreCase(STRTO))
-			headerType = TO;
-		else if (header.equalsIgnoreCase(STRFROM))
-			headerType = FROM;
-		else if (header.equalsIgnoreCase(STRFAULT))
-			headerType = FAULT;
-		else if (header.equalsIgnoreCase(STRACTION))
-			headerType = ACTION;
-		else if (header.equalsIgnoreCase(STRREPLYTO))
-			headerType = REPLYTO;
-		else
-			throw new SynapseException("unknown header type");
-	}
+    public void setHeaderType(String header) {
+        if (header.equalsIgnoreCase(STRTO))
+            headerType = TO;
+        else if (header.equalsIgnoreCase(STRFROM))
+            headerType = FROM;
+        else if (header.equalsIgnoreCase(STRFAULT))
+            headerType = FAULT;
+        else if (header.equalsIgnoreCase(STRACTION))
+            headerType = ACTION;
+        else if (header.equalsIgnoreCase(STRREPLYTO))
+            headerType = REPLYTO;
+        else
+            throw new SynapseException("Unknown header type : " + header);
+    }
 
-	public String getHeaderType() {
-		switch (headerType) {
+    public String getHeader(SynapseMessage sm) {
+        switch (headerType) {
+            case TO: {
+                if (sm.getTo() != null)
+                    return sm.getTo().getAddress();
 
-		case TO:
-			return STRTO;
-		case FROM:
-			return STRFROM;
-		case FAULT:
-			return STRFAULT;
-		case ACTION:
-			return STRACTION;
-		case REPLYTO:
-			return STRREPLYTO;
+            }
+            case FROM: {
+                if (sm.getFrom() != null)
+                    return sm.getFrom().getAddress();
+                break;
+            }
+            case FAULT: {
+                if (sm.getFaultTo() != null)
+                    return sm.getFaultTo().getAddress();
+                break;
+            }
+            case ACTION: {
+                if (sm.getWSAAction() != null)
+                    return sm.getWSAAction();
+                break;
+            }
+            case REPLYTO: {
+                if (sm.getReplyTo() != null)
+                    return sm.getReplyTo().getAddress();
+                break;
+            }
+        }
 
-		}
-		return null;
-	}
+        return null;
+    }
 
-	public String getHeader(SynapseMessage sm) {
-		switch (headerType) {
-		case TO: {
-			if (sm.getTo() != null)
-				return sm.getTo().getAddress();
+    /**
+     * Removed the header indicated by this header type from the given message
+     * @param synMsg the current message from which the header should be removed
+     */
+    public void removeHeader(SynapseMessage synMsg) {
+        //TODO This is not yet implemented - revisit later
+        System.err.println("Unimplemented functionality - Needs to be fixed");
+    }
 
-		}
-		case FROM: {
-			if (sm.getFrom() != null)
-				return sm.getFrom().getAddress();
-			break;
-		}
-		case FAULT: {
-			if (sm.getFaultTo() != null)
-				return sm.getFaultTo().getAddress();
-			break;
-		}
-		case ACTION: {
-			if (sm.getWSAAction() != null)
-				return sm.getWSAAction();
-			break;
-		}
-		case REPLYTO: {
-			if (sm.getReplyTo() != null)
-				return sm.getReplyTo().getAddress();
-			break;
-		}
-		}
+    /**
+     * Sets the given value into the message's indicated header
+     * @param synMsg the current message on which to set the header
+     * @param value the value to be set
+     */
+    public void setHeader(SynapseMessage synMsg, String value) {
+        switch (headerType) {
+            case 0: {
+                throw new SynapseException(
+                    "headerType=0 in setHeader. Assume called setHeader before setHeaderType");
+            }
 
-		return null;
-	}
+            case TO: {
 
-	public void setHeader(SynapseMessage sm, String value) {
-		switch (headerType) {
-		case 0: {
-			throw new SynapseException(
-					"headerType=0 in setHeader. Assume called setHeader before setHeaderType");
-		}
-
-		case TO: {
-
-			sm.setTo(new EndpointReference(value));
-			break;
-		}
-		case FROM: {
-			sm.setFrom(new EndpointReference(value));
-			break;
-		}
-		case REPLYTO: {
-			sm.setReplyTo(new EndpointReference(value));
-			break;
-		}
-		case ACTION: {
-			sm.setWSAAction(value);
-			break;
-		}
-
-		}
-	}
+                synMsg.setTo(new EndpointReference(value));
+                break;
+            }
+            case FROM: {
+                synMsg.setFrom(new EndpointReference(value));
+                break;
+            }
+            case REPLYTO: {
+                synMsg.setReplyTo(new EndpointReference(value));
+                break;
+            }
+            case ACTION: {
+                synMsg.setWSAAction(value);
+                break;
+            }
+        }
+    }
 }
Index: modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java	(revision 0)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.api.ListMediator;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This class implements the base functionality of a List mediator
+ *
+ * @see ListMediator
+ */
+public abstract class AbstractListMediator extends AbstractMediator implements ListMediator {
+
+    private static final Log log = LogFactory.getLog(AbstractListMediator.class);
+
+    protected List mediators = new ArrayList();
+
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+
+        Iterator it = mediators.iterator();
+        while (it.hasNext()) {
+            Mediator m = (Mediator) it.next();
+            if (!m.mediate(synCtx)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public List getList() {
+        return mediators;
+    }
+
+    public boolean addChild(Mediator m) {
+        return mediators.add(m);
+    }
+
+    public Mediator getChild(int pos) {
+        return (Mediator) mediators.get(pos);
+    }
+
+    public boolean removeChild(Mediator m) {
+        return mediators.remove(m);
+    }
+
+    public Mediator removeChild(int pos) {
+        return (Mediator) mediators.remove(pos);
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/AbstractMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/AbstractMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/AbstractMediator.java	(revision 0)
@@ -0,0 +1,35 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.api.Mediator;
+
+/**
+ * This class is an abstract Mediator, that defines the logging and debugging
+ * elements of a mediator class.
+ */
+public abstract class AbstractMediator implements Mediator {
+
+    /**
+     * Returns the class name of the mediator
+     * @return the class name of the mediator
+     */
+    public String getType() {
+        return getClass().getSimpleName();
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/base/AbstractListMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/AbstractListMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/AbstractListMediator.java	(working copy)
@@ -1,72 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-import java.util.Iterator;
-
-import java.util.List;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.api.ListMediator;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseMessage;
-
-
-/**
- *
- *         stages, mediations that it has as subelements It is a way of grouping
- *         stuff.
- * 
- */
-public abstract class AbstractListMediator implements ListMediator {
-	
-	private Log log = LogFactory.getLog(getClass());
-
-	protected List mediators = null;
-	
-	public boolean mediate(SynapseMessage smc) {
-		log.debug("mediate()");
-		if (mediators == null) {
-			log.info("mediate called on empty mediator list");
-			return true;
-		}
-		Iterator it = mediators.iterator();
-		while (it.hasNext()) {
-			Mediator m = (Mediator) it.next();
-			log.debug(m.getClass());
-			if (!m.mediate(smc))
-				return false;
-		}
-		return true;
-	}
-
-	public void setList(List m) {
-		log.debug("setting list");
-		Iterator it = m.iterator();
-		while (it.hasNext()) {
-			Mediator x = (Mediator)it.next();
-			log.debug(x.getClass());
-		}
-		mediators = m;
-	}
-	public List getList() {
-		return mediators;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/DefineMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/DefineMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/DefineMediator.java	(working copy)
@@ -1,43 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.mediators.base;
-
-import org.apache.synapse.SynapseMessage;
-
-/**
- *
- */
-public class DefineMediator extends AbstractListMediator {
-
-    public boolean mediate(SynapseMessage sm) {
-        return true;
-    }
-
-    /*
-    The Processor.process() is common to every one. Define Processor is a unique
-    mediator that is not run in-line. It should always reference by some entity. This
-    Entity is "<refdefine/>. <refdefine/> has the @ref which will reference to the
-    <define/>.
-
-    The Following method processRef(SynapseEnvironment se, SynapseMessage sm) will
-    allow to reference the <define/> process and, will not allow the <define/> to be a inline
-    process either.
-    */
-
-    public boolean mediateRef(SynapseMessage sm) {
-        return super.mediate(sm);
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/base/InMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/InMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/InMediator.java	(working copy)
@@ -1,37 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-
-import org.apache.synapse.SynapseMessage;
-
-/**
- *
- * 
- * Only processes if this is not a response
- *
- */
-public class InMediator extends AbstractListMediator {
-
-	public boolean mediate(SynapseMessage sm) {
-		if (!sm.isResponse()) return super.mediate(sm);
-		return true;
-		
-	}
-	
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/NeverMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/NeverMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/NeverMediator.java	(working copy)
@@ -1,34 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-
-import org.apache.synapse.SynapseMessage;
-
-/**
- *
- * This never executes its children. Used as a holder (for references)
- *
- */
-public class NeverMediator extends AbstractListMediator {
-
-	public boolean mediate(SynapseMessage sm) {
-		return true;
-	}
-	
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/OutMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/OutMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/OutMediator.java	(working copy)
@@ -1,34 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-import org.apache.synapse.SynapseMessage;
-
-/**
- * <p>
- * This only executes on response messages
- *
- */
-public class OutMediator extends AbstractListMediator{
-
-	public boolean mediate(SynapseMessage sm) {
-		if (sm.isResponse()) return super.mediate(sm);
-			return true;
-	}
-	
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/RefDefineMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/RefDefineMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/RefDefineMediator.java	(working copy)
@@ -1,50 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Processor that reference to <refdefine/>
- */
-public class RefDefineMediator implements Mediator {
-    private Log log = LogFactory.getLog(getClass());
-	private String refDefine = null;
-
-    public boolean mediate(SynapseMessage sm) {
-        log.debug("RefDfineProcessor-Process");
-        Mediator m = sm.getSynapseEnvironment().lookupMediator(getRefDefine());
-		if (m==null) log.debug("mediator with name "+this.getRefDefine()+" not found");
-		else if (m instanceof DefineMediator) {
-            DefineMediator defm = (DefineMediator)m;
-            return defm.mediateRef(sm);
-        }
-		return true;
-    }
-
-    public void setRefDefine(String refDefine) {
-        this.refDefine = refDefine;
-    }
-
-    public String getRefDefine() {
-        return this.refDefine;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/RefMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/RefMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/RefMediator.java	(working copy)
@@ -1,52 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-
-/**
- *
- * 
- * Calls another processor which is referred to by the Ref property.
- *
- */
-public class RefMediator implements Mediator {
-	private Log log = LogFactory.getLog(getClass());
-	private String ref = null;
-	
-	public boolean mediate(SynapseMessage sm) {
-		log.debug("mediate");
-		Mediator m = sm.getSynapseEnvironment().lookupMediator(getRef());
-		if (m==null) log.debug("mediator with name "+this.getRef()+" not found");
-		else return m.mediate(sm);
-		return true;
-	}
-
-	public void setRef(String ref) {
-		this.ref = ref;
-	}
-
-	public String getRef() {
-		return ref;
-	}
-
-		
-
-}
Index: modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java	(revision 0)
@@ -0,0 +1,78 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.base;
+
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The Sequence mediator either refers to another Sequence mediator instance
+ * or is a *Named* list/sequence of other (child) Mediators
+ */
+public class SequenceMediator extends AbstractListMediator {
+
+    private static final Log log = LogFactory.getLog(SequenceMediator.class);
+    private String name = null;
+    private String ref = null;
+
+    /**
+     * If this mediator refers to another named Sequence, execute that. Else
+     * execute the list of mediators (children) contained within this. If a referenced
+     * named sequence mediator instance cannot be found at runtime, an exception is
+     * thrown. This may occur due to invalid configuration of an erroneous runtime
+     * change of the synapse configuration. It is the responsibility of the
+     * SynapseConfiguration builder to ensure that dead references are not present.
+     *
+     * @param synCtx the synapse message
+     * @return as per standard mediator result
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        if (ref == null) {
+            return super.mediate(synCtx);
+
+        } else {
+            Mediator m = synCtx.getConfiguration().getNamedMediator(ref);
+            if (m == null) {
+                String msg = "Sequence mediator instance named " + ref + " cannot be found.";
+                log.error(msg);
+                throw new SynapseException(msg);
+            } else {
+                return m.mediate(synCtx);
+            }
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getRef() {
+        return ref;
+    }
+
+    public void setRef(String ref) {
+        this.ref = ref;
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/base/StageMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/StageMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/StageMediator.java	(working copy)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.base;
-
-
-/**
- *
- * 
- * 
- */
-public class StageMediator extends AbstractListMediator {
-}
Index: modules/core/src/org/apache/synapse/mediators/base/SynapseMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/SynapseMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/base/SynapseMediator.java	(working copy)
@@ -16,12 +16,16 @@
 
 package org.apache.synapse.mediators.base;
 
+import org.apache.synapse.mediators.AbstractListMediator;
+
 /**
+ * The SynapseMediator is the "mainmediator" of the synapse engine. It is
+ * given each message on arrival at the synapse engine. The synapse configuration
+ * holds a reference to this special mediator instance. The SynapseMediator
+ * holds the list of mediators supplied within the <rules> element of an XML
+ * based Synapse configuration
  *
- * 
- * This implements the main processor. Delegates to ListProcessor
- * Here in case we need the main <synapse> to do anything special
- *
+ * @see org.apache.synapse.config.SynapseConfiguration#getMainMediator()
  */
 public class SynapseMediator extends AbstractListMediator {
 }
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java	(working copy)
@@ -1,117 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.builtin.axis2;
-
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisModule;
-
-
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-
-
-
-
-
-import javax.xml.namespace.QName;
-
-
-/**
- * <p/>
- * This class turns on the addressing module and then calls an empty
- * service There's probably a better way but this should work!
- */
-public class AddressingInMediator implements Mediator{
-    private Log log = LogFactory.getLog(getClass());
-
-
-    public boolean mediate(SynapseMessage smc) {
-        log.debug("Processing __AddressingInHandler__");
-        try {
-            MessageContext mc = ((Axis2SynapseMessage)smc).getMessageContext();
-
-            // for this execution chain set Addressing as processed
-            smc.setProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE,Boolean.TRUE);
-
-            // default configuration_contex and axis_configuration
-            ConfigurationContext cc = mc.getConfigurationContext();
-            AxisConfiguration ac = cc.getAxisConfiguration();
-            AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
-            if (as == null)
-                throw new SynapseException("cannot locate service "
-                        + Constants.EMPTYMEDIATOR);
-            // Engagin addressing
-
-
-            AxisModule module = ac.getModule(new QName("addressing"));
-            if (module == null)
-                throw new SynapseException("cannot locate addressing module in the repository ");
-
-            if (!as.isEngaged(module.getName())) {
-                as.engageModule(module, ac);
-            }
-
-//            ac.engageModule(new QName("addressing"));
-
-            AxisEngine ae = new AxisEngine(cc);
-            AxisOperation ao = as
-                    .getOperation(Constants.MEDIATE_OPERATION_NAME);
-            OperationContext oc = OperationContextFactory
-                    .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-            ao.registerOperationContext(mc,oc);
-            ServiceContext sc = Utils.fillContextInformation(as, cc);
-            oc.setParent(sc);
-            mc.setAxisOperation(ao);
-            mc.setAxisService(as);
-            ae.receive(mc);
-            // purpose of addressing is over now disengage addressing
-//            ac.disEngageModule(addressingModule);
-            if (as.isEngaged(module.getName())) {
-                ac.disEngageModule(ac.getModule(module.getName()));
-            }
-
-
-        } catch (AxisFault axisFault) {
-            throw new SynapseException(
-                    "__AddresingInHandler__ caught an Exception" +
-                            axisFault.getMessage());
-        }
-        return true;
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.synapse.api.Mediator;
-
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class AddressingOutMediator implements Mediator {
-    public boolean mediate(SynapseMessage sm) {
-        // engage addressing outhandler in the out bound message. 
-        sm.setProperty(Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE, Boolean.TRUE);
-        return true;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java	(working copy)
@@ -1,98 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDocument;
-
-import javax.xml.namespace.QName;
-
-/**
- * <p/> This returns a fault in response to this message
- */
-public class FaultMediator implements Mediator{
-
-    private Log log = LogFactory.getLog(getClass());
-
-    private QName faultCode;
-    private String reason;
-
-    public boolean mediate(SynapseMessage smc) {
-        log.debug("process");
-
-        SOAPEnvelope envelop = smc.getEnvelope();
-        SOAPFactory factory;
-        if (envelop != null) {
-            if (envelop.getNamespace().getName().equals(
-                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                factory = OMAbstractFactory.getSOAP12Factory();
-            } else {
-                factory = OMAbstractFactory.getSOAP11Factory();
-            }
-
-        } else {
-            factory = OMAbstractFactory.getSOAP11Factory();
-        }
-        try {
-            // TODO : Figure out how to easily gen the correct fault
-
-            // Replace this
-            OMDocument soapFaultDocument = factory.createOMDocument();
-            SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
-            soapFaultDocument.addChild(faultEnvelope);
-
-            smc.setEnvelope(faultEnvelope);
-        } catch (Exception e) {
-            throw new SynapseException(e);
-        }
-        smc.setResponse(true);
-
-        // Flipping the headers
-        EndpointReference tempEPR = smc.getTo();
-        smc.setTo(smc.getReplyTo());
-        smc.setReplyTo(tempEPR);
-
-        smc.getSynapseEnvironment().injectMessage(smc);
-
-        return false;
-    }
-
-    public QName getFaultCode() {
-        return faultCode;
-    }
-
-    public void setFaultCode(QName faultCode) {
-        this.faultCode = faultCode;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java	(working copy)
@@ -1,79 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.util.Utils;
-import org.apache.axis2.AxisFault;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SecurityMediator implements Mediator {
-    private Log log = LogFactory.getLog(getClass());
-
-    public boolean mediate(SynapseMessage sm) {
-        log.debug("process");
-		try {
-			MessageContext mc = ((Axis2SynapseMessage) sm)
-					.getMessageContext();
-			ConfigurationContext cc = mc.getConfigurationContext();
-			AxisConfiguration ac = cc.getAxisConfiguration();
-			AxisEngine ae = new AxisEngine(cc);
-			AxisService as = ac.getService(Constants.SECURITY_QOS);
-			if (as == null)
-				throw new SynapseException("cannot locate service "
-                        + Constants.SECURITY_QOS);
-			ac.engageModule(new QName("security"));
-			AxisOperation ao = as
-					.getOperation(Constants.MEDIATE_OPERATION_NAME);
-			OperationContext oc = OperationContextFactory
-					.createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-			ao.registerOperationContext(mc, oc);
-
-			ServiceContext sc = Utils.fillContextInformation(as, cc);
-			oc.setParent(sc);
-
-			mc.setOperationContext(oc);
-			mc.setServiceContext(sc);
-
-			mc.setAxisOperation(ao);
-			mc.setAxisService(as);
-
-			ae.receive(mc);
-
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-		}
-		return true;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingInMediator.java	(working copy)
@@ -1,117 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.builtin.axis2;
-
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisModule;
-
-
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-
-
-
-
-
-import javax.xml.namespace.QName;
-
-
-/**
- * <p/>
- * This class turns on the addressing module and then calls an empty
- * service There's probably a better way but this should work!
- */
-public class AddressingInMediator implements Mediator{
-    private Log log = LogFactory.getLog(getClass());
-
-
-    public boolean mediate(SynapseMessage smc) {
-        log.debug("Processing __AddressingInHandler__");
-        try {
-            MessageContext mc = ((Axis2SynapseMessage)smc).getMessageContext();
-
-            // for this execution chain set Addressing as processed
-            smc.setProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE,Boolean.TRUE);
-
-            // default configuration_contex and axis_configuration
-            ConfigurationContext cc = mc.getConfigurationContext();
-            AxisConfiguration ac = cc.getAxisConfiguration();
-            AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
-            if (as == null)
-                throw new SynapseException("cannot locate service "
-                        + Constants.EMPTYMEDIATOR);
-            // Engagin addressing
-
-
-            AxisModule module = ac.getModule(new QName("addressing"));
-            if (module == null)
-                throw new SynapseException("cannot locate addressing module in the repository ");
-
-            if (!as.isEngaged(module.getName())) {
-                as.engageModule(module, ac);
-            }
-
-//            ac.engageModule(new QName("addressing"));
-
-            AxisEngine ae = new AxisEngine(cc);
-            AxisOperation ao = as
-                    .getOperation(Constants.MEDIATE_OPERATION_NAME);
-            OperationContext oc = OperationContextFactory
-                    .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-            ao.registerOperationContext(mc,oc);
-            ServiceContext sc = Utils.fillContextInformation(as, cc);
-            oc.setParent(sc);
-            mc.setAxisOperation(ao);
-            mc.setAxisService(as);
-            ae.receive(mc);
-            // purpose of addressing is over now disengage addressing
-//            ac.disEngageModule(addressingModule);
-            if (as.isEngaged(module.getName())) {
-                ac.disEngageModule(ac.getModule(module.getName()));
-            }
-
-
-        } catch (AxisFault axisFault) {
-            throw new SynapseException(
-                    "__AddresingInHandler__ caught an Exception" +
-                            axisFault.getMessage());
-        }
-        return true;
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/AddressingOutMediator.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.synapse.api.Mediator;
-
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class AddressingOutMediator implements Mediator {
-    public boolean mediate(SynapseMessage sm) {
-        // engage addressing outhandler in the out bound message. 
-        sm.setProperty(Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE, Boolean.TRUE);
-        return true;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/FaultMediator.java	(working copy)
@@ -1,98 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDocument;
-
-import javax.xml.namespace.QName;
-
-/**
- * <p/> This returns a fault in response to this message
- */
-public class FaultMediator implements Mediator{
-
-    private Log log = LogFactory.getLog(getClass());
-
-    private QName faultCode;
-    private String reason;
-
-    public boolean mediate(SynapseMessage smc) {
-        log.debug("process");
-
-        SOAPEnvelope envelop = smc.getEnvelope();
-        SOAPFactory factory;
-        if (envelop != null) {
-            if (envelop.getNamespace().getName().equals(
-                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                factory = OMAbstractFactory.getSOAP12Factory();
-            } else {
-                factory = OMAbstractFactory.getSOAP11Factory();
-            }
-
-        } else {
-            factory = OMAbstractFactory.getSOAP11Factory();
-        }
-        try {
-            // TODO : Figure out how to easily gen the correct fault
-
-            // Replace this
-            OMDocument soapFaultDocument = factory.createOMDocument();
-            SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
-            soapFaultDocument.addChild(faultEnvelope);
-
-            smc.setEnvelope(faultEnvelope);
-        } catch (Exception e) {
-            throw new SynapseException(e);
-        }
-        smc.setResponse(true);
-
-        // Flipping the headers
-        EndpointReference tempEPR = smc.getTo();
-        smc.setTo(smc.getReplyTo());
-        smc.setReplyTo(tempEPR);
-
-        smc.getSynapseEnvironment().injectMessage(smc);
-
-        return false;
-    }
-
-    public QName getFaultCode() {
-        return faultCode;
-    }
-
-    public void setFaultCode(QName faultCode) {
-        this.faultCode = faultCode;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/axis2/SecurityMediator.java	(working copy)
@@ -1,79 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.util.Utils;
-import org.apache.axis2.AxisFault;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SecurityMediator implements Mediator {
-    private Log log = LogFactory.getLog(getClass());
-
-    public boolean mediate(SynapseMessage sm) {
-        log.debug("process");
-		try {
-			MessageContext mc = ((Axis2SynapseMessage) sm)
-					.getMessageContext();
-			ConfigurationContext cc = mc.getConfigurationContext();
-			AxisConfiguration ac = cc.getAxisConfiguration();
-			AxisEngine ae = new AxisEngine(cc);
-			AxisService as = ac.getService(Constants.SECURITY_QOS);
-			if (as == null)
-				throw new SynapseException("cannot locate service "
-                        + Constants.SECURITY_QOS);
-			ac.engageModule(new QName("security"));
-			AxisOperation ao = as
-					.getOperation(Constants.MEDIATE_OPERATION_NAME);
-			OperationContext oc = OperationContextFactory
-					.createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-			ao.registerOperationContext(mc, oc);
-
-			ServiceContext sc = Utils.fillContextInformation(as, cc);
-			oc.setParent(sc);
-
-			mc.setOperationContext(oc);
-			mc.setServiceContext(sc);
-
-			mc.setAxisOperation(ao);
-			mc.setAxisService(as);
-
-			ae.receive(mc);
-
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-		}
-		return true;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java	(working copy)
@@ -16,20 +16,29 @@
 
 package org.apache.synapse.mediators.builtin;
 
-import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
-import org.apache.synapse.SynapseMessage;
-
 /**
- * Implementaion of <drop/>
+ * Halts further processing/mediation of the current message. i.e. returns false
  */
-public class DropMediator implements Mediator  {
-    
-    public boolean mediate(SynapseMessage sm) {
-        if (sm.getTo() == null) {
+public class DropMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(LogMediator.class);
+
+    /**
+     * Halts further mediation of the current message by returning false.
+     * @param synCtx the current message
+     * @return false always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        if (synCtx.getSynapseMessage().getTo() == null) {
             return false;
-        }else{
-            sm.setTo(null);
+        } else {
+            synCtx.getSynapseMessage().setTo(null);
             return false;
         }
     }
Index: modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java	(working copy)
@@ -1,61 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.mediators.builtin;
-
-import org.apache.synapse.HeaderType;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.api.Mediator;
-
-
-/**
- *
- *      @see org.apache.synapse.HeaderType  
- * <p> Sets aspects of the header to new values.
- *   Uses HeaderType to set header values     
- * 
- */
-public class HeaderMediator implements Mediator{
-	
-	private HeaderType headerType = new HeaderType();
-
-	private String value = null;
-
-	public void setHeaderType(String ht) {
-		headerType.setHeaderType(ht);
-	}
-	
-	public String getHeaderType() {
-		return headerType.getHeaderType();
-	}
-	
-	public boolean mediate(SynapseMessage sm) {
-
-		headerType.setHeader(sm, getValue());
-		return true;
-	}
-
-	public void setValue(String value) {
-		this.value = value;
-	}
-
-	public String getValue() {
-		return value;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java	(working copy)
@@ -16,40 +16,145 @@
 
 package org.apache.synapse.mediators.builtin;
 
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.synapse.SynapseMessage;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
 
-import org.apache.synapse.api.Mediator;
 
-
 /**
- *
- * <p>
- * Logs the message using commons logging
- * 
- * <p>
- * TODO make configurable - short or detailed logs
- *
+ * Logs the specified message into the configured logger. The log levels specify
+ * which attributes would be logged, and is configurable. Additionally custom
+ * properties may be defined to the logger, where literal values or expressions
+ * could be specified for logging. The custom properties are printed into the log
+ * using the defined seperator (\n, "," etc)
  */
-public class LogMediator implements Mediator {
-	
-	private Log log = LogFactory.getLog(getClass());
+public class LogMediator extends AbstractMediator {
 
-	public boolean mediate(SynapseMessage smc) {
-		log.info("---------------------------------------");
-		if (smc.getTo() != null)
-			log.info("To: " + smc.getTo().getAddress());
-		if (smc.getFrom() != null)
-			log.info("From: " + smc.getFrom().getAddress());
-		if (smc.getReplyTo() != null)
-			log.info("ReplyTo: " + smc.getReplyTo().getAddress());
-		if (smc.getEnvelope() != null)
-			log.info("Envelope: " + smc.getEnvelope().toString());
-		log.info("---------------------------------------");
-		return true;
-	}
+    private static final Log log = LogFactory.getLog(LogMediator.class);
 
+    public static final int CUSTOM = 0;
+    public static final int SIMPLE = 1;
+    public static final int HEADERS = 2;
+    public static final int FULL = 3;
 
+    private int logLevel = SIMPLE;
+    private String SEP = ", ";
+    private List properties = new ArrayList();
+
+    /**
+     * Logs the current message according to the supplied semantics
+     * @param synCtx (current) message to be logged
+     * @return true always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        log.info(getLogMessage(synCtx));
+        return true;
+    }
+
+    private String getLogMessage(SynapseContext synCtx) {
+        switch (logLevel) {
+            case CUSTOM:
+                return getCustomLogMessage(synCtx);
+            case SIMPLE:
+                return getSimpleLogMessage(synCtx);
+            case HEADERS:
+                return getHeadersLogMessage(synCtx);
+            case FULL:
+                return getFullLogMessage(synCtx);
+            default:
+                return "Invalid log level specified";
+        }
+    }
+
+    private String getCustomLogMessage(SynapseContext synCtx) {
+        StringBuffer sb = new StringBuffer();
+        setCustomProperties(sb, synCtx);
+        return sb.toString();
+    }
+
+    private String getSimpleLogMessage(SynapseContext synCtx) {
+        SynapseMessage synMsg = synCtx.getSynapseMessage();
+        StringBuffer sb = new StringBuffer();
+        if (synMsg.getTo() != null)
+            sb.append("To: " + synMsg.getTo().getAddress());
+        if (synMsg.getFrom() != null)
+            sb.append(SEP + "From: " + synMsg.getFrom().getAddress());
+        if (synMsg.getWSAAction() != null)
+            sb.append(SEP + "WSAction: " + synMsg.getWSAAction());
+        if (synMsg.getSoapAction() != null)
+            sb.append(SEP + "SOAPAction: " + synMsg.getSoapAction());
+        if (synMsg.getReplyTo() != null)
+            sb.append(SEP + "ReplyTo: " + synMsg.getReplyTo().getAddress());
+        if (synMsg.getMessageID() != null)
+            sb.append(SEP + "MessageID: " + synMsg.getMessageID());
+        setCustomProperties(sb, synCtx);
+        return sb.toString();
+    }
+
+    private String getHeadersLogMessage(SynapseContext synCtx) {
+        SynapseMessage synMsg = synCtx.getSynapseMessage();
+        StringBuffer sb = new StringBuffer();
+        Iterator iter = synMsg.getEnvelope().getHeader().examineAllHeaderBlocks();
+        while (iter.hasNext()) {
+            SOAPHeader header = (SOAPHeader) iter.next();
+            sb.append(SEP + header.getLocalName() + " : " + header.getText());
+        }
+        setCustomProperties(sb, synCtx);
+        return sb.toString();
+    }
+
+    private String getFullLogMessage(SynapseContext synCtx) {
+        SynapseMessage synMsg = synCtx.getSynapseMessage();
+        StringBuffer sb = new StringBuffer();
+        sb.append(getSimpleLogMessage(synCtx));
+        if (synMsg.getEnvelope() != null)
+            sb.append(SEP + "Envelope: " + synMsg.getEnvelope());
+        setCustomProperties(sb, synCtx);
+        return sb.toString();
+    }
+
+    private void setCustomProperties(StringBuffer sb, SynapseContext synCtx) {
+        if (properties != null && !properties.isEmpty()) {
+            Iterator iter = properties.iterator();
+            while (iter.hasNext()) {
+                MediatorProperty prop = (MediatorProperty) iter.next();
+                sb.append(SEP + prop.getName() + " = " +
+                    (prop.getValue() != null ? prop.getValue() : prop.getEvaluatedExpression(synCtx)));
+            }
+        }
+    }
+
+    public int getLogLevel() {
+        return logLevel;
+    }
+
+    public void setLogLevel(int logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public String getSeperator() {
+        return SEP;
+    }
+
+    public void setSeperator(String SEP) {
+        this.SEP = SEP;
+    }
+
+    public void addProperty(MediatorProperty p) {
+        properties.add(p);
+    }
+
+    public void addAllProperties(List list) {
+        properties.addAll(list);
+    }
+
 }
Index: modules/core/src/org/apache/synapse/mediators/builtin/PropertyMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/PropertyMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/builtin/PropertyMediator.java	(revision 0)
@@ -0,0 +1,68 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.builtin;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.Util;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+
+/**
+ * The property mediator would save a named property as a local property
+ * of the Synapse Message Context. Properties set this way could be
+ * extracted through the XPath extension function "synapse:get-property(prop-name)"
+ */
+public class PropertyMediator extends AbstractMediator {
+
+    private String name = null;
+    private String value = null;
+    private AXIOMXPath expression = null;
+
+    /**
+     * Sets a property into the current (local) Synapse Context
+     * @param smc the message context
+     * @return true always
+     */
+    public boolean mediate(SynapseContext smc) {
+        smc.setProperty(getName(),
+            (value != null ? getValue() : Util.getStringValue(getExpression(), smc)));
+        return true;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public AXIOMXPath getExpression() {
+        return expression;
+    }
+
+    public void setExpression(AXIOMXPath expression) {
+        this.expression = expression;
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java	(working copy)
@@ -16,31 +16,34 @@
 
 package org.apache.synapse.mediators.builtin;
 
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseMessage;
 
 /**
- *
- * <p>
- * 
- * This sends the message on (or back)
- *
+ * The Send mediator sends the message using the following semantics.
+ * <p/>
+ * This is a leaf mediator (i.e. further processing halts after this mediator completes)
+ * <p/>
+ * TODO support endpoints, loadbalancing and failover
  */
-public class SendMediator implements Mediator {
-	
+public class SendMediator extends AbstractMediator {
 
-	private Log log = LogFactory.getLog(getClass());
-
-	
-	public boolean mediate(SynapseMessage smc) {
-		log.debug("mediate");
-		smc.getSynapseEnvironment().send(smc);
-		return false;
-
-	}
-
-	
-
+    private static final Log log = LogFactory.getLog(SendMediator.class);
+    /**
+     * This is a leaf mediator. i.e. processing stops once send is invoked,
+     * as it always returns false
+     *
+     * @param synCtx the current message to be sent
+     * @return false always as this is a leaf mediator
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        log.debug("Sending To: " + (synCtx.getSynapseMessage().getTo() != null ?
+            synCtx.getSynapseMessage().getTo().getAddress() : "null"));
+        log.debug("Body : \n" + synCtx.getSynapseMessage().getEnvelope());
+        synCtx.getSynapseEnvironment().send(synCtx);
+        return false;
+    }
 }
Index: modules/core/src/org/apache/synapse/mediators/builtin/SendNowMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/SendNowMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/SendNowMediator.java	(working copy)
@@ -1,168 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.builtin;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2FlexibleMEPClient;
-import org.apache.synapse.axis2.DynamicAxisOperation;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.wsdl.WSDLConstants;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-import javax.xml.namespace.QName;
-
-/**
- * Implementaion of <sendnow/>
- */
-public class SendNowMediator implements Mediator {
-    public boolean mediate( SynapseMessage sm) {
-        MessageContext mc = ((Axis2SynapseMessage)sm).getMessageContext();
-
-        try {
-            MessageContext response = send(mc);
-            if (response.getProperty(MessageContext.TRANSPORT_IN) !=null) {
-                SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(
-                response, mc.getEnvelope().getNamespace()
-                .getName());
-
-                response.setEnvelope(resenvelope);
-                outMessageSerialization(response,mc,sm);
-            }
-
-
-        } catch (AxisFault axisFault) {
-            throw new SynapseException(axisFault);
-        }
-        // this will stop processing message and what User
-        return false;
-    }
-
-    public MessageContext send(MessageContext smc) throws AxisFault {
-        ConfigurationContext cc = smc.getConfigurationContext();
-        AxisConfiguration ac = cc.getAxisConfiguration();
-        PhasesInfo phasesInfo = ac.getPhasesInfo();
-
-        // setting operation default chains
-        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
-            DynamicAxisOperation operation = new DynamicAxisOperation(new QName(
-                            "__DYNAMIC_OPERATION__"));
-            AxisService axisAnonymousService =
-                    new AxisService("__ANONYMOUS_SERVICE__");
-            axisAnonymousService.addOperation(operation);
-            ac.addService(axisAnonymousService);
-            phasesInfo.setOperationPhases(operation);
-        }
-        ServiceGroupContext sgc = new ServiceGroupContext(cc,
-                (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
-        ServiceContext sc =
-                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
-
-        MessageContext mc = new MessageContext();
-        mc.setConfigurationContext(sc.getConfigurationContext());
-        ///////////////////////////////////////////////////////////////////////
-        // filtering properties
-        if (smc.getSoapAction() != null)
-            mc.setSoapAction(smc.getSoapAction());
-        if (smc.getWSAAction() != null)
-            mc.setWSAAction(smc.getWSAAction());
-        if (smc.getFrom() != null)
-            mc.setFrom(smc.getFrom());
-        if (smc.getMessageID() != null)
-            mc.setMessageID(smc.getMessageID());
-        else
-            mc.setMessageID(String.valueOf("uuid:"
-                    + UUIDGenerator.getUUID()));
-        if (smc.getReplyTo() != null)
-            mc.setReplyTo(smc.getReplyTo());
-        if (smc.getRelatesTo() != null)
-            mc.setRelatesTo(smc.getRelatesTo());
-        if (smc.getTo() != null) {
-            mc.setTo(smc.getTo());
-        } else {
-            throw new AxisFault(
-                    "To canno't be null, if null Synapse can't infer the transport");
-        }
-        if (smc.isDoingREST()) {
-            mc.setDoingREST(true);
-        }
-        mc.setEnvelope(Axis2FlexibleMEPClient.outEnvelopeConfiguration(smc));
-
-        AxisOperation axisAnonymousOperation =
-                ac.getService("__ANONYMOUS_SERVICE__")
-                        .getOperation(new QName("__DYNAMIC_OPERATION__"));
-
-        Options options = new Options();
-        OperationClient mepClient =
-                axisAnonymousOperation.createClient(sc,options);
-
-        mepClient.addMessageContext(mc);
-        mepClient.execute(true);
-        MessageContext response = mepClient
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-
-
-        response.setProperty(MessageContext.TRANSPORT_OUT,
-                smc.getProperty(MessageContext.TRANSPORT_OUT));
-        response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                smc.getProperty(
-                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-
-        // If request is REST we assume the response is REST, so set the
-        // variable
-        response.setDoingREST(smc.isDoingREST());
-
-        return response;
-    }
-
-    private void outMessageSerialization(MessageContext mcn,MessageContext mco,SynapseMessage sm) throws AxisFault {
-
-        // copying important configuration stuff
-        sm.setResponse(true);
-        // as agreed upone
-        mcn.setTo(null);
-        Object os = mco
-                .getProperty(MessageContext.TRANSPORT_OUT);
-        mcn.setProperty(MessageContext.TRANSPORT_OUT, os);
-        TransportInDescription ti = mco.getTransportIn();
-        mcn.setTransportIn(ti);
-        mcn.setServerSide(true);
-
-        AxisEngine ae = new AxisEngine(mco.getConfigurationContext());
-        ae.send(mcn);
-
-
-    }
-
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/ValidateMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/ValidateMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/builtin/ValidateMediator.java	(revision 0)
@@ -0,0 +1,198 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.builtin;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseMessage;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+import org.jaxen.JaxenException;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLOutputFactory;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Validate a message or an element against a schema
+ */
+public class ValidateMediator extends AbstractListMediator {
+
+    private static final Log log = LogFactory.getLog(ValidateMediator.class);
+
+    private String schemaUrl = null;
+    private AXIOMXPath source = null;
+
+    private static final String SCHEMA_LOCATION_NO_NS =
+        "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation";
+    private static final String SCHEMA_LOCATION_NS =
+        "http://apache.org/xml/properties/schema/external-schemaLocation";
+    private static final String FULL_CHECKING = "http://apache.org/xml/features/validation/schema-full-checking";
+    private static final String SCHEMA_VALIDATION = "http://apache.org/xml/features/validation/schema";
+    private static final String VALIDATION = "http://xml.org/sax/features/validation";
+
+    public String getSchemaUrl() {
+        return schemaUrl;
+    }
+
+    public void setSchemaUrl(String schemaUrl) {
+        this.schemaUrl = schemaUrl;
+    }
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    private OMNode getValidateSource(SynapseMessage synMsg) {
+
+        if (source == null) {
+            try {
+                source = new AXIOMXPath("//SOAP-ENV:Body");
+                source.addNamespace("SOAP-ENV", synMsg.isSOAP11() ?
+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            } catch (JaxenException e) {}
+        }
+
+        try {
+            Object o = source.evaluate(synMsg.getEnvelope());
+            if (o instanceof OMNode) {
+                return (OMNode) o;
+            } else if (o instanceof List && !((List) o).isEmpty()) {
+                return (OMNode) ((List) o).get(0);  // Always fetches *only* the first
+            } else {
+                String msg = "The evaluation of the XPath expression " + source + " must result in an OMNode";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } catch (JaxenException e) {
+            String msg = "Error evaluating XPath " + source + " on message";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+    public boolean mediate(SynapseContext synCtx) {
+
+        ByteArrayInputStream baisFromSource = null;
+        StringBuffer nsLocations = new StringBuffer();
+
+        try {
+            // create a byte array output stream and serialize the source node into it
+            ByteArrayOutputStream baosForSource = new ByteArrayOutputStream();
+            XMLStreamWriter xsWriterForSource = XMLOutputFactory.newInstance().createXMLStreamWriter(baosForSource);
+
+            // save the list of defined namespaces for validation against the schema
+            OMNode sourceNode = getValidateSource(synCtx.getSynapseMessage());
+            if (sourceNode instanceof OMElement) {
+                Iterator iter = ((OMElement) sourceNode).getAllDeclaredNamespaces();
+                while (iter.hasNext()) {
+                    OMNamespace omNS = (OMNamespace) iter.next();
+                    nsLocations.append(omNS.getName() + " " + getSchemaUrl());
+                }
+            }
+            sourceNode.serialize(xsWriterForSource);
+            baisFromSource = new ByteArrayInputStream(baosForSource.toByteArray());
+
+        } catch (Exception e) {
+            String msg = "Error accessing source element for validation : " + source;
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+
+        try {
+            SAXParserFactory spFactory = SAXParserFactory.newInstance();
+            spFactory.setNamespaceAware(true);
+            spFactory.setValidating(true);
+            SAXParser parser = spFactory.newSAXParser();
+
+            parser.setProperty(VALIDATION, Boolean.TRUE);
+            parser.setProperty(SCHEMA_VALIDATION, Boolean.TRUE);
+            parser.setProperty(FULL_CHECKING, Boolean.TRUE);
+            parser.setProperty(SCHEMA_LOCATION_NS, nsLocations.toString());
+            parser.setProperty(SCHEMA_LOCATION_NO_NS, getSchemaUrl());
+
+            Validator handler = new Validator();
+            parser.parse(baisFromSource, handler);
+
+            if (handler.isValidationError()) {
+                log.debug("Validation failed :" + handler.getSaxParseException().getMessage());
+                // super.mediate() invokes the "on-fail" sequence of mediators
+                return super.mediate(synCtx);
+            }
+
+        }
+        catch (Exception e) {
+            String msg = "Error validating " + source + " against schema : " + schemaUrl + " : " + e.getMessage();
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+
+        return true;
+    }
+
+    /**
+     * This class handles validation errors to be used for error reporting
+     */
+    private class Validator extends DefaultHandler {
+
+        private boolean validationError = false;
+        private SAXParseException saxParseException = null;
+
+        public void error(SAXParseException exception) throws SAXException {
+            validationError = true;
+            saxParseException = exception;
+        }
+
+        public void fatalError(SAXParseException exception) throws SAXException {
+            validationError = true;
+            saxParseException = exception;
+        }
+
+        public void warning(SAXParseException exception) throws SAXException {
+        }
+
+        public boolean isValidationError() {
+            return validationError;
+        }
+
+        public SAXParseException getSaxParseException() {
+            return saxParseException;
+        }
+    }
+
+}
Index: modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java	(working copy)
@@ -1,91 +0,0 @@
-package org.apache.synapse.mediators.builtin.xslt;
-
-
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAbstractFactory;
-
-/**
- *
- * @see org.apache.synapse.mediators.base.builtin.xslt.XSLTProcessorConfigurator
- * <p> This class is the class that transforms messages using XSLT. 
- *   
-
- *
- */
-public class XSLTMediator implements Mediator {
-
-    private Transformer tran = null;
-
-    private boolean isBody = false;
-
-    public boolean mediate(SynapseMessage smc) {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xsw;
-        try {
-            xsw = XMLOutputFactory.newInstance().createXMLStreamWriter(baos);
-
-        if (isBody) smc.getEnvelope().getBody().serialize(xsw);
-        else smc.getEnvelope().serialize(xsw);
-
-        Source src = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
-        ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
-        StreamResult result = new StreamResult(baos2);
-        tran.transform(src, result);
-        StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baos2.toByteArray()));
-        OMElement nw = builder.getDocumentElement();
-        if (isBody) smc.getEnvelope().setFirstChild(nw);
-        //TODO don't assume SOAP 1.1
-        else smc.setEnvelope(OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope(builder));
-
-        } catch (Exception e) {
-            throw new SynapseException(e);
-        }
-        return true;
-    }
-
-    /**
-     * @param b
-     * <p> If isBody is true then the XSLT is applied to the Body of the SOAP message, otherwise to the whole env
-     */
-    public void setIsBody(boolean b) {
-        isBody  = b;
-    }
-
-
-    /**
-     * @param is
-     * <p>
-     * This sets the correct XSL transform
-     */
-    public void setXSLInputStream(InputStream is) {
-        try {
-            Source src = new StreamSource(is);
-            tran = TransformerFactory.newInstance().newTransformer(src);
-        } catch (Exception e) {
-            throw new SynapseException(e);
-
-        }
-    }
-
-}
-
-	
Index: modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java	(working copy)
@@ -1,56 +0,0 @@
-package org.apache.synapse.mediators.builtin.xslt;
-
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.xml.AbstractMediatorFactory;
-import org.apache.synapse.xml.Constants;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-
-
-
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-
-/**
- *
- * @see org.apache.synapse.mediators.base.builtin.xslt.XSLTProcessor
- * <p> This class configures the XSLT transformer 
- * <p> The tag looks like this
- * <xmp><xslt name="x" xsl="file.xsl" type="body|envelope"/></xmp>
- *  Perform the given XSLT on the SOAP-Envelope or Body 
- *  <p>If type is not present, assumed to be body
- */
-public class XSLTMediatorFactory extends AbstractMediatorFactory {
-    private static final QName tagName = new QName(Constants.SYNAPSE_NAMESPACE, "xslt");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        XSLTMediator xm = new XSLTMediator();
-        super.setNameOnMediator(se,el,xm);
-
-        OMAttribute type = el.getAttribute(new QName("type"));
-        if (type != null && type.getAttributeValue().trim().toLowerCase().equals("envelope")) xm.setIsBody(false);
-        else xm.setIsBody(true);
-
-        OMAttribute xsl = el.getAttribute(new QName("xsl"));
-        if (xsl == null) throw new SynapseException("no xsl attribute on: "+el.toString());
-
-        InputStream xslStream =  se.getClassLoader().getResourceAsStream(xsl.getAttributeValue());
-        xm.setXSLInputStream(xslStream);
-
-        return xm;
-
-    }
-
-    public QName getTagQName() {
-
-        return tagName;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediator.java	(working copy)
@@ -1,91 +0,0 @@
-package org.apache.synapse.mediators.builtin.xslt;
-
-
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAbstractFactory;
-
-/**
- *
- * @see org.apache.synapse.mediators.base.builtin.xslt.XSLTProcessorConfigurator
- * <p> This class is the class that transforms messages using XSLT. 
- *   
-
- *
- */
-public class XSLTMediator implements Mediator {
-
-    private Transformer tran = null;
-
-    private boolean isBody = false;
-
-    public boolean mediate(SynapseMessage smc) {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xsw;
-        try {
-            xsw = XMLOutputFactory.newInstance().createXMLStreamWriter(baos);
-
-        if (isBody) smc.getEnvelope().getBody().serialize(xsw);
-        else smc.getEnvelope().serialize(xsw);
-
-        Source src = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
-        ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
-        StreamResult result = new StreamResult(baos2);
-        tran.transform(src, result);
-        StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baos2.toByteArray()));
-        OMElement nw = builder.getDocumentElement();
-        if (isBody) smc.getEnvelope().setFirstChild(nw);
-        //TODO don't assume SOAP 1.1
-        else smc.setEnvelope(OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope(builder));
-
-        } catch (Exception e) {
-            throw new SynapseException(e);
-        }
-        return true;
-    }
-
-    /**
-     * @param b
-     * <p> If isBody is true then the XSLT is applied to the Body of the SOAP message, otherwise to the whole env
-     */
-    public void setIsBody(boolean b) {
-        isBody  = b;
-    }
-
-
-    /**
-     * @param is
-     * <p>
-     * This sets the correct XSL transform
-     */
-    public void setXSLInputStream(InputStream is) {
-        try {
-            Source src = new StreamSource(is);
-            tran = TransformerFactory.newInstance().newTransformer(src);
-        } catch (Exception e) {
-            throw new SynapseException(e);
-
-        }
-    }
-
-}
-
-	
Index: modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/builtin/xslt/XSLTMediatorFactory.java	(working copy)
@@ -1,56 +0,0 @@
-package org.apache.synapse.mediators.builtin.xslt;
-
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.xml.AbstractMediatorFactory;
-import org.apache.synapse.xml.Constants;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-
-
-
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-
-/**
- *
- * @see org.apache.synapse.mediators.base.builtin.xslt.XSLTProcessor
- * <p> This class configures the XSLT transformer 
- * <p> The tag looks like this
- * <xmp><xslt name="x" xsl="file.xsl" type="body|envelope"/></xmp>
- *  Perform the given XSLT on the SOAP-Envelope or Body 
- *  <p>If type is not present, assumed to be body
- */
-public class XSLTMediatorFactory extends AbstractMediatorFactory {
-    private static final QName tagName = new QName(Constants.SYNAPSE_NAMESPACE, "xslt");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        XSLTMediator xm = new XSLTMediator();
-        super.setNameOnMediator(se,el,xm);
-
-        OMAttribute type = el.getAttribute(new QName("type"));
-        if (type != null && type.getAttributeValue().trim().toLowerCase().equals("envelope")) xm.setIsBody(false);
-        else xm.setIsBody(true);
-
-        OMAttribute xsl = el.getAttribute(new QName("xsl"));
-        if (xsl == null) throw new SynapseException("no xsl attribute on: "+el.toString());
-
-        InputStream xslStream =  se.getClassLoader().getResourceAsStream(xsl.getAttributeValue());
-        xm.setXSLInputStream(xslStream);
-
-        return xm;
-
-    }
-
-    public QName getTagQName() {
-
-        return tagName;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(working copy)
@@ -13,52 +13,100 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.synapse.mediators.ext;
 
-package org.apache.synapse.mediators.types;
-
-
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.Util;
 import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.lang.reflect.Method;
 
 /**
+ * The class mediator delegates the mediation to a new instance of a specified class. The specified class
+ * must implement the Mediator interface
  *
- * 
- * This executes the "mediate" operation on a new instance of the specified class
- * 
- * TODO add support for simple properties to be set
- *
+ * @see Mediator
  */
-public class ClassMediator implements Mediator{
+public class ClassMediator extends AbstractMediator {
 
-	private Class clazz = null;
+    private static final Log log = LogFactory.getLog(ClassMediator.class);
 
-	
+    private Class clazz = null;
+    private List properties = new ArrayList();
 
-	public boolean mediate(SynapseMessage smc) {
-		Mediator m = null;
+    /**
+     * Delegate mediation to a new instance of the specified class
+     * @param synCtx the message context
+     * @return as per standard semantics
+     */
+    public boolean mediate(SynapseContext synCtx) {
 
-		try {
-			m = (Mediator) getClazz().newInstance();
-		} catch (Exception e) {
-			throw new SynapseException(e);
-		}
-		/*if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
-			((EnvironmentAware) m).setSynapseEnvironment(se);
-		}*/
-		return m.mediate(smc);
+        log.debug(getType() + " mediate()");
+        Mediator m = null;
+        try {
+            m = (Mediator) clazz.newInstance();
 
-	}
+        } catch (Exception e) {
+            String msg = "Error while creating an instance of the specified mediator class : " + clazz.getName();
+            log.error(msg, e);
+            throw new SynapseException(msg, e);
+        }
 
-	
-	public void setClazz(Class clazz) {
-		this.clazz = clazz;
-	}
+        setProperties(m, synCtx);
 
-	public Class getClazz() {
-		return clazz;
-	}
+        return m.mediate(synCtx);
+    }
 
+    /**
+     * Only String properties are supported
+     * @param m the mediator
+     */
+    private void setProperties(Mediator m, SynapseContext synCtx) {
+        Iterator iter = properties.iterator();
+        while (iter.hasNext()) {
+            MediatorProperty mProp = (MediatorProperty) iter.next();
+
+            String mName = "set" + Character.toUpperCase(mProp.getName().charAt(0)) + mProp.getName().substring(1);
+            String value = (mProp.getValue() != null ?
+                mProp.getValue() :
+                Util.getStringValue(mProp.getExpression(), synCtx));
+
+
+            try {
+                Method method = m.getClass().getMethod(mName, new Class[] {String.class});
+                method.invoke(m, new Object[] { value });
+
+            } catch (Exception e) {
+                String msg = "Error setting property : " + mProp.getName() + " as a String property into class" +
+                    " mediator : " + m.getClass() + " : " + e.getMessage();
+                log.error(msg);
+                throw new SynapseException(msg, e);
+            }
+        }
+    }
+
+    public void setClazz(Class clazz) {
+        this.clazz = clazz;
+    }
+
+    public Class getClazz() {
+        return clazz;
+    }
+
+    public void addProperty(MediatorProperty p) {
+        properties.add(p);
+    }
+
+    public void addAllProperties(List list) {
+        properties.addAll(list);
+    }
+
 }
Index: modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(working copy)
@@ -13,52 +13,100 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.synapse.mediators.ext;
 
-package org.apache.synapse.mediators.types;
-
-
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.Util;
 import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.lang.reflect.Method;
 
 /**
+ * The class mediator delegates the mediation to a new instance of a specified class. The specified class
+ * must implement the Mediator interface
  *
- * 
- * This executes the "mediate" operation on a new instance of the specified class
- * 
- * TODO add support for simple properties to be set
- *
+ * @see Mediator
  */
-public class ClassMediator implements Mediator{
+public class ClassMediator extends AbstractMediator {
 
-	private Class clazz = null;
+    private static final Log log = LogFactory.getLog(ClassMediator.class);
 
-	
+    private Class clazz = null;
+    private List properties = new ArrayList();
 
-	public boolean mediate(SynapseMessage smc) {
-		Mediator m = null;
+    /**
+     * Delegate mediation to a new instance of the specified class
+     * @param synCtx the message context
+     * @return as per standard semantics
+     */
+    public boolean mediate(SynapseContext synCtx) {
 
-		try {
-			m = (Mediator) getClazz().newInstance();
-		} catch (Exception e) {
-			throw new SynapseException(e);
-		}
-		/*if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
-			((EnvironmentAware) m).setSynapseEnvironment(se);
-		}*/
-		return m.mediate(smc);
+        log.debug(getType() + " mediate()");
+        Mediator m = null;
+        try {
+            m = (Mediator) clazz.newInstance();
 
-	}
+        } catch (Exception e) {
+            String msg = "Error while creating an instance of the specified mediator class : " + clazz.getName();
+            log.error(msg, e);
+            throw new SynapseException(msg, e);
+        }
 
-	
-	public void setClazz(Class clazz) {
-		this.clazz = clazz;
-	}
+        setProperties(m, synCtx);
 
-	public Class getClazz() {
-		return clazz;
-	}
+        return m.mediate(synCtx);
+    }
 
+    /**
+     * Only String properties are supported
+     * @param m the mediator
+     */
+    private void setProperties(Mediator m, SynapseContext synCtx) {
+        Iterator iter = properties.iterator();
+        while (iter.hasNext()) {
+            MediatorProperty mProp = (MediatorProperty) iter.next();
+
+            String mName = "set" + Character.toUpperCase(mProp.getName().charAt(0)) + mProp.getName().substring(1);
+            String value = (mProp.getValue() != null ?
+                mProp.getValue() :
+                Util.getStringValue(mProp.getExpression(), synCtx));
+
+
+            try {
+                Method method = m.getClass().getMethod(mName, new Class[] {String.class});
+                method.invoke(m, new Object[] { value });
+
+            } catch (Exception e) {
+                String msg = "Error setting property : " + mProp.getName() + " as a String property into class" +
+                    " mediator : " + m.getClass() + " : " + e.getMessage();
+                log.error(msg);
+                throw new SynapseException(msg, e);
+            }
+        }
+    }
+
+    public void setClazz(Class clazz) {
+        this.clazz = clazz;
+    }
+
+    public Class getClazz() {
+        return clazz;
+    }
+
+    public void addProperty(MediatorProperty p) {
+        properties.add(p);
+    }
+
+    public void addAllProperties(List list) {
+        properties.addAll(list);
+    }
+
 }
Index: modules/core/src/org/apache/synapse/mediators/filters/AbstractFilterMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/AbstractFilterMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/filters/AbstractFilterMediator.java	(working copy)
@@ -1,53 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.filters;
-
-
-
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseMessageConstants;
-import org.apache.synapse.mediators.base.AbstractListMediator;
-
-
-/**
- *	This is a base type for "conditional" mediators. Any mediator that is used in "only once"
- *  processing should be an extension of this. This makes sure that the matched property gets set properly
- *  
- *        
- */
-public abstract class AbstractFilterMediator extends AbstractListMediator {
-
-	//private Log log = LogFactory.getLog(getClass());
-
-	public boolean mediate(SynapseMessage smc) {
-		if (this.test(smc)) {
-		    smc.setProperty(SynapseMessageConstants.MATCHED,Boolean.TRUE);
-		    return super.mediate(smc);
-		}
-		else
-		{
-			 smc.setProperty(SynapseMessageConstants.MATCHED,Boolean.FALSE);
-			 return true;
-		}
-	}
-	
-	public abstract boolean test(SynapseMessage sm);
-	
-
-	
-}
Index: modules/core/src/org/apache/synapse/mediators/filters/DefaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/DefaultMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/filters/DefaultMediator.java	(working copy)
@@ -1,26 +0,0 @@
-package org.apache.synapse.mediators.filters;
-
-import org.apache.synapse.SynapseMessage;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class DefaultMediator extends AbstractFilterMediator {
-   
-	public boolean test(SynapseMessage sm) {
-		return true;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/filters/ExactlyOneMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/ExactlyOneMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/filters/ExactlyOneMediator.java	(working copy)
@@ -1,53 +0,0 @@
-package org.apache.synapse.mediators.filters;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseMessageConstants;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.AbstractListMediator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Corresponding to <exactly/> This conatins conditional mediators such as
- * <regex/> and <xpath/> It will look for the first match, if the first match is
- * true then all the other mediators listed thereafter will be ingnored
- */
-public class ExactlyOneMediator extends AbstractListMediator {
-
-	private Log log = LogFactory.getLog(getClass());
-
-public boolean mediate( SynapseMessage smc) {
-        log.debug("ExactlyOneMediator");
-        List mediators = getList(); // from parent
-        if (mediators == null || mediators.size()==0) {
-            log.info("no mediators called -  empty list");
-            return true;
-        }
-        Iterator it = mediators.iterator();
-                
-        while (it.hasNext()) {
-            Mediator m = (Mediator) it.next();
-            log.debug(m.getClass());
-            
-            boolean cont = m.mediate(smc);
-            if (!cont) return false; // if any mediator says finish then
-										// finish
-            
-            if (smc.getProperty(SynapseMessageConstants.MATCHED) == null) {
-            	// should never get here --- famous last words.
-            	log.error("Condition mediator "+m.getClass()+" did not properly signal matching");
-            	return true;  
-            }
-            	
-            boolean matched = ((Boolean) smc.getProperty(
-                         SynapseMessageConstants.MATCHED))
-                         .booleanValue();
-            if (matched) return true;      
-        }
-        return true;
-    }
-}
Index: modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java	(revision 0)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.mediators.filters;
+
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.Util;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import java.util.regex.Pattern;
+
+/**
+ * The filter mediator combines the regex and xpath filtering functionality. If an xpath
+ * is set, it is evaluated; else the given regex is evaluated against the source xpath.
+ */
+public class FilterMediator extends AbstractListMediator implements org.apache.synapse.api.FilterMediator {
+
+    private static final Log log = LogFactory.getLog(FilterMediator.class);
+    private AXIOMXPath source = null;
+    private Pattern regex = null;
+    private AXIOMXPath xpath = null;
+
+    /**
+     * Executes the list of sub/child mediators, if the filter condition is satisfied
+     * @param synCtx the current message
+     * @return true if filter condition fails. else returns as per List mediator semantics
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        if (test(synCtx)) {
+            return super.mediate(synCtx);
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * Tests the supplied condition after evaluation against the given XPath
+     * or Regex (against a source XPath). When a regular expression is supplied
+     * the source XPath is evaluated into a String value, and matched against
+     * the given regex
+     * @param synCtx the current message for evaluation of the test condition
+     * @return true if evaluation of the XPath/Regex results in true
+     */
+    public boolean test(SynapseContext synCtx) {
+        try {
+            if (xpath != null) {
+                return xpath.booleanValueOf(synCtx.getSynapseMessage().getEnvelope());
+
+            } else if (source != null && regex != null) {
+                return regex.matcher(Util.getStringValue(source, synCtx)).matches();
+
+            } else {
+                log.error("Invalid configuration specified");
+                return false;
+            }
+
+        } catch (JaxenException e) {
+            log.error("XPath error : " + e.getMessage());
+            return false;
+        }
+    }
+
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    public Pattern getRegex() {
+        return regex;
+    }
+
+    public void setRegex(Pattern regex) {
+        this.regex = regex;
+    }
+
+    public AXIOMXPath getXpath() {
+        return xpath;
+    }
+
+    public void setXpath(AXIOMXPath xpath) {
+        this.xpath = xpath;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/mediators/filters/RegexMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/RegexMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/filters/RegexMediator.java	(working copy)
@@ -1,102 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.filters;
-
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.synapse.HeaderType;
-import org.apache.synapse.SynapseMessage;
-
-
-
-/**
- *
- * <p>
- * This checks the pattern against a property and if true processes the message with its child or children
- * <p>
- * TODO add to the set of properties you can search
- * 
- * 
- */
-public class RegexMediator extends AbstractFilterMediator {
-	private Pattern pattern = null;
-
-	private Log log = LogFactory.getLog(getClass());
-
-	private HeaderType headerType = new HeaderType();
-
-	private String property = null;
-
-	public void setHeaderType(String header) {
-		headerType.setHeaderType(header);
-	}
-
-	public String getHeaderType() {
-		return headerType.getHeaderType();
-	}
-
-	public void setPattern(String p) {
-		pattern = Pattern.compile(p);
-	}
-
-	public String getPattern() {
-		return pattern.toString();
-	}
-
-	public void setPropertyName(String p) {
-		this.property = p;
-	}
-
-	public String getPropertyName() {
-		return property;
-	}
-
-	public boolean test(SynapseMessage smc) {
-
-		if (pattern == null) {
-			log.debug("trying to process with empty pattern");
-			return true;
-		}
-
-        String toMatch;
-		if (property != null) {
-			toMatch = smc.getProperty(property).toString();
-		} else {
-			toMatch = headerType.getHeader(smc);
-		}
-
-		if (toMatch==null) return false;  
-
-		if (pattern.matcher(toMatch).matches()) {
-            if (log.isDebugEnabled()) {
-                log.debug("Regex pattern " + pattern.pattern() + " matched "
-                        + toMatch);
-            }
-            return true;
-		}
-
-        if (log.isDebugEnabled()) {
-            log.debug("Regex pattern '" + pattern.pattern() +
-                    "' failed to match '" + toMatch);
-        }
-        return false;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/filters/SwitchCaseMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/SwitchCaseMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/filters/SwitchCaseMediator.java	(revision 0)
@@ -0,0 +1,50 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.filters;
+
+import org.apache.synapse.mediators.AbstractListMediator;
+
+import java.util.regex.Pattern;
+
+/**
+ * A SwitchCaseMediator is a list mediator which has a regex that is matched by
+ * its owning SwitchMediator for selection
+ */
+public class SwitchCaseMediator extends AbstractListMediator {
+
+    private Pattern regex = null;
+    private boolean defaultCase = false;
+
+    public Pattern getRegex() {
+        return regex;
+    }
+
+    public void setRegex(Pattern regex) {
+        this.regex = regex;
+    }
+
+    public boolean isDefaultCase() {
+        return defaultCase;
+    }
+
+    public void setDefaultCase(boolean defaultCase) {
+        this.defaultCase = defaultCase;
+    }
+
+    public boolean matches(String value) {
+        return regex.matcher(value).matches();
+    }
+}
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/mediators/filters/SwitchMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/SwitchMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/filters/SwitchMediator.java	(revision 0)
@@ -0,0 +1,78 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.filters;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.Util;
+import org.apache.synapse.api.Mediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+
+import java.util.regex.Pattern;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * The switch mediator implements the functionality of the "switch" contruct. It first
+ * evaluates the given XPath expression into a String value, and performs a match against
+ * the given list of cases. This is actually a list of sequences, and depending on the
+ * selected case, the selected sequence gets executed.
+ */
+public class SwitchMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(SwitchMediator.class);
+
+    private AXIOMXPath source = null;
+    private List cases = new ArrayList();
+    private SwitchCaseMediator defaultCase = null;
+
+    /**
+     * Iterate over switch cases and find match and execute selected sequence
+     * @param synCtx current context
+     * @return as per standard semantics
+     */
+    public boolean mediate(SynapseContext synCtx) {
+
+        String sourceText = Util.getStringValue(source, synCtx);
+        Iterator iter = cases.iterator();
+
+        while (iter.hasNext()) {
+            SwitchCaseMediator swCase = (SwitchCaseMediator) iter.next();
+            if (swCase.matches(sourceText)) {
+                return swCase.mediate(synCtx);
+            }
+        }
+
+        if (defaultCase != null) {
+            return defaultCase.mediate(synCtx);
+        }
+
+        return true;
+    }
+
+    /**
+     * Adds the given mediator (Should be a SwitchCaseMediator) to the list of cases
+     * of this Switch mediator
+     * @param m the SwitchCaseMediator instance to be added
+     */
+    public void addCase(SwitchCaseMediator m) {
+        cases.add(m);
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/filters/XPathMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/XPathMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/filters/XPathMediator.java	(working copy)
@@ -1,85 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.filters;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseMessageConstants;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.jaxen.JaxenException;
-
-/**
- *
- * 
- * <p>
- * This class executes an XPath test against the message envelope and then processes all subsequent rules/mediations
- * if the test is true
- * <p>
- * TODO add the context into the XPath matching space
- * 
- */
-public class XPathMediator extends AbstractFilterMediator {
-
-	private Log log = LogFactory.getLog(getClass());
-
-	private AXIOMXPath xp = null;
-
-
-	public boolean test(SynapseMessage smc) {
-		if (xp == null) {
-			log.debug("trying to process xpath without being set");
-			return true;
-		}
-		try {
-			if (xp.booleanValueOf(smc.getEnvelope())) {
-				log.debug("matched xpath: " + xp.toString());
-				// now do "all"
-                smc.setProperty(SynapseMessageConstants.MATCHED,Boolean.TRUE);
-                return true;
-			}
-
-		} catch (JaxenException je) {
-			throw new SynapseException("Problem evaluating " + xp.toString(),
-					je);
-		}
-		return false;
-	}
-
-	public void setXPathExpr(String expr) {
-		try {
-			xp = new AXIOMXPath(expr);
-		} catch (JaxenException je) {
-			throw new SynapseException(je);
-		}
-	}
-
-	public String getXPathExpr() {
-		return xp.toString();
-	}
-
-	public void addXPathNamespace(String prefix, String uri) {
-		try {
-			xp.addNamespace(prefix, uri);
-		} catch (JaxenException je) {
-			throw new SynapseException(je);
-		}
-
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/MediatorProperty.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/MediatorProperty.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/MediatorProperty.java	(revision 0)
@@ -0,0 +1,71 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.config.xml.Constants;
+import org.apache.synapse.Util;
+import org.apache.synapse.SynapseContext;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A mediator property is a name-value or name-expression pair which could be supplied
+ * for certain mediators. If expressions are supplied they are evaluated at the runtime
+ * against the current message into literal String values.
+ */
+public class MediatorProperty {
+
+    public static final QName PROPERTY_Q  = new QName(Constants.SYNAPSE_NAMESPACE, "property");
+    public static final QName ATT_NAME_Q  = new QName(Constants.NULL_NAMESPACE, "name");
+    public static final QName ATT_VALUE_Q = new QName(Constants.NULL_NAMESPACE, "value");
+    public static final QName ATT_EXPR_Q  = new QName(Constants.NULL_NAMESPACE, "expression");
+
+    private String name;
+    private String value;
+    private AXIOMXPath expression;
+
+    public MediatorProperty() {}
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public AXIOMXPath getExpression() {
+        return expression;
+    }
+
+    public void setExpression(AXIOMXPath expression) {
+        this.expression = expression;
+    }
+
+    public String getEvaluatedExpression(SynapseContext synCtx) {
+        return Util.getStringValue(expression, synCtx);
+    }
+
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(revision 0)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.mediators.transform;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.soap.*;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.mediators.AbstractMediator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This transforms the current message instance into a SOAP Fault message. If the
+ * original message was SOAP 1.1 the fault will also be SOAP 1.1 else, SOAP 1.2
+ *
+ * TODO this class needs more attention! - revisit later
+ */
+public class FaultMediator extends AbstractMediator {
+    
+    private static final Log log = LogFactory.getLog(FaultMediator.class);
+
+    public static final int SOAP11 = 1;
+    public static final int SOAP12 = 2;
+
+    private int soapVersion;
+    private QName code;
+    private String reason;
+
+    //TODO support SOAP 1.2 fault stuff..
+    //Node, Role, detail etc
+
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        SynapseMessage synMsg = synCtx.getSynapseMessage();
+        SOAPEnvelope envelop = synMsg.getEnvelope();
+        SOAPFactory factory;
+
+        switch (soapVersion) {
+            case SOAP11:
+                factory = OMAbstractFactory.getSOAP11Factory();
+                break;
+            case SOAP12:
+                factory = OMAbstractFactory.getSOAP12Factory();
+                break;
+            default : {
+                if (envelop != null) {
+                    if (envelop.getNamespace().getName().equals(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                        factory = OMAbstractFactory.getSOAP12Factory();
+                    } else {
+                        factory = OMAbstractFactory.getSOAP11Factory();
+                    }
+                } else {
+                    factory = OMAbstractFactory.getSOAP11Factory();
+                }
+            }
+        }
+
+        OMDocument soapFaultDocument = factory.createOMDocument();
+        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+        soapFaultDocument.addChild(faultEnvelope);
+
+        /*SOAPFaultReason reason = factory.createSOAPFaultReason();
+        reason.setText(getReason());
+
+        SOAPFault fault = factory.createSOAPFault();
+        fault.setReason(reason);
+
+        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+        faultEnvelope.getBody().addFault(fault);*/
+
+        // set the fault message to the "faultTo" of the original message if it exists
+        // else to the "replyTo"
+        EndpointReference toEPR = synMsg.getTo();
+        EndpointReference faultToEPR = synMsg.getFaultTo();
+        if (faultToEPR != null) {
+            synMsg.setTo(faultToEPR);
+            synMsg.setReplyTo(toEPR);
+        } else {
+            EndpointReference replyToEPR = synMsg.getReplyTo();
+            synMsg.setTo(replyToEPR);
+            synMsg.setReplyTo(toEPR);
+        }
+        synMsg.setResponse(true);
+
+        try {
+            synMsg.setEnvelope(faultEnvelope);
+        } catch (AxisFault af) {
+            String msg = "Error replacing SOAP envelope with a fault envelope " + af.getMessage();
+            log.error(msg);
+            throw new SynapseException(af);
+        }
+        return true;
+    }
+
+    public QName getCode() {
+        return code;
+    }
+
+    public void setCode(QName code) {
+        this.code = code;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public int getSoapVersion() {
+        return soapVersion;
+    }
+
+    public void setSoapVersion(int soapVersion) {
+        this.soapVersion = soapVersion;
+    }
+
+
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java	(revision 0)
@@ -0,0 +1,176 @@
+package org.apache.synapse.mediators.transform;
+
+
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.*;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * The transform mediator performs an XSLT or XQuery transformation requested, using
+ * the current message. The source attribute (if available) spcifies the source element
+ * on which the transformation would be applied. Additional properties passed into this
+ * mediator would become parameters (for XSLT) or variables (XQuery).
+ */
+public class TransformMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(TransformMediator.class);
+
+    private URL xsltUrl = null;
+    private URL xQueryUrl = null;
+    private AXIOMXPath source = null;
+
+    /**
+     * Transforms this message (or its element specified as the source) using the
+     * given XSLT or XQuery transformation
+     * @param synCtx the current message where the transformation will apply
+     * @return true always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+
+        if (xsltUrl != null) {
+            performXLST(synCtx.getSynapseMessage());
+            return true;
+
+        } else if (xQueryUrl != null) {
+            //TODO later revisit later
+            System.err.println("Unimplemented functionality..");
+            return true;
+
+        } else {
+            log.error("Invalid configuration - xslt/xq not specified");
+            return false;
+        }
+    }
+
+    private void performXLST(SynapseMessage synMsg) {
+        try {
+            // create a transformer
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(
+                new StreamSource(xsltUrl.openStream()));
+
+            // create a byte array output stream and serialize the source node into it
+            ByteArrayOutputStream baosForSource = new ByteArrayOutputStream();
+            XMLStreamWriter xsWriterForSource = XMLOutputFactory.newInstance().createXMLStreamWriter(baosForSource);
+
+            OMNode sourceNode = getTransformSource(synMsg);
+            sourceNode.serialize(xsWriterForSource);
+            Source transformSrc = new StreamSource(new ByteArrayInputStream(baosForSource.toByteArray()));
+
+            // create a new Stream result over a new BAOS..
+            ByteArrayOutputStream baosForTarget = new ByteArrayOutputStream();
+            StreamResult transformTgt = new StreamResult(baosForTarget);
+
+            // perform transformation
+            transformer.transform(transformSrc, transformTgt);
+
+            StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baosForTarget.toByteArray()));
+            OMContainer parent = sourceNode.getParent();
+
+            if (parent instanceof SOAPEnvelope) {
+                ((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
+                ((SOAPEnvelope) parent).getBody().setFirstChild(builder.getDocumentElement());
+            } else {
+                parent.getFirstOMChild().detach();
+                parent.addChild(builder.getDocumentElement());
+            }
+
+        } catch (MalformedURLException mue) {
+            handleException(mue);
+        } catch (TransformerConfigurationException tce) {
+            handleException(tce);
+        } catch (XMLStreamException xse) {
+            handleException(xse);
+        } catch (TransformerException te) {
+            handleException(te);
+        } catch (IOException ioe) {
+            handleException(ioe);
+        }
+    }
+
+    private OMNode getTransformSource(SynapseMessage synMsg) {
+
+        if (source == null) {
+            try {
+                source = new AXIOMXPath("//SOAP-ENV:Body");
+                source.addNamespace("SOAP-ENV", synMsg.isSOAP11() ?
+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            } catch (JaxenException e) {}
+        }
+
+        try {
+            Object o = source.evaluate(synMsg.getEnvelope());;
+            if (o instanceof OMNode) {
+                return (OMNode) o;
+            } else if (o instanceof List && !((List) o).isEmpty()) {
+                return (OMNode) ((List) o).get(0);  // Always fetches *only* the first
+            } else {
+                String msg = "The evaluation of the XPath expression " + source + " must result in an OMNode";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } catch (JaxenException e) {
+            String msg = "Error evaluating XPath " + source + " on message";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+    private void handleException(Exception e) {
+        String msg = "Error performing XSLT/XQ transformation " + e.getMessage();
+        log.error(msg);
+        throw new SynapseException(msg, e);
+    }
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    public URL getXsltUrl() {
+        return xsltUrl;
+    }
+
+    public void setXsltUrl(URL xsltUrl) {
+        this.xsltUrl = xsltUrl;
+    }
+
+    public URL getXQueryUrl() {
+        return xQueryUrl;
+    }
+
+    public void setXQueryUrl(URL xQueryUrl) {
+        this.xQueryUrl = xQueryUrl;
+    }
+
+}
+
+	
Index: modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java	(revision 0)
@@ -0,0 +1,101 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.transform;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.HeaderType;
+import org.apache.synapse.Util;
+import org.apache.synapse.SynapseContext;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The header mediator is able to set a given value as a SOAP header, or remove a given
+ * header from the current message instance. This supports the headers currently
+ * supported by the HeaderType class. If an expression is supplied, its runtime value
+ * is evaluated using the current message. Unless the action is set to remove, the
+ * default behaviour of this mediator is to set a header value.
+ *
+ * @see HeaderType
+ */
+public class HeaderMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(HeaderMediator.class);
+
+    public static final int ACTION_SET = 0;
+    public static final int ACTION_REMOVE = 1;
+
+    private String name = null;
+    private String value = null;
+    private int action = ACTION_SET;
+
+    private AXIOMXPath expression = null;
+    private HeaderType headerType = new HeaderType();
+
+    /**
+     * Sets/Removes a SOAP header on the current message
+     *
+     * @param synCtx the current message which is altered as necessary
+     * @return true always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+
+        if (action == ACTION_SET) {
+            headerType.setHeader(synCtx.getSynapseMessage(),
+                (getValue() != null ? getValue() :
+                    Util.getStringValue(getExpression(), synCtx)));
+
+        } else {
+            headerType.removeHeader(synCtx.getSynapseMessage());
+        }
+        return true;
+    }
+
+    public int getAction() {
+        return action;
+    }
+
+    public void setAction(int action) {
+        this.action = action;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+        this.headerType.setHeaderType(name);
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public AXIOMXPath getExpression() {
+        return expression;
+    }
+
+    public void setExpression(AXIOMXPath expression) {
+        this.expression = expression;
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(revision 0)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.synapse.mediators.transform;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.soap.*;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.mediators.AbstractMediator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This transforms the current message instance into a SOAP Fault message. If the
+ * original message was SOAP 1.1 the fault will also be SOAP 1.1 else, SOAP 1.2
+ *
+ * TODO this class needs more attention! - revisit later
+ */
+public class FaultMediator extends AbstractMediator {
+    
+    private static final Log log = LogFactory.getLog(FaultMediator.class);
+
+    public static final int SOAP11 = 1;
+    public static final int SOAP12 = 2;
+
+    private int soapVersion;
+    private QName code;
+    private String reason;
+
+    //TODO support SOAP 1.2 fault stuff..
+    //Node, Role, detail etc
+
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+        SynapseMessage synMsg = synCtx.getSynapseMessage();
+        SOAPEnvelope envelop = synMsg.getEnvelope();
+        SOAPFactory factory;
+
+        switch (soapVersion) {
+            case SOAP11:
+                factory = OMAbstractFactory.getSOAP11Factory();
+                break;
+            case SOAP12:
+                factory = OMAbstractFactory.getSOAP12Factory();
+                break;
+            default : {
+                if (envelop != null) {
+                    if (envelop.getNamespace().getName().equals(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                        factory = OMAbstractFactory.getSOAP12Factory();
+                    } else {
+                        factory = OMAbstractFactory.getSOAP11Factory();
+                    }
+                } else {
+                    factory = OMAbstractFactory.getSOAP11Factory();
+                }
+            }
+        }
+
+        OMDocument soapFaultDocument = factory.createOMDocument();
+        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+        soapFaultDocument.addChild(faultEnvelope);
+
+        /*SOAPFaultReason reason = factory.createSOAPFaultReason();
+        reason.setText(getReason());
+
+        SOAPFault fault = factory.createSOAPFault();
+        fault.setReason(reason);
+
+        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+        faultEnvelope.getBody().addFault(fault);*/
+
+        // set the fault message to the "faultTo" of the original message if it exists
+        // else to the "replyTo"
+        EndpointReference toEPR = synMsg.getTo();
+        EndpointReference faultToEPR = synMsg.getFaultTo();
+        if (faultToEPR != null) {
+            synMsg.setTo(faultToEPR);
+            synMsg.setReplyTo(toEPR);
+        } else {
+            EndpointReference replyToEPR = synMsg.getReplyTo();
+            synMsg.setTo(replyToEPR);
+            synMsg.setReplyTo(toEPR);
+        }
+        synMsg.setResponse(true);
+
+        try {
+            synMsg.setEnvelope(faultEnvelope);
+        } catch (AxisFault af) {
+            String msg = "Error replacing SOAP envelope with a fault envelope " + af.getMessage();
+            log.error(msg);
+            throw new SynapseException(af);
+        }
+        return true;
+    }
+
+    public QName getCode() {
+        return code;
+    }
+
+    public void setCode(QName code) {
+        this.code = code;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public int getSoapVersion() {
+        return soapVersion;
+    }
+
+    public void setSoapVersion(int soapVersion) {
+        this.soapVersion = soapVersion;
+    }
+
+
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java	(revision 0)
@@ -0,0 +1,101 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.transform;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.HeaderType;
+import org.apache.synapse.Util;
+import org.apache.synapse.SynapseContext;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The header mediator is able to set a given value as a SOAP header, or remove a given
+ * header from the current message instance. This supports the headers currently
+ * supported by the HeaderType class. If an expression is supplied, its runtime value
+ * is evaluated using the current message. Unless the action is set to remove, the
+ * default behaviour of this mediator is to set a header value.
+ *
+ * @see HeaderType
+ */
+public class HeaderMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(HeaderMediator.class);
+
+    public static final int ACTION_SET = 0;
+    public static final int ACTION_REMOVE = 1;
+
+    private String name = null;
+    private String value = null;
+    private int action = ACTION_SET;
+
+    private AXIOMXPath expression = null;
+    private HeaderType headerType = new HeaderType();
+
+    /**
+     * Sets/Removes a SOAP header on the current message
+     *
+     * @param synCtx the current message which is altered as necessary
+     * @return true always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+
+        if (action == ACTION_SET) {
+            headerType.setHeader(synCtx.getSynapseMessage(),
+                (getValue() != null ? getValue() :
+                    Util.getStringValue(getExpression(), synCtx)));
+
+        } else {
+            headerType.removeHeader(synCtx.getSynapseMessage());
+        }
+        return true;
+    }
+
+    public int getAction() {
+        return action;
+    }
+
+    public void setAction(int action) {
+        this.action = action;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+        this.headerType.setHeaderType(name);
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public AXIOMXPath getExpression() {
+        return expression;
+    }
+
+    public void setExpression(AXIOMXPath expression) {
+        this.expression = expression;
+    }
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java	(revision 0)
+++ modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java	(revision 0)
@@ -0,0 +1,176 @@
+package org.apache.synapse.mediators.transform;
+
+
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.*;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * The transform mediator performs an XSLT or XQuery transformation requested, using
+ * the current message. The source attribute (if available) spcifies the source element
+ * on which the transformation would be applied. Additional properties passed into this
+ * mediator would become parameters (for XSLT) or variables (XQuery).
+ */
+public class TransformMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(TransformMediator.class);
+
+    private URL xsltUrl = null;
+    private URL xQueryUrl = null;
+    private AXIOMXPath source = null;
+
+    /**
+     * Transforms this message (or its element specified as the source) using the
+     * given XSLT or XQuery transformation
+     * @param synCtx the current message where the transformation will apply
+     * @return true always
+     */
+    public boolean mediate(SynapseContext synCtx) {
+        log.debug(getType() + " mediate()");
+
+        if (xsltUrl != null) {
+            performXLST(synCtx.getSynapseMessage());
+            return true;
+
+        } else if (xQueryUrl != null) {
+            //TODO later revisit later
+            System.err.println("Unimplemented functionality..");
+            return true;
+
+        } else {
+            log.error("Invalid configuration - xslt/xq not specified");
+            return false;
+        }
+    }
+
+    private void performXLST(SynapseMessage synMsg) {
+        try {
+            // create a transformer
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(
+                new StreamSource(xsltUrl.openStream()));
+
+            // create a byte array output stream and serialize the source node into it
+            ByteArrayOutputStream baosForSource = new ByteArrayOutputStream();
+            XMLStreamWriter xsWriterForSource = XMLOutputFactory.newInstance().createXMLStreamWriter(baosForSource);
+
+            OMNode sourceNode = getTransformSource(synMsg);
+            sourceNode.serialize(xsWriterForSource);
+            Source transformSrc = new StreamSource(new ByteArrayInputStream(baosForSource.toByteArray()));
+
+            // create a new Stream result over a new BAOS..
+            ByteArrayOutputStream baosForTarget = new ByteArrayOutputStream();
+            StreamResult transformTgt = new StreamResult(baosForTarget);
+
+            // perform transformation
+            transformer.transform(transformSrc, transformTgt);
+
+            StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baosForTarget.toByteArray()));
+            OMContainer parent = sourceNode.getParent();
+
+            if (parent instanceof SOAPEnvelope) {
+                ((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
+                ((SOAPEnvelope) parent).getBody().setFirstChild(builder.getDocumentElement());
+            } else {
+                parent.getFirstOMChild().detach();
+                parent.addChild(builder.getDocumentElement());
+            }
+
+        } catch (MalformedURLException mue) {
+            handleException(mue);
+        } catch (TransformerConfigurationException tce) {
+            handleException(tce);
+        } catch (XMLStreamException xse) {
+            handleException(xse);
+        } catch (TransformerException te) {
+            handleException(te);
+        } catch (IOException ioe) {
+            handleException(ioe);
+        }
+    }
+
+    private OMNode getTransformSource(SynapseMessage synMsg) {
+
+        if (source == null) {
+            try {
+                source = new AXIOMXPath("//SOAP-ENV:Body");
+                source.addNamespace("SOAP-ENV", synMsg.isSOAP11() ?
+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            } catch (JaxenException e) {}
+        }
+
+        try {
+            Object o = source.evaluate(synMsg.getEnvelope());;
+            if (o instanceof OMNode) {
+                return (OMNode) o;
+            } else if (o instanceof List && !((List) o).isEmpty()) {
+                return (OMNode) ((List) o).get(0);  // Always fetches *only* the first
+            } else {
+                String msg = "The evaluation of the XPath expression " + source + " must result in an OMNode";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } catch (JaxenException e) {
+            String msg = "Error evaluating XPath " + source + " on message";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+    private void handleException(Exception e) {
+        String msg = "Error performing XSLT/XQ transformation " + e.getMessage();
+        log.error(msg);
+        throw new SynapseException(msg, e);
+    }
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    public URL getXsltUrl() {
+        return xsltUrl;
+    }
+
+    public void setXsltUrl(URL xsltUrl) {
+        this.xsltUrl = xsltUrl;
+    }
+
+    public URL getXQueryUrl() {
+        return xQueryUrl;
+    }
+
+    public void setXQueryUrl(URL xQueryUrl) {
+        this.xQueryUrl = xQueryUrl;
+    }
+
+}
+
+	
Index: modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java	(working copy)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.types;
-
-
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-
-
-/**
- *
- * 
- * This executes the "mediate" operation on a new instance of the specified class
- * 
- * TODO add support for simple properties to be set
- *
- */
-public class ClassMediator implements Mediator{
-
-	private Class clazz = null;
-
-	
-
-	public boolean mediate(SynapseMessage smc) {
-		Mediator m = null;
-
-		try {
-			m = (Mediator) getClazz().newInstance();
-		} catch (Exception e) {
-			throw new SynapseException(e);
-		}
-		/*if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
-			((EnvironmentAware) m).setSynapseEnvironment(se);
-		}*/
-		return m.mediate(smc);
-
-	}
-
-	
-	public void setClazz(Class clazz) {
-		this.clazz = clazz;
-	}
-
-	public Class getClazz() {
-		return clazz;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java	(working copy)
@@ -1,114 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.types.axis2;
-
-
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.util.Utils;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-
-/**
- *
- * <p>
- * This class executes a service in the "owning" axis2 engine.
- * The service operation will be "mediate" and the service name is set as the ServiceName property
- * 
- *
- */
-public class ServiceMediator implements Mediator {
-	
-
-	private String serviceName = null;
-
-	public boolean mediate(SynapseMessage smc) {
-		MessageContext messageContext = null;
-		try {
-			messageContext = ((Axis2SynapseMessage) smc)
-					.getMessageContext();
-		} catch (ClassCastException cce) {
-			throw new SynapseException(
-					"A non-Axis2 MC SOAPMessageContext has been passed to the Axis2 MediationExecutor",
-					cce);
-		}
-
-		
-
-		try {
-			ConfigurationContext cc = messageContext.getConfigurationContext();
-			AxisConfiguration ac = cc.getAxisConfiguration();
-			AxisEngine ae = new AxisEngine(cc);
-
-			AxisService as = null;
-			AxisOperation ao = null;
-			
-			as = ac.getService(getServiceName());
-			if (as == null)
-				throw new SynapseException("cannot locate service "
-						+ getServiceName());
-			
-			ao = as.getOperation(Constants.MEDIATE_OPERATION_NAME);
-			OperationContext oc = OperationContextFactory
-					.createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-			ao.registerOperationContext(messageContext, oc);
-
-			ServiceContext sc = Utils.fillContextInformation(as, cc);
-			oc.setParent(sc);
-
-			messageContext.setOperationContext(oc);
-			messageContext.setServiceContext(sc);
-
-			messageContext.setAxisOperation(ao);
-			messageContext.setAxisService(as);
-
-			ae.receive(messageContext);
-
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-
-		}
-
-		return ((Boolean) messageContext
-				.getProperty(Constants.MEDIATOR_RESPONSE_PROPERTY))
-				.booleanValue();
-
-	}
-
-	public void setServiceName(String serviceName) {
-		this.serviceName = serviceName;
-	}
-
-	public String getServiceName() {
-		return serviceName;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/types/axis2/ServiceMediator.java	(working copy)
@@ -1,114 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.types.axis2;
-
-
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.util.Utils;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-
-/**
- *
- * <p>
- * This class executes a service in the "owning" axis2 engine.
- * The service operation will be "mediate" and the service name is set as the ServiceName property
- * 
- *
- */
-public class ServiceMediator implements Mediator {
-	
-
-	private String serviceName = null;
-
-	public boolean mediate(SynapseMessage smc) {
-		MessageContext messageContext = null;
-		try {
-			messageContext = ((Axis2SynapseMessage) smc)
-					.getMessageContext();
-		} catch (ClassCastException cce) {
-			throw new SynapseException(
-					"A non-Axis2 MC SOAPMessageContext has been passed to the Axis2 MediationExecutor",
-					cce);
-		}
-
-		
-
-		try {
-			ConfigurationContext cc = messageContext.getConfigurationContext();
-			AxisConfiguration ac = cc.getAxisConfiguration();
-			AxisEngine ae = new AxisEngine(cc);
-
-			AxisService as = null;
-			AxisOperation ao = null;
-			
-			as = ac.getService(getServiceName());
-			if (as == null)
-				throw new SynapseException("cannot locate service "
-						+ getServiceName());
-			
-			ao = as.getOperation(Constants.MEDIATE_OPERATION_NAME);
-			OperationContext oc = OperationContextFactory
-					.createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-			ao.registerOperationContext(messageContext, oc);
-
-			ServiceContext sc = Utils.fillContextInformation(as, cc);
-			oc.setParent(sc);
-
-			messageContext.setOperationContext(oc);
-			messageContext.setServiceContext(sc);
-
-			messageContext.setAxisOperation(ao);
-			messageContext.setAxisService(as);
-
-			ae.receive(messageContext);
-
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
-
-		}
-
-		return ((Boolean) messageContext
-				.getProperty(Constants.MEDIATOR_RESPONSE_PROPERTY))
-				.booleanValue();
-
-	}
-
-	public void setServiceName(String serviceName) {
-		this.serviceName = serviceName;
-	}
-
-	public String getServiceName() {
-		return serviceName;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/mediators/types/ClassMediator.java	(working copy)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.mediators.types;
-
-
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-
-
-/**
- *
- * 
- * This executes the "mediate" operation on a new instance of the specified class
- * 
- * TODO add support for simple properties to be set
- *
- */
-public class ClassMediator implements Mediator{
-
-	private Class clazz = null;
-
-	
-
-	public boolean mediate(SynapseMessage smc) {
-		Mediator m = null;
-
-		try {
-			m = (Mediator) getClazz().newInstance();
-		} catch (Exception e) {
-			throw new SynapseException(e);
-		}
-		/*if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
-			((EnvironmentAware) m).setSynapseEnvironment(se);
-		}*/
-		return m.mediate(smc);
-
-	}
-
-	
-	public void setClazz(Class clazz) {
-		this.clazz = clazz;
-	}
-
-	public Class getClazz() {
-		return clazz;
-	}
-
-}
Index: modules/core/src/org/apache/synapse/Metrics.java
===================================================================
--- modules/core/src/org/apache/synapse/Metrics.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/Metrics.java	(working copy)
@@ -1,5 +0,0 @@
-package org.apache.synapse;
-
-public interface Metrics {
-
-}
Index: modules/core/src/org/apache/synapse/MetricsFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/MetricsFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/MetricsFactory.java	(working copy)
@@ -1,8 +0,0 @@
-package org.apache.synapse;
-
-import org.apache.axis2.addressing.EndpointReference;
-
-public interface MetricsFactory {
-	Metrics getMetrics(String URI);
-	Metrics getMetrics(EndpointReference epr);
-}
Index: modules/core/src/org/apache/synapse/Processor.java
===================================================================
--- modules/core/src/org/apache/synapse/Processor.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/Processor.java	(working copy)
@@ -1,60 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse;
-
-
-/**
- * @deprecated
- * 
- * Processors are the main extension mechanism for Synapse. 
- * <p>
- * A Processor together with the XML ProcessorConfigurator extends both the synapse.xml 
- * and the actual processing power of Synapse.
- * <p>
- * Some of the processors are "builtin" and those are defined in the ProcessorConfiguratorFinder
- * <p>
- * Other processors can be registered using the JAR Service Provider model:
- * <br><a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider">http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider</a><p>
- * 
- * The processor then deals with a message. It returns false if no further
- * processing is desired. It can have a name (or null)
- * <p>
- * Processors can either devolve processing to other processors (e.g. a rule,
- * stage, etc) or deal with the message itself (e.g. mediator)
- * 
- */
-public interface Processor {
-	
-	
-	/**
-	 * This method is used to process a message. A response of true indicates continue processing.
-	 * A response of false indicates to stop processing.
-	 */
-	public boolean process(SynapseEnvironment se, SynapseMessage sm);
-	
-	
-	/**
-	 * the name of the instance of this processor
-	 */
-	public String getName();
-	
-	
-	/**
-	 * set the name of the instance of the processor
-	 */
-	public void setName(String name);
-}
Index: modules/core/src/org/apache/synapse/registry/Registry.java
===================================================================
--- modules/core/src/org/apache/synapse/registry/Registry.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/registry/Registry.java	(working copy)
@@ -1,22 +0,0 @@
-package org.apache.synapse.registry;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-//import org.apache.ws.commons.schema.XmlSchema;
-//import org.apache.ws.policy.Policy;
-//import org.apache.wsdl.WSDLDescription;
-
-public interface Registry {
-	public OMElement getXML(String identifier);
-	public String getString(String identifier);
-	public String getURI(String identifier); // guaranteed a URI
-	public EndpointReference getEPR(String identifier);
-	public List getURIList(String identifier); // could be a list of links to other entries
-//	public Policy getPolicy(String identifier);
-//	public XmlSchema getSchema(String identifier);
-//	public WSDLDescription getWSDL(String identifier);
-	public Properties getProperties(String identifier); 
-}
Index: modules/core/src/org/apache/synapse/registry/Registry.java
===================================================================
--- modules/core/src/org/apache/synapse/registry/Registry.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/registry/Registry.java	(working copy)
@@ -1,22 +0,0 @@
-package org.apache.synapse.registry;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-//import org.apache.ws.commons.schema.XmlSchema;
-//import org.apache.ws.policy.Policy;
-//import org.apache.wsdl.WSDLDescription;
-
-public interface Registry {
-	public OMElement getXML(String identifier);
-	public String getString(String identifier);
-	public String getURI(String identifier); // guaranteed a URI
-	public EndpointReference getEPR(String identifier);
-	public List getURIList(String identifier); // could be a list of links to other entries
-//	public Policy getPolicy(String identifier);
-//	public XmlSchema getSchema(String identifier);
-//	public WSDLDescription getWSDL(String identifier);
-	public Properties getProperties(String identifier); 
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java	(working copy)
@@ -1,139 +0,0 @@
-package org.apache.synapse.resources;
-
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.resources.xml.ResourceMediator;
-import org.apache.synapse.resources.xml.PropertyMediator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceHelperFactory {
-    private Log log = LogFactory.getLog(getClass());
-
-    private static ResourceHelperFactory fac;
-
-    private static boolean created = false;
-
-    private HashMap resourcesProcessorsMap = new HashMap();
-
-    private ResourceHelperFactory() {
-    }
-
-    public static ResourceHelperFactory newInstance() {
-        if (created) {
-            return fac;
-        } else {
-            fac = new ResourceHelperFactory();
-        }
-        return fac;
-    }
-
-    public ResourceHelper createResourceHelper() {
-        log.debug("Creating resources helper");
-        ResourceHelperImpl helper = new ResourceHelperImpl();
-        if (resourcesProcessorsMap==null) {throw new SynapseException("null resources map");}
-        log.debug("size of resources list "+resourcesProcessorsMap.size());
-        for (Iterator ite = resourcesProcessorsMap.keySet().iterator();
-             ite.hasNext();) {
-
-            String key = (String) ite.next();
-
-            Object obj = resourcesProcessorsMap.get(key);
-
-            if (obj instanceof ResourceMediator) {
-                ResourceMediator rp = (ResourceMediator) obj;
-                // getting the resource handler
-                ResourceHandler rh = getResourceHandler(rp.getType());
-                //filling the propertybags of ResourceHanlder
-                fillResourceHandler(rp,rh);
-                helper.registerResourceHandler(rh,rp.getURIRoot());
-                log.debug(">created helper for "+rp.getURIRoot());
-            } else {
-                throw new SynapseException(
-                        "Should be found only ResourceHandler implementations");
-            }
-
-        }
-        return helper;
-    }
-
-    private void fillResourceHandler(ResourceMediator rm, ResourceHandler rh) {
-        //filling the ResourcesHandlers properties
-        List rms = rm.getList();
-
-        for (Iterator ite = rms.iterator();ite.hasNext();) {
-            Object obj = ite.next();
-            if (obj instanceof PropertyMediator) {
-                PropertyMediator pp = (PropertyMediator)obj;
-                rh.setProperty(pp.getName(),pp.getValue());
-            } else {
-                throw new SynapseException("Support only PropertyMediator, found :" + obj.getClass().getName());
-            }
-        }
-
-
-
-    }
-
-    public void addResourceMediator(String uri, ResourceMediator rm) {
-    	resourcesProcessorsMap.put(uri, rm);
-    }
-    public ResourceMediator getResourceMediator(String uri) {
-    	return (ResourceMediator)resourcesProcessorsMap.get(uri);
-    }
-    public void setResourceProcessorsMap(HashMap resourceProcessorsMap) {
-        this.resourcesProcessorsMap = resourceProcessorsMap;
-    }
-
-    private ResourceHandler getResourceHandler(String clazzName) {
-        ResourceHandler handler;
-        try {
-            Class clazz = Class.forName(clazzName);
-            Constructor ct = clazz.getConstructor(new Class[]{});
-            Object obj = ct.newInstance(new Object[]{});
-
-            if (obj instanceof ResourceHandler) {
-                handler = (ResourceHandler) obj;
-            } else {
-                throw new SynapseException(
-                        "Only Objects implements ResourceHandler should be available");
-            }
-            return handler;
-        } catch (ClassNotFoundException e) {
-            throw new SynapseException(e);
-        } catch (IllegalAccessException e) {
-            throw new SynapseException(e);
-        } catch (NoSuchMethodException e) {
-            throw new SynapseException(e);
-        } catch (InvocationTargetException e) {
-            throw new SynapseException(e);
-        } catch (InstantiationException e) {
-            throw new SynapseException(e);
-        }
-
-    }
-
-
-
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHandler.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHandler.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHandler.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.resources;
-
-import org.apache.axiom.om.OMElement;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public interface ResourceHandler {
-    OMElement get(String uri);
-
-    void setProperty(String name, String value);
-    String getProperty(String name);
-    String[] getPropertyNames();
-
-    boolean isUpdated(String uriRoot); // used to poll if resource has changed (Pull model)
-
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelper.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelper.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelper.java	(working copy)
@@ -1,33 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.resources;
-
-import org.apache.synapse.api.ResourceUpdateAware;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- */
-public interface ResourceHelper {
-
-    OMElement get(String uri); // get a resource
-    OMElement get(String uri, ResourceUpdateAware mediator); // get a resource and be notified of changes
-    void registerResourceHandler(ResourceHandler rh, String urlRoot);
-         // register a handler for a given set of URLs (which share the same root)
-    void notifyUpdate(String uriRoot);
-         // a resource handler uses this to notify that all resources with that root have changed (Resource Push model)
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java	(working copy)
@@ -1,80 +0,0 @@
-package org.apache.synapse.resources;
-
-import org.apache.synapse.api.ResourceUpdateAware;
-import org.apache.synapse.SynapseException;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.HashMap;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceHelperImpl implements ResourceHelper {
-
-	private Log log = LogFactory.getLog(getClass());
-    protected HashMap resourceHandlers = new HashMap();
-
-
-    public OMElement get(String uri) { // get a resource
-        if (!(uri.equals("") || uri == null)) {
-            Object obj = resourceHandlers.get(uri);
-            if (obj != null) {
-                if (obj instanceof ResourceHandler) {
-                    ResourceHandler rh = (ResourceHandler) obj;
-
-                    return rh.get(uri);
-                } else {
-                    throw new SynapseException("Unsupported uri");
-                }
-            } else {
-                throw new SynapseException("Map doesnt contain the requested ResourceHandler "+uri);
-
-            }
-        } else {
-            throw new SynapseException("Unsupported ResourceHandler ");
-        }
-
-
-    }
-
-    public OMElement get(String uri,
-                         ResourceUpdateAware mediator) { // get a resource and be notified of changes
-
-        throw new SynapseException("Not implemented");
-    }
-
-    public void registerResourceHandler(ResourceHandler rh, String urlRoot) {
-    	log.debug("registering resource handler for "+urlRoot);
-        //runtime null pointer setting if neeeded, otherwise it has already been checked.
-        if (rh != null && (urlRoot != null)) {
-            if (resourceHandlers.containsKey(urlRoot)) {
-                throw new SynapseException("Uri-root already exists");
-            } else {
-                resourceHandlers.put(urlRoot, rh);
-            }
-
-        }
-    }
-
-    // register a handler for a given set of URLs (which share the same root)
-    public void notifyUpdate(String uriRoot) {
-        throw new SynapseException("Not Implemented");
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java	(working copy)
@@ -1,99 +0,0 @@
-package org.apache.synapse.resources.http;
-
-import org.apache.synapse.resources.ResourceHandler;
-import org.apache.synapse.SynapseException;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.util.HashMap;
-import java.io.IOException;
-import java.io.InputStream;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class SimpleGETResourceHandler implements ResourceHandler {
-
-    protected HashMap propertyMap = new HashMap();
-
-    public OMElement get(String uri) {
-        OMElement response = null;
-        HttpClient httpClient = new HttpClient();
-        /*
-         Following code technically gives the mediators to do a simple Http GET and aquire
-         some resources. Any mediator can use this method to quire its resources.
-        */
-        GetMethod httpGet = new GetMethod(uri);
-        try {
-
-            httpClient.executeMethod(httpGet);
-            if (httpGet.getStatusCode() == HttpStatus.SC_OK) {
-                response = processResponse(httpGet.getResponseBodyAsStream());
-            }
-        } catch (IOException e) {
-            throw new SynapseException(e);
-        } finally {
-            httpGet.releaseConnection();
-        }
-        if (response == null)
-            throw new SynapseException("There are no valid resonse resources");
-        return response;
-    }
-
-    public void setProperty(String name, String value) {
-        propertyMap.put(name, value);
-    }
-
-    public String getProperty(String name) {
-        return (String) propertyMap.get(name);
-    }
-
-    public String[] getPropertyNames() {
-
-        return ((String[]) propertyMap.keySet()
-                .toArray(new String[propertyMap.size()]));
-    }
-
-    public boolean isUpdated(String uriRoot){ // used to poll if resource has changed (Pull model)
-
-        //todo: implement this method.
-        return false;
-    }
-
-    private static OMElement processResponse(InputStream inputStream) {
-        if (inputStream == null) {
-            throw new SynapseException(
-                    "Input Stream cannot be null for Resource request");
-        }
-        try {
-            XMLStreamReader parser = XMLInputFactory.newInstance()
-                    .createXMLStreamReader(inputStream);
-            StAXOMBuilder builder =
-                    new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
-            OMElement resourceElement = builder.getDocumentElement();
-            resourceElement.build(); //make sure we are in safe side
-            return resourceElement;
-        } catch (XMLStreamException e) {
-            throw new SynapseException(e);
-        }
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/http/SimpleGETResourceHandler.java	(working copy)
@@ -1,99 +0,0 @@
-package org.apache.synapse.resources.http;
-
-import org.apache.synapse.resources.ResourceHandler;
-import org.apache.synapse.SynapseException;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.util.HashMap;
-import java.io.IOException;
-import java.io.InputStream;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class SimpleGETResourceHandler implements ResourceHandler {
-
-    protected HashMap propertyMap = new HashMap();
-
-    public OMElement get(String uri) {
-        OMElement response = null;
-        HttpClient httpClient = new HttpClient();
-        /*
-         Following code technically gives the mediators to do a simple Http GET and aquire
-         some resources. Any mediator can use this method to quire its resources.
-        */
-        GetMethod httpGet = new GetMethod(uri);
-        try {
-
-            httpClient.executeMethod(httpGet);
-            if (httpGet.getStatusCode() == HttpStatus.SC_OK) {
-                response = processResponse(httpGet.getResponseBodyAsStream());
-            }
-        } catch (IOException e) {
-            throw new SynapseException(e);
-        } finally {
-            httpGet.releaseConnection();
-        }
-        if (response == null)
-            throw new SynapseException("There are no valid resonse resources");
-        return response;
-    }
-
-    public void setProperty(String name, String value) {
-        propertyMap.put(name, value);
-    }
-
-    public String getProperty(String name) {
-        return (String) propertyMap.get(name);
-    }
-
-    public String[] getPropertyNames() {
-
-        return ((String[]) propertyMap.keySet()
-                .toArray(new String[propertyMap.size()]));
-    }
-
-    public boolean isUpdated(String uriRoot){ // used to poll if resource has changed (Pull model)
-
-        //todo: implement this method.
-        return false;
-    }
-
-    private static OMElement processResponse(InputStream inputStream) {
-        if (inputStream == null) {
-            throw new SynapseException(
-                    "Input Stream cannot be null for Resource request");
-        }
-        try {
-            XMLStreamReader parser = XMLInputFactory.newInstance()
-                    .createXMLStreamReader(inputStream);
-            StAXOMBuilder builder =
-                    new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
-            OMElement resourceElement = builder.getDocumentElement();
-            resourceElement.build(); //make sure we are in safe side
-            return resourceElement;
-        } catch (XMLStreamException e) {
-            throw new SynapseException(e);
-        }
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHandler.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHandler.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHandler.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.resources;
-
-import org.apache.axiom.om.OMElement;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public interface ResourceHandler {
-    OMElement get(String uri);
-
-    void setProperty(String name, String value);
-    String getProperty(String name);
-    String[] getPropertyNames();
-
-    boolean isUpdated(String uriRoot); // used to poll if resource has changed (Pull model)
-
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelper.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelper.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelper.java	(working copy)
@@ -1,33 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.resources;
-
-import org.apache.synapse.api.ResourceUpdateAware;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- */
-public interface ResourceHelper {
-
-    OMElement get(String uri); // get a resource
-    OMElement get(String uri, ResourceUpdateAware mediator); // get a resource and be notified of changes
-    void registerResourceHandler(ResourceHandler rh, String urlRoot);
-         // register a handler for a given set of URLs (which share the same root)
-    void notifyUpdate(String uriRoot);
-         // a resource handler uses this to notify that all resources with that root have changed (Resource Push model)
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelperFactory.java	(working copy)
@@ -1,139 +0,0 @@
-package org.apache.synapse.resources;
-
-
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.resources.xml.ResourceMediator;
-import org.apache.synapse.resources.xml.PropertyMediator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceHelperFactory {
-    private Log log = LogFactory.getLog(getClass());
-
-    private static ResourceHelperFactory fac;
-
-    private static boolean created = false;
-
-    private HashMap resourcesProcessorsMap = new HashMap();
-
-    private ResourceHelperFactory() {
-    }
-
-    public static ResourceHelperFactory newInstance() {
-        if (created) {
-            return fac;
-        } else {
-            fac = new ResourceHelperFactory();
-        }
-        return fac;
-    }
-
-    public ResourceHelper createResourceHelper() {
-        log.debug("Creating resources helper");
-        ResourceHelperImpl helper = new ResourceHelperImpl();
-        if (resourcesProcessorsMap==null) {throw new SynapseException("null resources map");}
-        log.debug("size of resources list "+resourcesProcessorsMap.size());
-        for (Iterator ite = resourcesProcessorsMap.keySet().iterator();
-             ite.hasNext();) {
-
-            String key = (String) ite.next();
-
-            Object obj = resourcesProcessorsMap.get(key);
-
-            if (obj instanceof ResourceMediator) {
-                ResourceMediator rp = (ResourceMediator) obj;
-                // getting the resource handler
-                ResourceHandler rh = getResourceHandler(rp.getType());
-                //filling the propertybags of ResourceHanlder
-                fillResourceHandler(rp,rh);
-                helper.registerResourceHandler(rh,rp.getURIRoot());
-                log.debug(">created helper for "+rp.getURIRoot());
-            } else {
-                throw new SynapseException(
-                        "Should be found only ResourceHandler implementations");
-            }
-
-        }
-        return helper;
-    }
-
-    private void fillResourceHandler(ResourceMediator rm, ResourceHandler rh) {
-        //filling the ResourcesHandlers properties
-        List rms = rm.getList();
-
-        for (Iterator ite = rms.iterator();ite.hasNext();) {
-            Object obj = ite.next();
-            if (obj instanceof PropertyMediator) {
-                PropertyMediator pp = (PropertyMediator)obj;
-                rh.setProperty(pp.getName(),pp.getValue());
-            } else {
-                throw new SynapseException("Support only PropertyMediator, found :" + obj.getClass().getName());
-            }
-        }
-
-
-
-    }
-
-    public void addResourceMediator(String uri, ResourceMediator rm) {
-    	resourcesProcessorsMap.put(uri, rm);
-    }
-    public ResourceMediator getResourceMediator(String uri) {
-    	return (ResourceMediator)resourcesProcessorsMap.get(uri);
-    }
-    public void setResourceProcessorsMap(HashMap resourceProcessorsMap) {
-        this.resourcesProcessorsMap = resourceProcessorsMap;
-    }
-
-    private ResourceHandler getResourceHandler(String clazzName) {
-        ResourceHandler handler;
-        try {
-            Class clazz = Class.forName(clazzName);
-            Constructor ct = clazz.getConstructor(new Class[]{});
-            Object obj = ct.newInstance(new Object[]{});
-
-            if (obj instanceof ResourceHandler) {
-                handler = (ResourceHandler) obj;
-            } else {
-                throw new SynapseException(
-                        "Only Objects implements ResourceHandler should be available");
-            }
-            return handler;
-        } catch (ClassNotFoundException e) {
-            throw new SynapseException(e);
-        } catch (IllegalAccessException e) {
-            throw new SynapseException(e);
-        } catch (NoSuchMethodException e) {
-            throw new SynapseException(e);
-        } catch (InvocationTargetException e) {
-            throw new SynapseException(e);
-        } catch (InstantiationException e) {
-            throw new SynapseException(e);
-        }
-
-    }
-
-
-
-}
Index: modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/ResourceHelperImpl.java	(working copy)
@@ -1,80 +0,0 @@
-package org.apache.synapse.resources;
-
-import org.apache.synapse.api.ResourceUpdateAware;
-import org.apache.synapse.SynapseException;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.HashMap;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceHelperImpl implements ResourceHelper {
-
-	private Log log = LogFactory.getLog(getClass());
-    protected HashMap resourceHandlers = new HashMap();
-
-
-    public OMElement get(String uri) { // get a resource
-        if (!(uri.equals("") || uri == null)) {
-            Object obj = resourceHandlers.get(uri);
-            if (obj != null) {
-                if (obj instanceof ResourceHandler) {
-                    ResourceHandler rh = (ResourceHandler) obj;
-
-                    return rh.get(uri);
-                } else {
-                    throw new SynapseException("Unsupported uri");
-                }
-            } else {
-                throw new SynapseException("Map doesnt contain the requested ResourceHandler "+uri);
-
-            }
-        } else {
-            throw new SynapseException("Unsupported ResourceHandler ");
-        }
-
-
-    }
-
-    public OMElement get(String uri,
-                         ResourceUpdateAware mediator) { // get a resource and be notified of changes
-
-        throw new SynapseException("Not implemented");
-    }
-
-    public void registerResourceHandler(ResourceHandler rh, String urlRoot) {
-    	log.debug("registering resource handler for "+urlRoot);
-        //runtime null pointer setting if neeeded, otherwise it has already been checked.
-        if (rh != null && (urlRoot != null)) {
-            if (resourceHandlers.containsKey(urlRoot)) {
-                throw new SynapseException("Uri-root already exists");
-            } else {
-                resourceHandlers.put(urlRoot, rh);
-            }
-
-        }
-    }
-
-    // register a handler for a given set of URLs (which share the same root)
-    public void notifyUpdate(String uriRoot) {
-        throw new SynapseException("Not Implemented");
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java	(working copy)
@@ -1,57 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.xml.MediatorFactory;
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class PropertyMediatorFactory implements MediatorFactory {
-
-    private static final String PROPERTY = "property";
-
-    private static final QName PROPERTY_Q =
-            new QName(Constants.SYNAPSE_NAMESPACE,
-                    PROPERTY);
-
-    private static final QName PROPERTY_NAME_ATT_Q = new QName("name");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        PropertyMediator pm = new PropertyMediator();
-
-        OMAttribute name = el.getAttribute(PROPERTY_NAME_ATT_Q);
-        if (name == null) {
-            throw new SynapseException(PROPERTY + " must have "
-                    + PROPERTY_NAME_ATT_Q + " attribute: " + el.toString());
-        }
-
-        String value = el.getText();
-        pm.setName(name.getAttributeValue());
-        pm.setValue(value);
-
-        return pm;  
-    }
-
-    public QName getTagQName() {
-        return PROPERTY_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java	(working copy)
@@ -1,115 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.xml.MediatorFactory;
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-
-    private static final String RESOURCE = "resource";
-
-	private static final QName RESOURCE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			RESOURCE);
-
-	private static final QName RESOURCE_TYPE_ATT_Q = new QName("type");
-
-	private static final QName RESOURCE_URI_ROOT_ATT_Q = new QName("uri-root");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-
-        ResourceMediator rp = new ResourceMediator();
-
-        this.addPropertiesMediatorsAndURIRoot(se,el,rp);
-
-        OMAttribute type = el.getAttribute(RESOURCE_TYPE_ATT_Q);
-		if (type == null) {
-			throw new SynapseException(RESOURCE + " must have "
-                    + RESOURCE_TYPE_ATT_Q + " attribute: " + el.toString());
-		}
-
-		OMAttribute uriRoot = el.getAttribute(RESOURCE_URI_ROOT_ATT_Q);
-		if (uriRoot == null) {
-			throw new SynapseException(RESOURCE + " must have "
-					+ RESOURCE_URI_ROOT_ATT_Q + " attribute: " + el.toString());
-		}
-        rp.setType(type.getAttributeValue());
-
-        rp.setURIRoot(uriRoot.getAttributeValue());
-
-        return rp;
-    }
-
-    public QName getTagQName() {
-        return RESOURCE_Q;
-    }
-
-    // this methods will give access to SynapseEnvironment's resouces registration
-
-
-    public void addPropertiesMediatorsAndURIRoot(SynapseEnvironment se, OMElement el,
-                                       ResourceMediator m) {
-        this.setURIRoot(se,el,m);
-
-        Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
-        while (it.hasNext()) {
-            OMElement child = (OMElement) it.next();
-            Mediator mediator=
-                    MediatorFactoryFinder.getMediator(se, child);
-
-            if (mediator != null) {
-                if (mediator instanceof PropertyMediator)
-                    mediators.add(mediator);
-                else
-                    throw new SynapseException(
-                            "List contains an invalid Mediator" +
-                                    mediator.getClass().getName());
-            } else
-                log.info("Unknown child of all" + child.getLocalName());
-        }
-        m.setList(mediators);
-
-    }
-
-    public void setURIRoot(SynapseEnvironment se, OMElement el, ResourceMediator m) {
-
-		OMAttribute uriRoot = el.getAttribute(RESOURCE_URI_ROOT_ATT_Q);
-		if (uriRoot != null) {
-            // uri-root has already set
-       //     se.addResourceMediator(uriRoot.getAttributeValue(), m);
-            m.setURIRoot(uriRoot.getAttributeValue());
-		}
-		log.debug("compile "+el.getLocalName()+" with uri-root '"+uriRoot.getAttributeValue() +"' on "+m.getClass());
-
-	}
-
-}
Index: modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java	(working copy)
@@ -1,44 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class PropertyMediator implements Mediator {
-
-    protected String name;
-    protected String value;
-    public boolean mediate(SynapseMessage sm) {
-        // this is not a inline mediator. Its soule purpose is to provide properties from Synapse.xml
-        return true;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-    public String getValue() {
-        return value;
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java	(working copy)
@@ -1,46 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.mediators.base.AbstractListMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceMediator extends AbstractListMediator {
-    protected String type;
-    protected String uriRoot;
-    public boolean process(SynapseEnvironment se, SynapseMessage smc) {
-        // this is not a inline mediator, It's soule purpose of existence is to populate the ResourceHandler
-        return true;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getType(){
-        return type;
-    }
-
-    public void setURIRoot(String uriRoot) {
-        this.uriRoot = uriRoot;
-    }
-    public String getURIRoot() {
-        return uriRoot;
-    }
-
-    
-}
Index: modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/PropertyMediator.java	(working copy)
@@ -1,44 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class PropertyMediator implements Mediator {
-
-    protected String name;
-    protected String value;
-    public boolean mediate(SynapseMessage sm) {
-        // this is not a inline mediator. Its soule purpose is to provide properties from Synapse.xml
-        return true;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-    public String getValue() {
-        return value;
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/PropertyMediatorFactory.java	(working copy)
@@ -1,57 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.xml.MediatorFactory;
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class PropertyMediatorFactory implements MediatorFactory {
-
-    private static final String PROPERTY = "property";
-
-    private static final QName PROPERTY_Q =
-            new QName(Constants.SYNAPSE_NAMESPACE,
-                    PROPERTY);
-
-    private static final QName PROPERTY_NAME_ATT_Q = new QName("name");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        PropertyMediator pm = new PropertyMediator();
-
-        OMAttribute name = el.getAttribute(PROPERTY_NAME_ATT_Q);
-        if (name == null) {
-            throw new SynapseException(PROPERTY + " must have "
-                    + PROPERTY_NAME_ATT_Q + " attribute: " + el.toString());
-        }
-
-        String value = el.getText();
-        pm.setName(name.getAttributeValue());
-        pm.setValue(value);
-
-        return pm;  
-    }
-
-    public QName getTagQName() {
-        return PROPERTY_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/ResourceMediator.java	(working copy)
@@ -1,46 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.mediators.base.AbstractListMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceMediator extends AbstractListMediator {
-    protected String type;
-    protected String uriRoot;
-    public boolean process(SynapseEnvironment se, SynapseMessage smc) {
-        // this is not a inline mediator, It's soule purpose of existence is to populate the ResourceHandler
-        return true;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getType(){
-        return type;
-    }
-
-    public void setURIRoot(String uriRoot) {
-        this.uriRoot = uriRoot;
-    }
-    public String getURIRoot() {
-        return uriRoot;
-    }
-
-    
-}
Index: modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java	(working copy)
@@ -1,115 +0,0 @@
-package org.apache.synapse.resources.xml;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.xml.MediatorFactory;
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class ResourceMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-
-    private static final String RESOURCE = "resource";
-
-	private static final QName RESOURCE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			RESOURCE);
-
-	private static final QName RESOURCE_TYPE_ATT_Q = new QName("type");
-
-	private static final QName RESOURCE_URI_ROOT_ATT_Q = new QName("uri-root");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-
-        ResourceMediator rp = new ResourceMediator();
-
-        this.addPropertiesMediatorsAndURIRoot(se,el,rp);
-
-        OMAttribute type = el.getAttribute(RESOURCE_TYPE_ATT_Q);
-		if (type == null) {
-			throw new SynapseException(RESOURCE + " must have "
-                    + RESOURCE_TYPE_ATT_Q + " attribute: " + el.toString());
-		}
-
-		OMAttribute uriRoot = el.getAttribute(RESOURCE_URI_ROOT_ATT_Q);
-		if (uriRoot == null) {
-			throw new SynapseException(RESOURCE + " must have "
-					+ RESOURCE_URI_ROOT_ATT_Q + " attribute: " + el.toString());
-		}
-        rp.setType(type.getAttributeValue());
-
-        rp.setURIRoot(uriRoot.getAttributeValue());
-
-        return rp;
-    }
-
-    public QName getTagQName() {
-        return RESOURCE_Q;
-    }
-
-    // this methods will give access to SynapseEnvironment's resouces registration
-
-
-    public void addPropertiesMediatorsAndURIRoot(SynapseEnvironment se, OMElement el,
-                                       ResourceMediator m) {
-        this.setURIRoot(se,el,m);
-
-        Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
-        while (it.hasNext()) {
-            OMElement child = (OMElement) it.next();
-            Mediator mediator=
-                    MediatorFactoryFinder.getMediator(se, child);
-
-            if (mediator != null) {
-                if (mediator instanceof PropertyMediator)
-                    mediators.add(mediator);
-                else
-                    throw new SynapseException(
-                            "List contains an invalid Mediator" +
-                                    mediator.getClass().getName());
-            } else
-                log.info("Unknown child of all" + child.getLocalName());
-        }
-        m.setList(mediators);
-
-    }
-
-    public void setURIRoot(SynapseEnvironment se, OMElement el, ResourceMediator m) {
-
-		OMAttribute uriRoot = el.getAttribute(RESOURCE_URI_ROOT_ATT_Q);
-		if (uriRoot != null) {
-            // uri-root has already set
-       //     se.addResourceMediator(uriRoot.getAttributeValue(), m);
-            m.setURIRoot(uriRoot.getAttributeValue());
-		}
-		log.debug("compile "+el.getLocalName()+" with uri-root '"+uriRoot.getAttributeValue() +"' on "+m.getClass());
-
-	}
-
-}
Index: modules/core/src/org/apache/synapse/SynapseContext.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseContext.java	(revision 0)
+++ modules/core/src/org/apache/synapse/SynapseContext.java	(revision 0)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.synapse;
+
+
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.core.SynapseEnvironment;
+
+
+/**
+ * The Synapse Context is available to mediators through the SynapseMessage. It
+ * allows one to call to the underlying SynapseEnvironment (i.e. the SOAP engine
+ * - such as Axis2 - where required. It also allows one to access the current
+ * SynapseConfiguration. Additionally it holds per message properties (i.e. local
+ * properties valid for the lifetime of the message)
+ */
+public interface SynapseContext {
+
+    /**
+     * Get a reference to the current SynapseConfiguration
+     *
+     * @return the current synapse configuration
+     */
+    public SynapseConfiguration getConfiguration();
+
+    /**
+     * Set or replace the Synapse Configuration instance to be used. May be used to
+     * programatically change the configuration at runtime etc.
+     *
+     * @param cfg The new synapse configuration instance
+     */
+    public void setConfiguration(SynapseConfiguration cfg);
+
+    /**
+     * Returns a reference to the host Synapse Environment
+     * @return the Synapse Environment
+     */
+    public SynapseEnvironment getSynapseEnvironment();
+
+    /**
+     * Sets the SynapseEnvironment reference to this context
+     * @param se the reference to the Synapse Environment
+     */
+    public void setSynapseEnvironment(SynapseEnvironment se);
+
+    /**
+     * Sets the associated Synapse message
+     * @param sm the synapse message associated with this context
+     */
+    public void setSynapseMessage(SynapseMessage sm);
+
+    /**
+     * Return the associated SynapseMessage
+     * @return the associated Synapse message
+     */
+    public SynapseMessage getSynapseMessage();
+
+    /**
+     * Get the value of a custom (local) property set on the message instance
+     * @param key key to look up property
+     * @return value for the given key
+     */
+    public Object getProperty(String key);
+
+    /**
+     * Set a custom (local) property with the given name on the message instance
+     * @param key key to be used
+     * @param value value to be saved
+     */
+    public void setProperty(String key, Object value);
+
+}
Index: modules/core/src/org/apache/synapse/SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseEnvironment.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/SynapseEnvironment.java	(working copy)
@@ -1,105 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse;
-
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
-
-
-/**
- *
- * 
- * <p>Common stuff needed to embed Synapse into a given runtime (e.g. Axis2) 
- * <p>This interface is used by the mediators, and also by EnvironmentAware mediators
- * 
- *
- */
-public interface SynapseEnvironment {
-
-
-    
-    /*
-      * This method injects a new message into the Synapse engine
-      * It is used in a couple of ways. Firstly, this is how, for example,
-      * Axis2 kicks messages into Synapse to start with.
-      * <p>
-      * Also mediators can use this to send messages that they want to be mediated by Synapse
-      * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
-      * injectMessage()
-      */
-    public void injectMessage(SynapseMessage smc);
-
-    /*
-      * Mediators that wish to load classes should use the ClassLoader given here
-      */
-    public ClassLoader getClassLoader();
-
-
-    /**
-     * This method allows you send messages on. As opposed to injectMessage send message does not
-     * process these through Synapse.
-     * <p>
-     * This will send request messages on, and send response messages back to the client
-     */
-    public void send(SynapseMessage smc);
-
-
-    /**
-     * This is used by the references to find a processor with a given name
-     *
-     */
-    public Mediator lookupMediator(String name);
-
-
-    /**
-     * This is how you add a processor to the list of processors. The name which it can be
-     * retrieved by is the processor.getName()
-     */
-    public void addMediator(String name, Mediator m);
-
-
-    /**
-     * This returns the "Master Processor" which is the root processor for this instance of
-     * Synapse. Usually this would be the processor derived from &ltsynapse>.
-     */
-    public Mediator getMasterMediator();
-
-
-    /**
-     * This sets the root processor for the engine.
-     */
-    public void setMasterMediator(Mediator p);
-
-	public Object getProperty(String string);
-
-	public void setProperty(String string, Object object);
-
-	public Registry getRegistry();
-	public void setRegistry(Registry reg);
-	
-	public Metrics getMetrics(String URI);
-	public Metrics getMetrics(EndpointReference epr);
-	public void setMetricsFactory(MetricsFactory mf);
-		
-	public void publish(OMElement element);
-	
-    //public ResourceHelper getResourceHelper();
-
-    //public void addResourceMediator(String name, Mediator p);
-}
Index: modules/core/src/org/apache/synapse/SynapseException.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseException.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/SynapseException.java	(working copy)
@@ -16,27 +16,22 @@
 package org.apache.synapse;
 
 /**
- *
  * <p>Runtime exception for Synapse code to throw
- *
  */
 public class SynapseException extends RuntimeException {
 
-	private static final long serialVersionUID = -7244032125641596311L;
+    private static final long serialVersionUID = -7244032125641596311L;
 
-	public SynapseException(String string) {
-		super(string);
+    public SynapseException(String string) {
+        super(string);
+    }
 
-	}
+    public SynapseException(String msg, Throwable e) {
+        super(msg, e);
+    }
 
-	public SynapseException(String msg, Throwable e) {
-		super(msg, e);
+    public SynapseException(Throwable t) {
+        super(t);
+    }
 
-	}
-
-	public SynapseException(Throwable t) {
-		super(t);
-
-	}
-
 }
Index: modules/core/src/org/apache/synapse/SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseMessage.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/SynapseMessage.java	(working copy)
@@ -16,25 +16,36 @@
 
 package org.apache.synapse;
 
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axiom.soap.SOAPEnvelope;
 
 /**
- *
- * 
- * <p> The core definition of a message flowing thru Synapse.
+ * <p> This interface defines a message flowing through Synapse
  * <p> The aim of this is to capture the Message Addressing Properties
- * (aka Message Information Headers) and the SOAP Envelope. 
+ * (aka Message Information Headers) and the SOAP Envelope.
  * The core To/From/FaultTo/ReplyTo/MessageID/RelatesTo stuff is here. <p>
  * In addition this has get/setEnvelope.
- * <p>
- *  There is also a bag of properties<p>
- *  There are markers for whether we support REST, MTOM and also if this is a response or not
+ * <p/>
+ * There is also a bag of properties<p>
+ * There are markers for whether we support REST, MTOM and also if this is a response or not
  */
 public interface SynapseMessage {
 
+    /**
+     * Get the SOAP envelope of this message
+     * @return the SOAP envelope of the message
+     */
+    public SOAPEnvelope getEnvelope();
+
+    /**
+     * Sets the given envelope as the current SOAPEnvelope for this message
+     * @param envelope the envelope to be set
+     * @throws AxisFault on exception
+     */
+    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault;
+
     public EndpointReference getFaultTo();
 
     public void setFaultTo(EndpointReference reference);
@@ -43,17 +54,13 @@
 
     public void setFrom(EndpointReference reference);
 
-    public SOAPEnvelope getEnvelope();
-
-    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault;
-
     public String getMessageID();
 
     public void setMessageID(String string);
 
     public RelatesTo getRelatesTo();
 
-    public void setRelatesTo(RelatesTo reference);
+    public void setRelatesTo(RelatesTo[] reference);
 
     public EndpointReference getReplyTo();
 
@@ -63,40 +70,107 @@
 
     public void setTo(EndpointReference reference);
 
+    /**
+     * Sets the WSAAction
+     * @param actionURI the WSAAction
+     */
     public void setWSAAction(String actionURI);
 
+    /**
+     * Returns the WSAAction
+     * @return the WSAAction
+     */
     public String getWSAAction();
 
+    /**
+     * Returns the SOAPAction of the message
+     * @return the SOAPAction
+     */
+    public String getSoapAction();
+
+    /**
+     * Set the SOAPAction
+     * @param string the SOAP Action
+     */
+    public void setSoapAction(String string);
+
+    /**
+     * Set the message if
+     * @param messageID
+     */
     public void setMessageId(String messageID);
 
+    /**
+     * Gets the message id
+     * @return the message id
+     */
     public String getMessageId();
 
-    public Object getProperty(String key);
-
-    public void setProperty(String key, Object value);
-
-    public String getSoapAction();
-
-    public void setSoapAction(String string);
-
+    /**
+     * If this message using MTOM?
+     * @return true if using MTOM
+     */
     public boolean isDoingMTOM();
 
+    /**
+     * Marks as using MTOM
+     * @param b true to mark as using MTOM
+     */
     public void setDoingMTOM(boolean b);
 
+    /**
+     * Is this message over REST?
+     * @return true if over REST
+     */
     public boolean isDoingREST();
 
+    /**
+     * Marks this message as over REST
+     * @param b true to mark as REST
+     */
     public void setDoingREST(boolean b);
 
+    /**
+     * Is this message a SOAP 1.1 message?
+     * @return true if this is a SOAP 1.1 message
+     */
     public boolean isSOAP11();
 
+    /**
+     * Mark this message as a response or not.
+     * @see org.apache.synapse.SynapseMessage#isResponse()
+     * @param b true to set this as a response
+     */
     public void setResponse(boolean b);
 
+    /**
+     * Is this message a response to a synchronous message sent out through Synapse?
+     * @return true if this message is a response message
+     */
     public boolean isResponse();
 
+    /**
+     * Marks this message as a fault response
+     * @see org.apache.synapse.SynapseMessage#isFaultResponse()
+     * @param b true to mark this as a fault response
+     */
     public void setFaultResponse(boolean b);
 
+    /**
+     * Is this message a response to a fault message?
+     * @return true if this is a response to a fault message
+     */
     public boolean isFaultResponse();
-    
-    public SynapseEnvironment getSynapseEnvironment();
-    public void setSynapseEnvironment(SynapseEnvironment env);
+
+    /**
+     * Return a reference to the SynapseContext
+     * @return the SynapseContext
+     */
+    public SynapseContext getSynapseContext();
+
+    /**
+     * Set the reference to the SynapseContext
+     * @param env the SynapseContext
+     */
+    public void setSynapseContext(SynapseContext env);
 }
Index: modules/core/src/org/apache/synapse/SynapseMessageConstants.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseMessageConstants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/SynapseMessageConstants.java	(working copy)
@@ -1,20 +0,0 @@
-package org.apache.synapse;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public interface SynapseMessageConstants {
-    String MATCHED = "--BOOLEAN_MATCH__";
-}
Index: modules/core/src/org/apache/synapse/Util.java
===================================================================
--- modules/core/src/org/apache/synapse/Util.java	(revision 0)
+++ modules/core/src/org/apache/synapse/Util.java	(revision 0)
@@ -0,0 +1,70 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse;
+
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.om.impl.llom.OMElementImpl;
+import org.apache.axiom.om.impl.llom.OMTextImpl;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.jaxen.JaxenException;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Holds utility methods used by Synapse
+ */
+public class Util {
+
+    private static final Log log = LogFactory.getLog(Util.class);
+
+    /**
+     * Evaluates the given XPath expression against the SOAPEnvelope of the
+     * current message and returns a String representation of the result
+     * @param xpath the expression to evaluate
+     * @param synCtx the source message which holds the SOAP envelope
+     * @return a String representation of the result of evaluation
+     */
+    public static String getStringValue(AXIOMXPath xpath, SynapseContext synCtx) {
+
+        try {
+            Object result = xpath.evaluate(synCtx.getSynapseMessage().getEnvelope());
+            StringBuffer textValue = new StringBuffer();
+
+            if (result instanceof List) {
+                Iterator iter = ((List) result).iterator();
+                while (iter.hasNext()) {
+                    Object o = iter.next();
+                    if (o instanceof OMTextImpl) {
+                        textValue.append(((OMTextImpl) o).getText());
+                    } else if (o instanceof OMElementImpl) {
+                        textValue.append(((OMElementImpl) o).getText());
+                    }
+                }
+            } else {
+                textValue.append(result.toString());
+            }
+            return textValue.toString();
+
+        } catch (JaxenException je) {
+            String msg = "Evaluation of the XPath expression " + xpath.toString() + " resulted in an error";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+    }
+
+}
Index: modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java	(working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.SynapseMediator;
-import org.apache.axiom.om.OMElement;
-
-public class SynapseMediatorFactory extends
-        AbstractListMediatorFactory {
-
-    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE,
-            "synapse");
-
-    public QName getTagQName() {
-        return tagname;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SynapseMediator sm = new SynapseMediator();
-        super.addChildrenAndSetName(se, el, sm);
-        return sm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java	(working copy)
@@ -1,81 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMNamespace;
-
-/**
- *
- * 
- * <p>
- * This class executes a test and then processes all subsequent rules/mediations
- * if the test is true
- * 
- */
-public class XPathMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final String XPATH = "xpath";
-
-    private static final QName XPATH_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "xpath");
-
-    private static final QName XPATH_EXPRESSION_ATT_Q = new QName("expr");
-
-    /*
-      * (non-Javadoc)
-      *
-      * @see org.apache.synapse.spi.Processor#compile(org.apache.synapse.api.SynapseEnvironment,
-      *      org.apache.axis2.om.OMElement)
-      */
-    public Mediator  createMediator(SynapseEnvironment se, OMElement el) {
-        XPathMediator xm = new XPathMediator();
-
-        super.addChildrenAndSetName(se, el, xm);
-
-        OMAttribute expr = el.getAttribute(XPATH_EXPRESSION_ATT_Q);
-        if (expr == null) {
-            throw new SynapseException(XPATH + " must have "
-                    + XPATH_EXPRESSION_ATT_Q + " attribute: " + el.toString());
-        }
-
-        xm.setXPathExpr(expr.getAttributeValue());
-        Iterator it = el.getAllDeclaredNamespaces();
-        while (it.hasNext()) {
-            OMNamespace n = (OMNamespace) it.next();
-            xm.addXPathNamespace(n.getPrefix(), n.getName());
-        }
-
-        return xm;
-    }
-
-    public QName getTagQName() {
-
-        return XPATH_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java	(working copy)
@@ -1,40 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.DefaultMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class DefaultMediatorFactory
-        extends AbstractListMediatorFactory
-        {
-
-    private static final QName DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"default");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        DefaultMediator dm = new DefaultMediator();
-        super.addChildrenAndSetName(se,el,dm);
-        return dm;  
-    }
-
-    public QName getTagQName() {
-        return DEFAULT_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java	(working copy)
@@ -1,33 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.Processor;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-/**
- * @deprecated
- *
- */
-public interface ProcessorConfigurator {
-    public Processor createProcessor(SynapseEnvironment se, OMElement el);
-    public QName getTagQName();
-
-}
Index: modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.RefDefineMediator;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-import javax.xml.namespace.QName;
-
-/*
- */
-public class RefDefineMediatorFactory extends AbstractMediatorFactory {
-	private static final QName REF_DEFINE_Q = new QName(
-			Constants.SYNAPSE_NAMESPACE, "refdefine");
-
-	public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-		RefDefineMediator rdm = new RefDefineMediator();
-		super.setNameOnMediator(se, el, rdm);
-		OMAttribute attr = el.getAttribute(new QName("ref"));
-		if (attr == null)
-			throw new SynapseException("<ref> must have attribute ref");
-		rdm.setRefDefine(attr.getAttributeValue());
-		return rdm;
-	}
-
-	public QName getTagQName() {
-		return REF_DEFINE_Q;
-	}
-}
Index: modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java	(working copy)
@@ -1,61 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.HeaderMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- *         <p>
- *         <xmp><synapse:header name="optional" type="to|from|faultto|replyto|action"
- *         value="newvalue"/> </xmp>
- * 
- * 
- */
-public class HeaderMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "header");
-
-
-        private static final QName TYPE_ATT_Q = new QName("type"),
-            VALUE_ATT_Q = new QName("value");
-
-        public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-            HeaderMediator hm = new HeaderMediator();
-            super.setNameOnMediator(se, el, hm);
-            OMAttribute val = el.getAttribute(VALUE_ATT_Q);
-            OMAttribute type = el.getAttribute(TYPE_ATT_Q);
-            if (val == null || type == null) {
-                throw new SynapseException("<header> must have both " + VALUE_ATT_Q
-                    + " and " + TYPE_ATT_Q + " attributes: " + el.toString());
-            }
-            hm.setHeaderType(type.getAttributeValue());
-            hm.setValue( val.getAttributeValue());
-            return hm;
-    }
-
-    public QName getTagQName() {
-        return HEADER_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java	(working copy)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.SendMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-public class SendMediatorFactory extends AbstractMediatorFactory {
-
-
-    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "send");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SendMediator sm =  new SendMediator();
-        super.setNameOnMediator(se, el,sm);
-        return sm;
-
-    }
-
-    public QName getTagQName() {
-
-        return SEND_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.DefineMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class DefineMediatorFactory extends AbstractListMediatorFactory {
-    private static final QName DEFINE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-                "define");
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        DefineMediator defineMediator = new DefineMediator();
-        super.addChildrenAndSetName(se,el,defineMediator);
-        return defineMediator;
-    }
-
-    public QName getTagQName() {
-        return DEFINE_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java	(working copy)
@@ -1,62 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.ListMediator;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- * <p> This is the abstract parent of any tag which is a "Node" - so &ltstage>, &ltin>&ltout> and &ltnever> all fit this model
- * <p>It recursively creates a list of processors from the children. 
- *
- */
-public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
-
-    Log log = LogFactory.getLog(getClass());
-
-    public void addChildrenAndSetName(SynapseEnvironment se, OMElement el, ListMediator m)
-    {
-        super.setNameOnMediator(se, el, m);
-
-        Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
-        while (it.hasNext()) {
-            OMElement child = (OMElement) it.next();
-            Mediator med = MediatorFactoryFinder.getMediator(se, child);
-            if (med != null)
-                mediators.add(med);
-            else
-                log.info("Unknown child of all" + child.getLocalName());
-        }
-        m.setList(mediators);
-
-    }
-
-
-
-}
Index: modules/core/src/org/apache/synapse/xml/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/Constants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/Constants.java	(working copy)
@@ -1,25 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-/**
- * <p/>
- * Constants used in the XML processing
- */
-public interface Constants {
-    String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
-    String SYNAPSE = "synapse";
-}
Index: modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java	(working copy)
@@ -1,50 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-public class ServiceMediatorFactory extends AbstractMediatorFactory {
-    private static final QName tagName = new QName(Constants.SYNAPSE_NAMESPACE,
-            "servicemediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ServiceMediator sm = new ServiceMediator();
-        super.setNameOnMediator(se,el,sm);
-
-        OMAttribute attr = el.getAttribute(new QName("service"));
-        if (attr == null)
-            throw new SynapseException(
-                    "<servicemediator> must have 'service' attribute");
-        sm.setServiceName(attr.getAttributeValue());
-        return sm;
-    }
-
-    public QName getTagQName() {
-
-        return tagName;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java	(working copy)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.StageMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- *<xmp><synapse:stage name="optional"> do everything in here </synapse:stage></xmp>
- */
-public class StageMediatorFactory extends
-        AbstractListMediatorFactory{
-    private static final QName STAGE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "stage");
-
-    public QName getTagQName() {
-        return STAGE_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        StageMediator sm = new StageMediator();
-        super.addChildrenAndSetName(se, el, sm);
-        return sm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java	(working copy)
@@ -1,53 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * 
- * <p> This is the abstract superclass of any tag that isn't a "node". I.e. mediators or builtin
- * mediators like log
- *
- */
-public abstract class AbstractMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-   
-    public void setNameOnMediator(SynapseEnvironment se, OMElement el, Mediator m) {
-
-        OMAttribute nm = el.getAttribute(new QName("name"));
-        String name =null;
-        if (nm != null) {
-             name = nm.getAttributeValue().trim();
-            //m.setName(name);
-            se.addMediator(name, m);
-        }
-        log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
-
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.DropMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class DropMediatorFactory extends AbstractMediatorFactory {
-
-    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"drop");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        return new DropMediator();
-    }
-
-    public QName getTagQName() {
-        return DROP_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java	(working copy)
@@ -1,59 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * <xmp><synapse:classmediator name="nm" class="org.fremantle.mediator"</synapse:classmediator></xmp>
- * TODO add ability to configure properties with Strings/OMElements based on children.
- */
-public class ClassMediatorFactory extends AbstractMediatorFactory {
-    private static final QName CLM_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "classmediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ClassMediator cmp = new ClassMediator();
-        super.setNameOnMediator(se, el, cmp);
-
-        OMAttribute clsName = el.getAttribute(new QName("class"));
-        if (clsName == null)
-            throw new SynapseException("missing class attribute on element"
-                    + el.toString());
-        try {
-            Class clazz = se.getClassLoader().loadClass(clsName.getAttributeValue());
-            cmp.setClazz(clazz);
-        } catch (ClassNotFoundException e) {
-            throw new SynapseException("class loading error", e);
-        }
-        return cmp;
-
-    }
-
-
-    public QName getTagQName() {
-        return CLM_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/InMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/InMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/InMediatorFactory.java	(working copy)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.InMediator;
-import org.apache.axiom.om.OMElement;
-
-
-/**
- *
- * 
- * <p>
- * <xmp><in name="optional">.... </in></xmp>
- * Uses children if processing an request (i.e. if !response).  
- *
- */
-public class InMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName IN_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "in");
-
-    public QName getTagQName() {
-        return IN_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        InMediator im = new InMediator();
-        super.addChildrenAndSetName(se, el, im);
-        return im;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java	(working copy)
@@ -1,136 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.resources.xml.PropertyMediatorFactory;
-import org.apache.synapse.resources.xml.ResourceMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-
-import sun.misc.Service;
-
-/**
- *
- * 
- * This class is based on J2SE Service Provider model
- * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
- */
-
-public class MediatorFactoryFinder {
-
-	private static Map lookup = null;
-
-	private static Log log = LogFactory
-			.getLog(MediatorFactoryFinder.class);
-
-	private static Class[] mediatorFactories = {
-			SynapseMediatorFactory.class,
-			StageMediatorFactory.class, RegexMediatorFactory.class,
-			XPathMediatorFactory.class,
-			HeaderMediatorFactory.class,
-			ClassMediatorFactory.class,
-			ServiceMediatorFactory.class,
-			LogMediatorFactory.class, SendMediatorFactory.class,
-			FaultMediatorFactory.class,
-			AddressingInMediatorFactory.class,
-			AddressingOutMediatorFactory.class,
-			InMediatorFactory.class, OutMediatorFactory.class,
-			NeverMediatorFactory.class, RefMediatorFactory.class,
-            XSLTMediatorFactory.class,DefineMediatorFactory.class,
-            SendNowMediatorFactory.class,SendMediatorFactory.class,
-            DropMediatorFactory.class,
-            RefDefineMediatorFactory.class, ExactlyOneMediatorFactory.class,
-            DefaultMediatorFactory.class,
-            PropertyMediatorFactory.class, ResourceMediatorFactory.class,
-            };
-
-	private static void initialise() {
-
-		if (lookup != null)
-			return;
-		lookup = new HashMap();
-
-		for (int i = 0; i < mediatorFactories.length; i++) {
-			Class c = mediatorFactories[i];
-			try {
-				lookup.put(((MediatorFactory) c.newInstance())
-						.getTagQName(), c);
-			} catch (Exception e) {
-				throw new SynapseException("problem instantiating "+c.getName(), e);
-			}
-		}
-		log.debug("registering extensions");
-		log.debug(System.getProperty("java.class.path"));
-		// now try additional processors
-		Iterator it = Service.providers(MediatorFactory.class);
-		while (it.hasNext()) {
-			MediatorFactory mf = (MediatorFactory) it.next();
-			QName tag = mf.getTagQName();
-			lookup.put(tag, mf.getClass());
-			log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
-		}
-	}
-
-                            	/**
-	 * @param qn
-	 * @return the class which implements the Processor for the given QName
-	 */
-	public static Class find(QName qn) {
-		initialise();
-		return (Class) lookup.get(qn);
-	}
-	
-	/**
-	 * This method returns a Processor given an OMElement. This will be used
-	 * recursively by the elements which contain processor elements themselves
-	 * (e.g. rules)
-	 * 
-	 * @param synapseEnv
-	 * @param element
-	 * @return Processor
-	 */
-	public static Mediator getMediator(SynapseEnvironment synapseEnv, OMElement element) {
-		OMNamespace n = element.getNamespace();
-		
-		Class cls = find(new QName(n.getName(), element
-				.getLocalName()));
-		try {
-			MediatorFactory mf = (MediatorFactory) cls.newInstance();
-			Mediator m = mf.createMediator(synapseEnv, element);
-			return m;
-		} catch (InstantiationException e) {
-			throw new SynapseException(e);
-		} catch (IllegalAccessException e) {
-			throw new SynapseException(e);
-		}
-	}
-}
Index: modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java	(working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.OutMediator;
-import org.apache.axiom.om.OMElement;
-
-
-public class OutMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName OUT_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "out");
-
-    public QName getTagQName() {
-        return OUT_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        OutMediator outMediator= new OutMediator();
-        super.addChildrenAndSetName(se, el, outMediator);
-        return outMediator;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.SecurityMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SecurityMediatorFactory extends AbstractMediatorFactory {
-    private static final QName SEC_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"engage-security");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SecurityMediator sm = new SecurityMediator();
-        super.setNameOnMediator(se,el,sm);
-        return sm;
-    }
-
-    public QName getTagQName() {
-        return SEC_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- *  <xmp><synapse:addressing/></xmp>
- *         <p>
- *         This tag turns on the addressing module 
- * 
- */
-public class AddressingInMediatorFactory extends AbstractMediatorFactory {
-    private static final QName ADD_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "engage-addressing-in");
-
-
-    public QName getTagQName() {
-        return ADD_Q;
-    }
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        AddressingInMediator ap = new AddressingInMediator();
-        super.setNameOnMediator(se,el,ap);
-        return ap;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java	(working copy)
@@ -1,81 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * 
- */
-public class RegexMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final String REGEX = "regex";
-
-    private static final QName REGEX_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            REGEX);
-
-    private static final QName REGEX_PATTERN_ATT_Q = new QName("pattern");
-
-    private static final QName REGEX_PROPERTY_ATT_Q = new QName("property");
-
-    private static final QName REGEX_HEADER_ATT_Q = new QName("message-address");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        RegexMediator rm = new RegexMediator();
-        super.addChildrenAndSetName(se, el, rm);
-
-        OMAttribute patt = el.getAttribute(REGEX_PATTERN_ATT_Q);
-        if (patt == null) {
-            throw new SynapseException(REGEX + " must have "
-                    + REGEX_PATTERN_ATT_Q + " attribute: " + el.toString());
-        }
-
-        OMAttribute prop = el.getAttribute(REGEX_PROPERTY_ATT_Q);
-        OMAttribute head = el.getAttribute(REGEX_HEADER_ATT_Q);
-        if (prop == null && head == null) {
-            throw new SynapseException(REGEX + " must have either "
-                    + REGEX_PROPERTY_ATT_Q + " or " + REGEX_HEADER_ATT_Q
-                    + " attributes: " + el.toString());
-        }
-        rm.setPattern(patt.getAttributeValue());
-        if (prop != null) {
-            rm.setPropertyName(prop.getAttributeValue());
-        } else {
-            String header = head.getAttributeValue();
-            rm.setHeaderType(header);
-        }
-        return rm;
-    }
-
-    public QName getTagQName() {
-        return REGEX_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java	(working copy)
@@ -1,60 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.FaultMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- *         <p>
- *         <xmp><synapse:fault name="optional"/> </xmp>
- * 	TODO add the ability to configure the fault codes, etc
- * 
- */
-public class FaultMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "fault");
-
-    private static final QName FAULTCODE = new QName(
-            Constants.SYNAPSE_NAMESPACE, "faultCode");
-    private static final QName REASON = new QName(
-            Constants.SYNAPSE_NAMESPACE, "reason");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        FaultMediator fp = new FaultMediator();
-
-        OMElement code = el.getFirstChildWithName(FAULTCODE);
-        if (code != null) {
-            fp.setFaultCode(code.getTextAsQName());
-        }
-        OMElement reason = el.getFirstChildWithName(REASON);
-        if (reason != null) {
-            fp.setReason(reason.getText());
-        }
-        super.setNameOnMediator(se, el, fp);
-        return fp;
-    }
-
-    public QName getTagQName() {
-        return HEADER_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.ExactlyOneMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-import javax.xml.namespace.QName;
-
-/**
- * This will create <exactlyone>
- *                       <regex/>[0..n]
- *                       <xpath/>[0..n]
- *                       <default/> ?
- *                  </exactlyone>
- *
- *
- */
-public class ExactlyOneMediatorFactory extends AbstractListMediatorFactory {
-
-    private static final String EXACTLYONE = "exactlyone";
-
-	private static final QName SWITCH_Q = new QName(org.apache.synapse.xml.Constants.SYNAPSE_NAMESPACE,
-			EXACTLYONE);
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ExactlyOneMediator exactlyOne = new ExactlyOneMediator();
-        super.addChildrenAndSetName(se,el,exactlyOne);
-        // now validate all children are ConditionProcessors
-        
-        
-        return exactlyOne;
-    }
-
-    public QName getTagQName() {
-        return SWITCH_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
-import org.apache.synapse.mediators.builtin.axis2.AddressingOutMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class AddressingOutMediatorFactory extends AbstractMediatorFactory {
-
-    private static final QName ADD_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "engage-addressing-out");
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        AddressingOutMediator aom = new AddressingOutMediator();
-        super.setNameOnMediator(se,el,aom);
-        return aom;
-    }
-
-    public QName getTagQName() {
-        return ADD_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.RefMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-
-public class RefMediatorFactory extends
-        AbstractMediatorFactory {
-    private static final QName REF_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "ref");
-
-    public QName getTagQName() {
-        return REF_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        RefMediator rm = new RefMediator();
-        super.setNameOnMediator(se, el, rm);
-        OMAttribute attr = el.getAttribute(new QName("ref"));
-        if (attr==null) throw new SynapseException("<ref> must have attribute ref");
-        rm.setRef(attr.getAttributeValue());
-        return rm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.SendNowMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-/**
- */
-public class SendNowMediatorFactory extends AbstractMediatorFactory {
-    private static final QName SEND_NOW_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"sendnow");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-    	 SendNowMediator sm = new SendNowMediator();
-         super.setNameOnMediator(se,el,sm);
-         return sm;
-    }
-
-    public QName getTagQName() {
-        return SEND_NOW_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/MediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/MediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/MediatorFactory.java	(working copy)
@@ -1,28 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-
-public interface MediatorFactory {
-    public Mediator createMediator(SynapseEnvironment se, OMElement el);
-    public QName getTagQName();
-}
Index: modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java	(working copy)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.NeverMediator;
-import org.apache.axiom.om.OMElement;
-
-
-/**
- * <xmp><synapse:never name="optional"><more stuff in here></synapse:never></xmp>
- * Stuff in here never gets processed
- * You might think that a bit useless, but it lets you put things you want to refer to from elsewhere
- */
-public class NeverMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName NEVER_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "never");
-
-    public QName getTagQName() {
-        return NEVER_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        NeverMediator nm = new NeverMediator();
-        super.addChildrenAndSetName(se, el, nm);
-        return nm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java	(working copy)
@@ -1,52 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.LogMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- * <p>
- * Logs messages using Commons-logging. 
- * 
- * <xmp><log name="optional"/></xmp>
- * TODO add support for simple one-line log entry (doesn't cause body parsing)
- *
- */
-public class LogMediatorFactory extends AbstractMediatorFactory {
-    private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "log");
-
-
-    public QName getTagQName() {
-        return LOG_Q;
-    }
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        LogMediator lm = new LogMediator();
-        super.setNameOnMediator(se,el,lm);
-        return lm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AbstractListMediatorFactory.java	(working copy)
@@ -1,62 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.ListMediator;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- * <p> This is the abstract parent of any tag which is a "Node" - so &ltstage>, &ltin>&ltout> and &ltnever> all fit this model
- * <p>It recursively creates a list of processors from the children. 
- *
- */
-public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
-
-    Log log = LogFactory.getLog(getClass());
-
-    public void addChildrenAndSetName(SynapseEnvironment se, OMElement el, ListMediator m)
-    {
-        super.setNameOnMediator(se, el, m);
-
-        Iterator it = el.getChildElements();
-        List mediators = new LinkedList();
-        while (it.hasNext()) {
-            OMElement child = (OMElement) it.next();
-            Mediator med = MediatorFactoryFinder.getMediator(se, child);
-            if (med != null)
-                mediators.add(med);
-            else
-                log.info("Unknown child of all" + child.getLocalName());
-        }
-        m.setList(mediators);
-
-    }
-
-
-
-}
Index: modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AbstractMediatorFactory.java	(working copy)
@@ -1,53 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * 
- * <p> This is the abstract superclass of any tag that isn't a "node". I.e. mediators or builtin
- * mediators like log
- *
- */
-public abstract class AbstractMediatorFactory implements MediatorFactory {
-
-    private Log log = LogFactory.getLog(getClass());
-   
-    public void setNameOnMediator(SynapseEnvironment se, OMElement el, Mediator m) {
-
-        OMAttribute nm = el.getAttribute(new QName("name"));
-        String name =null;
-        if (nm != null) {
-             name = nm.getAttributeValue().trim();
-            //m.setName(name);
-            se.addMediator(name, m);
-        }
-        log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
-
-    }
-
-
-}
Index: modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AddressingInMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- *  <xmp><synapse:addressing/></xmp>
- *         <p>
- *         This tag turns on the addressing module 
- * 
- */
-public class AddressingInMediatorFactory extends AbstractMediatorFactory {
-    private static final QName ADD_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "engage-addressing-in");
-
-
-    public QName getTagQName() {
-        return ADD_Q;
-    }
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        AddressingInMediator ap = new AddressingInMediator();
-        super.setNameOnMediator(se,el,ap);
-        return ap;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/AddressingOutMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-
-import org.apache.synapse.mediators.builtin.axis2.AddressingOutMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class AddressingOutMediatorFactory extends AbstractMediatorFactory {
-
-    private static final QName ADD_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "engage-addressing-out");
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        AddressingOutMediator aom = new AddressingOutMediator();
-        super.setNameOnMediator(se,el,aom);
-        return aom;
-    }
-
-    public QName getTagQName() {
-        return ADD_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ClassMediatorFactory.java	(working copy)
@@ -1,59 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * <xmp><synapse:classmediator name="nm" class="org.fremantle.mediator"</synapse:classmediator></xmp>
- * TODO add ability to configure properties with Strings/OMElements based on children.
- */
-public class ClassMediatorFactory extends AbstractMediatorFactory {
-    private static final QName CLM_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "classmediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ClassMediator cmp = new ClassMediator();
-        super.setNameOnMediator(se, el, cmp);
-
-        OMAttribute clsName = el.getAttribute(new QName("class"));
-        if (clsName == null)
-            throw new SynapseException("missing class attribute on element"
-                    + el.toString());
-        try {
-            Class clazz = se.getClassLoader().loadClass(clsName.getAttributeValue());
-            cmp.setClazz(clazz);
-        } catch (ClassNotFoundException e) {
-            throw new SynapseException("class loading error", e);
-        }
-        return cmp;
-
-    }
-
-
-    public QName getTagQName() {
-        return CLM_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/Constants.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/Constants.java	(working copy)
@@ -1,25 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-/**
- * <p/>
- * Constants used in the XML processing
- */
-public interface Constants {
-    String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
-    String SYNAPSE = "synapse";
-}
Index: modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DefaultMediatorFactory.java	(working copy)
@@ -1,40 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.DefaultMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class DefaultMediatorFactory
-        extends AbstractListMediatorFactory
-        {
-
-    private static final QName DEFAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"default");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        DefaultMediator dm = new DefaultMediator();
-        super.addChildrenAndSetName(se,el,dm);
-        return dm;  
-    }
-
-    public QName getTagQName() {
-        return DEFAULT_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DefineMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.DefineMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class DefineMediatorFactory extends AbstractListMediatorFactory {
-    private static final QName DEFINE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-                "define");
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        DefineMediator defineMediator = new DefineMediator();
-        super.addChildrenAndSetName(se,el,defineMediator);
-        return defineMediator;
-    }
-
-    public QName getTagQName() {
-        return DEFINE_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/DropMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.DropMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class DropMediatorFactory extends AbstractMediatorFactory {
-
-    private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"drop");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        return new DropMediator();
-    }
-
-    public QName getTagQName() {
-        return DROP_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ExactlyOneMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.ExactlyOneMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-import javax.xml.namespace.QName;
-
-/**
- * This will create <exactlyone>
- *                       <regex/>[0..n]
- *                       <xpath/>[0..n]
- *                       <default/> ?
- *                  </exactlyone>
- *
- *
- */
-public class ExactlyOneMediatorFactory extends AbstractListMediatorFactory {
-
-    private static final String EXACTLYONE = "exactlyone";
-
-	private static final QName SWITCH_Q = new QName(org.apache.synapse.xml.Constants.SYNAPSE_NAMESPACE,
-			EXACTLYONE);
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ExactlyOneMediator exactlyOne = new ExactlyOneMediator();
-        super.addChildrenAndSetName(se,el,exactlyOne);
-        // now validate all children are ConditionProcessors
-        
-        
-        return exactlyOne;
-    }
-
-    public QName getTagQName() {
-        return SWITCH_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/FaultMediatorFactory.java	(working copy)
@@ -1,60 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.FaultMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- *         <p>
- *         <xmp><synapse:fault name="optional"/> </xmp>
- * 	TODO add the ability to configure the fault codes, etc
- * 
- */
-public class FaultMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "fault");
-
-    private static final QName FAULTCODE = new QName(
-            Constants.SYNAPSE_NAMESPACE, "faultCode");
-    private static final QName REASON = new QName(
-            Constants.SYNAPSE_NAMESPACE, "reason");
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        FaultMediator fp = new FaultMediator();
-
-        OMElement code = el.getFirstChildWithName(FAULTCODE);
-        if (code != null) {
-            fp.setFaultCode(code.getTextAsQName());
-        }
-        OMElement reason = el.getFirstChildWithName(REASON);
-        if (reason != null) {
-            fp.setReason(reason.getText());
-        }
-        super.setNameOnMediator(se, el, fp);
-        return fp;
-    }
-
-    public QName getTagQName() {
-        return HEADER_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/HeaderMediatorFactory.java	(working copy)
@@ -1,61 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.HeaderMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- *         <p>
- *         <xmp><synapse:header name="optional" type="to|from|faultto|replyto|action"
- *         value="newvalue"/> </xmp>
- * 
- * 
- */
-public class HeaderMediatorFactory extends AbstractMediatorFactory {
-    private static final QName HEADER_Q = new QName(
-            Constants.SYNAPSE_NAMESPACE, "header");
-
-
-        private static final QName TYPE_ATT_Q = new QName("type"),
-            VALUE_ATT_Q = new QName("value");
-
-        public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-            HeaderMediator hm = new HeaderMediator();
-            super.setNameOnMediator(se, el, hm);
-            OMAttribute val = el.getAttribute(VALUE_ATT_Q);
-            OMAttribute type = el.getAttribute(TYPE_ATT_Q);
-            if (val == null || type == null) {
-                throw new SynapseException("<header> must have both " + VALUE_ATT_Q
-                    + " and " + TYPE_ATT_Q + " attributes: " + el.toString());
-            }
-            hm.setHeaderType(type.getAttributeValue());
-            hm.setValue( val.getAttributeValue());
-            return hm;
-    }
-
-    public QName getTagQName() {
-        return HEADER_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/InMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/InMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/InMediatorFactory.java	(working copy)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.InMediator;
-import org.apache.axiom.om.OMElement;
-
-
-/**
- *
- * 
- * <p>
- * <xmp><in name="optional">.... </in></xmp>
- * Uses children if processing an request (i.e. if !response).  
- *
- */
-public class InMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName IN_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "in");
-
-    public QName getTagQName() {
-        return IN_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        InMediator im = new InMediator();
-        super.addChildrenAndSetName(se, el, im);
-        return im;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/LogMediatorFactory.java	(working copy)
@@ -1,52 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.LogMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- * 
- * <p>
- * Logs messages using Commons-logging. 
- * 
- * <xmp><log name="optional"/></xmp>
- * TODO add support for simple one-line log entry (doesn't cause body parsing)
- *
- */
-public class LogMediatorFactory extends AbstractMediatorFactory {
-    private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "log");
-
-
-    public QName getTagQName() {
-        return LOG_Q;
-    }
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        LogMediator lm = new LogMediator();
-        super.setNameOnMediator(se,el,lm);
-        return lm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/MediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/MediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/MediatorFactory.java	(working copy)
@@ -1,28 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-
-public interface MediatorFactory {
-    public Mediator createMediator(SynapseEnvironment se, OMElement el);
-    public QName getTagQName();
-}
Index: modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/MediatorFactoryFinder.java	(working copy)
@@ -1,136 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.resources.xml.PropertyMediatorFactory;
-import org.apache.synapse.resources.xml.ResourceMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-
-import sun.misc.Service;
-
-/**
- *
- * 
- * This class is based on J2SE Service Provider model
- * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
- */
-
-public class MediatorFactoryFinder {
-
-	private static Map lookup = null;
-
-	private static Log log = LogFactory
-			.getLog(MediatorFactoryFinder.class);
-
-	private static Class[] mediatorFactories = {
-			SynapseMediatorFactory.class,
-			StageMediatorFactory.class, RegexMediatorFactory.class,
-			XPathMediatorFactory.class,
-			HeaderMediatorFactory.class,
-			ClassMediatorFactory.class,
-			ServiceMediatorFactory.class,
-			LogMediatorFactory.class, SendMediatorFactory.class,
-			FaultMediatorFactory.class,
-			AddressingInMediatorFactory.class,
-			AddressingOutMediatorFactory.class,
-			InMediatorFactory.class, OutMediatorFactory.class,
-			NeverMediatorFactory.class, RefMediatorFactory.class,
-            XSLTMediatorFactory.class,DefineMediatorFactory.class,
-            SendNowMediatorFactory.class,SendMediatorFactory.class,
-            DropMediatorFactory.class,
-            RefDefineMediatorFactory.class, ExactlyOneMediatorFactory.class,
-            DefaultMediatorFactory.class,
-            PropertyMediatorFactory.class, ResourceMediatorFactory.class,
-            };
-
-	private static void initialise() {
-
-		if (lookup != null)
-			return;
-		lookup = new HashMap();
-
-		for (int i = 0; i < mediatorFactories.length; i++) {
-			Class c = mediatorFactories[i];
-			try {
-				lookup.put(((MediatorFactory) c.newInstance())
-						.getTagQName(), c);
-			} catch (Exception e) {
-				throw new SynapseException("problem instantiating "+c.getName(), e);
-			}
-		}
-		log.debug("registering extensions");
-		log.debug(System.getProperty("java.class.path"));
-		// now try additional processors
-		Iterator it = Service.providers(MediatorFactory.class);
-		while (it.hasNext()) {
-			MediatorFactory mf = (MediatorFactory) it.next();
-			QName tag = mf.getTagQName();
-			lookup.put(tag, mf.getClass());
-			log.debug("added MediatorFactory " + mf.getClass() + " to handle " + tag);
-		}
-	}
-
-                            	/**
-	 * @param qn
-	 * @return the class which implements the Processor for the given QName
-	 */
-	public static Class find(QName qn) {
-		initialise();
-		return (Class) lookup.get(qn);
-	}
-	
-	/**
-	 * This method returns a Processor given an OMElement. This will be used
-	 * recursively by the elements which contain processor elements themselves
-	 * (e.g. rules)
-	 * 
-	 * @param synapseEnv
-	 * @param element
-	 * @return Processor
-	 */
-	public static Mediator getMediator(SynapseEnvironment synapseEnv, OMElement element) {
-		OMNamespace n = element.getNamespace();
-		
-		Class cls = find(new QName(n.getName(), element
-				.getLocalName()));
-		try {
-			MediatorFactory mf = (MediatorFactory) cls.newInstance();
-			Mediator m = mf.createMediator(synapseEnv, element);
-			return m;
-		} catch (InstantiationException e) {
-			throw new SynapseException(e);
-		} catch (IllegalAccessException e) {
-			throw new SynapseException(e);
-		}
-	}
-}
Index: modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/NeverMediatorFactory.java	(working copy)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.NeverMediator;
-import org.apache.axiom.om.OMElement;
-
-
-/**
- * <xmp><synapse:never name="optional"><more stuff in here></synapse:never></xmp>
- * Stuff in here never gets processed
- * You might think that a bit useless, but it lets you put things you want to refer to from elsewhere
- */
-public class NeverMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName NEVER_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "never");
-
-    public QName getTagQName() {
-        return NEVER_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        NeverMediator nm = new NeverMediator();
-        super.addChildrenAndSetName(se, el, nm);
-        return nm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/OutMediatorFactory.java	(working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.OutMediator;
-import org.apache.axiom.om.OMElement;
-
-
-public class OutMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final QName OUT_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "out");
-
-    public QName getTagQName() {
-        return OUT_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        OutMediator outMediator= new OutMediator();
-        super.addChildrenAndSetName(se, el, outMediator);
-        return outMediator;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ProcessorConfigurator.java	(working copy)
@@ -1,33 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.Processor;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-/**
- * @deprecated
- *
- */
-public interface ProcessorConfigurator {
-    public Processor createProcessor(SynapseEnvironment se, OMElement el);
-    public QName getTagQName();
-
-}
Index: modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RefDefineMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.RefDefineMediator;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-import javax.xml.namespace.QName;
-
-/*
- */
-public class RefDefineMediatorFactory extends AbstractMediatorFactory {
-	private static final QName REF_DEFINE_Q = new QName(
-			Constants.SYNAPSE_NAMESPACE, "refdefine");
-
-	public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-		RefDefineMediator rdm = new RefDefineMediator();
-		super.setNameOnMediator(se, el, rdm);
-		OMAttribute attr = el.getAttribute(new QName("ref"));
-		if (attr == null)
-			throw new SynapseException("<ref> must have attribute ref");
-		rdm.setRefDefine(attr.getAttributeValue());
-		return rdm;
-	}
-
-	public QName getTagQName() {
-		return REF_DEFINE_Q;
-	}
-}
Index: modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RefMediatorFactory.java	(working copy)
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.RefMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-
-public class RefMediatorFactory extends
-        AbstractMediatorFactory {
-    private static final QName REF_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "ref");
-
-    public QName getTagQName() {
-        return REF_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        RefMediator rm = new RefMediator();
-        super.setNameOnMediator(se, el, rm);
-        OMAttribute attr = el.getAttribute(new QName("ref"));
-        if (attr==null) throw new SynapseException("<ref> must have attribute ref");
-        rm.setRef(attr.getAttributeValue());
-        return rm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/RegexMediatorFactory.java	(working copy)
@@ -1,81 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-/**
- *
- * 
- */
-public class RegexMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final String REGEX = "regex";
-
-    private static final QName REGEX_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            REGEX);
-
-    private static final QName REGEX_PATTERN_ATT_Q = new QName("pattern");
-
-    private static final QName REGEX_PROPERTY_ATT_Q = new QName("property");
-
-    private static final QName REGEX_HEADER_ATT_Q = new QName("message-address");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        RegexMediator rm = new RegexMediator();
-        super.addChildrenAndSetName(se, el, rm);
-
-        OMAttribute patt = el.getAttribute(REGEX_PATTERN_ATT_Q);
-        if (patt == null) {
-            throw new SynapseException(REGEX + " must have "
-                    + REGEX_PATTERN_ATT_Q + " attribute: " + el.toString());
-        }
-
-        OMAttribute prop = el.getAttribute(REGEX_PROPERTY_ATT_Q);
-        OMAttribute head = el.getAttribute(REGEX_HEADER_ATT_Q);
-        if (prop == null && head == null) {
-            throw new SynapseException(REGEX + " must have either "
-                    + REGEX_PROPERTY_ATT_Q + " or " + REGEX_HEADER_ATT_Q
-                    + " attributes: " + el.toString());
-        }
-        rm.setPattern(patt.getAttributeValue());
-        if (prop != null) {
-            rm.setPropertyName(prop.getAttributeValue());
-        } else {
-            String header = head.getAttributeValue();
-            rm.setHeaderType(header);
-        }
-        return rm;
-    }
-
-    public QName getTagQName() {
-        return REGEX_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SecurityMediatorFactory.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.xml;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.SecurityMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SecurityMediatorFactory extends AbstractMediatorFactory {
-    private static final QName SEC_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"engage-security");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SecurityMediator sm = new SecurityMediator();
-        super.setNameOnMediator(se,el,sm);
-        return sm;
-    }
-
-    public QName getTagQName() {
-        return SEC_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SendMediatorFactory.java	(working copy)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.SendMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.axiom.om.OMElement;
-
-public class SendMediatorFactory extends AbstractMediatorFactory {
-
-
-    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "send");
-
-
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SendMediator sm =  new SendMediator();
-        super.setNameOnMediator(se, el,sm);
-        return sm;
-
-    }
-
-    public QName getTagQName() {
-
-        return SEND_Q;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SendNowMediatorFactory.java	(working copy)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.SendNowMediator;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-/**
- */
-public class SendNowMediatorFactory extends AbstractMediatorFactory {
-    private static final QName SEND_NOW_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-			"sendnow");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-    	 SendNowMediator sm = new SendNowMediator();
-         super.setNameOnMediator(se,el,sm);
-         return sm;
-    }
-
-    public QName getTagQName() {
-        return SEND_NOW_Q;
-    }
-}
Index: modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/ServiceMediatorFactory.java	(working copy)
@@ -1,50 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-
-public class ServiceMediatorFactory extends AbstractMediatorFactory {
-    private static final QName tagName = new QName(Constants.SYNAPSE_NAMESPACE,
-            "servicemediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        ServiceMediator sm = new ServiceMediator();
-        super.setNameOnMediator(se,el,sm);
-
-        OMAttribute attr = el.getAttribute(new QName("service"));
-        if (attr == null)
-            throw new SynapseException(
-                    "<servicemediator> must have 'service' attribute");
-        sm.setServiceName(attr.getAttributeValue());
-        return sm;
-    }
-
-    public QName getTagQName() {
-
-        return tagName;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/StageMediatorFactory.java	(working copy)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.xml.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.StageMediator;
-import org.apache.axiom.om.OMElement;
-
-/**
- *
- *<xmp><synapse:stage name="optional"> do everything in here </synapse:stage></xmp>
- */
-public class StageMediatorFactory extends
-        AbstractListMediatorFactory{
-    private static final QName STAGE_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "stage");
-
-    public QName getTagQName() {
-        return STAGE_Q;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        StageMediator sm = new StageMediator();
-        super.addChildrenAndSetName(se, el, sm);
-        return sm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/SynapseMediatorFactory.java	(working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.base.SynapseMediator;
-import org.apache.axiom.om.OMElement;
-
-public class SynapseMediatorFactory extends
-        AbstractListMediatorFactory {
-
-    private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE,
-            "synapse");
-
-    public QName getTagQName() {
-        return tagname;
-    }
-
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        SynapseMediator sm = new SynapseMediator();
-        super.addChildrenAndSetName(se, el, sm);
-        return sm;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java	(revision 405035)
+++ modules/core/src/org/apache/synapse/xml/XPathMediatorFactory.java	(working copy)
@@ -1,81 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.xml;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMNamespace;
-
-/**
- *
- * 
- * <p>
- * This class executes a test and then processes all subsequent rules/mediations
- * if the test is true
- * 
- */
-public class XPathMediatorFactory extends
-        AbstractListMediatorFactory {
-    private static final String XPATH = "xpath";
-
-    private static final QName XPATH_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "xpath");
-
-    private static final QName XPATH_EXPRESSION_ATT_Q = new QName("expr");
-
-    /*
-      * (non-Javadoc)
-      *
-      * @see org.apache.synapse.spi.Processor#compile(org.apache.synapse.api.SynapseEnvironment,
-      *      org.apache.axis2.om.OMElement)
-      */
-    public Mediator  createMediator(SynapseEnvironment se, OMElement el) {
-        XPathMediator xm = new XPathMediator();
-
-        super.addChildrenAndSetName(se, el, xm);
-
-        OMAttribute expr = el.getAttribute(XPATH_EXPRESSION_ATT_Q);
-        if (expr == null) {
-            throw new SynapseException(XPATH + " must have "
-                    + XPATH_EXPRESSION_ATT_Q + " attribute: " + el.toString());
-        }
-
-        xm.setXPathExpr(expr.getAttributeValue());
-        Iterator it = el.getAllDeclaredNamespaces();
-        while (it.hasNext()) {
-            OMNamespace n = (OMNamespace) it.next();
-            xm.addXPathNamespace(n.getPrefix(), n.getName());
-        }
-
-        return xm;
-    }
-
-    public QName getTagQName() {
-
-        return XPATH_Q;
-    }
-
-}
Index: modules/core/test-resources/axis2/services/emptymediator/META-INF/services.xml
===================================================================
--- modules/core/test-resources/axis2/services/emptymediator/META-INF/services.xml	(revision 405035)
+++ modules/core/test-resources/axis2/services/emptymediator/META-INF/services.xml	(working copy)
@@ -1,6 +1,6 @@
 <service name="emptymediator">
     <operation name="mediate" > 
-          <messageReceiver class="org.apache.synapse.axis2.EmptyMessageReceiver" />
+          <messageReceiver class="org.apache.synapse.core.axis2.EmptyMessageReceiver" />
     </operation>
 </service>
   
\ No newline at end of file
Index: modules/core/test-resources/axis2/services/synapse/META-INF/services.xml
===================================================================
--- modules/core/test-resources/axis2/services/synapse/META-INF/services.xml	(revision 405035)
+++ modules/core/test-resources/axis2/services/synapse/META-INF/services.xml	(working copy)
@@ -1,7 +1,7 @@
   <service name="synapse">
 
     <operation name="mediate" > 
-          <messageReceiver class="org.apache.synapse.axis2.SynapseMessageReceiver" />
+          <messageReceiver class="org.apache.synapse.core.axis2.SynapseMessageReceiver" />
     </operation>
     
   </service>
Index: modules/core/test-resources/misc/validate.xsd
===================================================================
--- modules/core/test-resources/misc/validate.xsd	(revision 0)
+++ modules/core/test-resources/misc/validate.xsd	(revision 0)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.apache-synapse.org/test" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.apache-synapse.org/test">
+	<xs:element name="CheckPriceRequest">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="Code" type="xs:string"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
\ No newline at end of file
Index: modules/core/test-resources/misc/validate.xsd
===================================================================
--- modules/core/test-resources/misc/validate.xsd	(revision 0)
+++ modules/core/test-resources/misc/validate.xsd	(revision 0)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.apache-synapse.org/test" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.apache-synapse.org/test">
+	<xs:element name="CheckPriceRequest">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="Code" type="xs:string"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
\ No newline at end of file
Index: modules/core/test-resources/org/apache/axis2/META-INF/environmentaware-service.xml
===================================================================
--- modules/core/test-resources/org/apache/axis2/META-INF/environmentaware-service.xml	(revision 405035)
+++ modules/core/test-resources/org/apache/axis2/META-INF/environmentaware-service.xml	(working copy)
@@ -6,6 +6,6 @@
         org.apache.axis2.test.EnvironmentAwareMediator</parameter>
     <operation name="mediate">
         <messageReceiver
-                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+                class="org.apache.synapse.core.axis2.axis2.ServiceMediatorMessageReceiver"/>
     </operation>
 </service>
\ No newline at end of file
Index: modules/core/test-resources/org/apache/axis2/META-INF/service-mediator.xml
===================================================================
--- modules/core/test-resources/org/apache/axis2/META-INF/service-mediator.xml	(revision 405035)
+++ modules/core/test-resources/org/apache/axis2/META-INF/service-mediator.xml	(working copy)
@@ -6,6 +6,6 @@
         org.apache.axis2.test.TestMediator</parameter>
     <operation name="mediate">
         <messageReceiver
-                class="org.apache.synapse.axis2.ServiceMediatorMessageReceiver"/>
+                class="org.apache.synapse.core.axis2.axis2.ServiceMediatorMessageReceiver"/>
     </operation>
 </service>
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java	(working copy)
@@ -1,44 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.configurators;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-
-import org.apache.synapse.Constants;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironmentFinder;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.description.Parameter;
-
-
-public class SynapseConfiguratorTest extends TestCase {
-    public void testSynapseEnvironmentFinder() throws Exception {
-        MessageContext mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-				.getSynapseEnvironment(mc);
-        assertNotNull(env);
-
-        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-
-        Parameter parm =  ac.getParameter(Constants.SYNAPSE_ENVIRONMENT);
-        assertNotNull(parm);
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/configurators/SynapseConfiguratorTest.java	(working copy)
@@ -1,44 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.configurators;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-
-import org.apache.synapse.Constants;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironmentFinder;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.description.Parameter;
-
-
-public class SynapseConfiguratorTest extends TestCase {
-    public void testSynapseEnvironmentFinder() throws Exception {
-        MessageContext mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-				.getSynapseEnvironment(mc);
-        assertNotNull(env);
-
-        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
-
-        Parameter parm =  ac.getParameter(Constants.SYNAPSE_ENVIRONMENT);
-        assertNotNull(parm);
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java	(working copy)
@@ -1,29 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.TestSynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.TestSynapseMessage;
-
-
-import junit.framework.TestCase;
-
-public class AddressingInProcessorTest extends TestCase {
-
-    public void testAddressingInProcessor() throws Exception {
-
-        SynapseEnvironment se = TestSynapseEnvironment.createAxis2SynapseEnvironment();
-        SynapseMessage smNoAdd = TestSynapseMessage.createSampleSOAP11MessageWithoutAddressing("target/synapse-repository");
-
-        AddressingInMediator aip = new AddressingInMediator();
-
-        aip.mediate(smNoAdd);
-        assertTrue("to should be null if there is no addressing header", smNoAdd.getTo() == null);
-
-        SynapseMessage smAdd = TestSynapseMessage.createSampleSOAP11MessageWithAddressing("target/synapse-repository");
-        aip.mediate(smAdd);
-        assertTrue("to should be the incoming addressing header",
-                smAdd.getTo().getAddress().equals(TestSynapseMessage.URN_SAMPLE_TO_ADDRESS));
-
-    }
-}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/builtin/axis2/AddressingInProcessorTest.java	(working copy)
@@ -1,29 +0,0 @@
-package org.apache.synapse.mediators.builtin.axis2;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.TestSynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.TestSynapseMessage;
-
-
-import junit.framework.TestCase;
-
-public class AddressingInProcessorTest extends TestCase {
-
-    public void testAddressingInProcessor() throws Exception {
-
-        SynapseEnvironment se = TestSynapseEnvironment.createAxis2SynapseEnvironment();
-        SynapseMessage smNoAdd = TestSynapseMessage.createSampleSOAP11MessageWithoutAddressing("target/synapse-repository");
-
-        AddressingInMediator aip = new AddressingInMediator();
-
-        aip.mediate(smNoAdd);
-        assertTrue("to should be null if there is no addressing header", smNoAdd.getTo() == null);
-
-        SynapseMessage smAdd = TestSynapseMessage.createSampleSOAP11MessageWithAddressing("target/synapse-repository");
-        aip.mediate(smAdd);
-        assertTrue("to should be the incoming addressing header",
-                smAdd.getTo().getAddress().equals(TestSynapseMessage.URN_SAMPLE_TO_ADDRESS));
-
-    }
-}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/mediators/builtin/ValidateMediatorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/builtin/ValidateMediatorTest.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/builtin/ValidateMediatorTest.java	(revision 0)
@@ -0,0 +1,127 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.builtin;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.TestSynapseMessage;
+import org.apache.synapse.TestSynapseMessageContext;
+import org.apache.synapse.mediators.TestMediateHandler;
+import org.apache.synapse.mediators.TestMediator;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.StringReader;
+import java.io.File;
+
+public class ValidateMediatorTest extends TestCase implements TestMediateHandler {
+
+    private static final String VALID_ENVELOPE =
+            "<m0:CheckPriceRequest xmlns:m0=\"http://www.apache-synapse.org/test\">\n" +
+            "\t<m0:Code>String</m0:Code>\n" +
+            "</m0:CheckPriceRequest>\n";
+
+    private static final String IN_VALID_ENVELOPE =
+            "<m0:CheckPriceRequest xmlns:m0=\"http://www.apache-synapse.org/test\">\n" +
+            "\t<m0:Codes>String</m0:Codes>\n" +
+            "</m0:CheckPriceRequest>\n";
+
+    private boolean onFailInvoked = false;
+    private TestMediator testMediator = null;
+
+    public void setUp() {
+        testMediator = new TestMediator();
+        testMediator.setHandler(this);
+    }
+
+    public void handle(SynapseContext synCtx) {
+        onFailInvoked = true;
+    }
+
+    public void setOnFailInvoked(boolean onFailInvoked) {
+        this.onFailInvoked = onFailInvoked;
+    }
+
+    public void testValidateMedaitorValidCase() throws Exception {
+        setOnFailInvoked(false);
+
+        // create a validate mediator
+        ValidateMediator validate = new ValidateMediator();
+
+        // set the schema url, source xpath and any name spaces
+        System.out.println("Current Dir : " + new File(".").getAbsolutePath());
+        validate.setSchemaUrl("test-resources/misc/validate.xsd");
+        AXIOMXPath source = new AXIOMXPath("//m0:CheckPriceRequest");
+        source.addNamespace("m0", "http://www.apache-synapse.org/test");
+        validate.setSource(source);
+
+        // set dummy mediator to be called on fail
+        validate.addChild(testMediator);
+
+        // test validate mediator, with static enveope
+        validate.mediate(getTestContext(VALID_ENVELOPE));
+
+        assertTrue(!onFailInvoked);
+    }
+
+    public void testValidateMedaitorInvalidCase() throws Exception {
+        setOnFailInvoked(false);
+
+        // create a validate mediator
+        ValidateMediator validate = new ValidateMediator();
+
+        // set the schema url, source xpath and any name spaces
+        validate.setSchemaUrl("modules/core/test-resources/misc/validate.xsd");
+        AXIOMXPath source = new AXIOMXPath("//m0:CheckPriceRequest");
+        source.addNamespace("m0", "http://www.apache-synapse.org/test");
+        validate.setSource(source);
+
+        // set dummy mediator to be called on fail
+        validate.addChild(testMediator);
+
+        // test validate mediator, with static enveope
+        validate.mediate(getTestContext(IN_VALID_ENVELOPE));
+
+        assertTrue(onFailInvoked);
+    }
+
+    private TestSynapseMessageContext getTestContext(String bodyText) throws Exception {
+
+        // create a test synapse context
+        TestSynapseMessageContext synCtx = new TestSynapseMessageContext();
+        TestSynapseMessage synMsg = new TestSynapseMessage();
+
+        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
+        omDoc.addChild(envelope);
+
+        XMLStreamReader parser = XMLInputFactory.newInstance().
+            createXMLStreamReader(new StringReader(bodyText));
+        StAXOMBuilder builder = new StAXOMBuilder(parser);
+
+        // set a dummy static message
+        envelope.getBody().addChild(builder.getDocumentElement());
+
+        synMsg.setEnvelope(envelope);
+        synCtx.setSynapseMessage(synMsg);
+        return synCtx;
+    }
+
+}
Index: modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java	(revision 0)
@@ -0,0 +1,48 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.ext;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+
+/**
+ * Since the class mediator always "instantiates" a new instance of a class
+ * use a static member variable just to test this.. This class is not nice.. :-)
+ * but does what is expected... :-(
+ */
+public class ClassMediatorTestMediator implements Mediator {
+
+    public static boolean invoked = false;
+
+    public static String testProp = null;
+
+    public boolean mediate(SynapseContext synCtx) {
+        invoked = true;
+        return false;
+    }
+
+    public String getType() {
+        return null;
+    }
+
+    public void setTestProp(String s) {
+        testProp = s;
+    }
+
+    public String getTestProp() {
+        return testProp;
+    }
+}
Index: modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java	(revision 0)
@@ -0,0 +1,58 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.ext;
+
+import junit.framework.TestCase;
+import org.apache.synapse.TestSynapseMessageContext;
+import org.apache.synapse.mediators.MediatorProperty;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+
+/**
+ * Tests the class mediator instantiation and setting of literal and
+ * XPath parameters at runtime.
+ */
+public class ClassMediatorTest extends TestCase {
+
+    public void testCreationWithoutProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.invoked);
+    }
+
+    public void testCreationWithLiteralProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        MediatorProperty mp = new MediatorProperty();
+        mp.setName("testProp");
+        mp.setValue("testValue");
+        cm.addProperty(mp);
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.testProp.equals("testValue"));
+    }
+
+    public void testCreationWithXPathProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        MediatorProperty mp = new MediatorProperty();
+        mp.setName("testProp");
+        mp.setExpression(new AXIOMXPath("concat('XPath ','is ','FUN!')"));
+        cm.addProperty(mp);
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.testProp.equals("XPath is FUN!"));
+    }
+
+}
Index: modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTest.java	(revision 0)
@@ -0,0 +1,58 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.ext;
+
+import junit.framework.TestCase;
+import org.apache.synapse.TestSynapseMessageContext;
+import org.apache.synapse.mediators.MediatorProperty;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+
+/**
+ * Tests the class mediator instantiation and setting of literal and
+ * XPath parameters at runtime.
+ */
+public class ClassMediatorTest extends TestCase {
+
+    public void testCreationWithoutProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.invoked);
+    }
+
+    public void testCreationWithLiteralProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        MediatorProperty mp = new MediatorProperty();
+        mp.setName("testProp");
+        mp.setValue("testValue");
+        cm.addProperty(mp);
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.testProp.equals("testValue"));
+    }
+
+    public void testCreationWithXPathProperties() throws Exception {
+        ClassMediator cm = new ClassMediator();
+        MediatorProperty mp = new MediatorProperty();
+        mp.setName("testProp");
+        mp.setExpression(new AXIOMXPath("concat('XPath ','is ','FUN!')"));
+        cm.addProperty(mp);
+        cm.setClazz(ClassMediatorTestMediator.class);
+        cm.mediate(new TestSynapseMessageContext());
+        assertTrue(ClassMediatorTestMediator.testProp.equals("XPath is FUN!"));
+    }
+
+}
Index: modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/ext/ClassMediatorTestMediator.java	(revision 0)
@@ -0,0 +1,48 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators.ext;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+
+/**
+ * Since the class mediator always "instantiates" a new instance of a class
+ * use a static member variable just to test this.. This class is not nice.. :-)
+ * but does what is expected... :-(
+ */
+public class ClassMediatorTestMediator implements Mediator {
+
+    public static boolean invoked = false;
+
+    public static String testProp = null;
+
+    public boolean mediate(SynapseContext synCtx) {
+        invoked = true;
+        return false;
+    }
+
+    public String getType() {
+        return null;
+    }
+
+    public void setTestProp(String s) {
+        testProp = s;
+    }
+
+    public String getTestProp() {
+        return testProp;
+    }
+}
Index: modules/core/test/org/apache/synapse/mediators/LoggerTestSample.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/LoggerTestSample.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/LoggerTestSample.java	(working copy)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.mediators;
-
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-/**
- *
- *
- * <p>A sample Mediator that logs the message
- * 
- */
-public class LoggerTestSample implements Mediator {
-
-    public boolean mediate(SynapseMessage mc) {
-        System.out.println("LoggerTestSample.mediate:");
-        if (mc.getTo() != null && mc.getTo().getAddress() != null)
-            System.out.println("LoggerTestSample.mediate to:" + mc.getTo().getAddress());
-        else
-            System.out.println("Empty To");
-        if (mc.getReplyTo() != null && mc.getReplyTo().getAddress() != null)
-            System.out.println("LoggerTestSample.mediate ReplyTo:"
-                    + mc.getReplyTo().getAddress());
-        else
-            System.out.println("Empty ReplyTo");
-        SOAPEnvelope env = mc.getEnvelope();
-        System.out.println(env.toString());
-        System.out.println();
-        return true;
-    }
-
-}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java	(working copy)
@@ -1,61 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-package org.apache.synapse.mediators;
-
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-import junit.framework.TestCase;
-
-
-public class MediatorFalseReturnTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"mediator_false\">\n" +
-                    "    <classmediator name=\"mediator_false\" class=\"org.apache.synapse.mediators.SampleFalseReturnMediator1\"/>\n" +
-                    "    <log/>" +
-                    "</stage>\n" +
-                    "<stage name=\"do_loggin\">\n" +
-                    "    <classmediator name=\"mediator_false\" class=\"org.apache.synapse.mediators.SampleMediator2\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testFalseReturnFromMediator() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("mediator_false"));
-        assertNull(smc.getProperty("test_string"));
-    }
-
-}
Index: modules/core/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java	(working copy)
@@ -1,28 +0,0 @@
-package org.apache.synapse.mediators;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SampleFalseReturnMediator1 implements Mediator {
-    public boolean mediate(SynapseMessage smc) {
-        System.out
-                .println("you are in the sample \"false\" returning mediator ");
-        return false;
-    }
-}
Index: modules/core/test/org/apache/synapse/mediators/SampleMediator2.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/SampleMediator2.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/SampleMediator2.java	(working copy)
@@ -1,27 +0,0 @@
-package org.apache.synapse.mediators;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SampleMediator2 implements Mediator {
-    public boolean mediate(SynapseMessage smc) {
-        smc.setProperty("test_string",new String("Done"));
-        return false;
-    }
-}
Index: modules/core/test/org/apache/synapse/mediators/SampleRouter.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/SampleRouter.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/SampleRouter.java	(working copy)
@@ -1,30 +0,0 @@
-package org.apache.synapse.mediators;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SampleRouter implements Mediator {
-    public boolean mediate(SynapseMessage smc) {
-        smc.setWSAAction("urn:synapse/sendon");
-        smc.setTo(new EndpointReference(
-                "http://localhost:8090/axis2/services/npe"));
-        return true;
-    }
-}
Index: modules/core/test/org/apache/synapse/mediators/SendBack.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/SendBack.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/SendBack.java	(working copy)
@@ -1,34 +0,0 @@
-package org.apache.synapse.mediators;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseMessage;
-import org.apache.axis2.addressing.EndpointReference;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SendBack implements Mediator {
-    public boolean mediate(SynapseMessage smc) {
-        /**
-         * Since addressing is not engaged before running this test case 
-         * To give the right behavior for this test-case
-         * setTo is set for anonymous url.
-         */
-        smc.setTo(new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"));
-        smc.setResponse(true);
-        return true;
-    }
-}
Index: modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java	(working copy)
@@ -1,42 +0,0 @@
-package org.apache.synapse.mediators;
-
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseMessage;
-//import org.apache.axiom.om.OMElement;
-//import junit.framework.TestCase;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class SimpleGETResourceAquiringMediator
-        implements Mediator{
-    
-
-    
-
-    public void setClassLoader(ClassLoader cl) {
-        throw new SynapseException(
-                "no class loader available for <classmediator/>");
-    }
-
-    public boolean mediate(SynapseMessage smc) {
-   //     OMElement resourcesElement = smc.getSynapseEnvironment().getResourceHelper()
-     //           .get("http://127.0.0.1:8090/axis2/services/npe/simple_resources");
-        // test for resources being not null
-   //     TestCase.assertNotNull(resourcesElement);
-        return true;
-    }
-}
Index: modules/core/test/org/apache/synapse/mediators/TestMediateHandler.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/TestMediateHandler.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/TestMediateHandler.java	(revision 0)
@@ -0,0 +1,23 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.SynapseContext;
+
+public interface TestMediateHandler {
+
+    public void handle(SynapseContext synCtx);
+}
Index: modules/core/test/org/apache/synapse/mediators/TestMediator.java
===================================================================
--- modules/core/test/org/apache/synapse/mediators/TestMediator.java	(revision 0)
+++ modules/core/test/org/apache/synapse/mediators/TestMediator.java	(revision 0)
@@ -0,0 +1,49 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+
+/**
+ * Test mediator class.
+ */
+public class TestMediator implements Mediator {
+
+    private TestMediateHandler handlerTest = null;
+
+    public TestMediator() {
+    }
+
+    public boolean mediate(SynapseContext synCtx) {
+        if (handlerTest != null) {
+            handlerTest.handle(synCtx);
+        }
+        return true;
+    }
+
+    public String getType() {
+        return null;
+    }
+
+    public TestMediateHandler getHandler() {
+        return handlerTest;
+    }
+
+    public void setHandler(TestMediateHandler handlerTest) {
+        this.handlerTest = handlerTest;
+    }
+}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java	(working copy)
@@ -1,69 +0,0 @@
-package org.apache.synapse.spi.conditions;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axiom.om.OMElement;
-
-/**
- * TestCase for SwitchProcessor
- */
-public class ExactlyOneProcessorWithRuleTest extends TestCase {
-    private MessageContext mc;
-    private OMElement config;
-    private SynapseEnvironment env;
-    private String synapsexml1 =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<exactlyone>"+
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "    <xpath expr=\"//ns:text\" xmlns:ns=\"urn:text-body\">\n" +
-                              "<engage-addressing-in/>"+
-                    "    </xpath>"+
-                    "</exactlyone>"+
-                    "</synapse>";
-
-    private String synapsexml2 =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<exactlyone>"+
-                    "    <xpath expr=\"//ns:text_empty\" xmlns:ns=\"urn:text-body\"/>\n" +
-                    "    <xpath expr=\"//ns:text_empty2\" xmlns:ns=\"urn:text-body\">\n" +
-                              "<engage-addressing-in/>"+
-                    "    </xpath>"+
-                    "    <default> "+
-                    "        <engage-addressing-in/>"+
-                    "    </default> "+
-                    "</exactlyone>"+
-                    "</synapse>";
-
-
-
-    public void testXathSwithProcessor() throws Exception {
-            mc = Axis2EnvSetup
-                    .axis2Deployment("target/synapse-repository");
-            config = Axis2EnvSetup.getSynapseConfigElement(synapsexml1);
-            env = new Axis2SynapseEnvironment(config,
-                    Thread.currentThread().getContextClassLoader());
-            SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-            env.injectMessage(smc);
-            assertTrue(((Boolean) smc.getProperty(
-                    Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        }
-
-        public void testDefaultProcessor() throws Exception {
-            mc = Axis2EnvSetup
-                    .axis2Deployment("target/synapse-repository");
-            config = Axis2EnvSetup.getSynapseConfigElement(synapsexml2);
-            env = new Axis2SynapseEnvironment(config,
-                    Thread.currentThread().getContextClassLoader());
-            SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-            env.injectMessage(smc);
-            assertTrue(((Boolean) smc.getProperty(
-                    Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        }
-
-}
Index: modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/conditions/ExactlyOneProcessorWithRuleTest.java	(working copy)
@@ -1,69 +0,0 @@
-package org.apache.synapse.spi.conditions;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axiom.om.OMElement;
-
-/**
- * TestCase for SwitchProcessor
- */
-public class ExactlyOneProcessorWithRuleTest extends TestCase {
-    private MessageContext mc;
-    private OMElement config;
-    private SynapseEnvironment env;
-    private String synapsexml1 =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<exactlyone>"+
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "    <xpath expr=\"//ns:text\" xmlns:ns=\"urn:text-body\">\n" +
-                              "<engage-addressing-in/>"+
-                    "    </xpath>"+
-                    "</exactlyone>"+
-                    "</synapse>";
-
-    private String synapsexml2 =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<exactlyone>"+
-                    "    <xpath expr=\"//ns:text_empty\" xmlns:ns=\"urn:text-body\"/>\n" +
-                    "    <xpath expr=\"//ns:text_empty2\" xmlns:ns=\"urn:text-body\">\n" +
-                              "<engage-addressing-in/>"+
-                    "    </xpath>"+
-                    "    <default> "+
-                    "        <engage-addressing-in/>"+
-                    "    </default> "+
-                    "</exactlyone>"+
-                    "</synapse>";
-
-
-
-    public void testXathSwithProcessor() throws Exception {
-            mc = Axis2EnvSetup
-                    .axis2Deployment("target/synapse-repository");
-            config = Axis2EnvSetup.getSynapseConfigElement(synapsexml1);
-            env = new Axis2SynapseEnvironment(config,
-                    Thread.currentThread().getContextClassLoader());
-            SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-            env.injectMessage(smc);
-            assertTrue(((Boolean) smc.getProperty(
-                    Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        }
-
-        public void testDefaultProcessor() throws Exception {
-            mc = Axis2EnvSetup
-                    .axis2Deployment("target/synapse-repository");
-            config = Axis2EnvSetup.getSynapseConfigElement(synapsexml2);
-            env = new Axis2SynapseEnvironment(config,
-                    Thread.currentThread().getContextClassLoader());
-            SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-            env.injectMessage(smc);
-            assertTrue(((Boolean) smc.getProperty(
-                    Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java	(working copy)
@@ -1,64 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-
-public class FaultProcessorWithRuleTest extends TestCase {
-    /**
-     * this is an incomple test
-     * what we should expect an error code
-     * but what we receive is 200ok.
-     */
-    private SimpleHTTPServer synapseServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-fault", null);
-        synapseServer =
-                new SimpleHTTPServer(context, 5043);
-        synapseServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-    }
-
-    public void testFaultPrcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-fault"), null);
-        Options co = new Options();
-        co.setTo(targetEpr);
-        serviceClient.setOptions(co);
-        serviceClient.fireAndForget(Axis2EnvSetup.payload());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java	(working copy)
@@ -1,83 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-/*
- */
-public class SendNowProcessorWithRuleTest extends TestCase {
-     private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow", "target/synapse-repository-sendnow/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext,8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendNowProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        OMElement response = serviceClient
-                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-        assertEquals("Synapse Testing String_Response_With_Addressing",
-                response.getText());
-
-    }
-
-    public void testSendNowPingProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.fireAndForget(Axis2EnvSetup.payloadNamedPing());
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java	(working copy)
@@ -1,66 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.synapse.xml.AddressingInMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class AddressingProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"engage-addressing\">\n" +
-                    "    <engage-addressing-in/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testAddressingProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertTrue(((Boolean) smc.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-    }
-
-    public void testAddressingConfigurator() throws Exception {
-        AddressingInMediatorFactory fac = new AddressingInMediatorFactory();
-
-        Mediator pro = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(pro instanceof AddressingInMediator);
-        
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java	(working copy)
@@ -1,63 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.xml.XPathMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class XpathProcessorWithRuleTest extends TestCase {
-    private MessageContext mc;
-    private OMElement config;
-    private SynapseEnvironment env;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"xpath\">\n" +
-                    "    <xpath expr=\"//ns:text\" xmlns:ns=\"urn:text-body\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        mc = Axis2EnvSetup
-                .axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testXpathProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("xpath", env.lookupProcessor("xpath").getName());
-    }
-    public void testXPathMediatorFactory() throws Exception {
-        XPathMediatorFactory fac = new XPathMediatorFactory();
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof XPathMediator);
-        assertEquals("//ns:text",((XPathMediator)med).getXPathExpr());
-    }
-}
-
-
Index: modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java	(working copy)
@@ -1,63 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.synapse.xml.ServiceMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"test-service-mediator\">\n" +
-                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
-        config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testAxis2MediatorProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("service-mediator"));
-    }
-
-    public void testAxis2MediatorConfigurator() throws Exception {
-        ServiceMediatorFactory fac = new ServiceMediatorFactory();
-
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof ServiceMediator);
-        //assertNotNull(pro.getName());
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java	(working copy)
@@ -1,52 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorWithAddressingEnageWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"test-service-mediator\">\n" +
-                    "    <engage-addressing-in/>\n"+
-                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
-        OMElement config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testServiceMediatorWithAddressingEngage() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("service-mediator"));
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java	(working copy)
@@ -1,90 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class SendOnProcessorWithRuleTest extends TestCase {
-
-    private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon", "target/synapse-repository-sendon/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext, 5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext, 8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.disEngageModule(new QName("addressing"));
-        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
-        assertEquals("Synapse Testing String_Response", response.getText());
-
-    }
-
-    public void testSendProcessorMultipleTimes() throws Exception {
-        for (int i = 0; i < 10; i++) {
-            ServiceClient serviceClient = new ServiceClient(
-                    Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                            "target/synapse-repository-sendon"), null);
-            Options options = new Options();
-            options.setTo(targetEpr);
-            serviceClient.setOptions(options);
-            serviceClient.disEngageModule(new QName("addressing"));
-            OMElement response =
-                    serviceClient.sendReceive(Axis2EnvSetup.payload());
-            assertEquals("Synapse Testing String_Response", response.getText());
-        }
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java	(working copy)
@@ -1,69 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.ListMediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axiom.om.OMElement;
-
-import java.util.List;
-
-
-public class DefineProcessorwithRuleTest extends TestCase {
-    private SynapseEnvironment env;
-    private OMElement config;
-    private MessageContext mc;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<refdefine ref=\"test_define\"/>\n" +
-                    "<refdefine ref=\"test_define_addressing\"/>\n" +
-                    "<define name=\"test_define\">\n" +
-                    "    <log/>" +
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "</define>\n" +
-
-                    "<define name=\"test_define_addressing\">\n" +
-                    "    <engage-addressing-in/>" +
-                    "</define>\n" +
-            "</synapse>";
-    public void setUp() throws Exception{
-        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        mc.setTo(new EndpointReference("http://xmethods.org"));
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testRegexProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("test_define", env.lookupMediator("test_define").getName());
-        //assertEquals("test_define_addressing", env.lookupMediator("test_define_addressing").getName());
-        List embeddedProcessors = ((ListMediator)env.lookupMediator("test_define")).getList();
-        assertEquals(2,embeddedProcessors.size());
-        ListMediator masterMediator = (ListMediator)env.getMasterMediator();
-        List masterMediatorList = masterMediator.getList();
-        assertEquals(4,masterMediatorList.size());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java	(working copy)
@@ -1,61 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.synapse.xml.ClassMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ClassMediatorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"loger\">\n" +
-                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testClassMediatorProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("mediation"));
-    }
-    public void testClassMediatorConfigurator() throws Exception {
-        ClassMediatorFactory conf = new ClassMediatorFactory();
-        Mediator pro = conf.createMediator(env, config.getFirstElement().getFirstElement());
-        assertTrue(pro instanceof ClassMediator);
-        //assertEquals("mediation",pro.getName());
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java	(working copy)
@@ -1,99 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-
-import junit.framework.TestCase;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SendOnProcessorWithAddressingEngageWithRuleTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon", "target/synapse-repository-sendon/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext,8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon"), null);
-        Options options = new Options();
-        options.setAction("urn:anonymous");
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.engageModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-        OMElement response = serviceClient
-                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-        assertEquals("Synapse Testing String_Response_With_Addressing",
-                response.getText());
-
-    }
-
-    public void testSendProcessorMultiple() {
-        try {
-            for (int i = 0; i < 8; i++) {
-                ServiceClient serviceClient = new ServiceClient(
-                        Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                                "target/synapse-repository-sendon"), null);
-                Options options = new Options();
-                options.setTo(targetEpr);
-                options.setAction("urn:anonymous");
-                serviceClient.setOptions(options);
-                serviceClient.engageModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-                OMElement response = serviceClient
-                        .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-                assertEquals("Synapse Testing String_Response_With_Addressing",
-                        response.getText());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java	(working copy)
@@ -1,72 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.transport.tcp.TCPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class HTTPToTCPMessageMediationTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private TCPServer axis2TcpServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-httptcp", "target/synapse-repository-httptcp/conf/axis2.xml");
-
-        synapseServer =
-                new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2TcpServer is the one who holds the actual service
-         */
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2Tcp", "target/synapse-repository-sendonAxis2Tcp/conf/axis2.xml");
-        axis2TcpServer =
-                new TCPServer(8090, serverContext);
-        synapseServer.start();
-        axis2TcpServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2TcpServer.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-httptcp"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
-        assertEquals("Synapse Testing String_Response", response.getText());
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java	(working copy)
@@ -1,53 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class InProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<in>" +
-                    "    <engage-addressing-in/>\n" +
-                    "</in>\n" +
-            "</synapse>\n";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-    }
-
-    public void testAddressingProcessor() throws Exception {
-        SynapseEnvironment env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
-        assertTrue(((Boolean) smc.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        //assertEquals("add",env.lookupMediator("add").getName());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java	(working copy)
@@ -1,42 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-
-
-public class BuiltInProcessorWithRuleTest extends TestCase {
-
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"logall\">\n" +
-                    "    <log/>\n" +
-                    "</stage>\n"+
-             "</synapse>";
-    private SynapseEnvironment env;
-
-    public void testSynapseEnvironment() throws Exception {
-        env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        assertNotNull(env.getMasterMediator());
-     }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java	(working copy)
@@ -1,58 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-
-public class SendBackProcessorWithRuleTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-send", null);
-        synapseServer = new SimpleHTTPServer(context, 5043);
-        synapseServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-    }
-
-    public void testSendPrcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-send"), null);
-        Options co = new Options();
-        co.setTo(targetEpr);
-        serviceClient.setOptions(co);
-        serviceClient.fireAndForget(Axis2EnvSetup.payload());
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java	(working copy)
@@ -1,64 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.xml.RegexMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class RegexProcessorWithRuleTest extends TestCase {
-    private SynapseEnvironment env;
-    private OMElement config;
-    private MessageContext mc;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"regex\">\n" +
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "</stage>\n" +
-            "</synapse>";
-    public void setUp() throws Exception{
-        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        mc.setTo(new EndpointReference("http://xmethods.org"));
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testRegexProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("regex", env.lookupProcessor("regex").getName());
-
-    }
-
-    public void testRegexProcessorConfigurator() throws Exception {
-        RegexMediatorFactory fac= new RegexMediatorFactory();
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof RegexMediator);
-        assertEquals("to",((RegexMediator)med).getHeaderType());
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/AddressingProcessorWithRuleTest.java	(working copy)
@@ -1,66 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.synapse.xml.AddressingInMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class AddressingProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"engage-addressing\">\n" +
-                    "    <engage-addressing-in/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testAddressingProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertTrue(((Boolean) smc.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-    }
-
-    public void testAddressingConfigurator() throws Exception {
-        AddressingInMediatorFactory fac = new AddressingInMediatorFactory();
-
-        Mediator pro = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(pro instanceof AddressingInMediator);
-        
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/BuiltInProcessorWithRuleTest.java	(working copy)
@@ -1,42 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-
-
-public class BuiltInProcessorWithRuleTest extends TestCase {
-
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"logall\">\n" +
-                    "    <log/>\n" +
-                    "</stage>\n"+
-             "</synapse>";
-    private SynapseEnvironment env;
-
-    public void testSynapseEnvironment() throws Exception {
-        env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        assertNotNull(env.getMasterMediator());
-     }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ClassMediatorWithRuleTest.java	(working copy)
@@ -1,61 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.synapse.xml.ClassMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ClassMediatorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"loger\">\n" +
-                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testClassMediatorProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("mediation"));
-    }
-    public void testClassMediatorConfigurator() throws Exception {
-        ClassMediatorFactory conf = new ClassMediatorFactory();
-        Mediator pro = conf.createMediator(env, config.getFirstElement().getFirstElement());
-        assertTrue(pro instanceof ClassMediator);
-        //assertEquals("mediation",pro.getName());
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java	(working copy)
@@ -1,69 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.ListMediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axiom.om.OMElement;
-
-import java.util.List;
-
-
-public class DefineProcessorwithRuleTest extends TestCase {
-    private SynapseEnvironment env;
-    private OMElement config;
-    private MessageContext mc;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<refdefine ref=\"test_define\"/>\n" +
-                    "<refdefine ref=\"test_define_addressing\"/>\n" +
-                    "<define name=\"test_define\">\n" +
-                    "    <log/>" +
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "</define>\n" +
-
-                    "<define name=\"test_define_addressing\">\n" +
-                    "    <engage-addressing-in/>" +
-                    "</define>\n" +
-            "</synapse>";
-    public void setUp() throws Exception{
-        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        mc.setTo(new EndpointReference("http://xmethods.org"));
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testRegexProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("test_define", env.lookupMediator("test_define").getName());
-        //assertEquals("test_define_addressing", env.lookupMediator("test_define_addressing").getName());
-        List embeddedProcessors = ((ListMediator)env.lookupMediator("test_define")).getList();
-        assertEquals(2,embeddedProcessors.size());
-        ListMediator masterMediator = (ListMediator)env.getMasterMediator();
-        List masterMediatorList = masterMediator.getList();
-        assertEquals(4,masterMediatorList.size());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java	(working copy)
@@ -1,64 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-
-public class FaultProcessorWithRuleTest extends TestCase {
-    /**
-     * this is an incomple test
-     * what we should expect an error code
-     * but what we receive is 200ok.
-     */
-    private SimpleHTTPServer synapseServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-fault", null);
-        synapseServer =
-                new SimpleHTTPServer(context, 5043);
-        synapseServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-    }
-
-    public void testFaultPrcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-fault"), null);
-        Options co = new Options();
-        co.setTo(targetEpr);
-        serviceClient.setOptions(co);
-        serviceClient.fireAndForget(Axis2EnvSetup.payload());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java	(working copy)
@@ -1,72 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.transport.tcp.TCPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class HTTPToTCPMessageMediationTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private TCPServer axis2TcpServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-httptcp", "target/synapse-repository-httptcp/conf/axis2.xml");
-
-        synapseServer =
-                new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2TcpServer is the one who holds the actual service
-         */
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2Tcp", "target/synapse-repository-sendonAxis2Tcp/conf/axis2.xml");
-        axis2TcpServer =
-                new TCPServer(8090, serverContext);
-        synapseServer.start();
-        axis2TcpServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2TcpServer.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-httptcp"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
-        assertEquals("Synapse Testing String_Response", response.getText());
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java	(working copy)
@@ -1,53 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class InProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<in>" +
-                    "    <engage-addressing-in/>\n" +
-                    "</in>\n" +
-            "</synapse>\n";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-    }
-
-    public void testAddressingProcessor() throws Exception {
-        SynapseEnvironment env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        smc.setSynapseEnvironment(env);
-        env.injectMessage(smc);
-        assertTrue(((Boolean) smc.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        //assertEquals("add",env.lookupMediator("add").getName());
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java	(working copy)
@@ -1,64 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.xml.RegexMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class RegexProcessorWithRuleTest extends TestCase {
-    private SynapseEnvironment env;
-    private OMElement config;
-    private MessageContext mc;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"regex\">\n" +
-                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
-                    "</stage>\n" +
-            "</synapse>";
-    public void setUp() throws Exception{
-        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        mc.setTo(new EndpointReference("http://xmethods.org"));
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testRegexProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("regex", env.lookupProcessor("regex").getName());
-
-    }
-
-    public void testRegexProcessorConfigurator() throws Exception {
-        RegexMediatorFactory fac= new RegexMediatorFactory();
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof RegexMediator);
-        assertEquals("to",((RegexMediator)med).getHeaderType());
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java	(working copy)
@@ -1,58 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-
-public class SendBackProcessorWithRuleTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-send", null);
-        synapseServer = new SimpleHTTPServer(context, 5043);
-        synapseServer.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-    }
-
-    public void testSendPrcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-send"), null);
-        Options co = new Options();
-        co.setTo(targetEpr);
-        serviceClient.setOptions(co);
-        serviceClient.fireAndForget(Axis2EnvSetup.payload());
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java	(working copy)
@@ -1,83 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-/*
- */
-public class SendNowProcessorWithRuleTest extends TestCase {
-     private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow", "target/synapse-repository-sendnow/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext,8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendNowProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        OMElement response = serviceClient
-                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-        assertEquals("Synapse Testing String_Response_With_Addressing",
-                response.getText());
-
-    }
-
-    public void testSendNowPingProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendnow"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.fireAndForget(Axis2EnvSetup.payloadNamedPing());
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java	(working copy)
@@ -1,99 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-
-import junit.framework.TestCase;
-
-import javax.xml.namespace.QName;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class SendOnProcessorWithAddressingEngageWithRuleTest extends TestCase {
-    private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon", "target/synapse-repository-sendon/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext,5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext,8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon"), null);
-        Options options = new Options();
-        options.setAction("urn:anonymous");
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.engageModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-        OMElement response = serviceClient
-                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-        assertEquals("Synapse Testing String_Response_With_Addressing",
-                response.getText());
-
-    }
-
-    public void testSendProcessorMultiple() {
-        try {
-            for (int i = 0; i < 8; i++) {
-                ServiceClient serviceClient = new ServiceClient(
-                        Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                                "target/synapse-repository-sendon"), null);
-                Options options = new Options();
-                options.setTo(targetEpr);
-                options.setAction("urn:anonymous");
-                serviceClient.setOptions(options);
-                serviceClient.engageModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
-                OMElement response = serviceClient
-                        .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
-                assertEquals("Synapse Testing String_Response_With_Addressing",
-                        response.getText());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java	(working copy)
@@ -1,90 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-
-
-public class SendOnProcessorWithRuleTest extends TestCase {
-
-    private SimpleHTTPServer synapseServer;
-    private SimpleHTTPServer axis2Server;
-    private EndpointReference targetEpr = new EndpointReference(
-            "http://127.0.0.1:5043/axis2/services/anonymous");
-
-    public void setUp() throws Exception {
-        ConfigurationContext synapseServerContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon", "target/synapse-repository-sendon/conf/axis2.xml");
-        ConfigurationContext serverContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendonAxis2", "target/synapse-repository-sendonAxis2/conf/axis2.xml");
-        synapseServer = new SimpleHTTPServer(synapseServerContext, 5043);
-        /**
-         * axis2Server is the one who holds the actual service
-         */
-        axis2Server =
-                new SimpleHTTPServer(serverContext, 8090);
-        synapseServer.start();
-        axis2Server.start();
-    }
-
-    protected void tearDown() throws Exception {
-        synapseServer.stop();
-        axis2Server.stop();
-    }
-
-    public void testSendProcessor() throws Exception {
-        ServiceClient serviceClient = new ServiceClient(
-                Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-sendon"), null);
-        Options options = new Options();
-        options.setTo(targetEpr);
-        serviceClient.setOptions(options);
-        serviceClient.disEngageModule(new QName("addressing"));
-        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
-        assertEquals("Synapse Testing String_Response", response.getText());
-
-    }
-
-    public void testSendProcessorMultipleTimes() throws Exception {
-        for (int i = 0; i < 10; i++) {
-            ServiceClient serviceClient = new ServiceClient(
-                    Axis2EnvSetup.createConfigurationContextFromFileSystem(
-                            "target/synapse-repository-sendon"), null);
-            Options options = new Options();
-            options.setTo(targetEpr);
-            serviceClient.setOptions(options);
-            serviceClient.disEngageModule(new QName("addressing"));
-            OMElement response =
-                    serviceClient.sendReceive(Axis2EnvSetup.payload());
-            assertEquals("Synapse Testing String_Response", response.getText());
-        }
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java	(working copy)
@@ -1,52 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorWithAddressingEnageWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"test-service-mediator\">\n" +
-                    "    <engage-addressing-in/>\n"+
-                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
-        OMElement config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testServiceMediatorWithAddressingEngage() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("service-mediator"));
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java	(working copy)
@@ -1,63 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.synapse.xml.ServiceMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorWithRuleTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"test-service-mediator\">\n" +
-                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
-        config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testAxis2MediatorProcessor() throws Exception {
-
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-        assertNotNull(env.lookupMediator("service-mediator"));
-    }
-
-    public void testAxis2MediatorConfigurator() throws Exception {
-        ServiceMediatorFactory fac = new ServiceMediatorFactory();
-
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof ServiceMediator);
-        //assertNotNull(pro.getName());
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java	(working copy)
@@ -1,63 +0,0 @@
-package org.apache.synapse.spi.injection;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.MessageContext;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.xml.XPathMediatorFactory;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class XpathProcessorWithRuleTest extends TestCase {
-    private MessageContext mc;
-    private OMElement config;
-    private SynapseEnvironment env;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<stage name=\"xpath\">\n" +
-                    "    <xpath expr=\"//ns:text\" xmlns:ns=\"urn:text-body\"/>\n" +
-                    "</stage>\n" +
-                    "</synapse>";
-
-    public void setUp() throws Exception {
-        mc = Axis2EnvSetup
-                .axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-    }
-
-    public void testXpathProcessor() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(mc,env);
-        env.injectMessage(smc);
-        //assertEquals("xpath", env.lookupProcessor("xpath").getName());
-    }
-    public void testXPathMediatorFactory() throws Exception {
-        XPathMediatorFactory fac = new XPathMediatorFactory();
-        Mediator med = fac.createMediator(env,config.getFirstElement().getFirstElement());
-        assertTrue(med instanceof XPathMediator);
-        assertEquals("//ns:text",((XPathMediator)med).getXPathExpr());
-    }
-}
-
-
Index: modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java	(working copy)
@@ -1,26 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class NeverProcessorTest extends TestCase {
-    public void testNeverProcessor() throws Exception{
-        //todo: this should be filled 
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java	(working copy)
@@ -1,43 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import junit.framework.TestCase;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class AddressingProcessorTest extends TestCase {
-
-    public void testAddressingProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        Mediator addressingMediator = new AddressingInMediator();
-        
-      
-        boolean result = addressingMediator.mediate(sm);
-        assertTrue(((Boolean) sm.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java	(working copy)
@@ -1,52 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.mediators.base.StageMediator;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-import java.util.List;
-import java.util.LinkedList;
-
-public class StageProcessorTest extends TestCase {
-    public void testStageProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        StageMediator med = new StageMediator();
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-        List list = new LinkedList();
-        list.add(new RegexMediator());
-        list.add(new XPathMediator());
-        med.setList(list);
-
-        boolean ret = med.mediate(sm);
-
-        assertTrue(ret);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java	(working copy)
@@ -1,40 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-public class XpathProcessorTest extends TestCase {
-    public void testXpathProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        XPathMediator med  = new XPathMediator();
-        med.setXPathExpr("//ns:text");
-        med.addXPathNamespace("ns", "urn:text-body");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorTest extends TestCase {
-    public void testServiceMediatorProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2"),env);
-        ServiceMediator med = new ServiceMediator();
-        med.setServiceName("test-mediator");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java	(working copy)
@@ -1,41 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.mediators.builtin.LogMediator;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class BulitinProcessorTest extends TestCase {
-    public void testLogProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        Mediator log = new LogMediator();
-        boolean result = log.mediate(sm);
-        assertTrue(result);
-    }
-    public void testSendProcessorTest() throws Exception {
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java	(working copy)
@@ -1,39 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.mediators.base.InMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class InProcessorTest extends TestCase {
-
-    public void testInProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        InMediator med = new InMediator();
-        boolean retrun = med.mediate(sm);
-        assertTrue(retrun);
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ClassMediatorProcessorTest extends TestCase {
-    public void testClassMediatorProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        ClassMediator med = new ClassMediator();
-        med.setClazz(Class.forName("org.apache.synapse.mediators.LoggerTestSample"));
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java	(working copy)
@@ -1,39 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axis2.addressing.EndpointReference;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class RegexProcessorTest extends TestCase {
-    public void testRegexProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        sm.setTo(new EndpointReference("http://xmethods.org"));
-        RegexMediator med = new RegexMediator();
-        med.setPattern("http://xmethods..\\*");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java	(working copy)
@@ -1,81 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediator;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-
-import java.io.ByteArrayInputStream;
-
-public class XSLTProcessorTest extends TestCase {
-    private String xsl = "<xsl:stylesheet version='1.0'\n" +
-            "                xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>\n" +
-            "    <xsl:template match=\"/\">\n" +
-            "        <transformedText>\n" +
-            "            <xsl:value-of select=\"//text\"/>\n" +
-            "            <xsl:text>Test Being Transformed</xsl:text>" +
-            "        </transformedText>\n" +
-            "    </xsl:template>\n" +
-            "</xsl:stylesheet>";
-
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<xslt name=\"stlt_test_name\" xsl=\"./transformation/simple_transformation.xsl\" type=\"body\"/>" +
-                    "</synapse>";
-
-
-    public void testXSLTProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        XSLTMediator med = new XSLTMediator();
-        med.setXSLInputStream(new ByteArrayInputStream(xsl.getBytes()));
-        med.setIsBody(true);
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-
-    public void testXSLTProcessorConfigurator() throws Exception {
-        XSLTMediatorFactory fac =
-                new XSLTMediatorFactory();
-        Class clazz = MediatorFactoryFinder
-                .find(fac.getTagQName());
-        assertNotNull(clazz);
-        Object mediatorObject = clazz.newInstance();
-        if (!(mediatorObject instanceof XSLTMediatorFactory)) {
-            throw new Exception(
-                    "XSLTProcessorConfigurator initialization falied");
-        }
-        SynapseEnvironment env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        assertNotNull(env.getMasterMediator());
-
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        // throws exceptions if anything goes wrong
-        env.injectMessage(sm);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java	(working copy)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- *
- */
-
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-import javax.xml.namespace.QName;
-
-public class FaultProcessorTest extends TestCase {
-
-	private SimpleHTTPServer synapseServer;
-
-	private EndpointReference targetEpr = new EndpointReference(
-			"http://127.0.0.1:5043/axis2/services/anonymous");
-
-	private QName operation = new QName("anonymous");
-
-	public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/synapse-repository-fault",null);
-        synapseServer = new SimpleHTTPServer(context,5043);
-		synapseServer.start();
-	}
-
-	protected void tearDown() throws Exception {
-		synapseServer.stop();
-	}
-
-	public void testFaultProcessor() {
-		try {
-			ServiceClient sc = new ServiceClient();
-
-			Options options = new Options();
-			options.setTo(targetEpr);
-			sc.setOptions(options);
-
-			sc.sendReceive(operation, Axis2EnvSetup.payload());
-			fail(null);
-		} catch (AxisFault e) {
-		}
-	}
-
-}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java	(working copy)
@@ -1,43 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.mediators.builtin.axis2.AddressingInMediator;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import junit.framework.TestCase;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class AddressingProcessorTest extends TestCase {
-
-    public void testAddressingProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        Mediator addressingMediator = new AddressingInMediator();
-        
-      
-        boolean result = addressingMediator.mediate(sm);
-        assertTrue(((Boolean) sm.getProperty(
-                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java	(working copy)
@@ -1,41 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.mediators.builtin.LogMediator;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class BulitinProcessorTest extends TestCase {
-    public void testLogProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        Mediator log = new LogMediator();
-        boolean result = log.mediate(sm);
-        assertTrue(result);
-    }
-    public void testSendProcessorTest() throws Exception {
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.ClassMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ClassMediatorProcessorTest extends TestCase {
-    public void testClassMediatorProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        ClassMediator med = new ClassMediator();
-        med.setClazz(Class.forName("org.apache.synapse.mediators.LoggerTestSample"));
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java	(working copy)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- *
- */
-
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-import javax.xml.namespace.QName;
-
-public class FaultProcessorTest extends TestCase {
-
-	private SimpleHTTPServer synapseServer;
-
-	private EndpointReference targetEpr = new EndpointReference(
-			"http://127.0.0.1:5043/axis2/services/anonymous");
-
-	private QName operation = new QName("anonymous");
-
-	public void setUp() throws Exception {
-        ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/synapse-repository-fault",null);
-        synapseServer = new SimpleHTTPServer(context,5043);
-		synapseServer.start();
-	}
-
-	protected void tearDown() throws Exception {
-		synapseServer.stop();
-	}
-
-	public void testFaultProcessor() {
-		try {
-			ServiceClient sc = new ServiceClient();
-
-			Options options = new Options();
-			options.setTo(targetEpr);
-			sc.setOptions(options);
-
-			sc.sendReceive(operation, Axis2EnvSetup.payload());
-			fail(null);
-		} catch (AxisFault e) {
-		}
-	}
-
-}
\ No newline at end of file
Index: modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java	(working copy)
@@ -1,39 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.mediators.base.InMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class InProcessorTest extends TestCase {
-
-    public void testInProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        InMediator med = new InMediator();
-        boolean retrun = med.mediate(sm);
-        assertTrue(retrun);
-    }
-
-}
Index: modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java	(working copy)
@@ -1,26 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class NeverProcessorTest extends TestCase {
-    public void testNeverProcessor() throws Exception{
-        //todo: this should be filled 
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java	(working copy)
@@ -1,39 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axis2.addressing.EndpointReference;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class RegexProcessorTest extends TestCase {
-    public void testRegexProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        sm.setTo(new EndpointReference("http://xmethods.org"));
-        RegexMediator med = new RegexMediator();
-        med.setPattern("http://xmethods..\\*");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java	(working copy)
@@ -1,38 +0,0 @@
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class ServiceMediatorProcessorTest extends TestCase {
-    public void testServiceMediatorProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2"),env);
-        ServiceMediator med = new ServiceMediator();
-        med.setServiceName("test-mediator");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java	(working copy)
@@ -1,52 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.mediators.base.StageMediator;
-import org.apache.synapse.mediators.filters.RegexMediator;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-
-import java.util.List;
-import java.util.LinkedList;
-
-public class StageProcessorTest extends TestCase {
-    public void testStageProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        StageMediator med = new StageMediator();
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-        List list = new LinkedList();
-        list.add(new RegexMediator());
-        list.add(new XPathMediator());
-        med.setList(list);
-
-        boolean ret = med.mediate(sm);
-
-        assertTrue(ret);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java	(working copy)
@@ -1,40 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.mediators.filters.XPathMediator;
-import org.apache.synapse.util.Axis2EnvSetup;
-
-public class XpathProcessorTest extends TestCase {
-    public void testXpathProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        XPathMediator med  = new XPathMediator();
-        med.setXPathExpr("//ns:text");
-        med.addXPathNamespace("ns", "urn:text-body");
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java	(working copy)
@@ -1,81 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-package org.apache.synapse.spi.processors;
-
-import junit.framework.TestCase;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediator;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-
-import java.io.ByteArrayInputStream;
-
-public class XSLTProcessorTest extends TestCase {
-    private String xsl = "<xsl:stylesheet version='1.0'\n" +
-            "                xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>\n" +
-            "    <xsl:template match=\"/\">\n" +
-            "        <transformedText>\n" +
-            "            <xsl:value-of select=\"//text\"/>\n" +
-            "            <xsl:text>Test Being Transformed</xsl:text>" +
-            "        </transformedText>\n" +
-            "    </xsl:template>\n" +
-            "</xsl:stylesheet>";
-
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<xslt name=\"stlt_test_name\" xsl=\"./transformation/simple_transformation.xsl\" type=\"body\"/>" +
-                    "</synapse>";
-
-
-    public void testXSLTProcessor() throws Exception {
-    	SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        XSLTMediator med = new XSLTMediator();
-        med.setXSLInputStream(new ByteArrayInputStream(xsl.getBytes()));
-        med.setIsBody(true);
-        boolean result = med.mediate(sm);
-        assertTrue(result);
-    }
-
-    public void testXSLTProcessorConfigurator() throws Exception {
-        XSLTMediatorFactory fac =
-                new XSLTMediatorFactory();
-        Class clazz = MediatorFactoryFinder
-                .find(fac.getTagQName());
-        assertNotNull(clazz);
-        Object mediatorObject = clazz.newInstance();
-        if (!(mediatorObject instanceof XSLTMediatorFactory)) {
-            throw new Exception(
-                    "XSLTProcessorConfigurator initialization falied");
-        }
-        SynapseEnvironment env = new Axis2SynapseEnvironment(
-                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
-                Thread.currentThread().getContextClassLoader());
-        assertNotNull(env.getMasterMediator());
-
-        SynapseMessage sm = new Axis2SynapseMessage(
-                Axis2EnvSetup.axis2Deployment("target/synapse-repository"),env);
-        // throws exceptions if anything goes wrong
-        env.injectMessage(sm);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java	(working copy)
@@ -1,66 +0,0 @@
-package org.apache.synapse.spi.resources;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-import junit.framework.TestCase;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class SimpleResourcesAquiringTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<resource type=\"org.apache.synapse.resources.http.SimpleGETResourceHandler\" uri-root=\"http://127.0.0.1:8090/axis2/services/npe/simple_resources\">\n" +
-                    "<property name=\"http.username\">paul</property>" +
-                    "<property name=\"http.password\">pass</property>" +
-                    "</resource>\n" +
-                    "<classmediator class=\"org.apache.synapse.mediators.SimpleGETResourceAquiringMediator\"/>\n" +
-                    "</synapse>";
-
-    private SimpleHTTPServer resources;
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-resources", null);
-        resources = new SimpleHTTPServer(context, 8090);
-        resources.start();
-    }
-
-    protected void tearDown() throws Exception {
-        resources.stop();
-    }
-
-    public void testSimpleResourcesHandler() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java
===================================================================
--- modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/spi/resources/SimpleResourcesAquiringTest.java	(working copy)
@@ -1,66 +0,0 @@
-package org.apache.synapse.spi.resources;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
-import org.apache.axiom.om.OMElement;
-import junit.framework.TestCase;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-public class SimpleResourcesAquiringTest extends TestCase {
-    private MessageContext msgCtx;
-    private SynapseEnvironment env;
-    private OMElement config;
-    private String synapsexml =
-            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
-                    "<resource type=\"org.apache.synapse.resources.http.SimpleGETResourceHandler\" uri-root=\"http://127.0.0.1:8090/axis2/services/npe/simple_resources\">\n" +
-                    "<property name=\"http.username\">paul</property>" +
-                    "<property name=\"http.password\">pass</property>" +
-                    "</resource>\n" +
-                    "<classmediator class=\"org.apache.synapse.mediators.SimpleGETResourceAquiringMediator\"/>\n" +
-                    "</synapse>";
-
-    private SimpleHTTPServer resources;
-
-    public void setUp() throws Exception {
-        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
-        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
-        env = new Axis2SynapseEnvironment(config,
-                Thread.currentThread().getContextClassLoader());
-        ConfigurationContext context = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(
-                        "target/synapse-repository-resources", null);
-        resources = new SimpleHTTPServer(context, 8090);
-        resources.start();
-    }
-
-    protected void tearDown() throws Exception {
-        resources.stop();
-    }
-
-    public void testSimpleResourcesHandler() throws Exception {
-        SynapseMessage smc = new Axis2SynapseMessage(msgCtx,env);
-        env.injectMessage(smc);
-
-    }
-}
Index: modules/core/test/org/apache/synapse/TestSynapseEnvironment.java
===================================================================
--- modules/core/test/org/apache/synapse/TestSynapseEnvironment.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/TestSynapseEnvironment.java	(working copy)
@@ -1,12 +0,0 @@
-package org.apache.synapse;
-
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
-
-public class TestSynapseEnvironment {
-
-	public static SynapseEnvironment createAxis2SynapseEnvironment() {
-		Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(null, null);
-		return se;
-	}
-
-}
Index: modules/core/test/org/apache/synapse/TestSynapseMessage.java
===================================================================
--- modules/core/test/org/apache/synapse/TestSynapseMessage.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/TestSynapseMessage.java	(working copy)
@@ -1,69 +1,141 @@
-package org.apache.synapse;
-
-import org.apache.axis2.AxisFault;
-
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-
-public class TestSynapseMessage {
-    public static final String URN_SAMPLE_TO_ADDRESS = "urn:sample-toAddress";
-
-
-    public static Axis2SynapseMessage createSampleSOAP11MessageWithoutAddressing(
-            String testingRepository) {
-        // create a lightweight Axis Config with no addressing to demonstrate
-        // "dumb" SOAP
-        MessageContext msgCtx;
-
-        try {
-            ConfigurationContext configCtx = ConfigurationContextFactory
-                    .createConfigurationContextFromFileSystem(testingRepository,null);
-            msgCtx = new MessageContext();
-            msgCtx.setConfigurationContext(configCtx);
-            msgCtx.setServerSide(true);
-
-            SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
-                    .getDefaultEnvelope();
-
-            OMElement body = OMAbstractFactory.getOMFactory().createOMElement(
-                    "test-body", "urn:test", "test");
-            OMAbstractFactory.getOMFactory().createOMText(body,
-                    "Do not be alarmed, this is just a test");
-
-            env.getBody().addChild(body);
-            msgCtx.setEnvelope(env);
-        } catch (AxisFault e) {
-            throw new SynapseException(e);
-        }
-        
-        return new Axis2SynapseMessage(msgCtx,null);
-    }
-
-    public static Axis2SynapseMessage createSampleSOAP11MessageWithAddressing(
-            String testingRepository) {
-        Axis2SynapseMessage sm =
-                createSampleSOAP11MessageWithoutAddressing(testingRepository);
-        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-        OMNamespace wsaNS =
-                fac.createOMNamespace(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_DEFAULT_PREFIX);
-        SOAPHeaderBlock addressingToHeaderBlock =
-                fac.createSOAPHeaderBlock(AddressingConstants.WSA_TO, wsaNS);
-        SOAPHeaderBlock addressingActionHeaderBlock =
-                fac.createSOAPHeaderBlock(AddressingConstants.WSA_ACTION, wsaNS);
-        addressingToHeaderBlock.setText(URN_SAMPLE_TO_ADDRESS);
-        sm.getEnvelope().getHeader().addChild(addressingToHeaderBlock);
-        sm.getEnvelope().getHeader().addChild(addressingActionHeaderBlock);
-
-        return sm;
-
-    }
-}
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.RelatesTo;
+
+public class TestSynapseMessage implements SynapseMessage {
+
+    SOAPEnvelope envelope = null;
+
+    public SOAPEnvelope getEnvelope() {
+        if (envelope == null)
+            return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        else
+            return envelope;
+    }
+
+    public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
+        this.envelope = envelope;
+    }
+
+    public EndpointReference getFaultTo() {
+        return null;
+    }
+
+    public void setFaultTo(EndpointReference reference) {
+    }
+
+    public EndpointReference getFrom() {
+        return null;
+    }
+
+    public void setFrom(EndpointReference reference) {
+    }
+
+    public String getMessageID() {
+        return null;
+    }
+
+    public void setMessageID(String string) {
+    }
+
+    public RelatesTo getRelatesTo() {
+        return null;
+    }
+
+    public void setRelatesTo(RelatesTo[] reference) {
+    }
+
+    public EndpointReference getReplyTo() {
+        return null;
+    }
+
+    public void setReplyTo(EndpointReference reference) {
+    }
+
+    public EndpointReference getTo() {
+        return null;
+    }
+
+    public void setTo(EndpointReference reference) {
+    }
+
+    public void setWSAAction(String actionURI) {
+    }
+
+    public String getWSAAction() {
+        return null;
+    }
+
+    public String getSoapAction() {
+        return null;
+    }
+
+    public void setSoapAction(String string) {
+    }
+
+    public void setMessageId(String messageID) {
+    }
+
+    public String getMessageId() {
+        return null;
+    }
+
+    public boolean isDoingMTOM() {
+        return false;
+    }
+
+    public void setDoingMTOM(boolean b) {
+    }
+
+    public boolean isDoingREST() {
+        return false;
+    }
+
+    public void setDoingREST(boolean b) {
+    }
+
+    public boolean isSOAP11() {
+        return false;
+    }
+
+    public void setResponse(boolean b) {
+    }
+
+    public boolean isResponse() {
+        return false;
+    }
+
+    public void setFaultResponse(boolean b) {
+    }
+
+    public boolean isFaultResponse() {
+        return false;
+    }
+
+    public SynapseContext getSynapseContext() {
+        return null;
+    }
+
+    public void setSynapseContext(SynapseContext env) {
+    }
+}
Index: modules/core/test/org/apache/synapse/TestSynapseMessageContext.java
===================================================================
--- modules/core/test/org/apache/synapse/TestSynapseMessageContext.java	(revision 0)
+++ modules/core/test/org/apache/synapse/TestSynapseMessageContext.java	(revision 0)
@@ -0,0 +1,56 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.synapse;
+
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.core.SynapseEnvironment;
+
+public class TestSynapseMessageContext implements SynapseContext {
+
+    private SynapseMessage synMsg = null;
+
+    public SynapseConfiguration getConfiguration() {
+        return null;
+    }
+
+    public void setConfiguration(SynapseConfiguration cfg) {
+    }
+
+    public SynapseEnvironment getSynapseEnvironment() {
+        return null;
+    }
+
+    public void setSynapseEnvironment(SynapseEnvironment se) {
+    }
+
+    public void setSynapseMessage(SynapseMessage sm) {
+        synMsg = sm;
+    }
+
+    public SynapseMessage getSynapseMessage() {
+        if (synMsg == null)
+            return new TestSynapseMessage();
+        else
+            return synMsg;
+    }
+
+    public Object getProperty(String key) {
+        return null;
+    }
+
+    public void setProperty(String key, Object value) {
+    }
+}
Index: modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java
===================================================================
--- modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java	(working copy)
@@ -1,134 +0,0 @@
-package org.apache.synapse.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.synapse.axis2.SynapseMessageReceiver;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.om.*;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class Axis2EnvSetup {
-    public static MessageContext axis2Deployment(String testingRepository)
-            throws AxisFault {
-        final ConfigurationContext configCtx = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(testingRepository,
-                        testingRepository + File.separator + "conf" + File.separator + "axis2.xml");
-        MessageContext msgCtx = new MessageContext();
-        msgCtx.setConfigurationContext(configCtx);
-        msgCtx.setEnvelope(testEnvSetup());
-        msgCtx.setServerSide(true);
-
-        AxisConfiguration axisConfiguration = msgCtx.getConfigurationContext()
-                .getAxisConfiguration();
-        AxisService service = new AxisService("se");
-        msgCtx.setAxisService(service);
-        service.setClassLoader(axisConfiguration.getServiceClassLoader());
-        AxisOperation axisOp = new InOutAxisOperation(
-                new QName("op"));
-        msgCtx.setAxisOperation(axisOp);
-        axisOp.setMessageReceiver(new SynapseMessageReceiver());
-        service.addOperation(axisOp);
-        axisConfiguration.addService(service);
-        msgCtx.setTo(
-                new EndpointReference("/axis2/services/" + "se" + "/" + "op"));
-        msgCtx.setSoapAction("op");
-        return msgCtx;
-    }
-
-    private static SOAPEnvelope testEnvSetup() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
-                .getDefaultEnvelope();
-        OMDocument doc = fac.createOMDocument();
-        doc.addChild(env);
-        OMElement ele = fac.createOMElement("text", "urn:text-body", "ns");
-        env.getBody().addChild(ele);
-        return env;
-    }
-
-    public static OMElement getSynapseConfigElement(String synapseXml)
-            throws XMLStreamException {
-        XMLStreamReader parser = XMLInputFactory.newInstance()
-                .createXMLStreamReader(
-                        new ByteArrayInputStream(synapseXml.getBytes()));
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        StAXOMBuilder staxBuilder = new StAXOMBuilder(fac, parser);
-        OMElement config = staxBuilder.getDocumentElement();
-        return config;
-
-    }
-
-    public static OMElement payload() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text", omNs);
-        value.addChild(
-                fac.createOMText(value, "Synapse Testing String"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static OMElement payloadNamedAdddressing() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text_addressing", omNs);
-        value.addChild(
-                fac.createOMText(value,
-                        "Synapse Testing String Through Addressing"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static OMElement payloadNamedPing() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text_ping", omNs);
-        value.addChild(
-                fac.createOMText(value, "Synapse Testing String for Ping"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static ConfigurationContext createConfigurationContextFromFileSystem(
-            String repository) throws AxisFault {
-
-        return ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(repository, null);
-    }
-}
Index: modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java
===================================================================
--- modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java	(revision 405035)
+++ modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java	(working copy)
@@ -1,134 +0,0 @@
-package org.apache.synapse.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.synapse.axis2.SynapseMessageReceiver;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.om.*;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*
-*/
-
-public class Axis2EnvSetup {
-    public static MessageContext axis2Deployment(String testingRepository)
-            throws AxisFault {
-        final ConfigurationContext configCtx = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(testingRepository,
-                        testingRepository + File.separator + "conf" + File.separator + "axis2.xml");
-        MessageContext msgCtx = new MessageContext();
-        msgCtx.setConfigurationContext(configCtx);
-        msgCtx.setEnvelope(testEnvSetup());
-        msgCtx.setServerSide(true);
-
-        AxisConfiguration axisConfiguration = msgCtx.getConfigurationContext()
-                .getAxisConfiguration();
-        AxisService service = new AxisService("se");
-        msgCtx.setAxisService(service);
-        service.setClassLoader(axisConfiguration.getServiceClassLoader());
-        AxisOperation axisOp = new InOutAxisOperation(
-                new QName("op"));
-        msgCtx.setAxisOperation(axisOp);
-        axisOp.setMessageReceiver(new SynapseMessageReceiver());
-        service.addOperation(axisOp);
-        axisConfiguration.addService(service);
-        msgCtx.setTo(
-                new EndpointReference("/axis2/services/" + "se" + "/" + "op"));
-        msgCtx.setSoapAction("op");
-        return msgCtx;
-    }
-
-    private static SOAPEnvelope testEnvSetup() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
-                .getDefaultEnvelope();
-        OMDocument doc = fac.createOMDocument();
-        doc.addChild(env);
-        OMElement ele = fac.createOMElement("text", "urn:text-body", "ns");
-        env.getBody().addChild(ele);
-        return env;
-    }
-
-    public static OMElement getSynapseConfigElement(String synapseXml)
-            throws XMLStreamException {
-        XMLStreamReader parser = XMLInputFactory.newInstance()
-                .createXMLStreamReader(
-                        new ByteArrayInputStream(synapseXml.getBytes()));
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        StAXOMBuilder staxBuilder = new StAXOMBuilder(fac, parser);
-        OMElement config = staxBuilder.getDocumentElement();
-        return config;
-
-    }
-
-    public static OMElement payload() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text", omNs);
-        value.addChild(
-                fac.createOMText(value, "Synapse Testing String"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static OMElement payloadNamedAdddressing() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text_addressing", omNs);
-        value.addChild(
-                fac.createOMText(value,
-                        "Synapse Testing String Through Addressing"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static OMElement payloadNamedPing() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(
-                "urn:text-body", "ns");
-        OMElement method = fac.createOMElement("service", omNs);
-        OMElement value = fac.createOMElement("text_ping", omNs);
-        value.addChild(
-                fac.createOMText(value, "Synapse Testing String for Ping"));
-        method.addChild(value);
-        return method;
-    }
-
-    public static ConfigurationContext createConfigurationContextFromFileSystem(
-            String repository) throws AxisFault {
-
-        return ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(repository, null);
-    }
-}
Index: modules/samples/project.xml
===================================================================
--- modules/samples/project.xml	(revision 405035)
+++ modules/samples/project.xml	(working copy)
@@ -17,6 +17,7 @@
             <artifactId>synapse-core</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
+<!--
         <dependency>
             <groupId>synapse</groupId>
             <artifactId>synapse-mediators</artifactId>
@@ -26,7 +27,7 @@
             <groupId>synapse</groupId>
             <artifactId>synapse-extensions</artifactId>
             <version>${pom.currentVersion}</version>
-        </dependency>
+        </dependency>-->
         <!-- external JARs -->
         <dependency>
             <groupId>axis2</groupId>
Index: modules/samples/src/sampleMediators/InjectRedirect.java
===================================================================
--- modules/samples/src/sampleMediators/InjectRedirect.java	(revision 405035)
+++ modules/samples/src/sampleMediators/InjectRedirect.java	(working copy)
@@ -16,21 +16,21 @@
 package sampleMediators;
 
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.mediators.AbstractMediator;
 
-public class InjectRedirect implements Mediator {
-	private String uri = null;
+public class InjectRedirect extends AbstractMediator {
+    private String uri = null;
 
-	public void setUri(String uri) {
-		this.uri = uri;
-	}
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
 
-	public boolean mediate(SynapseMessage mc) {
+    public boolean mediate(SynapseContext mc) {
 
-		System.out.println("Redirect.mediate: " + uri);
+        System.out.println("Redirect.mediate: " + uri);
 
-		mc.setTo(new EndpointReference(uri));
-		return true;
-	}
+        mc.getSynapseMessage().setTo(new EndpointReference(uri));
+        return true;
+    }
 }
\ No newline at end of file
Index: modules/samples/src/sampleMediators/Logger.java
===================================================================
--- modules/samples/src/sampleMediators/Logger.java	(revision 405035)
+++ modules/samples/src/sampleMediators/Logger.java	(working copy)
@@ -15,8 +15,9 @@
  */
 package sampleMediators;
 
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.api.Mediator;
+import org.apache.synapse.mediators.AbstractMediator;
 import org.apache.axiom.soap.SOAPEnvelope;
 
 /**
@@ -25,14 +26,15 @@
  * <p>A sample Mediator that logs the message
  * 
  */
-public class Logger implements Mediator {
+public class Logger extends AbstractMediator {
 
     /*
       * (non-Javadoc)
       *
       * @see org.apache.synapse.mediator.Mediator#mediate(org.apache.axis2.context.MessageContext)
       */
-    public boolean mediate(SynapseMessage mc) {
+    public boolean mediate(SynapseContext mctx) {
+        SynapseMessage mc = mctx.getSynapseMessage();
         System.out.println("Logger.mediate:");
         if (mc.getTo() != null && mc.getTo().getAddress() != null)
             System.out.println("Logger.mediate to:" + mc.getTo().getAddress());
Index: repository/conf/axis2.xml
===================================================================
--- repository/conf/axis2.xml	(revision 405035)
+++ repository/conf/axis2.xml	(working copy)
@@ -4,7 +4,7 @@
     <!-- ================================================= -->
     <parameter name="hotdeployment" locked="false">true</parameter>
     <parameter name="hotupdate" locked="false">false</parameter>
-    <parameter name="enableMTOM" locked="false">true</parameter>
+    <parameter name="enableMTOM" locked="false">false</parameter>
     <parameter name="sendStacktraceDetailsWithFaults" locked="false">true</parameter>
 
     <!-- Uncomment this to enable REST support -->
@@ -16,6 +16,8 @@
 
     <parameter name="userName" locked="false">admin</parameter>
     <parameter name="password" locked="false">axis2</parameter>
+    
+    <module ref="addressing"/>
 
     <!-- ================================================= -->
     <!-- Message Receivers -->
@@ -89,7 +91,7 @@
         <phase name="PreDispatch"/>
         <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
             <handler name="SynapseDispatcher"
-                     class="org.apache.synapse.axis2.SynapseDispatcher">
+                     class="org.apache.synapse.core.axis2.SynapseDispatcher">
                 <order phase="Dispatch"/>
             </handler>
 
@@ -125,7 +127,7 @@
         <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
 
             <handler name="SynapseDispatcher"
-                     class="org.apache.synapse.axis2.SynapseDispatcher">
+                     class="org.apache.synapse.core.axis2.SynapseDispatcher">
                 <order phase="Dispatch"/>
             </handler>
 
Index: repository/conf/synapse.xml
===================================================================
--- repository/conf/synapse.xml	(revision 405035)
+++ repository/conf/synapse.xml	(working copy)
@@ -1,37 +1,41 @@
-<synapse xmlns="http://ws.apache.org/ns/synapse">
-	<!-- start by reading ws-a headers if they exist -->
-    <engage-addressing-in/>
-    
-    <!-- now log the message using log4j -->
-	<log/>
-	
-    <!-- Check if the URL matches the stockquote gateway/dumb case -->
-	<regex message-address="to" pattern=".*/StockQuote.*">
-		<ref ref="stockquote"/>				
-	</regex>	
-	
-	<!-- check if the URL matches the virtual url - either the proxy or ws-add case -->
-	<regex message-address="to" pattern="http://stockquote.*">
-		<ref ref="stockquote"/>
-	</regex>	
-	
-	<!-- send the message on -->
-	<send/>
-	
-	<!-- these are only called if referenced above-->
-    <never>
-        <stage name="stockquote">
-            <!-- set the To address to the real endpoint -->
-            <header type="to" value="http://www.webservicex.net/stockquote.asmx"/>
-            <!-- check if the symbol is MSFT -->
-            <xpath expr="//*[wsx:symbol='MSFT']" xmlns:wsx="http://www.webserviceX.NET/">
-                <!-- if it is throw a fault -->
-                <fault>
-                    <reason>Isn't there a Windows API for that?</reason>
-                </fault>
-            </xpath>
-        </stage>
-
-    </never>
-</synapse>
-
+  <synapse xmlns="http://ws.apache.org/ns/synapse">
+    <definitions>
+      <sequence name="registration_flow">
+        <filter xpath="//regRequest[@Category='GOLD']">
+           <log level="full">
+           		<property name="category" value="GOLD"/>
+           </log>
+           <drop/>
+        </filter>  
+        <sequence ref="fault_flow"/>
+      </sequence>
+  
+      <sequence name="fault_flow">
+        <log level="full">
+          <property name="application" value="Hello World"/>
+        </log>
+        <drop/>
+      </sequence>
+      
+      <sequence name="stockquote">
+        <log level="full">
+          <property name="application" value="StockQuote"/>
+        </log>
+        <filter xpath="//*[wsx:symbol='MSFT']" xmlns:wsx="http://www.webserviceX.NET/">
+        	<makefault>
+        		<reason>Sorry the requested stock is no longer available</reason>
+        	</makefault>
+        </filter>
+        <header name="to" value="http://www.webservicex.net/stockquote.asmx"/>
+      </sequence>
+  
+    </definitions>
+  
+    <rules>
+    	<filter source="//wsa:To" regex=".*/StockQuote.*" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+    		<sequence ref="stockquote"/>
+    	</filter>
+    	<send/>
+    </rules>
+  
+  </synapse> 
\ No newline at end of file
Index: repository/modules/addressing-0.95.mar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: repository/modules/addressing-1.0.mar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: repository\modules\addressing-1.0.mar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: repository/services/emptymediator/META-INF/services.xml
===================================================================
--- repository/services/emptymediator/META-INF/services.xml	(revision 405035)
+++ repository/services/emptymediator/META-INF/services.xml	(working copy)
@@ -1,6 +1,6 @@
 <service name="emptymediator">
     <operation name="mediate" > 
-          <messageReceiver class="org.apache.synapse.axis2.EmptyMessageReceiver" />
+          <messageReceiver class="org.apache.synapse.core.axis2.EmptyMessageReceiver" />
     </operation>
 </service>
   
\ No newline at end of file
Index: repository/services/synapse/META-INF/services.xml
===================================================================
--- repository/services/synapse/META-INF/services.xml	(revision 405035)
+++ repository/services/synapse/META-INF/services.xml	(working copy)
@@ -1,7 +1,7 @@
   <service name="synapse">
 
     <operation name="mediate" > 
-          <messageReceiver class="org.apache.synapse.axis2.SynapseMessageReceiver" />
+          <messageReceiver class="org.apache.synapse.core.axis2.SynapseMessageReceiver" />
     </operation>
     
   </service>


Re: [VOTE] Moving Code from Scratch Area

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
+1 to going ahead.

Sanjiva.

On Fri, 2006-05-05 at 15:09 +0600, Saminda Abeyruwan wrote:
> Hi All,
> 
> 
> With Respect to the discussion had on the Chat (4th May 2006)
> [ http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser ] and the mailing thread [http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser] following members have approved of moving the Synapse code in scratch [https://svn.apache.org/repos/asf/incubator/synapse/trunk/scratch/synapse2] to the main branch.
> 
> 
> Paul Fremantle +1
> 
> Ant Elder +1
> 
> Saminda Abeyruwan +1
> 
> 
> This code consists on implementing of the configuration syntax that
> Sanjiva and Asankha proposed few weeks back.
> [ http://wiki.apache.org/incubator/Synapse/SynapseConfigurationLanguage] [ http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200605.mbox/browser ]
> 
> So please be kind enough to go through the code and let your consensus
> regarding prior so that we can start moving it ahead to the main
> branch. 
> 
> Until such time, the code in
> [ https://svn.apache.org/repos/asf/incubator/synapse/trunk/java ] has
> been freeze.
> 
> Thank you
> 
> Saminda 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org