Class GridFormatFinder
- Object
-
- GridFormatFinder
-
public final class GridFormatFinder extends Object
Enable programs to find all available grid format implementations.In order to be located by this finder datasources must provide an implementation of the
GridFormatFactorySpi
interface.In addition to implementing this interface datasouces should have a services file:
META-INF/services/org.geotools.data.GridFormatFactorySpi
The file should contain a single line which gives the full name of the implementing class.
Example:
org.geotools.data.mytype.MyTypeDataStoreFacotry
- Author:
- Simone Giannecchini, GeoSolutions
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbstractGridFormat
findFormat(Object o)
Returns aFormat
that is able to read a certain object.static AbstractGridFormat
findFormat(Object o, Hints hints)
Returns aFormat
that is able to read a certain object.static Set<AbstractGridFormat>
findFormats(Object o)
static Set<AbstractGridFormat>
findFormats(Object o, Hints hints)
static Set<GridFormatFactorySpi>
getAvailableFormats()
Finds all avalaible implementations ofGridFormatFactorySpi
which have registered using the services mechanism, and that have the appropriate libraries on the classpath.static Format[]
getFormatArray()
Returns an array with all availableGridFormatFactorySpi
implementations.static void
scanForPlugins()
Scans for factory plug-ins on the application class path.
-
-
-
Method Detail
-
getAvailableFormats
public static Set<GridFormatFactorySpi> getAvailableFormats()
Finds all avalaible implementations ofGridFormatFactorySpi
which have registered using the services mechanism, and that have the appropriate libraries on the classpath.- Returns:
- An unmodifiable
Set
of all discovered datastores which have registered factories, and whose available method returns true.
-
scanForPlugins
public static void scanForPlugins()
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.
-
getFormatArray
public static Format[] getFormatArray()
Returns an array with all availableGridFormatFactorySpi
implementations.It can be used toget basic information about all the available
GridCoverage
plugins. Note that this method finds all the implemented plugins but returns only the available one.A plugin could be implemented but not available due to missing dependencies.
- Returns:
- an array with all available
GridFormatFactorySpi
implementations.
-
findFormats
public static Set<AbstractGridFormat> findFormats(Object o)
-
findFormats
public static Set<AbstractGridFormat> findFormats(Object o, Hints hints)
-
findFormat
public static AbstractGridFormat findFormat(Object o)
Returns aFormat
that is able to read a certain object. If noFormat
is able to read such anObject
we return anUnknownFormat
object.It is worth to point out that this method will try to convert each format implementation to
AbstractGridFormat
because the originalFormat
interface did not allow for an accept method hence we had to subclass the interface to add such method and we did so by theAbstractGridFormat
abstract class.- Parameters:
o
- the object to check for acceptance.- Returns:
- an
AbstractGridFormat
that has stated to accept thisObject
o ornull
in no plugins was able to accept it.
-
findFormat
public static AbstractGridFormat findFormat(Object o, Hints hints)
Returns aFormat
that is able to read a certain object. If noFormat
is able to read such anObject
we return anUnknownFormat
object.It is worth to point out that this method will try to convert each format implementation to
AbstractGridFormat
because the originalFormat
interface did not allow for an accept method hence we had to subclass the interface to add such method and we did so by theAbstractGridFormat
abstract class.- Parameters:
o
- the object to check for acceptance.hints
- theHints
to control the format search.- Returns:
- an
AbstractGridFormat
that has stated to accept thisObject
o ornull
in no plugins was able to accept it.
-
-