| org.geotools.referencing.ReferencingFactoryFinder org.geotools.referencing.FactoryFinder org.geotools.referencing.ReferencingFactoryFinder
All known Subclasses: org.geotools.referencing.FactoryFinder,
ReferencingFactoryFinder | public class ReferencingFactoryFinder extends FactoryFinder (Code) | | Defines static methods used to access the application's default
implementation.
To declare a factory implementation, a services subdirectory is placed within the
META-INF directory that is present in every JAR file. This directory
contains a file for each factory interface that has one or more implementation classes
present in the JAR file. For example, if the JAR file contained a class named
com.mycompany.DatumFactoryImpl which implements the
DatumFactory interface, the JAR file would contain a file named:
META-INF/services/org.opengis.referencing.datum.DatumFactory
containing the line:
com.mycompany.DatumFactoryImpl
If the factory classes implements
RegisterableService , it will be notified upon
registration and deregistration. Note that the factory classes should be lightweight and quick
to load. Implementations of these interfaces should avoid complex dependencies on other classes
and on native code. The usual pattern for more complex services is to register a lightweight
proxy for the heavyweight service.
Note on factory ordering
This class is thread-safe. However, calls to any
ReferencingFactoryFinder.setAuthorityOrdering or
ReferencingFactoryFinder.setVendorOrdering methods have a system-wide effect. If two threads or two
applications need a different ordering, they shall manage their own instance of
FactoryRegistry . This
FactoryFinder class is simply a convenience
wrapper around a
FactoryRegistry instance.
since: 2.4 version: $Id: ReferencingFactoryFinder.java 29058 2008-02-03 17:47:07Z desruisseaux $ author: Martin Desruisseaux |
Method Summary | |
public static synchronized void | addAuthorityFactory(AuthorityFactory authority) Programmatic management of authority factories. | public static synchronized Set | getAuthorityNames() Returns the names of all currently registered authorities. | public static Set | getCRSAuthorityFactories(Hints hints) Returns a set of all available implementations for the
CRSAuthorityFactory interface.
This set can be used to list the available codes known to all authorities.
In the event that the same code is understood by more then one authority
you will need to assume both are close enough, or make use of this set directly
rather than use the
CRS.decode convenience method.
Parameters: hints - An optional map of hints, or null if none. | public static CRSAuthorityFactory | getCRSAuthorityFactory(String authority, Hints hints) Returns the first implementation of
CRSAuthorityFactory matching the specified
hints. | public static Set | getCRSFactories(Hints hints) Returns a set of all available implementations for the
CRSFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static CRSFactory | getCRSFactory(Hints hints) Returns the first implementation of
CRSFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. | public static Set | getCSAuthorityFactories(Hints hints) Returns a set of all available implementations for the
CSAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static CSAuthorityFactory | getCSAuthorityFactory(String authority, Hints hints) Returns the first implementation of
CSAuthorityFactory matching the specified
hints. | public static Set | getCSFactories(Hints hints) Returns a set of all available implementations for the
CSFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static CSFactory | getCSFactory(Hints hints) Returns the first implementation of
CSFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. | public static Set | getCoordinateOperationAuthorityFactories(Hints hints) Returns a set of all available implementations for the
CoordinateOperationAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static CoordinateOperationAuthorityFactory | getCoordinateOperationAuthorityFactory(String authority, Hints hints) Returns the first implementation of
CoordinateOperationAuthorityFactory matching
the specified hints. | public static Set | getCoordinateOperationFactories(Hints hints) Returns a set of all available implementations for the
CoordinateOperationFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static CoordinateOperationFactory | getCoordinateOperationFactory(Hints hints) Returns the first implementation of
CoordinateOperationFactory matching the specified
hints. | public static Set | getDatumAuthorityFactories(Hints hints) Returns a set of all available implementations for the
DatumAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static DatumAuthorityFactory | getDatumAuthorityFactory(String authority, Hints hints) Returns the first implementation of
DatumAuthorityFactory matching the specified
hints. | public static Set | getDatumFactories(Hints hints) Returns a set of all available implementations for the
DatumFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static DatumFactory | getDatumFactory(Hints hints) Returns the first implementation of
DatumFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. | public static Set | getMathTransformFactories(Hints hints) Returns a set of all available implementations for the
MathTransformFactory interface.
Parameters: hints - An optional map of hints, or null if none. | public static MathTransformFactory | getMathTransformFactory(Hints hints) Returns the first implementation of
MathTransformFactory matching the specified
hints. | public static synchronized boolean | isRegistered(Factory factory) Returns
true if the specified factory is registered. | public static synchronized void | listProviders(Writer out, Locale locale) List all available factory implementations in a tabular format. | public static void | main(String[] args) Dump to the standard output stream a list of available factory implementations.
This method can be invoked from the command line. | public static synchronized void | removeAuthorityFactory(AuthorityFactory authority) Programmatic management of authority factories. | public static void | scanForPlugins() Scans for factory plug-ins on the application class path. | public static synchronized boolean | setAuthorityOrdering(String authority1, String authority2) Sets a pairwise ordering between two authorities. | public static synchronized boolean | setVendorOrdering(String vendor1, String vendor2) Sets a pairwise ordering between two vendors. | public static synchronized boolean | unsetAuthorityOrdering(String authority1, String authority2) Unsets a pairwise ordering between two authorities. | public static synchronized boolean | unsetVendorOrdering(String vendor1, String vendor2) Unsets a pairwise ordering between two vendors. |
ReferencingFactoryFinder | ReferencingFactoryFinder()(Code) | | Do not allows any instantiation of this class.
|
addAuthorityFactory | public static synchronized void addAuthorityFactory(AuthorityFactory authority)(Code) | | Programmatic management of authority factories.
Needed for user managed, not plug-in managed, authority factory.
Also useful for test cases.
Parameters: authority - The authority factory to add. |
getAuthorityNames | public static synchronized Set getAuthorityNames()(Code) | | Returns the names of all currently registered authorities.
|
getCRSAuthorityFactories | public static Set getCRSAuthorityFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CRSAuthorityFactory interface.
This set can be used to list the available codes known to all authorities.
In the event that the same code is understood by more then one authority
you will need to assume both are close enough, or make use of this set directly
rather than use the
CRS.decode convenience method.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate reference system authority factory implementations. |
getCRSAuthorityFactory | public static CRSAuthorityFactory getCRSAuthorityFactory(String authority, Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CRSAuthorityFactory matching the specified
hints. If no implementation matches, a new one is created if possible or an exception is
thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Hints that may be understood includes
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER FORCE_LONGITUDE_FIRST_AXIS_ORDER ,
Hints.FORCE_STANDARD_AXIS_UNITS FORCE_STANDARD_AXIS_UNITS ,
Hints.FORCE_STANDARD_AXIS_DIRECTIONS FORCE_STANDARD_AXIS_DIRECTIONS and
Hints.VERSION VERSION .
TIP: The EPSG official factory and the EPSG extensions (additional CRS provided by
ESRI and others) are two distinct factories. Call to
getCRSAuthorityFactory("EPSG", null) returns only one of those, usually the official EPSG factory. If the union of those
two factories is wanted, then a chain of fallbacks is wanted. Consider using something like:
(CRSAuthorityFactory.class,
(hints));
Parameters: authority - The desired authority (e.g. "EPSG"). Parameters: hints - An optional map of hints, or null if none. The first coordinate reference system authority factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCRSAuthorityFactory interface. |
getCRSFactories | public static Set getCRSFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CRSFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate reference system factory implementations. |
getCRSFactory | public static CRSFactory getCRSFactory(Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CRSFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: hints - An optional map of hints, or null if none. The first coordinate reference system factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCRSFactory interface. |
getCSAuthorityFactories | public static Set getCSAuthorityFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CSAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate system authority factory implementations. |
getCSAuthorityFactory | public static CSAuthorityFactory getCSAuthorityFactory(String authority, Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CSAuthorityFactory matching the specified
hints. If no implementation matches, a new one is created if possible or an exception is
thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Hints that may be understood includes
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER FORCE_LONGITUDE_FIRST_AXIS_ORDER ,
Hints.FORCE_STANDARD_AXIS_UNITS FORCE_STANDARD_AXIS_UNITS and
Hints.FORCE_STANDARD_AXIS_DIRECTIONS FORCE_STANDARD_AXIS_DIRECTIONS and
Hints.VERSION VERSION .
Parameters: authority - The desired authority (e.g. "EPSG"). Parameters: hints - An optional map of hints, or null if none. The first coordinate system authority factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCSAuthorityFactory interface. |
getCSFactories | public static Set getCSFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CSFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate system factory implementations. |
getCSFactory | public static CSFactory getCSFactory(Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CSFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: hints - An optional map of hints, or null if none. The first coordinate system factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCSFactory interface. |
getCoordinateOperationAuthorityFactories | public static Set getCoordinateOperationAuthorityFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CoordinateOperationAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate operation authority factory implementations. |
getCoordinateOperationAuthorityFactory | public static CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory(String authority, Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CoordinateOperationAuthorityFactory matching
the specified hints. If no implementation matches, a new one is created if possible or an
exception is thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: authority - The desired authority (e.g. "EPSG"). Parameters: hints - An optional map of hints, or null if none. The first coordinate operation authority factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCoordinateOperationAuthorityFactory interface. |
getCoordinateOperationFactories | public static Set getCoordinateOperationFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
CoordinateOperationFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available coordinate operation factory implementations. |
getCoordinateOperationFactory | public static CoordinateOperationFactory getCoordinateOperationFactory(Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
CoordinateOperationFactory matching the specified
hints. If no implementation matches, a new one is created if possible or an exception is
thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Hints that may be understood includes
Hints.MATH_TRANSFORM_FACTORY MATH_TRANSFORM_FACTORY ,
Hints.DATUM_SHIFT_METHOD DATUM_SHIFT_METHOD ,
Hints.LENIENT_DATUM_SHIFT LENIENT_DATUM_SHIFT and
Hints.VERSION VERSION .
Parameters: hints - An optional map of hints, or null if none. The first coordinate operation factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theCoordinateOperationFactory interface. |
getDatumAuthorityFactories | public static Set getDatumAuthorityFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
DatumAuthorityFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available datum authority factory implementations. |
getDatumAuthorityFactory | public static DatumAuthorityFactory getDatumAuthorityFactory(String authority, Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
DatumAuthorityFactory matching the specified
hints. If no implementation matches, a new one is created if possible or an exception is
thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: authority - The desired authority (e.g. "EPSG"). Parameters: hints - An optional map of hints, or null if none. The first datum authority factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theDatumAuthorityFactory interface. |
getDatumFactories | public static Set getDatumFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
DatumFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available datum factory implementations. |
getDatumFactory | public static DatumFactory getDatumFactory(Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
DatumFactory matching the specified hints.
If no implementation matches, a new one is created if possible or an exception is thrown
otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: hints - An optional map of hints, or null if none. The first datum factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theDatumFactory interface. |
getMathTransformFactories | public static Set getMathTransformFactories(Hints hints)(Code) | | Returns a set of all available implementations for the
MathTransformFactory interface.
Parameters: hints - An optional map of hints, or null if none. Set of available math transform factory implementations. |
getMathTransformFactory | public static MathTransformFactory getMathTransformFactory(Hints hints) throws FactoryRegistryException(Code) | | Returns the first implementation of
MathTransformFactory matching the specified
hints. If no implementation matches, a new one is created if possible or an exception is
thrown otherwise. If more than one implementation is registered and an
, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Parameters: hints - An optional map of hints, or null if none. The first math transform factory that matches the supplied hints. throws: FactoryRegistryException - if no implementation was found or can be created for theMathTransformFactory interface. |
isRegistered | public static synchronized boolean isRegistered(Factory factory)(Code) | | Returns
true if the specified factory is registered. A factory may have been
registered by
ReferencingFactoryFinder.scanForPlugins() if it was declared in a
META-INF/services file, or it may have been
.
since: 2.4 |
listProviders | public static synchronized void listProviders(Writer out, Locale locale) throws IOException(Code) | | List all available factory implementations in a tabular format. For each factory interface,
the first implementation listed is the default one. This method provides a way to check the
state of a system, usually for debugging purpose.
Parameters: out - The output stream where to format the list. Parameters: locale - The locale for the list, or null . throws: IOException - if an error occurs while writting to out . |
main | public static void main(String[] args)(Code) | | Dump to the standard output stream a list of available factory implementations.
This method can be invoked from the command line. It provides a mean to verify
if some implementations were found in the classpath. The syntax is:
java org.geotools.referencing.FactoryFinder <options>
where options are:
-encoding <code> |
Set the character encoding |
-locale <language> |
Set the language for the output (e.g. "fr" for French) |
Note for Windows users: If the output contains strange
symbols, try to supply an "
-encoding " argument. Example:
java org.geotools.referencing.FactoryFinder -encoding Cp850
The codepage number (850 in the previous example) can be obtained from the DOS
commande line using the "
chcp " command with no arguments.
This
-encoding argument need to be supplied only once.
Parameters: args - Command line arguments. |
removeAuthorityFactory | public static synchronized void removeAuthorityFactory(AuthorityFactory authority)(Code) | | Programmatic management of authority factories.
Needed for user managed, not plug-in managed, authority factory.
Also useful for test cases.
Parameters: authority - The authority factory to remove. |
scanForPlugins | public static void scanForPlugins()(Code) | | Scans for factory plug-ins on the application class path. This method is needed because the
application class path can theoretically change, or additional plug-ins may become available.
Rather than re-scanning the classpath on every invocation of the API, the class path is
scanned automatically only on the first invocation. Clients can call this method to prompt
a re-scan. Thus this method need only be invoked by sophisticated applications which
dynamically make new plug-ins available at runtime.
|
setAuthorityOrdering | public static synchronized boolean setAuthorityOrdering(String authority1, String authority2)(Code) | | Sets a pairwise ordering between two authorities. If one or both authorities are not
currently registered, or if the desired ordering is already set, nothing happens
and
false is returned.
The example below said that EPSG
are preferred over ESRI ones:
FactoryFinder.setAuthorityOrdering("EPSG", "ESRI");
Parameters: authority1 - The preferred authority. Parameters: authority2 - The authority to which authority1 is preferred. true if the ordering was set for at least one category. |
setVendorOrdering | public static synchronized boolean setVendorOrdering(String vendor1, String vendor2)(Code) | | Sets a pairwise ordering between two vendors. If one or both vendors are not
currently registered, or if the desired ordering is already set, nothing happens
and
false is returned.
The example below said that an ESRI implementation (if available) is
preferred over the Geotools one:
FactoryFinder.setVendorOrdering("ESRI", "Geotools");
Parameters: vendor1 - The preferred vendor. Parameters: vendor2 - The vendor to which vendor1 is preferred. true if the ordering was set for at least one category. |
unsetAuthorityOrdering | public static synchronized boolean unsetAuthorityOrdering(String authority1, String authority2)(Code) | | Unsets a pairwise ordering between two authorities. If one or both authorities are not
currently registered, or if the desired ordering is already unset, nothing happens
and
false is returned.
Parameters: authority1 - The preferred authority. Parameters: authority2 - The vendor to which authority1 is preferred. true if the ordering was unset for at least one category. |
unsetVendorOrdering | public static synchronized boolean unsetVendorOrdering(String vendor1, String vendor2)(Code) | | Unsets a pairwise ordering between two vendors. If one or both vendors are not
currently registered, or if the desired ordering is already unset, nothing happens
and
false is returned.
Parameters: vendor1 - The preferred vendor. Parameters: vendor2 - The vendor to which vendor1 is preferred. true if the ordering was unset for at least one category. |
|
|