Bleck - you are both right :-(

Martin your example will work for referencing, but it is a lot of work 
to clean up the rest of the library to that standard. I am not sure we 
can pull it off right now. How about this ... we recognize that GeoTools 
right now is "single use" and we gather up the assumed functionality for 
null Hints into a single location.

interface GeoTools {
    static Hints hints;
    static {
         hints = createHintsFromSystemProperties();
    }
    public static void init( Hints hints ){
         if( hints == null ){
             hints = createHintsFromSystemProperties();
         }
         else {
             this.init = hints;
         }
    }
    public Hints getDefaultHints(){
         return hints;
    }
}

Comments:
- Changing the FactoryRegistry constructor to use 
GeoTools.getDefaultHints() when null is supplied would
   be consistent with our goal (use System properties by default), and 
allow an application like GeoServer to
   be in charge of its own fate.
- can we create a Hints directly using a property file? new Hints( 
System.getProperties() );

To map between a Hint and a System property we will need to think of 
something:
- use the Key to figure out a matching system property value (what the 
last FactoryFinder utility class did)
- extend Key with the System Property to check

Jody
> Andrea Aime a écrit :
>> In Geoserver we do use only the system properties, never the hints.
>> The issue is, all of Geoserver is using CRS to perform its work, so the
>> only way to force axis order application wide is to set the system 
>> property.
>> Is there any other global way to set these hints? CRS is used directly
>> by renderer, by datastores, and in many other places in Geoserver,
>> Eclipse is giving me 153 references to CRS in the Geoserver workspace 
>> (which means, Geoserver code + geotools code used by geoserver).
>> Maybe a way to provide CRS with standard hints is needed?
>
> There is no global hints at this time. We could add global hints for 
> the CRS convenience class, but I'm not sure that it would have much 
> value over system properties. Despite what I said in my previous 
> email, I would rather stay with system properties if an application 
> really want system-wide configuration.
>
> The idea with hints was to avoid system-wide configuration. We can 
> have application-wide configuration, but not system-wide in order to 
> allows different application to use Geotools in the same JVM. But 
> maybe there is not a strong need for that yet.
>
> For application-wide configuration, the idea was to put the following 
> in some application global class (not in CRS, since it would be 
> geotools-wide which we don't want).
>
>     static final Hints myGlobalHints = new Hints();
>     static {
>         myGlobalHints.put(Hints.MY_HINT, myGlobalValue);
>         myGlobalHints.put(Hints.MY_OTHER_HINT, myOtherGlobalValue);
>         // etc...
>     }
>
> Then, gives this hints in every place where your application invokes 
> FactoryFinder.getFooFactory(...).
>
>     myFooFactory = 
> FactoryFinder.getFooFactory(MyGlobalClass.myGlobalHints);
>
>     Martin


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to