|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
FactoryFinder
@ThreadSafe public class FactoryFinder
Defines static methods used to access the application factory implementations. This class provide access to the following services:
CitationFactory (metadata)This class is thread-safe but may have a high contention. Applications (or computational units in an application) are encouraged to save references to the factories they need in their own private fields. They would gain in performance and in stability, since the set of available factories may change during the execution.
Some methods like setVendorOrdering have a system-wide effect. Most
applications should not need to invoke them. If an application needs to protect itself against
configuration changes that may be performed by an other application sharing the Geotk library,
it shall manage its own instance of FactoryRegistry. This FactoryFinder class
itself is just a convenience wrapper around a FactoryRegistry instance.
| utility/geotk-utility (download) | View source code for this class |
| Field Summary | |
|---|---|
static Hints.Key |
FILTER_KEY
The key for a special hints specifying an additional Filter. |
| Method Summary | |
|---|---|
static Set<AggregateFactory> |
getAggregateFactories(Hints hints)
Returns a set of all available implementations for the AggregateFactory interface. |
static AggregateFactory |
getAggregateFactory(Hints hints)
Returns the first implementation of AggregateFactory matching the specified hints. |
static Set<CitationFactory> |
getCitationFactories(Hints hints)
Returns a set of all available implementations for the CitationFactory interface. |
static CitationFactory |
getCitationFactory(Hints hints)
Returns the first implementation of CitationFactory matching the specified hints. |
static Set<ComplexFactory> |
getComplexFactories(Hints hints)
Returns a set of all available implementations for the ComplexFactory interface. |
static ComplexFactory |
getComplexFactory(Hints hints)
Returns the first implementation of ComplexFactory matching the specified hints. |
static Set<CoordinateOperationFactory> |
getCoordinateOperationFactories(Hints hints)
Returns a set of all available implementations for the CoordinateOperationFactory interface. |
static CoordinateOperationFactory |
getCoordinateOperationFactory(Hints hints)
Returns the first implementation of CoordinateOperationFactory matching the specified
hints. |
static Set<CRSFactory> |
getCRSFactories(Hints hints)
Returns a set of all available implementations for the CRSFactory interface. |
static CRSFactory |
getCRSFactory(Hints hints)
Returns the first implementation of CRSFactory matching the specified hints. |
static Set<CSFactory> |
getCSFactories(Hints hints)
Returns a set of all available implementations for the CSFactory interface. |
static CSFactory |
getCSFactory(Hints hints)
Returns the first implementation of CSFactory matching the specified hints. |
static Set<DatumFactory> |
getDatumFactories(Hints hints)
Returns a set of all available implementations for the DatumFactory interface. |
static DatumFactory |
getDatumFactory(Hints hints)
Returns the first implementation of DatumFactory matching the specified hints. |
static Set<FeatureFactory> |
getFeatureFactories(Hints hints)
Returns a set of all available implementations for the FeatureFactory interface. |
static FeatureFactory |
getFeatureFactory(Hints hints)
Returns the first implementation of FeatureFactory matching the specified hints. |
static Set<FeatureTypeFactory> |
getFeatureTypeFactories(Hints hints)
Returns a set of all available implementations for the FeatureTypeFactory interface. |
static FeatureTypeFactory |
getFeatureTypeFactory(Hints hints)
Returns the first implementation of FeatureTypeFactory matching the specified hints. |
static Set<FilterFactory> |
getFilterFactories(Hints hints)
Returns a set of all available implementations for the FilterFactory interface. |
static FilterFactory |
getFilterFactory(Hints hints)
Returns the first implementation of FilterFactory matching the specified hints. |
static Set<GeometryFactory> |
getGeometryFactories(Hints hints)
Returns a set of all available implementations for the GeometryFactory interface. |
static GeometryFactory |
getGeometryFactory(Hints hints)
Returns the first implementation of GeometryFactory matching the specified hints. |
static Set<MathTransformFactory> |
getMathTransformFactories(Hints hints)
Returns a set of all available implementations for the MathTransformFactory interface. |
static MathTransformFactory |
getMathTransformFactory(Hints hints)
Returns the first implementation of MathTransformFactory matching the specified
hints. |
static Set<NameFactory> |
getNameFactories(Hints hints)
Returns a set of all available implementations for the NameFactory interface. |
static NameFactory |
getNameFactory(Hints hints)
Returns the first implementation of NameFactory matching the specified hints. |
static Set<PositionFactory> |
getPositionFactories(Hints hints)
Returns a set of all available implementations for the PositionFactory interface. |
static PositionFactory |
getPositionFactory(Hints hints)
Returns the first implementation of PositionFactory matching the specified hints. |
static Set<PrimitiveFactory> |
getPrimitiveFactories(Hints hints)
Returns a set of all available implementations for the PrimitiveFactory interface. |
static PrimitiveFactory |
getPrimitiveFactory(Hints hints)
Returns the first implementation of PrimitiveFactory matching the specified hints. |
static Set<StyleFactory> |
getStyleFactories(Hints hints)
Returns a set of all available implementations for the StyleFactory interface. |
static StyleFactory |
getStyleFactory(Hints hints)
Returns the first implementation of StyleFactory matching the specified hints. |
static Set<TemporalFactory> |
getTemporalFactories(Hints hints)
Returns a set of all available implementations for the TemporalFactory interface. |
static TemporalFactory |
getTemporalFactory(Hints hints)
Returns the first implementation of TemporalFactory matching the specified hints. |
static boolean |
isRegistered(Object factory)
Returns true if the specified factory is registered. |
static void |
listProviders(Writer out,
Locale locale)
Lists all available factory implementations in a tabular format. |
static void |
scanForPlugins()
Scans for factory plug-ins on the application class path. |
static boolean |
setImplementationOrdering(String package1,
String package2)
Sets a pairwise ordering between two implementations defined by package names. |
static boolean |
setVendorOrdering(String vendor1,
String vendor2)
Sets a pairwise ordering between two vendors. |
static boolean |
unsetImplementationOrdering(String package1,
String package2)
Unsets a pairwise ordering between two implementations defined by package names. |
static boolean |
unsetVendorOrdering(String vendor1,
String vendor2)
Unsets a pairwise ordering between two vendors. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Hints.Key FILTER_KEY
Filter.
If a value is given to this key in a Hints map, then every factory candidate
will be filtered by the given filter in addition of being checked for the other hints.
| Method Detail |
|---|
public static NameFactory getNameFactory(Hints hints)
throws FactoryRegistryException
NameFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
NameFactory interface.Hints.NAME_FACTORYpublic static Set<NameFactory> getNameFactories(Hints hints)
NameFactory interface.
hints - An optional map of hints, or null for the default ones.
public static CitationFactory getCitationFactory(Hints hints)
throws FactoryRegistryException
CitationFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
CitationFactory interface.Hints.CITATION_FACTORYpublic static Set<CitationFactory> getCitationFactories(Hints hints)
CitationFactory interface.
hints - An optional map of hints, or null for the default ones.
public static DatumFactory getDatumFactory(Hints hints)
throws FactoryRegistryException
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
ordering is set, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
DatumFactory interface.Hints.DATUM_FACTORYpublic static Set<DatumFactory> getDatumFactories(Hints hints)
DatumFactory interface.
hints - An optional map of hints, or null for the default ones.
public static CSFactory getCSFactory(Hints hints)
throws FactoryRegistryException
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
ordering is set, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
CSFactory interface.Hints.CS_FACTORYpublic static Set<CSFactory> getCSFactories(Hints hints)
CSFactory interface.
hints - An optional map of hints, or null for the default ones.
public static CRSFactory getCRSFactory(Hints hints)
throws FactoryRegistryException
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
ordering is set, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
CRSFactory interface.Hints.CRS_FACTORYpublic static Set<CRSFactory> getCRSFactories(Hints hints)
CRSFactory interface.
hints - An optional map of hints, or null for the default ones.
public static CoordinateOperationFactory getCoordinateOperationFactory(Hints hints)
throws FactoryRegistryException
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
ordering is set, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
Hints that may be understood includes
MATH_TRANSFORM_FACTORY,
DATUM_SHIFT_METHOD,
LENIENT_DATUM_SHIFT and
VERSION.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
CoordinateOperationFactory interface.Hints.COORDINATE_OPERATION_FACTORYpublic static Set<CoordinateOperationFactory> getCoordinateOperationFactories(Hints hints)
CoordinateOperationFactory interface.
hints - An optional map of hints, or null for the default ones.
public static MathTransformFactory getMathTransformFactory(Hints hints)
throws FactoryRegistryException
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
ordering is set, then the preferred
implementation is returned. Otherwise an arbitrary one is selected.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
MathTransformFactory interface.Hints.MATH_TRANSFORM_FACTORYpublic static Set<MathTransformFactory> getMathTransformFactories(Hints hints)
MathTransformFactory interface.
hints - An optional map of hints, or null for the default ones.
public static TemporalFactory getTemporalFactory(Hints hints)
throws FactoryRegistryException
TemporalFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
TemporalFactory interface.Hints.TEMPORAL_FACTORYpublic static Set<TemporalFactory> getTemporalFactories(Hints hints)
TemporalFactory interface.
hints - An optional map of hints, or null for the default ones.
public static PositionFactory getPositionFactory(Hints hints)
throws FactoryRegistryException
PositionFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
PositionFactory interface.Hints.POSITION_FACTORYpublic static Set<PositionFactory> getPositionFactories(Hints hints)
PositionFactory interface.
hints - An optional map of hints, or null for the default ones.
public static PrimitiveFactory getPrimitiveFactory(Hints hints)
throws FactoryRegistryException
PrimitiveFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
PrimitiveFactory interface.Hints.PRIMITIVE_FACTORYpublic static Set<PrimitiveFactory> getPrimitiveFactories(Hints hints)
PrimitiveFactory interface.
hints - An optional map of hints, or null for the default ones.
public static GeometryFactory getGeometryFactory(Hints hints)
throws FactoryRegistryException
GeometryFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
GeometryFactory interface.Hints.GEOMETRY_FACTORYpublic static Set<GeometryFactory> getGeometryFactories(Hints hints)
GeometryFactory interface.
hints - An optional map of hints, or null for the default ones.
public static ComplexFactory getComplexFactory(Hints hints)
throws FactoryRegistryException
ComplexFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
ComplexFactory interface.Hints.COMPLEX_FACTORYpublic static Set<ComplexFactory> getComplexFactories(Hints hints)
ComplexFactory interface.
hints - An optional map of hints, or null for the default ones.
public static AggregateFactory getAggregateFactory(Hints hints)
throws FactoryRegistryException
AggregateFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
ComplexFactory interface.Hints.AGGREGATE_FACTORYpublic static Set<AggregateFactory> getAggregateFactories(Hints hints)
AggregateFactory interface.
hints - An optional map of hints, or null for the default ones.
public static FeatureTypeFactory getFeatureTypeFactory(Hints hints)
throws FactoryRegistryException
FeatureTypeFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
FeatureTypeFactory interface.Hints.FEATURE_TYPE_FACTORYpublic static Set<FeatureTypeFactory> getFeatureTypeFactories(Hints hints)
FeatureTypeFactory interface.
hints - An optional map of hints, or null for the default ones.
public static FeatureFactory getFeatureFactory(Hints hints)
throws FactoryRegistryException
FeatureFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
FeatureFactory interface.Hints.FEATURE_FACTORYpublic static Set<FeatureFactory> getFeatureFactories(Hints hints)
FeatureFactory interface.
hints - An optional map of hints, or null for the default ones.
public static FilterFactory getFilterFactory(Hints hints)
throws FactoryRegistryException
FilterFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
FilterFactory interface.Hints.FILTER_FACTORYpublic static Set<FilterFactory> getFilterFactories(Hints hints)
FilterFactory interface.
hints - An optional map of hints, or null for the default ones.
public static StyleFactory getStyleFactory(Hints hints)
throws FactoryRegistryException
StyleFactory matching the specified hints.
hints - An optional map of hints, or null for the default ones.
FactoryRegistryException - if no implementation was found or can be created for the
StyleFactory interface.Hints.STYLE_FACTORYpublic static Set<StyleFactory> getStyleFactories(Hints hints)
StyleFactory interface.
hints - An optional map of hints, or null for the default ones.
@Configuration
public static boolean setVendorOrdering(String vendor1,
String vendor2)
false is returned.
The example below said that an ESRI implementation (if available) is preferred over the Geotoolkit.org one:
FactoryFinder.setVendorOrdering("ESRI", "Geotoolkit.org");
vendor1 - The preferred vendor.vendor2 - The vendor to which vendor1 is preferred.
true if the ordering was set for at least one category.AuthorityFactoryFinder.setAuthorityOrdering(String, String)
@Configuration
public static boolean unsetVendorOrdering(String vendor1,
String vendor2)
false is returned.
vendor1 - The preferred vendor.vendor2 - The vendor to which vendor1 was preferred.
true if the ordering was unset for at least one category.AuthorityFactoryFinder.unsetAuthorityOrdering(String, String)
@Configuration
public static boolean setImplementationOrdering(String package1,
String package2)
false is returned.
This method is preferred to setVendorOrdering(String, String) when the package
name are known, because it avoid the potentially costly (on some implementations) call
to Factory.getVendor().
Note: An example of costlygetVendor()implementation is the one in theCachingAuthorityFactoryclass, because it needs to create the underlying backing store in order to query its vendor property.
package1 - The package name of the preferred implementation.package2 - The package name of the implementation to which package1 is preferred.
true if the ordering was set for at least one category.setVendorOrdering(String, String)
@Configuration
public static boolean unsetImplementationOrdering(String package1,
String package2)
false is returned.
package1 - The preferred vendor.package2 - The vendor to which vendor1 was preferred.
true if the ordering was unset for at least one category.unsetVendorOrdering(String, String)public static boolean isRegistered(Object factory)
true if the specified factory is registered. A factory may have been
registered by scanForPlugins() if it was declared in a META-INF/services
file, or it may have been added
programmatically.
factory - The factory to check for registration.
true if the given factory is registered.
@Debug
public static void listProviders(Writer out,
Locale locale)
throws IOException
out - The output stream where to format the list.locale - The locale for the list, or null.
IOException - if an error occurs while writing to out.@Configuration public static void scanForPlugins()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||