|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractDataStore2
public class AbstractDataStore2
Represents a stating point for implementing your own DataStore.
The goal is to have this class provide everything else if you only need to provide:
All remaining functionality is implemented against these methods, including Transaction and Locking Support. These implementations will not be optimal but they will work.
To support custom query optimizations:Pleae note that there may be a better place for you to start out from, (like JDBCDataStore).
modules/library/main (gt2-main.jar) (Maven report) (SVN head)| Field Summary | |
|---|---|
protected static Logger |
LOGGER
The logger for the data module. |
| Constructor Summary | |
|---|---|
AbstractDataStore2()
Default (Writeable) DataStore |
|
| Method Summary | |
|---|---|
protected List |
createContents()
Subclass must overrride to connet to contents. |
protected InProcessLockingManager |
createLockingManager()
Currently returns an InProcessLockingManager. |
void |
createSchema(FeatureType featureType)
Subclass should implement to provide for creation. |
void |
dispose()
Dummy implementation, it's a no-op. |
List |
entries()
List of ActiveTypeEntry entries - one for each featureType provided by this Datastore |
ActiveTypeEntry |
entry(String typeName)
|
FeatureReader |
getFeatureReader(Query query,
Transaction transaction)
Access a FeatureReader providing access to Feature information. |
FeatureSource |
getFeatureSource(String typeName)
Aqure FeatureSource for indicated typeName. |
FeatureWriter |
getFeatureWriter(String typeName,
Filter filter,
Transaction transaction)
Access FeatureWriter for modification of existing DataStore contents. |
FeatureWriter |
getFeatureWriter(String typeName,
Transaction transaction)
TODO summary sentence for getFeatureWriter ... |
FeatureWriter |
getFeatureWriterAppend(String typeName,
Transaction transaction)
FeatureWriter setup to add new content. |
LockingManager |
getLockingManager()
Locking manager used for this DataStore. |
FeatureType |
getSchema(String typeName)
Retrive schema information for typeName |
String[] |
getTypeNames()
Convience method for retriving all the names from the Catalog Entires |
FeatureSource |
getView(Query query)
Create a FeatureSource that represents your Query. |
void |
updateSchema(String typeName,
FeatureType featureType)
Subclass should implement to provide modification support. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Logger LOGGER
| Constructor Detail |
|---|
public AbstractDataStore2()
| Method Detail |
|---|
protected InProcessLockingManager createLockingManager()
Subclasses that implement real locking may override this method to
return null.
public List entries()
protected List createContents()
An implementation that has any doubt about its contents should aquire them during object creation (where an IOException can be thrown).
This method is lazyly called to create a List of ActiveTypeEntry for each FeatureCollection in this DataStore.
public String[] getTypeNames()
getTypeNames in interface DataStorepublic ActiveTypeEntry entry(String typeName)
public FeatureType getSchema(String typeName)
throws IOException
getSchema in interface DataStoretypeName - typeName of requested FeatureType
IOException - If typeName cannot be found
public void createSchema(FeatureType featureType)
throws IOException
createSchema in interface DataStorefeatureType - Requested FeatureType
IOException - Subclass may throw IOException
UnsupportedOperationException - Subclass may implement
public void updateSchema(String typeName,
FeatureType featureType)
throws IOException
updateSchema in interface DataStoreIOException
public FeatureSource getView(Query query)
throws IOException,
SchemaException
If we can make this part of the public API, we can phase out FeatureResults. (and reduce the number of classes people need to know about).
getView in interface DataStorequery - Query.getTypeName() locates FeatureType being viewed
IOException - If FeatureSource is not available
SchemaException - If fetureType is not covered by existing schema
public FeatureSource getFeatureSource(String typeName)
throws IOException
Note this API is not sufficient; Namespace needs to be used as well.
getFeatureSource in interface DataStoreIOException
public FeatureReader getFeatureReader(Query query,
Transaction transaction)
throws IOException
This implementation passes off responsibility to the following overrideable methods:
If you can handle some aspects of Query natively (say expressions or reprojection) override the following:
getFeatureReader in interface DataStorequery - Requested form of the returned Features and the filter used
to constraints the resultstransaction - Transaction this query operates against
IOException
public FeatureWriter getFeatureWriter(String typeName,
Filter filter,
Transaction transaction)
throws IOException
DataStoreTo limit FeatureWriter to the FeatureTypes defined by this DataStore, typeName is used to indicate FeatureType. The resulting feature writer will allow modifications against the same FeatureType provided by getSchema( typeName )
The FeatureWriter will provide access to the existing contents of the FeatureType referenced by typeName. The provided filter will be used to skip over Features as required.
Notes For Implementing DataStore
The returned FeatureWriter does not support the addition of new
Features to FeatureType (it would need to police your modifications to
agree with filer). As such it will return
false for getNext() when it reaches the end of the Query
and NoSuchElementException when next() is called.
Helper classes for implementing a FeatureWriter (in order):
getFeatureWriter in interface DataStoretypeName - Indicates featureType to be modifiedfilter - constraints used to limit the modificationtransaction - Transaction this query operates against
IOException
public FeatureWriter getFeatureWriter(String typeName,
Transaction transaction)
throws IOException
getFeatureWriter in interface DataStoretypeName - transaction -
IOExceptionDataStore.getFeatureWriter(java.lang.String, org.geotools.data.Transaction)
public FeatureWriter getFeatureWriterAppend(String typeName,
Transaction transaction)
throws IOException
getFeatureWriterAppend in interface DataStoretypeName - transaction -
IOExceptionDataStore.getFeatureWriterAppend(java.lang.String, org.geotools.data.Transaction)public LockingManager getLockingManager()
By default AbstractDataStore makes use of InProcessLockingManager.
getLockingManager in interface DataStorenull, if the handling locking
in another fashion.DataStore.getLockingManager()public void dispose()
dispose in interface DataStore
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||