org.geotools.data.jdbc.datasource
Class DataSourceFinder

Object
  extended by DataSourceFinder

public final class DataSourceFinder
extends Object

Enable programs to find all available DataSourceFactorySpi implementations.

In addition to implementing this interface data souces should have a services file:
META-INF/services/org.geotools.data.jdbc.DataSourceFactorySpi

The file should contain a single line which gives the full name of the implementing class.

Example:
org.geotools.data.jdbc.DBCPDataSourceFactory

Module:
trunk/gt/modules   (gt-modules.jar) (Maven report) (SVN head)

Field Summary
protected static Logger LOGGER
          The logger for the filter module.
 
Method Summary
static Iterator getAvailableDataSources()
          Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, and that have the appropriate libraries on the classpath.
static DataSource getDataSource(Map 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 UnWrapper getUnWrapper(Connection conn)
          Checks each available datasource implementation in turn and returns the first one which claims to support the resource identified by the params object.
static UnWrapper getUnWrapper(Statement st)
          Checks each available UnWrapper implementation in turn and returns the first one which claims to support the resource identified by the params object.
static Iterator getUnWrappers()
          Finds all implemtaions of DataStoreFactory which have registered using the services mechanism, and that have the appropriate libraries on the classpath.
static void scanForPlugins()
          Scans for factory plug-ins on the application class path.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER
The logger for the filter module.

Method Detail

getDataSource

public static DataSource getDataSource(Map 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.

getUnWrapper

public static UnWrapper getUnWrapper(Connection conn)
                              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.

getUnWrapper

public static UnWrapper getUnWrapper(Statement st)
                              throws IOException
Checks each available UnWrapper 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.

getAvailableDataSources

public static Iterator getAvailableDataSources()
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.

getUnWrappers

public static Iterator getUnWrappers()
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.



Copyright © 1996-2009 Geotools. All Rights Reserved.