You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Sanjiva Weerawarana <sa...@opensource.lk> on 2006/05/02 20:58:46 UTC

Re: Implementation of the changes discussed last week - work in progress

On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> 
> I am separating the SynapseConfiguration from the SynapseEnvironment, 
> and also allowing for possible configuration model creation 
> programatically (if required). Hence a SynapseConfigurationBuilder (say) 
> could read a synapse.xml and create a SynapseConfiguration instance. A 
> reference to this SynapseConfiguration would be held in the 
> SynapseEnvironment, and the SynapseEnvironment would provide the usual 
> access to send(), injectMessage() etc. The SynapseConfiguration will 
> hold references to named Sequences, Endpoints and to global properties.

Sounds good but can we s/SynapseEnvironment/SynapseContext/ ?? That's
consistent with Axis2 naming and seems like a fit here too. I'm the one
who came up with the SynapseEnvironment name so I'm happy to propose a
change too ;-).

Sanjiva.


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


Re: Implementation of the changes discussed last week - work in progress

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Oh, i posted the prior structure a day before the chat. sorry for the
confusion.

Saminda

On 5/5/06, Paul Fremantle <pz...@gmail.com> wrote:
>
> My point was that I thought we had agreed a new structure on the web chat.
>
> Paul
>
>
> On 5/5/06, Saminda Abeyruwan < samindaa@gmail.com> wrote:
> >
> >
> > On 5/5/06, Paul Fremantle <pzfreo@gmail.com > wrote:
> > >
> > > Saminda
> > >
> > > Is this post still valid after yesterday's web chat?
> > >
> >
> > the structure that proposed by Dr.Sanjiva is much more cleaner.
> >
> > Paul
> > >
> > >
> > > On 5/4/06, Saminda Abeyruwan < samindaa@gmail.com > wrote:
> > > >
> > > > Hi Devs,
> > > >
> > > > With respect to currently held discussions on refactoring of Synapse
> > > > core, i would like to see the following packaging structure in core. The
> > > > inspiration came from Axis2 packing, which i humbly think pretty clear and
> > > > accurate.
> > > >
> > > > We have two context interfaces, SynapseContext (previously know as
> > > > SynapseEnvironment ) and SynapseMessage, so lets have a package *
> > > > org.apache.synapse.context *for them. So let have its impl also in
> > > > this package.
> > > >
> > > > Lets have a SynapseContextFactory to create SynapseContext impls.
> > > > SynapseContext and SynapseMessage will be the runtime entities.
> > > >
> > > > Lets have deployment time entity as SynapseConfiguration and let it
> > > > be in the *org.apache.synapse.xml* package. So all the builders need
> > > > to populate the SynapseConfiguration should come under this package. In
> > > > addition to this all the mediator factories should come under this package.
> > > >
> > > > For core mediators lets have *org.apache.synapse.mediators.*[builtim/filters
> > > > etc].
> > > >
> > > > One drawback i see in the current svn code is that the mediator
> > > > chain is built with the very first message that enters into Synapse. In
> > > > order to overcome this, simply lets have Synapse base listener,
> > > > SynapseServer which delegates to SimpleHTTPServer, with the the build
> > > > SynapseContext. So when the first message or any successive messages the
> > > > SynapseContext is available.
> > > >
> > > > Please be kind enough to comment on prior.
> > > >
> > > > Thank you
> > > >
> > > > Saminda
> > > >
> > > >
> > > >
> > > >
> > > > On 5/3/06, Paul Fremantle <pzfreo@gmail.com > wrote:
> > > > >
> > > > > I don't agree that the SynapseEnvironment is the same as the Axis2
> > > > > Context. The environment is an abstraction layer over a set of services. Its
> > > > > possible we need to split into three parts: a configuration, a context, and
> > > > > an environment.
> > > > >
> > > > > Paul
> > > > >
> > > > >
> > > > >
> > > > > On 5/2/06, Sanjiva Weerawarana < sanjiva@opensource.lk> wrote:
> > > > > >
> > > > > > On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> > > > > > >
> > > > > > > I am separating the SynapseConfiguration from the
> > > > > > SynapseEnvironment,
> > > > > > > and also allowing for possible configuration model creation
> > > > > > > programatically (if required). Hence a
> > > > > > SynapseConfigurationBuilder (say)
> > > > > > > could read a synapse.xml and create a SynapseConfiguration
> > > > > > instance. A
> > > > > > > reference to this SynapseConfiguration would be held in the
> > > > > > > SynapseEnvironment, and the SynapseEnvironment would provide
> > > > > > the usual
> > > > > > > access to send(), injectMessage() etc. The
> > > > > > SynapseConfiguration will
> > > > > > > hold references to named Sequences, Endpoints and to global
> > > > > > properties.
> > > > > >
> > > > > > Sounds good but can we s/SynapseEnvironment/SynapseContext/ ??
> > > > > > That's
> > > > > > consistent with Axis2 naming and seems like a fit here too. I'm
> > > > > > the one
> > > > > > who came up with the SynapseEnvironment name so I'm happy to
> > > > > > propose a
> > > > > > change too ;-).
> > > > > >
> > > > > > Sanjiva.
> > > > > >
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > >
> > > > > > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Paul Fremantle
> > > > > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> > > > >
> > > > > http://bloglines.com/blog/paulfremantle
> > > > > paul@wso2.com
> > > > >
> > > > > "Oxygenating the Web Service Platform", www.wso2.com
> > > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Paul Fremantle
> > > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> > >
> > > http://bloglines.com/blog/paulfremantle
> > > paul@wso2.com
> > >
> > > "Oxygenating the Web Service Platform", www.wso2.com
> > >
> >
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>

Re: Implementation of the changes discussed last week - work in progress

Posted by Paul Fremantle <pz...@gmail.com>.
My point was that I thought we had agreed a new structure on the web chat.

Paul

On 5/5/06, Saminda Abeyruwan <sa...@gmail.com> wrote:
>
>
> On 5/5/06, Paul Fremantle <pz...@gmail.com> wrote:
> >
> > Saminda
> >
> > Is this post still valid after yesterday's web chat?
> >
>
> the structure that proposed by Dr.Sanjiva is much more cleaner.
>
> Paul
> >
> >
> > On 5/4/06, Saminda Abeyruwan < samindaa@gmail.com > wrote:
> > >
> > > Hi Devs,
> > >
> > > With respect to currently held discussions on refactoring of Synapse
> > > core, i would like to see the following packaging structure in core. The
> > > inspiration came from Axis2 packing, which i humbly think pretty clear and
> > > accurate.
> > >
> > > We have two context interfaces, SynapseContext (previously know as
> > > SynapseEnvironment ) and SynapseMessage, so lets have a package *
> > > org.apache.synapse.context *for them. So let have its impl also in
> > > this package.
> > >
> > > Lets have a SynapseContextFactory to create SynapseContext impls.
> > > SynapseContext and SynapseMessage will be the runtime entities.
> > >
> > > Lets have deployment time entity as SynapseConfiguration and let it be
> > > in the *org.apache.synapse.xml* package. So all the builders need to
> > > populate the SynapseConfiguration should come under this package. In
> > > addition to this all the mediator factories should come under this package.
> > >
> > > For core mediators lets have *org.apache.synapse.mediators.*[builtim/filters
> > > etc].
> > >
> > > One drawback i see in the current svn code is that the mediator chain
> > > is built with the very first message that enters into Synapse. In order to
> > > overcome this, simply lets have Synapse base listener, SynapseServer which
> > > delegates to SimpleHTTPServer, with the the build SynapseContext. So when
> > > the first message or any successive messages the SynapseContext is
> > > available.
> > >
> > > Please be kind enough to comment on prior.
> > >
> > > Thank you
> > >
> > > Saminda
> > >
> > >
> > >
> > >
> > > On 5/3/06, Paul Fremantle <pzfreo@gmail.com > wrote:
> > > >
> > > > I don't agree that the SynapseEnvironment is the same as the Axis2
> > > > Context. The environment is an abstraction layer over a set of services. Its
> > > > possible we need to split into three parts: a configuration, a context, and
> > > > an environment.
> > > >
> > > > Paul
> > > >
> > > >
> > > >
> > > > On 5/2/06, Sanjiva Weerawarana < sanjiva@opensource.lk> wrote:
> > > > >
> > > > > On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> > > > > >
> > > > > > I am separating the SynapseConfiguration from the
> > > > > SynapseEnvironment,
> > > > > > and also allowing for possible configuration model creation
> > > > > > programatically (if required). Hence a
> > > > > SynapseConfigurationBuilder (say)
> > > > > > could read a synapse.xml and create a SynapseConfiguration
> > > > > instance. A
> > > > > > reference to this SynapseConfiguration would be held in the
> > > > > > SynapseEnvironment, and the SynapseEnvironment would provide the
> > > > > usual
> > > > > > access to send(), injectMessage() etc. The SynapseConfiguration
> > > > > will
> > > > > > hold references to named Sequences, Endpoints and to global
> > > > > properties.
> > > > >
> > > > > Sounds good but can we s/SynapseEnvironment/SynapseContext/ ??
> > > > > That's
> > > > > consistent with Axis2 naming and seems like a fit here too. I'm
> > > > > the one
> > > > > who came up with the SynapseEnvironment name so I'm happy to
> > > > > propose a
> > > > > change too ;-).
> > > > >
> > > > > Sanjiva.
> > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > >
> > > > > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Paul Fremantle
> > > > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> > > >
> > > > http://bloglines.com/blog/paulfremantle
> > > > paul@wso2.com
> > > >
> > > > "Oxygenating the Web Service Platform", www.wso2.com
> > > >
> > >
> > >
> >
> >
> > --
> > Paul Fremantle
> > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> >
> > http://bloglines.com/blog/paulfremantle
> > paul@wso2.com
> >
> > "Oxygenating the Web Service Platform", www.wso2.com
> >
>
>


--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Re: Implementation of the changes discussed last week - work in progress

Posted by Saminda Abeyruwan <sa...@gmail.com>.
On 5/5/06, Paul Fremantle <pz...@gmail.com> wrote:
>
> Saminda
>
> Is this post still valid after yesterday's web chat?
>

the structure that proposed by Dr.Sanjiva is much more cleaner.

Paul
>
>
> On 5/4/06, Saminda Abeyruwan <samindaa@gmail.com > wrote:
> >
> > Hi Devs,
> >
> > With respect to currently held discussions on refactoring of Synapse
> > core, i would like to see the following packaging structure in core. The
> > inspiration came from Axis2 packing, which i humbly think pretty clear and
> > accurate.
> >
> > We have two context interfaces, SynapseContext (previously know as
> > SynapseEnvironment ) and SynapseMessage, so lets have a package *
> > org.apache.synapse.context *for them. So let have its impl also in this
> > package.
> >
> > Lets have a SynapseContextFactory to create SynapseContext impls.
> > SynapseContext and SynapseMessage will be the runtime entities.
> >
> > Lets have deployment time entity as SynapseConfiguration and let it be
> > in the *org.apache.synapse.xml* package. So all the builders need to
> > populate the SynapseConfiguration should come under this package. In
> > addition to this all the mediator factories should come under this package.
> >
> > For core mediators lets have *org.apache.synapse.mediators.*[builtim/filters
> > etc].
> >
> > One drawback i see in the current svn code is that the mediator chain is
> > built with the very first message that enters into Synapse. In order to
> > overcome this, simply lets have Synapse base listener, SynapseServer which
> > delegates to SimpleHTTPServer, with the the build SynapseContext. So when
> > the first message or any successive messages the SynapseContext is
> > available.
> >
> > Please be kind enough to comment on prior.
> >
> > Thank you
> >
> > Saminda
> >
> >
> >
> >
> > On 5/3/06, Paul Fremantle <pzfreo@gmail.com > wrote:
> > >
> > > I don't agree that the SynapseEnvironment is the same as the Axis2
> > > Context. The environment is an abstraction layer over a set of services. Its
> > > possible we need to split into three parts: a configuration, a context, and
> > > an environment.
> > >
> > > Paul
> > >
> > >
> > >
> > > On 5/2/06, Sanjiva Weerawarana < sanjiva@opensource.lk> wrote:
> > > >
> > > > On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> > > > >
> > > > > I am separating the SynapseConfiguration from the
> > > > SynapseEnvironment,
> > > > > and also allowing for possible configuration model creation
> > > > > programatically (if required). Hence a SynapseConfigurationBuilder
> > > > (say)
> > > > > could read a synapse.xml and create a SynapseConfiguration
> > > > instance. A
> > > > > reference to this SynapseConfiguration would be held in the
> > > > > SynapseEnvironment, and the SynapseEnvironment would provide the
> > > > usual
> > > > > access to send(), injectMessage() etc. The SynapseConfiguration
> > > > will
> > > > > hold references to named Sequences, Endpoints and to global
> > > > properties.
> > > >
> > > > Sounds good but can we s/SynapseEnvironment/SynapseContext/ ??
> > > > That's
> > > > consistent with Axis2 naming and seems like a fit here too. I'm the
> > > > one
> > > > who came up with the SynapseEnvironment name so I'm happy to propose
> > > > a
> > > > change too ;-).
> > > >
> > > > Sanjiva.
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > >
> > > > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Paul Fremantle
> > > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> > >
> > > http://bloglines.com/blog/paulfremantle
> > > paul@wso2.com
> > >
> > > "Oxygenating the Web Service Platform", www.wso2.com
> > >
> >
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>

Re: Implementation of the changes discussed last week - work in progress

Posted by Paul Fremantle <pz...@gmail.com>.
Saminda

Is this post still valid after yesterday's web chat?

Paul

On 5/4/06, Saminda Abeyruwan <sa...@gmail.com> wrote:
>
> Hi Devs,
>
> With respect to currently held discussions on refactoring of Synapse core,
> i would like to see the following packaging structure in core. The
> inspiration came from Axis2 packing, which i humbly think pretty clear and
> accurate.
>
> We have two context interfaces, SynapseContext (previously know as
> SynapseEnvironment ) and SynapseMessage, so lets have a package *
> org.apache.synapse.context *for them. So let have its impl also in this
> package.
>
> Lets have a SynapseContextFactory to create SynapseContext impls.
> SynapseContext and SynapseMessage will be the runtime entities.
>
> Lets have deployment time entity as SynapseConfiguration and let it be in
> the *org.apache.synapse.xml* package. So all the builders need to populate
> the SynapseConfiguration should come under this package. In addition to this
> all the mediator factories should come under this package.
>
> For core mediators lets have *org.apache.synapse.mediators.*[builtim/filters
> etc].
>
> One drawback i see in the current svn code is that the mediator chain is
> built with the very first message that enters into Synapse. In order to
> overcome this, simply lets have Synapse base listener, SynapseServer which
> delegates to SimpleHTTPServer, with the the build SynapseContext. So when
> the first message or any successive messages the SynapseContext is
> available.
>
> Please be kind enough to comment on prior.
>
> Thank you
>
> Saminda
>
>
>
>
> On 5/3/06, Paul Fremantle <pz...@gmail.com> wrote:
> >
> > I don't agree that the SynapseEnvironment is the same as the Axis2
> > Context. The environment is an abstraction layer over a set of services. Its
> > possible we need to split into three parts: a configuration, a context, and
> > an environment.
> >
> > Paul
> >
> >
> >
> > On 5/2/06, Sanjiva Weerawarana < sanjiva@opensource.lk> wrote:
> > >
> > > On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> > > >
> > > > I am separating the SynapseConfiguration from the
> > > SynapseEnvironment,
> > > > and also allowing for possible configuration model creation
> > > > programatically (if required). Hence a SynapseConfigurationBuilder
> > > (say)
> > > > could read a synapse.xml and create a SynapseConfiguration instance.
> > > A
> > > > reference to this SynapseConfiguration would be held in the
> > > > SynapseEnvironment, and the SynapseEnvironment would provide the
> > > usual
> > > > access to send(), injectMessage() etc. The SynapseConfiguration will
> > > > hold references to named Sequences, Endpoints and to global
> > > properties.
> > >
> > > Sounds good but can we s/SynapseEnvironment/SynapseContext/ ?? That's
> > > consistent with Axis2 naming and seems like a fit here too. I'm the
> > > one
> > > who came up with the SynapseEnvironment name so I'm happy to propose a
> > > change too ;-).
> > >
> > > Sanjiva.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Paul Fremantle
> > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> >
> > http://bloglines.com/blog/paulfremantle
> > paul@wso2.com
> >
> > "Oxygenating the Web Service Platform", www.wso2.com
> >
>
>


--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Re: Implementation of the changes discussed last week - work in progress

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Hi Devs,

With respect to currently held discussions on refactoring of Synapse core, i
would like to see the following packaging structure in core. The inspiration
came from Axis2 packing, which i humbly think pretty clear and accurate.

We have two context interfaces, SynapseContext (previously know as
SynapseEnvironment ) and SynapseMessage, so lets have a package *
org.apache.synapse.context *for them. So let have its impl also in this
package.

Lets have a SynapseContextFactory to create SynapseContext impls.
SynapseContext and SynapseMessage will be the runtime entities.

Lets have deployment time entity as SynapseConfiguration and let it be in
the *org.apache.synapse.xml* package. So all the builders need to populate
the SynapseConfiguration should come under this package. In addition to this
all the mediator factories should come under this package.

For core mediators lets have *org.apache.synapse.mediators.*[builtim/filters
etc].

One drawback i see in the current svn code is that the mediator chain is
built with the very first message that enters into Synapse. In order to
overcome this, simply lets have Synapse base listener, SynapseServer which
delegates to SimpleHTTPServer, with the the build SynapseContext. So when
the first message or any successive messages the SynapseContext is
available.

Please be kind enough to comment on prior.

Thank you

Saminda




On 5/3/06, Paul Fremantle <pz...@gmail.com> wrote:
>
> I don't agree that the SynapseEnvironment is the same as the Axis2
> Context. The environment is an abstraction layer over a set of services. Its
> possible we need to split into three parts: a configuration, a context, and
> an environment.
>
> Paul
>
>
>
> On 5/2/06, Sanjiva Weerawarana <sa...@opensource.lk> wrote:
> >
> > On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> > >
> > > I am separating the SynapseConfiguration from the SynapseEnvironment,
> > > and also allowing for possible configuration model creation
> > > programatically (if required). Hence a SynapseConfigurationBuilder
> > (say)
> > > could read a synapse.xml and create a SynapseConfiguration instance. A
> > > reference to this SynapseConfiguration would be held in the
> > > SynapseEnvironment, and the SynapseEnvironment would provide the usual
> >
> > > access to send(), injectMessage() etc. The SynapseConfiguration will
> > > hold references to named Sequences, Endpoints and to global
> > properties.
> >
> > Sounds good but can we s/SynapseEnvironment/SynapseContext/ ?? That's
> > consistent with Axis2 naming and seems like a fit here too. I'm the one
> > who came up with the SynapseEnvironment name so I'm happy to propose a
> > change too ;-).
> >
> > Sanjiva.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> >
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>

Re: Implementation of the changes discussed last week - work in progress

Posted by Paul Fremantle <pz...@gmail.com>.
I don't agree that the SynapseEnvironment is the same as the Axis2 Context.
The environment is an abstraction layer over a set of services. Its possible
we need to split into three parts: a configuration, a context, and an
environment.

Paul


On 5/2/06, Sanjiva Weerawarana <sa...@opensource.lk> wrote:
>
> On Tue, 2006-05-02 at 11:46 +0530, Asankha C. Perera wrote:
> >
> > I am separating the SynapseConfiguration from the SynapseEnvironment,
> > and also allowing for possible configuration model creation
> > programatically (if required). Hence a SynapseConfigurationBuilder (say)
> > could read a synapse.xml and create a SynapseConfiguration instance. A
> > reference to this SynapseConfiguration would be held in the
> > SynapseEnvironment, and the SynapseEnvironment would provide the usual
> > access to send(), injectMessage() etc. The SynapseConfiguration will
> > hold references to named Sequences, Endpoints and to global properties.
>
> Sounds good but can we s/SynapseEnvironment/SynapseContext/ ?? That's
> consistent with Axis2 naming and seems like a fit here too. I'm the one
> who came up with the SynapseEnvironment name so I'm happy to propose a
> change too ;-).
>
> Sanjiva.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>


--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Re: Implementation of the changes discussed last week - work in progress

Posted by "Asankha C. Perera" <as...@wso2.com>.
Index: modules/core/src/org/apache/synapse/api/ListMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/api/ListMediator.java	(revision 398818)
+++ 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;
@@ -16,6 +31,4 @@
     public Mediator removeChild(int pos);
 
     public List getList();
-
-    public void setList(List l); //TODO do we need this?
 }
Index: modules/core/src/org/apache/synapse/api/Mediator.java
===================================================================
--- modules/core/src/org/apache/synapse/api/Mediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/api/Mediator.java	(working copy)
@@ -24,5 +24,5 @@
 public interface Mediator {
     public boolean mediate(SynapseMessage smc);
 
-    public String getName();
+    public String getType();
 }
\ No newline at end of file
Index: modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/axis2/Axis2Sender.java	(working copy)
@@ -26,7 +26,7 @@
 
 
 /**
- * This class helps the Axis2SynapseEnvironment implement the send method
+ * This class helps the Axis2SynapseContext implement the send method
  */
 public class Axis2Sender {
 
@@ -72,11 +72,11 @@
 
             outMsgContext.setTransportIn(ti);
 
-            if (smc.getSynapseEnvironment() == null) {
+            if (smc.getSynapseContext() == null) {
                 throw new SynapseException("no Synapse Env set on message");
             }
-            smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
-                outMsgContext, smc.getSynapseEnvironment()));
+            smc.getSynapseContext().injectMessage(new Axis2SynapseMessage(
+                outMsgContext, smc.getSynapseContext()));
         } catch (Exception e) {
             e.printStackTrace();
             throw new SynapseException(e);
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java	(revision 0)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.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.axis2;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.SynapseConfigurationBuilder;
+
+import java.io.InputStream;
+
+/**
+ * <p> This is the Axis2 implementation of the SynapseContext
+ */
+public class Axis2SynapseContext implements SynapseContext {
+
+    private ClassLoader cl = null;
+    private SynapseConfiguration config = null;
+    private Log log = LogFactory.getLog(getClass());
+
+    public Axis2SynapseContext(InputStream is, ClassLoader cl) {
+        super();
+        this.cl = cl;
+        new SynapseConfigurationBuilder().setConfiguration(this, is);
+    }
+
+    public void injectMessage(SynapseMessage smc) {
+        smc.setSynapseContext(this);
+        getConfiguration().getMainMediator().mediate(smc);
+    }
+
+    public void send(SynapseMessage sm) {
+        if (sm.isResponse())
+            Axis2Sender.sendBack(sm);
+        else
+            Axis2Sender.sendOn(sm);
+    }
+
+    public ClassLoader getClassLoader() {
+        return cl;
+    }
+
+    public void setClassLoader(ClassLoader cl) {
+        this.cl = cl;
+    }
+
+    public SynapseConfiguration getConfiguration() {
+        return config;
+    }
+
+    public void setConfiguration(SynapseConfiguration cfg) {
+        this.config = cfg;
+    }
+
+}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseContextFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseContextFinder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseContextFinder.java	(revision 0)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.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 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) {
+
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synapseCtxParam = ac.getParameter(SYNAPSE_CONTEXT);
+
+        if (synapseCtxParam == null) {
+
+            log.debug("Synapse Context not available. Creating...");
+            Parameter param = ac.getParameter(SYNAPSE_CONFIGURATION);
+
+            if (param == null) {
+                throw new SynapseException("Axis2 configuration does not specify a '" +
+                    SYNAPSE_CONFIGURATION + "' parameter");
+            }
+
+            String synapseConfig = (String) param.getValue();
+            InputStream is = mc.getAxisService().getClassLoader().getResourceAsStream(synapseConfig.trim());
+
+            Axis2SynapseContext synCtx = new Axis2SynapseContext(is, mc.getAxisService().getClassLoader());
+            setSynapseContext(mc, synCtx);
+        }
+        return (SynapseContext) ac.getParameter(SYNAPSE_CONTEXT).getValue();
+    }
+
+    public static synchronized void setSynapseContext(MessageContext mc, SynapseContext synCtx) {
+
+        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synapseCtxParam = new Parameter(SYNAPSE_CONTEXT, null);
+        synapseCtxParam.setValue(synCtx);
+
+        try {
+            ac.addParameter(synapseCtxParam);
+        } catch (AxisFault e) {
+            String msg = "Could not add parameter '" + SYNAPSE_CONTEXT + "' to the Axis2 configuration";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
+}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.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.axis2;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseMessage;
-import org.apache.synapse.config.SynapseConfiguration;
-
-/**
- * <p> This is the Axis2 implementation of the SynapseEnvironment
- */
-public class Axis2SynapseEnvironment implements SynapseEnvironment {
-
-    private ClassLoader cl = null;
-    private SynapseConfiguration config = null;
-    private Log log = LogFactory.getLog(getClass());
-
-    public Axis2SynapseEnvironment(OMElement synapseConfiguration,
-                                   ClassLoader cl) {
-        super();
-        this.cl = cl;
-//        if (synapseConfiguration!=null)
-//            mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
-        // TODO set main mediator here
-    }
-
-    public void injectMessage(SynapseMessage smc) {
-        smc.setSynapseEnvironment(this);
-        getConfiguration().getMainMediator().mediate(smc);
-    }
-
-    public void send(SynapseMessage sm) {
-        if (sm.isResponse())
-            Axis2Sender.sendBack(sm);
-        else
-            Axis2Sender.sendOn(sm);
-    }
-
-    public ClassLoader getClassLoader() {
-        return cl;
-    }
-
-    public void setClassLoader(ClassLoader cl) {
-        this.cl = cl;
-    }
-
-    public SynapseConfiguration getConfiguration() {
-        return config;
-    }
-
-    public void setConfiguration(SynapseConfiguration cfg) {
-        this.config = cfg;
-    }
-
-}
Index: modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java	(revision 398818)
+++ 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 org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-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.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-
-/**
- * <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.config");
-            }
-            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 398818)
+++ modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java	(working copy)
@@ -22,7 +22,7 @@
 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 java.util.HashMap;
@@ -43,9 +43,9 @@
 
     private boolean faultResponse = false;
 
-    public Axis2SynapseMessage(MessageContext mc, SynapseEnvironment se) {
+    public Axis2SynapseMessage(MessageContext mc, SynapseContext se) {
         setMessageContext(mc);
-        setSynapseEnvironment(se);
+        setSynapseContext(se);
     }
 
     public EndpointReference getFaultTo() {
@@ -211,12 +211,12 @@
         return this.faultResponse;
     }
 
-    public SynapseEnvironment getSynapseEnvironment() {
-        return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
+    public SynapseContext getSynapseContext() {
+        return Axis2SynapseContextFinder.getSynapseContext(mc);
     }
 
-    public void setSynapseEnvironment(SynapseEnvironment env) {
-        Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
+    public void setSynapseContext(SynapseContext synCtx) {
+        Axis2SynapseContextFinder.setSynapseContext(mc, synCtx);
         return;
     }
 
Index: modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java	(working copy)
@@ -14,15 +14,15 @@
         Mediator mediator = (Mediator) obj;
 /*
         if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
-            SynapseEnvironment se = (SynapseEnvironment) messageContext
-                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
-            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
+            SynapseContext se = (SynapseContext) messageContext
+                    .getProperty(Constants.MEDIATOR_SYNAPSE_CTX_PROPERTY);
+            ((EnvironmentAware) mediator).setSynapseContext(se);
             ((EnvironmentAware) mediator).setClassLoader(
                     messageContext.getAxisService().getClassLoader());
         }
         
 */
-        SynapseMessage smc = new Axis2SynapseMessage(messageContext, Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
+        SynapseMessage smc = new Axis2SynapseMessage(messageContext, Axis2SynapseContextFinder.getSynapseContext(messageContext));
         boolean returnValue = mediator.mediate(smc);
         messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
             new Boolean(returnValue));
Index: modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
===================================================================
--- modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java	(working copy)
@@ -21,7 +21,7 @@
 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;
 
 /**
@@ -35,17 +35,17 @@
 
     public void receive(MessageContext mc) throws AxisFault {
         log.debug("receiving message");
-        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
-            .getSynapseEnvironment(mc);
+        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);
+        smc.setSynapseContext(synCtx);
+        synCtx.injectMessage(smc);
 
         ///////////////////////////////////////////////////////////////////////
         // Response handling mechanism for 200/202 and 5XX
Index: modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java	(working copy)
@@ -13,17 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 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.SynapseContext;
+import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.ListMediator;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
@@ -37,24 +34,20 @@
  */
 public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
 
-    Log log = LogFactory.getLog(getClass());
-
-    public void addChildrenAndSetName(SynapseEnvironment se, OMElement el, ListMediator m)
+    public void addChildren(SynapseContext synCtx, 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(synCtx, 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/AbstractMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java	(working copy)
@@ -13,18 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
-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;
-
 /**
  *
  * 
@@ -34,20 +27,5 @@
  */
 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); TODO fix this later!
-        }
-        log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
-
-    }
-
-
+    Log log = LogFactory.getLog(getClass());
 }
Index: modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java	(working copy)
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
 import org.apache.synapse.config.Constants;
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.ext.ClassMediator;
@@ -33,10 +33,8 @@
 public class ClassMediatorFactory extends AbstractMediatorFactory {
     private static final QName CLM_Q = new QName(Constants.SYNAPSE_NAMESPACE,
             "classmediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(SynapseContext 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"
Index: modules/core/src/org/apache/synapse/config/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/config/Constants.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/Constants.java	(working copy)
@@ -27,6 +27,8 @@
     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/DropMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/DropMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/DropMediatorFactory.java	(working copy)
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.config.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.DropMediator;
@@ -27,9 +27,9 @@
 
 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(SynapseContext se, OMElement el) {
         return new DropMediator();
     }
 
Index: modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java	(working copy)
@@ -13,15 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.config.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.transform.FaultMediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
 
 /**
  *
@@ -31,27 +32,59 @@
  * 
  */
 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, "fault");
 
-    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(SynapseContext synMsg, 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/FilterMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java	(revision 0)
@@ -0,0 +1,96 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT 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 org.apache.synapse.SynapseContext;
+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.xpath.AXIOMXPath;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class FilterMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final QName FILTER_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
+
+    public Mediator createMediator(SynapseContext synCtx, OMElement elem) {
+        FilterMediator filter = new FilterMediator();
+        super.addChildren(synCtx, 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);
+                }
+            }
+
+        } 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);
+                }
+            }
+
+        } 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/HeaderMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java	(working copy)
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.config.Constants;
 import org.apache.synapse.api.Mediator;
@@ -41,9 +41,8 @@
         private static final QName TYPE_ATT_Q = new QName("type"),
             VALUE_ATT_Q = new QName("value");
 
-        public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+        public Mediator createMediator(SynapseContext 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) {
Index: modules/core/src/org/apache/synapse/config/LogMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/LogMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/LogMediatorFactory.java	(working copy)
@@ -14,40 +14,103 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.SynapseContext;
+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 java.util.Iterator;
+
 /**
+ * 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"]>
+ *      <property> *
+ * </log>
  */
 public class LogMediatorFactory extends AbstractMediatorFactory {
-    private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE,
-            "log");
 
+    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(SynapseContext synCtx, OMElement elem) {
 
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
-        LogMediator lm = new LogMediator();
-        super.setNameOnMediator(se,el,lm);
-        return lm;
+        LogMediator logMediator = new LogMediator();
+
+        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);
+            }
+        }
+
+        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 Log property";
+                    log.error(msg);
+                    throw new SynapseException(msg);
+                } else {
+                    prop.setExpression(attValue.getAttributeValue());
+                }
+
+            } else {
+                String msg = "Property attribute value OR expression must be specified for a Log property";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+            logMediator.addProperty(prop);
+        }
+
+        return logMediator;
     }
 
 }
Index: modules/core/src/org/apache/synapse/config/MediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/MediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/MediatorFactory.java	(working copy)
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 
 public interface MediatorFactory {
-    public Mediator createMediator(SynapseEnvironment se, OMElement el);
+    public Mediator createMediator(SynapseContext se, OMElement el);
     public QName getTagQName();
 }
Index: modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java	(working copy)
@@ -15,7 +15,7 @@
  */
 
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -27,8 +27,9 @@
 import org.apache.commons.logging.LogFactory;
 
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.MediatorFactory;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -44,80 +45,97 @@
 
 public class MediatorFactoryFinder {
 
-	private static Map lookup = null;
+    private static Map factoryMap = new HashMap();
+	private Log log = LogFactory.getLog(getClass());
 
-	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
+      };
 
-	private static Class[] mediatorFactories = {
-			SynapseMediatorFactory.class,
-			HeaderMediatorFactory.class,
-			ClassMediatorFactory.class,
-			ServiceMediatorFactory.class,
-			LogMediatorFactory.class, SendMediatorFactory.class,
-			FaultMediatorFactory.class,
-            SendMediatorFactory.class,
-            DropMediatorFactory.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 synapseCtx
 	 * @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 {
+	public Mediator getMediator(SynapseContext synapseCtx, 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(synapseCtx, 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/SendMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SendMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/SendMediatorFactory.java	(working copy)
@@ -14,34 +14,31 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 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.synapse.config.Constants;
+import org.apache.synapse.SynapseContext;
 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
+ */
 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(SynapseContext synMsg, 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/SequenceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.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.config;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseContext;
+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 javax.xml.namespace.QName;
+
+/**
+ * Builds an instance of a Sequence mediator through the Synapse configuration. It follows the following
+ * <sequence (ref="name" | name="name")> mediator* </sequence>
+ */
+public class SequenceMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
+
+    public QName getTagQName() {
+        return SEQUENCE_Q;
+    }
+
+    public Mediator createMediator(SynapseContext synCtx, 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(synCtx, elem, seqMediator);
+            synCtx.getConfiguration().addNamedMediator(n.getAttributeValue(), 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/ServiceMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java	(working copy)
@@ -15,12 +15,12 @@
  */
 
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.config.Constants;
 import org.apache.synapse.api.Mediator;
@@ -31,9 +31,8 @@
 public class ServiceMediatorFactory extends AbstractMediatorFactory {
     private static final QName tagName = new QName(Constants.SYNAPSE_NAMESPACE,
             "servicemediator");
-    public Mediator createMediator(SynapseEnvironment se, OMElement el) {
+    public Mediator createMediator(SynapseContext se, OMElement el) {
         ServiceMediator sm = new ServiceMediator();
-        super.setNameOnMediator(se,el,sm);
 
         OMAttribute attr = el.getAttribute(new QName("service"));
         if (attr == null)
Index: modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java	(revision 0)
+++ modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java	(revision 0)
@@ -0,0 +1,117 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT 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.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseException;
+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 java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Iterator;
+
+public class SynapseConfigurationBuilder {
+
+    private static Log log = LogFactory.getLog(SynapseConfigurationBuilder.class);
+    private SynapseConfiguration config = new SynapseConfiguration();
+
+    public SynapseConfigurationBuilder() {}
+
+    public void setConfiguration(SynapseContext synCtx, InputStream is) {
+
+        synCtx.setConfiguration(config);
+
+        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();
+
+        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(synCtx, elt);
+            }
+        }
+
+        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(synCtx, elt); //TODO process Endpoints
+            }
+        }
+
+        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(synCtx, elt); //TODO process Properties
+            }
+        }
+
+        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(synCtx, 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) {}
+        }
+    }
+
+    private void defineSequence(SynapseContext synCtx, OMElement ele) {
+        SequenceMediator seq = (SequenceMediator) MediatorFactoryFinder.getInstance().getMediator(synCtx, ele);
+        config.addNamedMediator(seq.getName(), seq);
+    }
+
+    public static void main(String[] args) throws Exception {
+        SynapseConfigurationBuilder scb = new SynapseConfigurationBuilder();
+        InputStream is = new FileInputStream("/Temp/delete/simple.xml");
+        SynapseContext se = new org.apache.synapse.axis2.Axis2SynapseContext(is,null);
+        System.out.println(se.getConfiguration());
+    }
+
+}
Index: modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.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.config;
-
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Iterator;
-
-public class SynapseConfigurationFactory {
-
-    public SynapseConfigurationFactory() {
-
-    }
-
-    public static SynapseConfiguration getConfiguration(String fileName) throws XMLStreamException, IOException {
-
-        SynapseConfiguration config = new SynapseConfiguration();
-
-        OMElement root =
-            new StAXOMBuilder(XMLInputFactory.newInstance().
-                createXMLStreamReader(new FileReader(fileName)))
-                .getDocumentElement();
-        root.build();
-
-        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);
-            }
-        }
-
-        return null;
-    }
-
-    private static void defineSequence(OMElement ele) {
-        //Mediator med = MediatorFactoryFinder.getMediator(synapseEnv, ele);
-        System.out.println("med");
-    }
-}
Index: modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java
===================================================================
--- modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java	(working copy)
@@ -14,29 +14,27 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseContext;
 import org.apache.synapse.config.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 {
+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(SynapseContext synCtx, OMElement elem) {
         SynapseMediator sm = new SynapseMediator();
-        //super.addChildrenAndSetName(se, el, sm); TODO fix this later
+        super.addChildren(synCtx, elem, sm);
         return sm;
     }
 
Index: modules/core/src/org/apache/synapse/Constants.java
===================================================================
--- modules/core/src/org/apache/synapse/Constants.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/Constants.java	(working copy)
@@ -29,16 +29,16 @@
     QName MEDIATE_OPERATION_NAME = new QName("mediate");
 
     String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
-    String MEDIATOR_SYNAPSE_ENV_PROPERTY = "synapse.mediator.environment";
+    String MEDIATOR_SYNAPSE_CTX_PROPERTY = "synapse.mediator.environment";
 
     String ISRESPONSE_PROPERTY = "synapse.isresponse";
 
     String EMPTYMEDIATOR = "emptymediator";
 
     //this is for the synapse.config config
-    String SYNAPSECONFIGURATION = "SynapseConfiguration";
+    String SYNAPSE_CONFIGURATION = "SynapseConfiguration";
 
-    String SYNAPSE_ENVIRONMENT = "synapse.environment";
+    String SYNAPSE_CONTEXT = "synapse.context";
 
     String ADD_ADDRESSING = "synapse.send.useaddressing";
 
Index: modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java	(working copy)
@@ -18,22 +18,22 @@
 
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.api.Mediator;
+import org.apache.synapse.api.ListMediator;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-public abstract class AbstractListMediator extends AbstractMediator {
+public abstract class AbstractListMediator extends AbstractMediator implements ListMediator {
 
     protected List mediators = new ArrayList();
 
     public boolean mediate(SynapseMessage synMsg) {
-        log.debug("List mediator : mediate() " + getName());
+        log.debug(getType() + " mediate()");
 
         Iterator it = mediators.iterator();
         while (it.hasNext()) {
             Mediator m = (Mediator) it.next();
-            log.debug(m.getClass());
             if (!m.mediate(synMsg)) {
                 return false;
             }
Index: modules/core/src/org/apache/synapse/mediators/AbstractMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/AbstractMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/AbstractMediator.java	(working copy)
@@ -23,7 +23,7 @@
 
     protected final Log log = LogFactory.getLog(getClass());
 
-    public String getName() {
-        return getClass().getName();
+    public String getType() {
+        return getClass().getSimpleName();
     }
 }
Index: modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java	(working copy)
@@ -16,6 +16,8 @@
 package org.apache.synapse.mediators.base;
 
 import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.AbstractListMediator;
 
 /**
@@ -35,11 +37,18 @@
      * @return as per standard mediator result
      */
     public boolean mediate(SynapseMessage synMsg) {
+        log.debug(getType() + " mediate()");
         if (ref == null) {
             return super.mediate(synMsg);
         } else {
-            return synMsg.getSynapseEnvironment().getConfiguration().
-                getNamedMediator(ref).mediate(synMsg);
+            Mediator m = synMsg.getSynapseContext().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(synMsg);
+            }
         }
     }
 
Index: modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java	(working copy)
@@ -25,6 +25,7 @@
 public class DropMediator extends AbstractMediator {
 
     public boolean mediate(SynapseMessage synMsg) {
+        log.debug(getType() + " mediate()");
         if (synMsg.getTo() == null) {
             return false;
         } else {
Index: modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java	(working copy)
@@ -42,7 +42,7 @@
     }
 
     public boolean mediate(SynapseMessage sm) {
-
+        log.debug(getType() + " mediate()");
         headerType.setHeader(sm, getValue());
         return true;
     }
Index: modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java	(working copy)
@@ -19,9 +19,11 @@
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.MediatorProperty;
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.ArrayList;
 
 
 /**
@@ -36,10 +38,11 @@
     public static final int FULL = 3;
 
     private int logLevel = SIMPLE;
-    private String SEP = "\n";
-    private List properties = null;
+    private String SEP = ", ";
+    private List properties = new ArrayList();
 
     public boolean mediate(SynapseMessage synMsg) {
+        log.debug(getType() + " mediate()");
         log.info(getLogMessage(synMsg));
         return true;
     }
@@ -107,44 +110,31 @@
         if (properties != null && !properties.isEmpty()) {
             Iterator iter = properties.iterator();
             while (iter.hasNext()) {
-                Property prop = (Property) iter.next();
+                MediatorProperty prop = (MediatorProperty) iter.next();
                 sb.append(SEP + prop.getName() + " = " +
-                    prop.getValue() != null ? prop.getValue() : prop.getEvaluatedExpression());
+                    (prop.getValue() != null ? prop.getValue() : prop.getEvaluatedExpression()));
             }
         }
     }
 
-    public class Property {
-        private String name;
-        private String value;
-        private String expression;
+    public int getLogLevel() {
+        return logLevel;
+    }
 
-        public String getName() {
-            return name;
-        }
+    public void setLogLevel(int logLevel) {
+        this.logLevel = logLevel;
+    }
 
-        public void setName(String name) {
-            this.name = name;
-        }
+    public String getSeperator() {
+        return SEP;
+    }
 
-        public String getValue() {
-            return value;
-        }
+    public void setSeperator(String SEP) {
+        this.SEP = SEP;
+    }
 
-        public void setValue(String value) {
-            this.value = value;
-        }
-
-        public String getExpression() {
-            return expression;
-        }
-
-        public void setExpression(String expression) {
-            this.expression = expression;
-        }
-
-        public String getEvaluatedExpression() {
-            return expression;  //TODO later use XPath xtention eval
-        }
+    public void addProperty(MediatorProperty p) {
+        properties.add(p);
     }
+
 }
Index: modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java	(working copy)
@@ -35,8 +35,8 @@
      * @return false always as this is a leaf mediator
      */
     public boolean mediate(SynapseMessage synMsg) {
-        log.debug(getName() + " mediate()");
-        synMsg.getSynapseEnvironment().send(synMsg);
+        log.debug(getType() + " mediate()");
+        synMsg.getSynapseContext().send(synMsg);
         return false;
     }
 }
Index: modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java	(working copy)
@@ -34,6 +34,7 @@
 
 
     public boolean mediate(SynapseMessage smc) {
+        log.debug(getType() + " mediate()");
         Mediator m = null;
 
         try {
@@ -42,7 +43,7 @@
             throw new SynapseException(e);
         }
         /*if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
-              ((EnvironmentAware) m).setSynapseEnvironment(se);
+              ((EnvironmentAware) m).setSynapseContext(se);
           }*/
         return m.mediate(smc);
 
Index: modules/core/src/org/apache/synapse/mediators/ext/ServiceMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/ext/ServiceMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/ext/ServiceMediator.java	(working copy)
@@ -42,6 +42,7 @@
     private String serviceName = null;
 
     public boolean mediate(SynapseMessage smc) {
+        log.debug(getType() + " mediate()");
         MessageContext messageContext = null;
         try {
             messageContext = ((Axis2SynapseMessage) smc)
Index: modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java	(working copy)
@@ -28,13 +28,14 @@
  * 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 {
+public class FilterMediator extends AbstractListMediator implements org.apache.synapse.api.FilterMediator {
 
-    private String source = null;
-    private String regex = null;
-    private String xpath = null;
+    private AXIOMXPath source = null;
+    private Pattern regex = null;
+    private AXIOMXPath xpath = null;
 
     public boolean mediate(SynapseMessage synMsg) {
+        log.debug(getType() + " mediate()");
         if (test(synMsg)) {
             return super.mediate(synMsg);
         } else {
@@ -45,14 +46,11 @@
     public boolean test(SynapseMessage synMsg) {
         try {
             if (xpath != null) {
-                AXIOMXPath xp = new AXIOMXPath(xpath);
-                return xp.booleanValueOf(synMsg.getEnvelope());
+                return xpath.booleanValueOf(synMsg.getEnvelope());
 
             } else if (source != null && regex != null) {
-                Pattern pattern = Pattern.compile(regex);
-                AXIOMXPath xp = new AXIOMXPath(source);
-                Object result = xp.evaluate(synMsg.getEnvelope());
-                return pattern.matcher(result.toString()).matches();
+                Object result = source.evaluate(synMsg.getEnvelope());
+                return regex.matcher(result.toString()).matches();
 
             } else {
                 log.error("Invalid configuration specified");
@@ -66,27 +64,27 @@
     }
 
 
-    public String getSource() {
+    public AXIOMXPath getSource() {
         return source;
     }
 
-    public void setSource(String source) {
+    public void setSource(AXIOMXPath source) {
         this.source = source;
     }
 
-    public String getRegex() {
+    public Pattern getRegex() {
         return regex;
     }
 
-    public void setRegex(String regex) {
+    public void setRegex(Pattern regex) {
         this.regex = regex;
     }
 
-    public String getXpath() {
+    public AXIOMXPath getXpath() {
         return xpath;
     }
 
-    public void setXpath(String xpath) {
+    public void setXpath(AXIOMXPath xpath) {
         this.xpath = xpath;
     }
 
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,63 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT 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.Constants;
+
+import javax.xml.namespace.QName;
+
+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 String 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 String getExpression() {
+        return expression;
+    }
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    public String getEvaluatedExpression() {
+        return expression;  //TODO later use XPath xtention eval
+    }
+
+}
Index: modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java	(working copy)
@@ -18,10 +18,9 @@
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
+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;
@@ -37,55 +36,80 @@
 
     private Log log = LogFactory.getLog(getClass());
 
-    private QName faultCode;
+    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(SynapseMessage smc) {
-        log.debug("process");
+    public boolean mediate(SynapseMessage synMsg) {
+        log.debug(getType() + " mediate()");
+        SOAPEnvelope envelop = synMsg.getEnvelope();
+        SOAPFactory factory;
 
-        SOAPEnvelope envelop = smc.getEnvelope();
-        SOAPFactory factory;
-        if (envelop != null) {
-            if (envelop.getNamespace().getName().equals(
-                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+        switch (soapVersion) {
+            case SOAP11:
+                factory = OMAbstractFactory.getSOAP11Factory();
+                break;
+            case SOAP12:
                 factory = OMAbstractFactory.getSOAP12Factory();
-            } else {
-                factory = OMAbstractFactory.getSOAP11Factory();
+                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();
+                }
             }
+        }
 
+        // TODO : Figure out how to easily gen the correct fault
+        // Replace this
+        OMDocument soapFaultDocument = factory.createOMDocument();
+        SOAPEnvelope faultEnvelope   = factory.getDefaultFaultEnvelope();
+        //SOAPFault fault = factory.createSOAPFault();
+        //faultEnvelope.setFirstChild(fault);
+        soapFaultDocument.addChild(faultEnvelope);
+
+        // 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 {
-            factory = OMAbstractFactory.getSOAP11Factory();
+            EndpointReference replyToEPR = synMsg.getReplyTo();
+            synMsg.setTo(replyToEPR);
+            synMsg.setReplyTo(toEPR);
         }
+        synMsg.setResponse(true);
+
         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);
+            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);
         }
-        smc.setResponse(true);
-
-        // Flipping the headers
-        EndpointReference tempEPR = smc.getTo();
-        smc.setTo(smc.getReplyTo());
-        smc.setReplyTo(tempEPR);
-
-        smc.getSynapseEnvironment().injectMessage(smc);
-
-        return false;
+        return true;
     }
 
-    public QName getFaultCode() {
-        return faultCode;
+    public QName getCode() {
+        return code;
     }
 
-    public void setFaultCode(QName faultCode) {
-        this.faultCode = faultCode;
+    public void setCode(QName code) {
+        this.code = code;
     }
 
     public String getReason() {
@@ -95,4 +119,14 @@
     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/XSLTMediator.java
===================================================================
--- modules/core/src/org/apache/synapse/mediators/transform/XSLTMediator.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/mediators/transform/XSLTMediator.java	(working copy)
@@ -32,7 +32,7 @@
     private String source = null;
 
     public boolean mediate(SynapseMessage synMsg) {
-
+        log.debug(getType() + " mediate()");
         if (xsltUrl != null) {
             performXLST(synMsg);
             return true;
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,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;
+
+
+import org.apache.synapse.config.SynapseConfiguration;
+
+
+/**
+ * The Synapse Environment is available to mediators through the SynapseMessage. It
+ * allows one to call to the underlying SOAP engine (such as Axis2) where required.
+ * e.g. send message, get classloader etc. It also holds a reference to the current
+ * SynapseConfiguration.
+ */
+public interface SynapseContext {
+
+    /*
+    * 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);
+
+    /**
+     * 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
+     *
+     * @param cfg The new synapse configuration instance
+     */
+    public void setConfiguration(SynapseConfiguration cfg);
+
+}
Index: modules/core/src/org/apache/synapse/SynapseEnvironment.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseEnvironment.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/SynapseEnvironment.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;
-
-
-import org.apache.synapse.config.SynapseConfiguration;
-
-
-/**
- * The Synapse Environment is available to mediators through the SynapseMessage. It
- * allows one to call to the underlying SOAP engine (such as Axis2) where required.
- * e.g. send message, get classloader etc. It also holds a reference to the current
- * SynapseConfiguration.
- */
-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);
-
-    /**
-     * 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
-     *
-     * @param cfg The new synapse configuration instance
-     */
-    public void setConfiguration(SynapseConfiguration cfg);
-
-}
Index: modules/core/src/org/apache/synapse/SynapseMessage.java
===================================================================
--- modules/core/src/org/apache/synapse/SynapseMessage.java	(revision 398818)
+++ modules/core/src/org/apache/synapse/SynapseMessage.java	(working copy)
@@ -91,7 +91,7 @@
 
     public boolean isFaultResponse();
 
-    public SynapseEnvironment getSynapseEnvironment();
+    public SynapseContext getSynapseContext();
 
-    public void setSynapseEnvironment(SynapseEnvironment env);
+    public void setSynapseContext(SynapseContext env);
 }