Class AbstractDataStoreFactory

All Implemented Interfaces:
DataStoreFactorySpi, Factory
Direct Known Subclasses:
DB2DataStoreFactory, PostgisDataStoreFactory, WFSDataStoreFactory

public abstract class AbstractDataStoreFactory
extends java.lang.Object
implements DataStoreFactorySpi

A best of toolkit for DataStoreFactory implementors.

Will also allow me to mess with the interface API without breaking every last DataStoreFactorySpi out there.

The default implementations often hinge around the use of getParameterInfo and the correct use of Param by your subclass.

You still have to implement a few methods:

 public DataSourceMetadataEnity createMetadata( Map params ) throws IOException {
 	    String host = (String) HOST.lookUp(params);
      String user = (String) USER.lookUp(params);
      Integer port = (Integer) PORT.lookUp(params);
      String database = (String) DATABASE.lookUp(params);

      String description = "Connection to "+getDisplayName()+" on "+host+" as "+user ;
      return new DataSourceMetadataEnity( host+":"+port, database, description );

Jody Garnett, Refractions Research

Nested Class Summary
Nested classes inherited from class
Constructor Summary
Method Summary
 boolean canProcess(java.util.Map params)
          Default implementation verifies the Map against the Param information.
 java.lang.String getDisplayName()
          Default Implementation abuses the naming convention.
 java.util.Map getImplementationHints()
          Returns the implementation hints.
 org.opengis.parameter.ParameterDescriptorGroup getParameters()
 boolean isAvailable()
          Defaults to true, only a few datastores need to check for drivers.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface
createDataStore, createNewDataStore, getDescription, getParametersInfo

Constructor Detail


public AbstractDataStoreFactory()
Method Detail


public java.lang.String getDisplayName()
Default Implementation abuses the naming convention.

Will return Foo for

Specified by:
getDisplayName in interface DataStoreFactorySpi
return display name based on class name


public boolean canProcess(java.util.Map params)
Default implementation verifies the Map against the Param information.

It will ensure that:

Why would you ever want to override this method? If you want to check that a expected file exists and is a directory.


 public boolean canProcess( Map params ) {
     if( !super.canProcess( params ) ){
          return false; // was not in agreement with getParametersInfo
     // example check
     File file = (File) DIRECTORY.lookup( params ); // DIRECTORY is a param
     return file.exists() && file.isDirectory();

Specified by:
canProcess in interface DataStoreFactorySpi
params -
true if params is in agreement with getParametersInfo, override for additional checks.


public boolean isAvailable()
Defaults to true, only a few datastores need to check for drivers.

Specified by:
isAvailable in interface DataStoreFactorySpi
true, override to check for drivers etc...


public org.opengis.parameter.ParameterDescriptorGroup getParameters()


public java.util.Map getImplementationHints()
Returns the implementation hints. The default implementation returns en empty map.

Specified by:
getImplementationHints in interface Factory
The map of hints, or an empty map if none.

Copyright © GeoTools. All Rights Reserved.