|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectDirectoryDataStore
public class DirectoryDataStore
This datastore represents methods of reading an enture directory. It propagates actual reading / writing of the data to the dataStore which reads / writes the requested format.
trunk/modules/unsupported (gt-unsupported.jar) (Maven report) (SVN head)| Constructor Summary | |
|---|---|
DirectoryDataStore(File f)
|
|
DirectoryDataStore(File f,
String[] co)
Creates a new DirectoryDataStore object. |
|
| Method Summary | |
|---|---|
void |
createSchema(SimpleFeatureType featureType)
Creates storage for a new featureType. |
void |
dispose()
Will dispose all child datastores. |
boolean |
exists(String authID)
Check if any locks exist held by the authorization lockID. |
FeatureReader<SimpleFeatureType,SimpleFeature> |
getFeatureReader(Query query,
Transaction transaction)
Access a FeatureReader providing access to Feature information. |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getFeatureSource(Name typeName)
Delegates to getFeatureSource(String) with
name.getLocalPart() |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getFeatureSource(String typeName)
Access a 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)
Access FeatureWriter for modification of the DataStore typeName. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getFeatureWriterAppend(String typeName,
Transaction transaction)
Aquire a FeatureWriter for adding new content to a FeatureType. |
ServiceInfo |
getInfo()
Information about this service. |
LockingManager |
getLockingManager()
Retrieve a per featureID based locking service from 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)
Retrieve FeatureType metadata by typeName. |
String[] |
getTypeNames()
Retrieves a list of of the available FeatureTypes. |
FeatureSource<SimpleFeatureType,SimpleFeature> |
getView(Query query)
Access a FeatureSource |
void |
lockFeatureID(String typeName,
String authID,
Transaction transaction,
FeatureLock featureLock)
FeatureID based locking. |
boolean |
refresh(String authID,
Transaction transaction)
Refresh locks held by the authorization lockID. |
boolean |
release(String authID,
Transaction transaction)
Release locks held by the authorization lockID. |
void |
unLockFeatureID(String typeName,
String authID,
Transaction transaction,
FeatureLock featureLock)
FeatureID based unlocking. |
void |
updateSchema(Name typeName,
SimpleFeatureType featureType)
Delegates to updateSchema(String, SimpleFeatureType) with
name.getLocalPart() |
void |
updateSchema(String typeName,
SimpleFeatureType featureType)
Used to force namespace and CS info into a persistent change. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DirectoryDataStore(File f)
throws MalformedURLException,
IOException
MalformedURLException
IOException
public DirectoryDataStore(File f,
String[] co)
throws MalformedURLException,
IOException
f - File the directoryco - list of file suffixes in order of preference for creating new
FTs
MalformedURLException
IOException| Method Detail |
|---|
public FeatureSource<SimpleFeatureType,SimpleFeature> getView(Query query)
throws IOException,
SchemaException
DataStore
The provided Query does not need to completely cover the existing
schema for Query.getTypeName(). The result will mostly likely only be
a FeatureSource
By using Query we allow support for reprojection, in addition to overriding the CoordinateSystem used by the native FeatureType.
We may wish to limit this method to only support Queries using Filter.EXCLUDE.
Update - GeoServer has an elegatent implementation of this functionality that we could steal. GeoServerFeatureSource, GeoServerFeatureStore and GeoServerFeatureLocking serve as a working prototype.
getView in interface DataStorequery - Query.getTypeName() locates FeatureType being viewed
IOException - If FeatureSourceSchemaException - If fetureType is not covered by existing schemapublic ServiceInfo getInfo()
DataAccessThis 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 String[] getTypeNames()
throws IOException
DataStoreThis is simply a list of the FeatureType names as aquiring the actual FeatureType schemas may be expensive.
Warning: this list may not be unique - the types may be in separate namespaces.
If you need to worry about such things please consider the use of the Catalog and CatalogEntry interface - many DataStores support this. getTypeNames is really a convience method for a Catalog.iterator() where the name of each entry is returned.
getTypeNames in interface DataStoreIOExceptionDataStore.getTypeNames()
public SimpleFeatureType getSchema(String typeName)
throws IOException
DataStoretypeName.
Retrieves the Schema information as a FeatureType object.
getSchema in interface DataStoretypeName - typeName of requested FeatureType
IOException - If typeName cannot be foundDataStore.getSchema(java.lang.String)
public void createSchema(SimpleFeatureType featureType)
throws IOException
DataAccessfeatureType.
The provided featureType we be accessable by the typeName
provided by featureType.getTypeName().
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>featureType - FetureType to add to DataStore
IOException - If featureType cannot be created
public void updateSchema(String typeName,
SimpleFeatureType featureType)
throws IOException
DataStoreThe provided featureType should completely cover the existing schema. All attributes should be accounted for and the typeName should match.
Suggestions:
updateSchema in interface DataStoreIOException
public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(String typeName)
throws IOException
DataStore
The resulting FeatureSource
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");
}
getFeatureSource in interface DataStoreIOExceptionDataStore.getFeatureSource(java.lang.String)
public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
Transaction transaction)
throws IOException
DataStoreFilter 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.EXCLUDE) {
return new EmptyFeatureReader(featureType);
}
String typeName = featureType.getTypeName();
FeatureType schema = getSchema( typeName );
FeatureReader reader = new DefaultFeatureReader( getAttributeReaders(), schema );
if (filter != Filter.INCLUDE) {
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.
getFeatureReader in interface DataStorequery - Requested form of the returned Features and the filter used
to constraints the resultstransaction - Transaction this query operates against
IOExceptionDataStore.getFeatureReader(org.geotools.data.Query,
org.geotools.data.Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> 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
IOExceptionDataStore.getFeatureWriter(java.lang.String,
Filter, org.geotools.data.Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
Transaction transaction)
throws IOException
DataStoreFeatureWriters 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.
getFeatureWriter in interface DataStoretypeName - Indicates featureType to be modifiedtransaction - Transaction to operates against
IOExceptionDataStore.getFeatureWriter(java.lang.String,
org.geotools.data.Transaction)
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName,
Transaction transaction)
throws IOException
DataStore
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.
getFeatureWriterAppend in interface DataStoretypeName - Indicates featureType to be modifiedtransaction - Transaction to operates against
IOExceptionDataStore.getFeatureWriterAppend(java.lang.String,
org.geotools.data.Transaction)public LockingManager getLockingManager()
DataStoreIt 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.
getLockingManager in interface DataStorenull, if the handling locking
in another fashion.DataStore.getLockingManager()public boolean exists(String authID)
LockingManagerlockID.
(remember that the lock may have expired)
exists in interface LockingManagerauthID - Authorization for lock
true if lock was foundLockingManager.exists(java.lang.String)
public boolean release(String authID,
Transaction transaction)
throws IOException
LockingManagerlockID.
(remember that the lock may have expired)
release in interface LockingManagerauthID - Authorization for locktransaction - Transaction with authorization for lockID
true if lock was found and released
IOException - DOCUMENT ME!LockingManager.release(java.lang.String,
org.geotools.data.Transaction)
public boolean refresh(String authID,
Transaction transaction)
throws IOException
LockingManagerlockID.
All features locked with the provied lockID will be locked
for additional time (the origional duration requested).
(remember that the lock may have expired)
refresh in interface LockingManagerauthID - Authorization for locktransaction - Transaction with authorization for lockID
true if lock was found and refreshed
IOException - DOCUMENT ME!LockingManager.refresh(java.lang.String,
org.geotools.data.Transaction)
public void unLockFeatureID(String typeName,
String authID,
Transaction transaction,
FeatureLock featureLock)
throws IOException
LockingManager
unLockFeatureID in interface LockingManagerIOException - DOCUMENT ME!LockingManager.unLockFeatureID(java.lang.String,
java.lang.String, org.geotools.data.Transaction,
org.geotools.data.FeatureLock)
public void lockFeatureID(String typeName,
String authID,
Transaction transaction,
FeatureLock featureLock)
throws IOException
LockingManager
lockFeatureID in interface LockingManagerIOException - DOCUMENT ME!LockingManager.lockFeatureID(java.lang.String,
java.lang.String, org.geotools.data.Transaction,
org.geotools.data.FeatureLock)public void dispose()
DirectoryDataStore will
be unusable.
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>IOExceptionDataAccess.getFeatureSource(Name)
public List<Name> getNames()
throws IOException
getTypeNames() meaning the
returned Names have no namespace set.
getNames in interface DataAccess<SimpleFeatureType,SimpleFeature>IOExceptionDataAccess.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()
IOExceptionDataAccess.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 | |||||||||