|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.AbstractDataStoreFactory
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 );
}
Nested Class Summary |
Nested classes inherited from class org.geotools.data.DataStoreFactorySpi |
DataStoreFactorySpi.Param |
Constructor Summary | |
AbstractDataStoreFactory()
|
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 org.geotools.data.DataStoreFactorySpi |
createDataStore, createNewDataStore, getDescription, getParametersInfo |
Constructor Detail |
public AbstractDataStoreFactory()
Method Detail |
public java.lang.String getDisplayName()
Will return Foo
for
org.geotools.data.foo.FooFactory
.
getDisplayName
in interface DataStoreFactorySpi
public boolean canProcess(java.util.Map params)
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.
Overrride:
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();
}
canProcess
in interface DataStoreFactorySpi
params
-
public boolean isAvailable()
isAvailable
in interface DataStoreFactorySpi
true
, override to check for drivers etc...public org.opengis.parameter.ParameterDescriptorGroup getParameters()
public java.util.Map getImplementationHints()
getImplementationHints
in interface Factory
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |