|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a Physical Store for FeatureTypes.
The source of data for FeatureTypes. Shapefiles, databases tables, etc. are referenced through this interface.
Summary of our requirements:
getFeatureReader( Query, Transaction )
- Transaction is still orthognal
getFeatureSource( Query )
- Query allows override, and reprojection...
getFeatureStore( typeName )
- write access is till by typeName
(just like getFeatureWriter)
- consider spliting API into to based on read-only, read/write ability?
Method Summary | |
void |
createSchema(FeatureType featureType)
Creates storage for a new featureType . |
FeatureReader |
getFeatureReader(FeatureType featureType,
Filter filter,
Transaction transaction)
Access a FeatureReader providing access to Feature information. |
FeatureSource |
getFeatureSource(java.lang.String typeName)
Access a FeatureSource for typeName providing a high-level API. |
FeatureWriter |
getFeatureWriter(java.lang.String typeName,
Filter filter,
Transaction transaction)
Access FeatureWriter for modification of the DataStore contents. |
FeatureWriter |
getFeatureWriter(java.lang.String typeName,
Transaction transaction)
Access FeatureWriter for modification of the DataStore typeName. |
FeatureWriter |
getFeatureWriterAppend(java.lang.String typeName,
Transaction transaction)
Aquire a FeatureWriter for adding new content to a FeatureType. |
LockingManager |
getLockingManager()
Retrieve a per featureID based locking service from this DataStore. |
FeatureType |
getSchema(java.lang.String typeName)
Retrieve FeatureType metadata by typeName . |
java.lang.String[] |
getTypeNames()
Retrieves a list of of the available FeatureTypes |
void |
updateSchema(java.lang.String typeName,
FeatureType featureType)
Used to force namespace and CS info into a persistent change. |
Method Detail |
public java.lang.String[] getTypeNames()
This is simply a list of the FeatureType names as aquiring the actual FeatureType schemas may be expensive.
public FeatureType getSchema(java.lang.String typeName) throws java.io.IOException
typeName
.
Retrieves the Schema information as a FeatureType object.
typeName
- typeName of requested FeatureType
java.io.IOException
- If typeName cannot be foundpublic void createSchema(FeatureType featureType) throws java.io.IOException
featureType
.
The provided featureType
we be accessable by the typeName
provided by featureType.getTypeName().
featureType
- FetureType to add to DataStore
java.io.IOException
- If featureType cannot be createdpublic void updateSchema(java.lang.String typeName, FeatureType featureType) throws java.io.IOException
The provided featureType should completely cover the existing schema. All attributes should be accounted for and the typeName should match.
Suggestions:
typeName
-
java.io.IOException
public FeatureSource getFeatureSource(java.lang.String typeName) throws java.io.IOException
The resulting FeatureSource may implment more functionality:
FeatureSource fsource = dataStore.getFeatureSource( "roads" );
FeatureStore fstore = null;
if( fsource instanceof FeatureLocking ){
fstore = (FeatureStore) fs;
}
else {
System.out.println("We do not have write access to roads");
}
typeName
-
java.io.IOException
public FeatureReader getFeatureReader(FeatureType featureType, Filter filter, Transaction transaction) throws java.io.IOException
Filter is used as a low-level indication of constraints. (Implementations may resort to using a FilteredFeatureReader, or provide their own optimizations)
FeatureType provides a template for the returned FeatureReader
Transaction to externalize DataStore state on a per Transaction basis. The most common example is a JDBC datastore saving a Connection for use across several FeatureReader requests. Similarly a Shapefile reader may wish to redirect FeatureReader requests to a alternate filename over the course of a Transaction.
Notes For Implementing DataStore
Subclasses may need to retrieve additional attributes, beyond those
requested by featureType.getAttributeTypes(), in order to correctly
apply the filter
.
These Additional attribtues should be not be returned by
FeatureReader. Subclasses may use ReTypeFeatureReader to aid in
acomplishing this.
Helper classes for implementing a FeatureReader (in order):
Sample use (not optimized):
if (filter == Filter.ALL) {
return new EmptyFeatureReader(featureType);
}
String typeName = featureType.getTypeName();
FeatureType schema = getSchema( typeName );
FeatureReader reader = new DefaultFeatureReader( getAttributeReaders(), schema );
if (filter != Filter.NONE) {
reader = new FilteringFeatureReader(reader, filter);
}
if (transaction != Transaction.AUTO_COMMIT) {
Map diff = state(transaction).diff(typeName);
reader = new DiffFeatureReader(reader, diff);
}
if (!featureType.equals(reader.getFeatureType())) {
reader = new ReTypeFeatureReader(reader, featureType);
}
return reader
Locking support does not need to be provided for FeatureReaders.
Suggestions:
featureType
- Describes the form of the returned Featuresfilter
- Constraints used to limit the resultstransaction
- Transaction this query opperates against
java.io.IOException
public FeatureWriter getFeatureWriter(java.lang.String typeName, Filter filter, Transaction transaction) throws java.io.IOException
The constructed FeatureWriter will be placed at the start of the
provided store
.
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 )
Notes For Implementing DataStore
The returned FeatureWriter does not support the addition on 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):
typeName
- Indicates featureType to be modifiedfilter
- constraints used to limit the modificationtransaction
- Transaction this query opperates against
java.io.IOException
public FeatureWriter getFeatureWriter(java.lang.String typeName, Transaction transaction) throws java.io.IOException
FeatureWriters will need to be limited to the FeatureTypes defined by the DataStore, the easiest way to express this limitation is to the FeatureType by a provided typeName.
The returned FeatureWriter will return false
for getNext()
when it reaches the end of the Query.
typeName
- Indicates featureType to be modifiedtransaction
- Transaction this query opperates against
java.io.IOException
public FeatureWriter getFeatureWriterAppend(java.lang.String typeName, Transaction transaction) throws java.io.IOException
This FeatureWriter will return false
for hasNext(), however
next() may be used to aquire new Features that may be writen out to add
new content.
typeName
- transaction
-
java.io.IOException
public LockingManager getLockingManager()
It is common to return an instanceof InProcessLockingManager for DataStores that do not provide native locking.
AbstractFeatureLocking makes use of this service to provide locking
support. You are not limitied by this implementation and may simply
return null
for this value.
null
, if the handling locking
in another fashion.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |