|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGeoTools
public final class GeoTools
Static methods relative to the global GeoTools configuration. GeoTools can be configured
in a system-wide basis through system properties, some
of them are declared as String
constants in this class.
There are many aspects to the configuration of GeoTools:
getDefaultHints()
, the
default values can be provided in application code, or specified using system properties.init(InitialContext)
method allowing to tell GeoTools about the JNDI
context to use.FactoryFinder
s and register
additional "Factory Iterators" for GeoTools to search using the
addFactoryIteratorProvider(org.geotools.factory.FactoryIteratorProvider)
method.
Field Summary | |
---|---|
static String |
CRS_AUTHORITY_EXTRA_DIRECTORY
The system property key for the default value to be assigned to the CRS_AUTHORITY_EXTRA_DIRECTORY
hint. |
static String |
EPSG_DATA_SOURCE
The system property key for the default value to be assigned to the EPSG_DATA_SOURCE hint. |
static String |
FORCE_LONGITUDE_FIRST_AXIS_ORDER
The system property key for the default value to be assigned to the FORCE_LONGITUDE_FIRST_AXIS_ORDER hint. |
Method Summary | |
---|---|
static void |
addChangeListener(ChangeListener listener)
Adds the specified listener to the list of objects to inform when system-wide configuration changed. |
static void |
addFactoryIteratorProvider(FactoryIteratorProvider provider)
Adds an alternative way to search for factory implementations. |
static void |
fireConfigurationChanged()
Informs every listeners that system-wide configuration changed. |
static String |
fixName(Context context,
String name)
Converts a GeoTools name to the syntax used by the specified JNDI context. |
static String |
fixName(String name)
Converts a GeoTools name to the syntax used by the GeoTools JNDI context. |
static Hints |
getDefaultHints()
Returns the default set of hints used for the various utility classes. |
static InitialContext |
getInitialContext(Hints hints)
Returns the default initial context. |
static Version |
getVersion()
Reports back the version of GeoTools being used. |
static void |
init(Hints hints)
Initializes GeoTools for use. |
static void |
init(InitialContext applicationContext)
Forces the initial context for test cases, or as needed. |
static void |
main(String[] args)
Reports the GeoTools version number to the standard output stream. |
static void |
removeChangeListener(ChangeListener listener)
Removes the specified listener from the list of objects to inform when system-wide configuration changed. |
static void |
removeFactoryIteratorProvider(FactoryIteratorProvider provider)
Removes a provider that was previously added. |
void |
setLoggerFactory(LoggerFactory factory)
Sets the global logger factory. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CRS_AUTHORITY_EXTRA_DIRECTORY
CRS_AUTHORITY_EXTRA_DIRECTORY
hint.
Hints.CRS_AUTHORITY_EXTRA_DIRECTORY
,
getDefaultHints()
,
Constant Field Valuespublic static final String EPSG_DATA_SOURCE
EPSG_DATA_SOURCE
hint.
Hints.EPSG_DATA_SOURCE
,
getDefaultHints()
,
Constant Field Valuespublic static final String FORCE_LONGITUDE_FIRST_AXIS_ORDER
FORCE_LONGITUDE_FIRST_AXIS_ORDER
hint.
This setting can provide a transition path for projects expecting a (longitude,
latitude) axis order on a system-wide level. Application developpers can set the
default value as below:
Note that this system property applies mostly to the default EPSG factory. Most other factories (System.setProperty(FORCE_LONGITUDE_FIRST_AXIS_ORDER, "true");
"CRS"
, "AUTO"
, etc.) don't need this property
since they use (longitude, latitude) axis order by design.
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER
,
getDefaultHints()
,
Constant Field ValuesMethod Detail |
---|
public static Version getVersion()
public void setLoggerFactory(LoggerFactory factory)
Logging.GEOTOOLS.setLoggerFactory(factory)
.
GeoTools ships with support for
Commons-logging and
log4j. This method exists to allow you
supply your own implementation (this is sometimes required when using a GeoTools
application in an exotic environment like Eclipse, OC4J or your application).
factory
- The logger factory to use.Logging.setLoggerFactory(LoggerFactory)
public static void init(Hints hints)
org.geotools
namespace sent to the Java logger are
redirected to Commons-logging.org.geotools
namespace sent
to the Java logger are redirected to Log4J.
In addition, the default hints are initialized to the
specified hints
.
Note that invoking this method is usually not needed for proper working of the Geotools library. It is just a convenience method for overwriting some Java and Geotools default settings in a way that seems to be common in server environment. Such overwriting may not be wanted for every situations.
Example of typical invocation in a Geoserver environment:
Hints hints = new Hints(); hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); hints.put(Hints.FORCE_AXIS_ORDER_HONORING, "http"); GeoTools.init(hints);
hints
- The hints to use.Logging.setLoggerFactory(String)
,
Logging.forceMonolineConsoleOutput()
,
Hints.putSystemDefault(java.awt.RenderingHints)
,
getDefaultHints()
public static void init(InitialContext applicationContext)
applicationContext
- The initial context to use.getInitialContext(org.geotools.factory.Hints)
public static Hints getDefaultHints()
GeoTools
class.Hints.putSystemDefault(java.awt.RenderingHints)
or init(org.geotools.factory.Hints)
method.Long term plan: We would like to transition the utility classes to being injected with their required factories, either by taking Hints as part of their constructor, or otherwise. Making this change would be a three step process 1) create instance methods for each static final class method 2) create an singleton instance of the class 3) change each static final class method into a call to the singleton. With this in place we could then encourage client code to make use of utility class instances before eventually retiring the static final methods.
public static InitialContext getInitialContext(Hints hints) throws NamingException
hints
- An optional set of hints, or null
if none.
null
).
NamingException
- if the initial context can't be created.init(InitialContext)
public static String fixName(String name)
InitialContext
. GeoTools uses "jdbc:EPSG"
internally, but many implementaitons use the form "jdbc/EPSG"
. Calling
this method before use will set the name right.
name
- Name of the form "jdbc:EPSG"
, or null
.
Context.composeName(String,String)
,
or null
if the given name was null.public static String fixName(Context context, String name)
fixName(String)
, but uses the specified
context instead of the GeoTools one.
context
- The context to use, or null
if none.name
- Name of the form "jdbc:EPSG"
, or null
.
Context.composeName(String,String)
,
or null
if the given name was null.public static void addFactoryIteratorProvider(FactoryIteratorProvider provider)
FactoryRegistry
has
a default mechanism bundled in it, which uses the content of all META-INF/services
directories found on the classpath. This addFactoryIteratorProvider
method allows
to specify additional discovery algorithms. It may be useful in the context of some
frameworks that use the constructor injection pattern, like the
Spring framework.
provider
- A new provider for factory iterators.public static void removeFactoryIteratorProvider(FactoryIteratorProvider provider)
provider
- The provider to remove.public static void addChangeListener(ChangeListener listener)
listener
- The listener to add.public static void removeChangeListener(ChangeListener listener)
listener
- The listener to remove.public static void fireConfigurationChanged()
public static void main(String[] args)
args
- Command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |