Package org.geotools.api.data
Class DataStoreFinder
- Object
-
- DataStoreFinder
-
public final class DataStoreFinder extends Object
Enable programs to find all available datastore implementations.In order to be located by this finder datasources must provide an implementation of the
DataStoreFactorySpi
interface.In addition to implementing this interface datasouces should have a services file:
META-INF/services/org.geotools.api.data.DataStoreFactorySpi
The file should contain a single line which gives the full name of the implementing class.
Example:
org.geotools.data.mytype.MyTypeDataStoreFacotry
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
deregisterFactory(DataStoreFactorySpi factorySpi)
Programmatically deregisters a store.static void
deregisterFactrory(DataStoreFactorySpi factorySpi)
Deprecated.static Iterator<DataStoreFactorySpi>
getAllDataStores()
Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, regardless weather it has the appropriate libraries on the classpath.static Iterator<DataStoreFactorySpi>
getAvailableDataStores()
Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, and that have the appropriate libraries on the classpath.static DataStore
getDataStore(Map<String,?> params)
Checks each available datasource implementation in turn and returns the first one which claims to support the resource identified by the params object.static void
registerFactory(DataStoreFactorySpi factorySpi)
Programmatically registers a store.static void
registerFactrory(DataStoreFactorySpi factorySpi)
Deprecated.static void
reset()
Resets the factory finder and prepares for a new full scan of the SPI subsystemsstatic void
scanForPlugins()
Scans for factory plug-ins on the application class path.
-
-
-
Method Detail
-
getDataStore
public static DataStore getDataStore(Map<String,?> params) throws IOException
Checks each available datasource implementation in turn and returns the first one which claims to support the resource identified by the params object.- Parameters:
params
- A Map object which contains a defenition of the resource to connect to. for file based resources the property 'url' should be set within this Map.- Returns:
- The first datasource which claims to process the required resource, returns null if none can be found.
- Throws:
IOException
- If a suitable loader can be found, but it can not be attached to the specified resource without errors.
-
getAllDataStores
public static Iterator<DataStoreFactorySpi> getAllDataStores()
Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, regardless weather it has the appropriate libraries on the classpath.- Returns:
- An iterator over all discovered datastores which have registered factories
-
getAvailableDataStores
public static Iterator<DataStoreFactorySpi> getAvailableDataStores()
Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, and that have the appropriate libraries on the classpath.- Returns:
- An iterator over 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.
-
reset
public static void reset()
Resets the factory finder and prepares for a new full scan of the SPI subsystems
-
registerFactory
public static void registerFactory(DataStoreFactorySpi factorySpi)
Programmatically registers a store. Mostly useful for tests, normal store registration should go through the SPI subsystem (META-INF/services files).
-
deregisterFactory
public static void deregisterFactory(DataStoreFactorySpi factorySpi)
Programmatically deregisters a store. Mostly useful for tests, normal store registration should go through the SPI subsystem (META-INF/services files).
-
registerFactrory
@Deprecated public static void registerFactrory(DataStoreFactorySpi factorySpi)
Deprecated.
-
deregisterFactrory
@Deprecated public static void deregisterFactrory(DataStoreFactorySpi factorySpi)
Deprecated.
-
-