synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Fremantle" <pzf...@gmail.com>
Subject Re: POJO command model plus annotations
Date Tue, 20 Nov 2007 11:44:19 GMT
Thoughts inline

On Nov 20, 2007 11:31 AM, ant elder <antelder@apache.org> wrote:

> OK i see, i thought "in" and "inout" were referring to the message
> direction like in the synapse config xml so get and getAndSet actions seem
> better to me.
>
> It does seem like a pretty cool way to write a medaitor.


Yep!

>
> - I guess the type of the property could be OMElement if you want  to get
> or set more than just a string?

Yes - we already support this in the existing command mediator

>
> - the action could really be optional as its not so hard for the runtime
> to see that the value has been changed and set/getandset would just be a
> performance optimisation

I guess so. It depends on whether we generate the property and
getters/setters or not. I was kind of assuming that we wouldn't generate
them. Alternatively we could cache values before and after the execute
method, but thats a bit yucky, I think its so simple to use an annotation,
and also since you get command completion for annotations inside IDEs we can
make it a required property.


>
> - could a default namespace set on the class so you don't have to always
> specify an nsdecl on each property?


Yes. Good idea. How about:
@namespace(default="http://fremantle.org");


>
> - is there a reason you used a name like @executeMethod instead of
> something mentioning "mediate" like on the Mediator interface?


Yes. Basically this is the Command Pattern
http://en.wikipedia.org/wiki/Command_pattern
PS We already implemented this! Just not with annotations.

I guess what I haven't figured out is how to deploy this into a synapse
config. Maybe we need a new tag

<annotated-java class=" "/> or something similar.

I also imagine we could do something similar for Tasks, but haven't thought
that through yet.

Paul

>
>
>    ...ant
>
>
> On Nov 20, 2007 11:03 AM, Paul Fremantle <pzfreo@gmail.com> wrote:
>
> > The idea is that the "direction" attribute defines which properties are
> > get/set or getAndSet. I think we need a clear naming scheme for this.
> >
> > How about:
> >
> > @property(xpath="/ns:getQuote
> > >
> > > /Symbol", nsdecl="xmlns:ns=' http://fremantle.org'<http://fremantle.org%27/>",
> > > action="get|set|getandset"
> > >
> > );
> >
> >
> >
> >
> > Paul
> >
> >
> > On Nov 20, 2007 10:13 AM, ant elder < ant.elder@gmail.com> wrote:
> >
> > > Thats quite interesting. The execute method is setting the value in
> > > the message payload right? So does something say that the property is a
> > > readonly or updatable or would all properties get checked after execute is
> > > called to see if they've been altered?
> > >
> > >    ...ant
> > >
> > >
> > > On Nov 20, 2007 10:02 AM, Paul Fremantle <pzfreo@gmail.com > wrote:
> > >
> > > > Folks
> > > >
> > > > How about doing some funky development and creating some
> > > > annotations.
> > > >
> > > > Basically the idea I have is to simplify development like this:
> > > >
> > > > public class PaulsPOJOMediator {
> > > >
> > > > @property(xpath="/ns:getQuote/Symbol", nsdecl="xmlns:ns='
> > > > http://fremantle.org' <http://fremantle.org%27>", direction="in");
> > > > private String symbol;
> > > >
> > > > @property(name="value", xpath="/ns:getQuote/Value",
> > > > nsdecl="xmlns:ns=' http://fremantle.org' <http://fremantle.org%27>",
> > > > direction="inout");
> > > > private String value;
> > > >
> > > > @executeMethod
> > > > public void execute() {
> > > >     this.value = "55";
> > > > }
> > > >
> > > > }
> > > >
> > > > --
> > > > 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
> > >
> > >
> > >
> >
> >
> > --
> > 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
> >
>
>


-- 
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

Mime
View raw message