Hi Udayanga, >From a users point of view how can I register a custom XPath variable or a function, provided that I have the implementation class of the provider interface that you have described??
Thanks, Ruwan On Wed, Nov 24, 2010 at 12:54 PM, Udayanga Wickramasinghe < [email protected]> wrote: > Hi devs, > I see that Synapse currently does not have an extension mechanism to > support custom xpath variable/function expressions . For example we can't > declare our own expression="$Custom_Property_Scope:C_PROPERTY" or > expression="$CUSTOM_RESP/urn:child" (actually this has been a requirement > of mine ) or even a customized xpath function similar to "get-property()". > Modifying SynapseXPathFunctionContext or SynapseXPathVariableContext could > make this happen but i guess that is not the proper way to do that :S . It > would be great if we can have an extensible way of doing this. I prepared a > patch for Synapse so that we could have such extensions for xpath .(which > would in-turn meet my requirement as well :)) > The basic flow of this implementation is as follows. We use > synapse.properties to register Synapse xpath variable/function based > extensions . > synapse.xpath.var.extensions --> Variable Context Extensions > synapse.xpath.func.extensions --> Function Context Extensions > These extensions should implement new interfaces , either > SynapseXpathFunctionContextProvider / SynapseXpathVariableContextProvider . > Each is provided with several interfaces including #getResolvingQName() > ,indicating Synapse that which respective expressions they are going to > support (ie:-localname + prefix + namespace URI combination). > > At Synapse initialization time we register all declared extensions.These > extensions will be available through SynapseEnvironment .(i had to introduce > two interfaces to support this , > SynapseEnvironment#getXpathFunctionExtensions() , > SynapseEnvironment#getXpathVariableExtensions() ) .Now that these extensions > are made available , xpath context resolvers at runtime > (ie:-SynapseXPathVariableContext) will try to resolve expressions through > provided extensions (if a matching extension is found ) , in case normal > synapse resolving flow fails..IMO i think this is a better way of providing > custom Xpath expression support... Please let me know your > suggestions,improvements ,etc regarding this approach...thanks in > advance..Meantime I'll make this patch available through a jira as well :) > > > Regards, > Udayanga > > -- > *Udayanga Wickramasinghe* > Software Engineer; WSO2 Inc.; http://wso2.com, > *email: **[email protected]* <[email protected]>* cell: +94 (77) > 983-4365 > blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com> > * > twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick> > * > ** > * <http://lk.linkedin.com/in/ddweerasiri> > -- Ruwan Linton Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org Lean . Enterprise . Middleware phone: +1 408 754 7388 ext 51789 email: [email protected]; cell: +94 77 341 3097 blog: http://blog.ruwan.org linkedin: http://www.linkedin.com/in/ruwanlinton google: http://www.google.com/profiles/ruwan.linton tweet: http://twitter.com/ruwanlinton
