synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas" <dava...@gmail.com>
Subject Re: Class mediator
Date Wed, 01 Aug 2007 13:06:40 GMT
Sounds good Paul!

On 8/1/07, Paul Fremantle <pzfreo@gmail.com> wrote:
> I changed the class mediator to only use static properties so that
> they would be set before the class.init() was called.
>
> However, Asankha has pointed out to me that there is another model
> that the dynamic properties had, which is to use XPath properties to
> set data on the mediator before it is called, thereby meaning that
> there is no need for user to need to understand OMElement or
> MessageContext to write a mediator.
>
> I guess I see these as two completely separate ways to write a
> mediator. In fact I see three potential approaches:
>
> 1) mediate(MessageContext mc)
> 2) set/get XPath data in/out of the message
> 3) Use ADB or Databinding and write Java based on the message type
>
> I'm not sure about the third option - it not very "loosely-coupled"
> but I can see how it would appeal to Java developers. I'd be happy to
> leave that till later.
>
> However, I think 1 and 2 are really distinct cases.
>
> The second model is really something called the Command Pattern. You
> can read about it here:
> http://en.wikipedia.org/wiki/Command_pattern
> http://www.javaworld.com/javaworld/javatips/jw-javatip68.html?page=1
>
> Basically this model is where you call:
>
> obj.setX(y);
> obj.setQ(z);
> obj.setF(e);
> obj.execute();
> obj.getX()
> obj.getQ()
> obj.getF();
>
> It seems like we could define a nice model for this in Synapse:
> <command class="org.fremantle.Command"> <!-- class must implement
> "void execute();" -->
>    <property name="Name" expression="xpath expression"
> action="set|get|setAndGet" type="String|float|double|boolean|..."/>
>    <property name="Symbol" expression="//Symbol" action="get" type="String"/>
>    <property name="Symbol" expression="/getQuoteResponse/Price[0]"
> action="set" type="Double"/>
> </command>
>
> Basically what this will do is allow the user to write a real POJO
> that implements getters and setters as well as the execute(); method.
> We then call XPaths and set data into the object, then call execute();
> then we update the message based on data from the getters.
>
> Thoughts?
>
> Paul
>
>
>
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

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


Mime
View raw message