| java.lang.Object org.geotools.factory.GeoTools
GeoTools | final public class GeoTools (Code) | | Static methods relative to the global GeoTools configuration. GeoTools can be configured
in a system-wide basis through
, some
of them are declared as
String constants in this class.
There are two aspects to the configuration of GeoTools:
- Default Settings: Are handled as the Hints returned by
getDefaultHints() , the default values
can be provided by your code, or specified using system properties.
- Integration JNDI: Telling the GeoTools library about the facilities of your application, or application
container takes several forms. This class provides the
initContext( InitialContext ) method
allowing you to tell GeoTools about the JNDI context you would like it to use.
- Intergration Plugins: If you are hosting GeoTools in a alternate plugin system such as Spring or OSGi you will need to hunt down the FactoryFinders and
register additional "FactoryIterators" you would like GeoTools to search using the
addFactoryIteratorProvider method.
JNDI Integration
This class provides a
for Java Naming and Directory
Interfaces (JNDI) in Geotools. This classes provides a central place where initial
context can been found for the Geotools library. This context is used for example by the
in order to
find connection parameters to an EPSG database. Using JNDI, such connection parameters can
be set in a J2EE environment.
since: 2.4 version: $Id: GeoTools.java 29058 2008-02-03 17:47:07Z desruisseaux $ author: Jody Garnett author: Martin Desruisseaux |
FORCE_LONGITUDE_FIRST_AXIS_ORDER | final public static String FORCE_LONGITUDE_FIRST_AXIS_ORDER(Code) | | The
key for the default
value to be assigned to the
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDERFORCE_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:
System.setProperty(FORCE_LONGITUDE_FIRST_AXIS_ORDER, "true");
Note that this system property applies mostly to the default EPSG factory. Most other
factories (
"CRS" ,
"AUTO" , etc.) don't need this property
since they use (longitude, latitude) axis order by design.
See Also: Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER See Also: GeoTools.getDefaultHints |
addChangeListener | public static void addChangeListener(ChangeListener listener)(Code) | | Adds the specified listener to the list of objects to inform when system-wide
configuration changed.
|
addFactoryIteratorProvider | public static void addFactoryIteratorProvider(FactoryIteratorProvider provider)(Code) | | Adds an alternative way to search for factory implementations.
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.
|
fireConfigurationChanged | public static void fireConfigurationChanged()(Code) | | Informs every listeners that system-wide configuration changed.
|
getDefaultHints | public static Hints getDefaultHints()(Code) | | Returns the default set of hints used for the various utility classes.
This default set is determined by:
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.
A copy of the default hints. It is safe to add to it. |
getVersion | public static Version getVersion()(Code) | | Reports back the version of GeoTools being used.
|
init | public static void init(Hints hints)(Code) | | Initializes GeoTools for use. This convenience method performs various tasks (more may
be added in the future), including setting up the
in one of the following states:
- If the Commons-logging
framework is available, then every logging message in the
org.geotools namespace sent to the Java
are
redirected to Commons-logging.
- Otherwise if the Log4J framework is
available, then every logging message in the
org.geotools namespace sent
to the Java
are redirected to Log4J.
- Otherwise, the Java logging
for
console output is replaced by a
.
In addition, the
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(null);
hints.put(
, Boolean.TRUE);
hints.put(
, "http");
GeoTools.init(hints);
See Also: Logging.setLoggerFactory(String) See Also: Logging.forceMonolineConsoleOutput See Also: Hints.putSystemDefault See Also: GeoTools.getDefaultHints |
main | public static void main(String[] args)(Code) | | Reports the GeoTools
number to the
.
|
removeChangeListener | public static void removeChangeListener(ChangeListener listener)(Code) | | Removes the specified listener from the list of objects to inform when system-wide
configuration changed.
|
removeFactoryIteratorProvider | public static void removeFactoryIteratorProvider(FactoryIteratorProvider provider)(Code) | | Removes a provider that was previously
.
Note that factories already obtained from the specified provider will not be
by this method.
|
scanForSystemHints | static boolean scanForSystemHints(Hints hints)(Code) | | Scans
for any property keys
defined in this class, and add their values to the specified map of hints. For
example if the
system property is
defined, then the
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDERFORCE_LONGITUDE_FIRST_AXIS_ORDER hint will be added to the set of hints.
true if at least one hint changed as a result of this scan,or false otherwise. |
setLoggerFactory | public void setLoggerFactory(LoggerFactory factory)(Code) | | Sets the global
.
This method is the same as
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).
See Also: Logging.setLoggerFactory(LoggerFactory) since: 2.4 |
|
|