org.geotools.data
Interface DataStore

All Superinterfaces:
DataAccess<SimpleFeatureType,SimpleFeature>
All Known Subinterfaces:
FileDataStore, WFSDataStore
All Known Implementing Classes:
AbstractDataStore, AbstractFileDataStore, ArcSDEDataStore, ArrayDataStore, CollectionDataStore, ContentDataStore, DataStoreWrapper, DirectoryDataStore, JDBCDataStore, MemoryDataStore, OracleDatastoreWrapper, PreGeneralizedDataStore, PropertyDataStore, ShapefileDataStore, SingleFeatureSourceDataStore, WFS_1_0_0_DataStore, WFS_1_1_0_DataStore

public interface DataStore
extends DataAccess<SimpleFeatureType,SimpleFeature>

This represents a physical source of feature data, such as a shapefiles or database, where the features will be instances of SimpleFeature. It is derived from the DataAccess interface (which works at the more general Feature level.

Author:
Jody Garnett, Refractions Research
See Also:
DataAccess, Feature, SimpleFeature

Method Summary
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction)
          Gets a FeatureReader for features selected by the given Query.
 SimpleFeatureSource getFeatureSource(Name typeName)
          Gets a SimpleFeatureSource for features of the type specified by a qualified name (namespace plus type name).
 SimpleFeatureSource getFeatureSource(String typeName)
          Gets a SimpleFeatureSource for features of the specified type.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction)
          Gets a FeatureWriter to modify features in this DataStore.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction)
          Gets a FeatureWriter to modify features in this DataStore.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction)
          Gets a FeatureWriter that can add new features to the DataStore.
 LockingManager getLockingManager()
          Retrieve a per featureID based locking service from this DataStore.
 SimpleFeatureType getSchema(String typeName)
          Gets the type information (schema) for the specified feature type.
 String[] getTypeNames()
          Gets the names of feature types available in this DataStore.
 void removeSchema(String typeName)
          Used to permanently remove a schema from the underlying storage This functionality is similar to an "drop table" statement in SQL.
 void updateSchema(String typeName, SimpleFeatureType featureType)
          Applies a new schema to the given feature type.
 
Methods inherited from interface DataAccess
createSchema, dispose, getInfo, getNames, getSchema, removeSchema, updateSchema
 

Method Detail

updateSchema

void updateSchema(String typeName,
                  SimpleFeatureType featureType)
                  throws IOException
Applies a new schema to the given feature type. This can be used to add or remove properties. The resulting update will be persistent.

Parameters:
typeName - name of the feature type to update
featureType - the new schema to apply
Throws:
IOException - on error

removeSchema

void removeSchema(String typeName)
                  throws IOException
Used to permanently remove a schema from the underlying storage

This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.

Parameters:
typeName -
Throws:
IOException - if the operation failed
UnsupportedOperation - if functionality is not available

getTypeNames

String[] getTypeNames()
                      throws IOException
Gets the names of feature types available in this DataStore. Please note that this is not guaranteed to return a list of unique names since the same unqualified name may be present in separate namespaces within the DataStore.

Returns:
names of feature types available in this DataStore
Throws:
IOException - if data access errors occur

getSchema

SimpleFeatureType getSchema(String typeName)
                            throws IOException
Gets the type information (schema) for the specified feature type.

Parameters:
typeName - the feature type name
Returns:
the requested feature type
Throws:
IOException - if typeName is not available

getFeatureSource

SimpleFeatureSource getFeatureSource(String typeName)
                                     throws IOException
Gets a SimpleFeatureSource for features of the specified type. SimpleFeatureSource provides a high-level API for feature operations.

The resulting SimpleFeatureSource may implment more functionality as in this example:



 SimpleFeatureSource fsource = dataStore.getFeatureSource("roads");
 if (fsource instanceof SimpleFeatureStore) {
     // we have write access to the feature data
     SimpleFeatureStore fstore = (SimpleFeatureStore) fs;
 }
 else {
     System.out.println("We do not have write access to roads");
 }
 

Parameters:
typeName - the feature type
Returns:
a SimpleFeatureSource (or possibly a subclass) providing operations for features of the specified type
Throws:
IOException - if data access errors occur
See Also:
SimpleFeatureSource, SimpleFeatureStore

getFeatureSource

SimpleFeatureSource getFeatureSource(Name typeName)
                                     throws IOException
Gets a SimpleFeatureSource for features of the type specified by a qualified name (namespace plus type name).

Specified by:
getFeatureSource in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
typeName - the qualified name of the feature type
Returns:
a SimpleFeatureSource (or possibly a subclass) providing operations for features of the specified type
Throws:
IOException - if data access errors occur
See Also:
getFeatureSource(String), SimpleFeatureSource, SimpleFeatureStore

getFeatureReader

FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
                                                                Transaction transaction)
                                                                throws IOException
Gets a FeatureReader for features selected by the given Query. FeatureReader provies an iterator-style API to feature data.

The Query provides the schema for the form of the returned features as well as a Filter to constrain the features available via the reader.

The Transaction can be used to externalize the state of the DataStore. Examples of this include a JDBCDataStore sharing a connection for use across several FeatureReader requests; and a ShapefileDataStore redirecting requests to an alternate file during the course of a Transaction.

Parameters:
query - a query providing the schema and constraints for features that the reader will return
transaction - a transaction that this reader will operate against
Returns:
an instance of FeatureReader
Throws:
IOException - if data access errors occur

getFeatureWriter

FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                Filter filter,
                                                                Transaction transaction)
                                                                throws IOException
Gets a FeatureWriter to modify features in this DataStore. FeatureWriter provides an iterator style API to features.

The returned writer does not allow features to be added.

Parameters:
typeName - the type name for features that will be accessible
filter - defines additional constraints on the features that will be accessible
transaction - the transation that the returned writer operates against
Returns:
an instance of FeatureWriter
Throws:
IOException - if data access errors occur
See Also:
getFeatureWriterAppend(String, Transaction)

getFeatureWriter

FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                Transaction transaction)
                                                                throws IOException
Gets a FeatureWriter to modify features in this DataStore. FeatureWriter provides an iterator style API to features.

The returned writer does not allow features to be added.

Parameters:
typeName - the type name for features that will be accessible
transaction - the transation that the returned writer operates against
Returns:
an instance of FeatureWriter
Throws:
IOException - if data access errors occur
See Also:
getFeatureWriterAppend(String, Transaction)

getFeatureWriterAppend

FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName,
                                                                      Transaction transaction)
                                                                      throws IOException
Gets a FeatureWriter that can add new features to the DataStore.

The FeatureWriter will return false when its hasNext() method is called, but next() can be used to acquire new features.

Parameters:
typeName - name of the feature type for which features will be added
transaction - the transaction to operate against
Returns:
an instance of FeatureWriter that can only be used to append new features
Throws:
IOException - if data access errors occur

getLockingManager

LockingManager getLockingManager()
Retrieve a per featureID based locking service from this DataStore.

Returns:
an instance of LockingManager; or null if locking is handled by the DataStore in a different fashion


Copyright © 1996-2014 Geotools. All Rights Reserved.