abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Route.expand (was Re: [jira] Commented: (ABDERA-95) DefaultProvider doesn't properly handle parameters in base routes)
Date Thu, 31 Jan 2008 22:07:38 GMT
There should already be code there to do that. Context implements 
Iterable<String> to iterate over the variables it supports.

- James

Jim Ancona wrote:
> James M Snell wrote:
>> Accepting a Context allows us to use custom resolvers for variable 
>> values... such as the ObjectContext will provides the ability to use 
>> java getters for the values.  I'd suggest that we go ahead and keep it.
> Then what's needed is a way to combine/merge two Contexts (into a new 
> one, I assume, since they're immutable). Any thoughts on the right way 
> to do that? I assume it will require that the interface add a way to 
> iterate the Context's contents.
> Jim
>> - James
>> Dan Diephouse wrote:
>>> I'm looking at this code again. Does Route.expand really need to take 
>>> a Context? It seems like all it should ever really need is a Map.
>>> James - thoughts?
>>> - Dan
>>> Jim Ancona (JIRA) wrote:
>>>>     [ 
>>>> https://issues.apache.org/jira/browse/ABDERA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564498#action_12564498

>>>> ]
>>>> Jim Ancona commented on ABDERA-95:
>>>> ----------------------------------
>>>> The problem with my fix is that the third parameter to 
>>>> RouteManager.urlFor() is an Object and my fix only handles the case 
>>>> where it is a Map. If you look at RouteManager.getContext(), you'll 
>>>> see that it handles two other cases (Contaxt and Object). I couldn't 
>>>> see  a general way to add the extra parameters to the Context. 
>>>> (Contexts don't even have the equivalent of Map.getKeys(), so you 
>>>> can't find out what in them in order to merge them.) My code will 
>>>> work in the current case, but would fail if a caller passed 
>>>> something other than a Map to RouteManager.urlFor() .
>>>> This look to me to be better than the servicesPattern approach. I 
>>>> had tried an approach using code that I wrote to parse a URI 
>>>> according to a URI template, but as James said, you can't do it in 
>>>> the general case, and besides the Principle of Least Power[1] 
>>>> applies: Routes are less powerful than templates but still solve the 
>>>> problem cleanly and therefore are more desirable in this case.
>>>> [1] - http://www.w3.org/2001/tag/doc/leastPower.html
>>>>> DefaultProvider doesn't properly handle parameters in base routes
>>>>> -----------------------------------------------------------------
>>>>>                 Key: ABDERA-95
>>>>>                 URL: https://issues.apache.org/jira/browse/ABDERA-95
>>>>>             Project: Abdera
>>>>>          Issue Type: Bug
>>>>>            Reporter: Jim Ancona
>>>>>         Attachments: CustomerAdapterTest.patch, 
>>>>> RouteManager_workaround.patch
>>>>> I spent some time trying to debug this last night, but didn't find 
>>>>> the solution. I will attach a unit test patch that reproduces the 
>>>>> problem.
>>> -- 
>>> Dan Diephouse
>>> MuleSource
>>> http://mulesource.com | http://netzooid.com/blog

View raw message