Global GeoTools Hints
---------------------
Key: GEOT-1223
URL: http://jira.codehaus.org/browse/GEOT-1223
Project: GeoTools
Issue Type: Improvement
Reporter: Jody Garnett
Currently GeoTools opperates around a number of Singletons ...
- FactoryRegistries (in the varous FactoryFinder and CommonFactoryFinder
classes)
- Lots of cached Factories in utility classes such as CRS
And so on.
There is a problem with this - we are suppoed to control the use of Factories
with Hints ... but all these implementations do something like the following:
{code}
return CommonFactoryFinder.getFilterFactory( null );
{code}
Where "null" seems to mean - I don't care do something smart for me.
This change request is the obvious one - lets do something smart.
{code}
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;
}
}
{code}
We can then change the above code example to:
{code}
return CommonFactoryFinder.getFilterFactory( GeoTools.getDefaultHints() );
{code}
A couple of "non obvious" consequences:
* Creating the hints based on System propreties will not work in an applet,
they will need to explicitly call the init method
* FactoryRegistry "partitions" the factory instances based on the Hints provided
** This means the GeoTools.getDefaultHints() acts as a single singleton for the
entire library
* We can change the GeoTools hints returned by getDefaultHints() based on
ThreadGroup
** Tthis is how you should do a singleton anyways
** The GeoTools library would then become more safe for use in environments
that care about ThreadGroup (like Java EE and Applets)
* We can use the GeoTools class to hold Keys for the library (rather then have
them scattered)
* We can use the GeoTools class to hold getVersion() - something that has been
requested previously
This change will restore the previous functionality of FactoryFinder (where you
could control the library a bit with System properties).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel