Martin Desruisseaux wrote:
> Martin Desruisseaux a écrit :
>   
>> If this proposal is accepted, I can declare two ReferencingFactoryFinder
>> instances: DEFAULT and STRICT. Users would need to replace every calls to:
>>     
Hi Martin; I think we talked about this one years ago? I am just going 
to present my origional idea - you can
take it or leave it as you see fit.
> More notes on the rational behind that. Use case:
>
> 1) A user ask for a factory using FactoryFinder.DEFAULT.getFooFactory(hints).
>
> 2) The FactoryFinder merge the user-specified hints with the global hints,
>    then create the Factory (if it was not already instantiated) using the
>    Factory(Hints) constructor.
>
> 3) The factory depends on some other factories. Before to ask FactoryFinder
>    again, it may apply some processing on the user hints, maybe *removing*
>    some user-specified hints - for example CRS codes specified as URN are
>    always "as the authority said" even if the users provided the "force
>    longitude first axis order" hint.
>
> 4) The factory invokes FactoryFinder.STRICT.getFooFactory(hints) for fetching
>    its dependency. We use STRICT, not DEFAULT, because:
>
>    - We already have the user hints - we are inside a Factory(Hints) 
> constructor
>      invoked by FactoryFinder.DEFAULT and we are fetching dependencies.
>
>    - We don't want global hints to be merged again. If we are fetching a URN
>      factory dependency, we really don't want the "force longitude first axis
>      order" to be merged to the hints - we just removed that hint in the
>      previous step!
>
>
> So in conclusion:
>
> * Users would use FactoryFinder.DEFAULT
>
> * Factory(Hints) constructor that need to fetch dependencies would use
>   FactoryFinder.STRICT with the hints that they got (and eventually
>   filtered) in the constructor.
>   

Just going to compare this with my origional idea for taking this 
problem away:
- FooFactoryFinder( hints ) constructor defined, will store the users 
Hints in a field and use it when calling the create methods
- FooFactoryFinder.createFooFactory() will produce the Foo using the 
above Hints
- Users make a different finder if they want to search with different 
Hints (the finder is the stage for the activity of the create methods)
- FooFactoryFinder.DEFAULT provided for code that used to use the static 
methods

Several alternatives for getting your "strict" behavior into the mix:
- FooFactoryFinder( hints, strict ) used to mix in global hints into the 
user supplied hints (if strict is false)
- Hints.isStrict() with a default of false would make strictness a part 
of the hints api; so we don't have to splice this code into every 
factory finder constructor



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to