|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAbstractDataStoreFactory
public abstract class 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/interfaces inherited from interface DataAccessFactory |
---|
DataAccessFactory.Param |
Constructor Summary | |
---|---|
AbstractDataStoreFactory()
|
Method Summary | |
---|---|
boolean |
canProcess(Map params)
Default implementation verifies the Map against the Param information. |
String |
getDisplayName()
Default Implementation abuses the naming convention. |
Map<RenderingHints.Key,?> |
getImplementationHints()
Returns the implementation hints. |
ParameterDescriptorGroup |
getParameters()
|
boolean |
isAvailable()
Defaults to true, only a few datastores need to check for drivers. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface DataStoreFactorySpi |
---|
createDataStore, createNewDataStore |
Methods inherited from interface DataAccessFactory |
---|
getDescription, getParametersInfo |
Constructor Detail |
---|
public AbstractDataStoreFactory()
Method Detail |
---|
public String getDisplayName()
Will return Foo
for
org.geotools.data.foo.FooFactory
.
getDisplayName
in interface DataAccessFactory
public boolean canProcess(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 DataAccessFactory
params
-
public boolean isAvailable()
isAvailable
in interface DataAccessFactory
true
, override to check for drivers etc...public ParameterDescriptorGroup getParameters()
public Map<RenderingHints.Key,?> getImplementationHints()
getImplementationHints
in interface Factory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |