|
||||||||||
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 (gt-main.jar)
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(SimpleFeatureType 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<SimpleFeatureType,SimpleFeature> |
getFeatureReader(Query query,
Transaction transaction)
Access a FeatureReader |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getFeatureSource(Name typeName)
Delegates to getFeatureSource(String) with
name.getLocalPart() |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getFeatureSource(String typeName)
Aqure FeatureSource |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriter(String typeName,
Filter filter,
Transaction transaction)
Access FeatureWriter for modification of existing DataStore contents. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriter(String typeName,
Transaction transaction)
TODO summary sentence for getFeatureWriter ... |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriterAppend(String typeName,
Transaction transaction)
FeatureWriter setup to add new content. |
ServiceInfo |
getInfo()
Information about this service. |
LockingManager |
getLockingManager()
Locking manager used for this DataStore. |
List<Name> |
getNames()
Returns the same list of names than getTypeNames() meaning the
returned Names have no namespace set. |
SimpleFeatureType |
getSchema(Name name)
Delegates to getSchema(String) with name.getLocalPart() |
SimpleFeatureType |
getSchema(String typeName)
Retrive schema information for typeName |
String[] |
getTypeNames()
Convience method for retriving all the names from the Catalog Entires |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getView(Query query)
Create a FeatureSource |
void |
updateSchema(Name typeName,
SimpleFeatureType featureType)
Delegates to updateSchema(String, SimpleFeatureType) with
name.getLocalPart() |
void |
updateSchema(String typeName,
SimpleFeatureType 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
public String[] getTypeNames()
getTypeNames
in interface DataStore
public ActiveTypeEntry entry(String typeName)
public ServiceInfo getInfo()
DataAccess
This method offers access to a summary of header or metadata information describing the service.
Subclasses may return a specific ServiceInfo instance that has additional information (such as FilterCapabilities).
getInfo
in interface DataAccess<SimpleFeatureType,SimpleFeature>
public SimpleFeatureType getSchema(String typeName) throws IOException
getSchema
in interface DataStore
typeName
- typeName of requested FeatureType
IOException
- If typeName cannot be foundpublic void createSchema(SimpleFeatureType featureType) throws IOException
createSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
featureType
- Requested FeatureType
IOException
- Subclass may throw IOException
UnsupportedOperationException
- Subclass may implementpublic void updateSchema(String typeName, SimpleFeatureType featureType) throws IOException
updateSchema
in interface DataStore
IOException
public FeatureSource<SimpleFeatureType,SimpleFeature> 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 DataStore
query
- Query.getTypeName() locates FeatureType being viewed
IOException
- If FeatureSourceSchemaException
- If fetureType is not covered by existing schemapublic FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(String typeName) throws IOException
Note this API is not sufficient; Namespace needs to be used as well.
getFeatureSource
in interface DataStore
IOException
public FeatureReader<SimpleFeatureType,SimpleFeature> 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 DataStore
query
- Requested form of the returned Features and the filter used
to constraints the resultstransaction
- Transaction this query operates against
IOException
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction) throws IOException
DataStore
To 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 DataStore
typeName
- Indicates featureType to be modifiedfilter
- constraints used to limit the modificationtransaction
- Transaction this query operates against
IOException
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction) throws IOException
getFeatureWriter
in interface DataStore
typeName
- transaction
-
IOException
DataStore.getFeatureWriter(java.lang.String, org.geotools.data.Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction) throws IOException
getFeatureWriterAppend
in interface DataStore
typeName
- transaction
-
IOException
DataStore.getFeatureWriterAppend(java.lang.String, org.geotools.data.Transaction)
public LockingManager getLockingManager()
By default AbstractDataStore makes use of InProcessLockingManager.
getLockingManager
in interface DataStore
null
, if the handling locking
in another fashion.DataStore.getLockingManager()
public void dispose()
dispose
in interface DataAccess<SimpleFeatureType,SimpleFeature>
public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(Name typeName) throws IOException
getFeatureSource(String)
with
name.getLocalPart()
getFeatureSource
in interface DataAccess<SimpleFeatureType,SimpleFeature>
IOException
DataAccess.getFeatureSource(Name)
public List<Name> getNames() throws IOException
getTypeNames()
meaning the
returned Names have no namespace set.
getNames
in interface DataAccess<SimpleFeatureType,SimpleFeature>
IOException
DataAccess.getNames()
public SimpleFeatureType getSchema(Name name) throws IOException
getSchema(String)
with name.getLocalPart()
getSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
name
- Type name a the resource from getNames()
IOException
DataAccess.getSchema(Name)
public void updateSchema(Name typeName, SimpleFeatureType featureType) throws IOException
updateSchema(String, SimpleFeatureType)
with
name.getLocalPart()
updateSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
IOException
- if the operation failedDataAccess.getFeatureSource(Name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |