Ruwam

What I don't like about this is that everywhere else in Synapse we have a consistent access to message context properties. Nowhere else do we use this syntax.

Whatever we do we need to sync it up with all the other places where we get and set mc properties I think - e.g. DBLookup, etc.

Paul

On Dec 14, 2007 3:42 AM, Ruwan Linton <ruwan.linton@gmail.com> wrote:
Pual,

Well. I think it's a hack and a bit tricky.

I have simplified the configuration a little bit to remove the mix case as it is obvious that is one is *Read* then the other should be *Update*.

But I prefer to keep the context-name attribute with those actions due to two reasons.

1) the configuration is clean and does not have any hidden meaning (for example; it does not contain if the action is Update then the get-property refers to set-property)
2) using the get-property to retrieve message context properties is a round trip in execution, (we can by pass that using a string comparison as you suggested in the Update case, but I don't feel like it is right .. :() obviously even with this configuration user has the ability to specify the get as a get-property but at the same time he has the simple faster config as well.

Following is the simplified configuration that I have already implemented.

<pojoCommand name="class-name">
  <property name="string" value="literal"/> <!-- refers to action ==> ReadValue -->
  <property name="string" expression="/xpath/expression" action=("ReadMessage" | "UpdateMessage" | "ReadAndUpdateMessage")/>
  <property name="string" value="literal" expression="/xpath/expression"/> <!-- refers to action ==>ReadValueAndUpdateMessage -->
  <property name="string" context-name="string" action=("ReadContext" | "UpdateContext" | "ReadAndUpdateContext")/>
  <property name="string" value="literal" context-name="string"/> <!-- refers to action ==>ReadValueAndUpdateContext -->
  <property name="string" context-name="string" expression="/xpath/expression" action=("ReadMessage" | "ReadContext")/> <!-- if read one then update the other -->
</pojoCommand>

Thanks,
Ruwan


On Dec 13, 2007 9:17 PM, Paul Fremantle < pzfreo@gmail.com> wrote:
Ruwan

I propose one modification. I'd really like to get rid of the whole Context stuff. It should be automatic.
Here is my proposal.

1) We figure out if we can make the get-property('context-name') also allow updating the message context too.
2) We just see if the XPath is a 'get-property'. When we come to update the message, if its a get-property we bypass Jaxen/XPath and directly update the context.

That way the syntax can just be:

<pojoCommand name="class-name">
  <property name="string" value="literal"/>
  <property name="string" expression="/xpath/expression or get-property('context-property')" action=("ReadMessage" | "UpdateMessage" | "ReadAndUpdateMessage")/>
</pojoCommand>

Thoughts?

Paul



On Dec 12, 2007 6:10 AM, Ruwan Linton < ruwan@apache.org> wrote:
Hi devs,

Now POJOCommand mediator supports both set properties to the object and getting them from the object to the message back with using the action attribute. Paul and I had a chat about this syntax and though of using somewhat similar to the notations of the AnnotatedCommand mediator, so the new effective configuration is going to be like following;

<pojoCommand name="class-name">
  <property name="string" value="literal">
      either literal or XML child
  </property>
  <property name="string" context-name="string" action=("UpdateContext" | "ReadContext" | "ReadAndUpdateContext")>
  <property name="string" expression="XPATH expression" action=("ReadMessage" | "UpdateMessage" | "ReadAndUpdateMessage")/>
</pojoCommand>

For the name value pair properties and name and xml child properties there is no action because it is always going to be Read to the Command object but not going to be Updates.

Do we need to support mix of these actions as well? For example if one needs to read the command property as a name value pair and update the message with that property as a message property as illustrated bellow;

set xyz="ruwan"
execute
get xyz => //request/person/name

if we form a single action for this it is going to be ["ReadValueAndUpdateMessage"]

WDYT?

Thanks,
Ruwan

--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"



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



--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"



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