public abstract class DataStoreWrapper extends Object implements DataStore
DataStore object.| Modifier and Type | Field and Description |
|---|---|
protected File |
auxiliaryFolder
Auxiliary folder which contains properties file with mapping information
|
protected static String |
COORDINATE_REFERENCE_SYSTEM |
protected DataStore |
datastore
The underlying datastore
|
protected static String |
HIDDEN_FOLDER |
protected static Logger |
LOGGER |
protected static String |
MAPPEDNAME |
protected Map<Name,FeatureTypeMapper> |
mapping
Mapping between typeNames and FeatureTypeMapper
|
protected static String |
NAME |
protected static String |
SCHEMA |
| Constructor and Description |
|---|
DataStoreWrapper(DataStore datastore,
String auxFolderPath)
Base constructor
|
DataStoreWrapper(DataStore datastore,
String auxFolderPath,
String subFolderName)
Base constructor with custom hidden folder
|
| Modifier and Type | Method and Description |
|---|---|
void |
createSchema(SimpleFeatureType featureType)
Creates storage for a new
featureType. |
void |
dispose()
Disposes of this data store and releases any resource that it is using.
|
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. |
protected FeatureTypeMapper |
getFeatureTypeMapper(Properties props)
Return a specific
FeatureTypeMapper by parsing mapping properties contained within
the specified Properties object |
protected abstract FeatureTypeMapper |
getFeatureTypeMapper(SimpleFeatureType featureType)
Return a specific
FeatureTypeMapper instance on top of an input featureType |
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. |
ServiceInfo |
getInfo()
Information about this service.
|
LockingManager |
getLockingManager()
Retrieve a per featureID based locking service from this
DataStore. |
List<Name> |
getNames()
Names of the available Resources.
|
SimpleFeatureType |
getSchema(Name name)
Description of the named resource.
|
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(Name typeName)
Used to permanently remove a schema from the underlying storage
This functionality is similar to an "drop table" statement in SQL.
|
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.
|
protected void |
storeMapper(FeatureTypeMapper mapper)
Store the
FeatureTypeMapper instance |
protected void |
storeProperties(Properties properties,
String typeName)
Store the properties on disk
|
protected SimpleFeatureSource |
transformFeatureStore(SimpleFeatureStore source,
FeatureTypeMapper mapper) |
void |
updateSchema(Name typeName,
SimpleFeatureType featureType)
Used to update a schema in place.
|
void |
updateSchema(String typeName,
SimpleFeatureType featureType)
Applies a new schema to the given feature type.
|
protected static final String HIDDEN_FOLDER
protected static final String NAME
protected static final String MAPPEDNAME
protected static final String SCHEMA
protected static final String COORDINATE_REFERENCE_SYSTEM
protected static final Logger LOGGER
protected File auxiliaryFolder
protected final DataStore datastore
protected final Map<Name,FeatureTypeMapper> mapping
public DataStoreWrapper(DataStore datastore, String auxFolderPath)
public 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 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 DataStoreIOException - If featureType cannot be createdprotected void storeProperties(Properties properties, String typeName)
public void updateSchema(Name typeName, SimpleFeatureType featureType) throws IOException
DataAccessThis functionality is similar to an "alter table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
updateSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>IOException - if the operation failedpublic List<Name> getNames() throws IOException
DataAccessFor additional information please see getInfo( Name ) and getSchema( Name ).
getNames in interface DataAccess<SimpleFeatureType,SimpleFeature>IOExceptionpublic SimpleFeatureType getSchema(Name name) throws IOException
DataAccessThe FeatureType returned describes the contents being published. For additional metadata please review getInfo( Name ).
getSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>name - Type name a the resource from getNames()IOExceptionpublic SimpleFeatureType getSchema(String typeName) throws IOException
DataStoregetSchema in interface DataStoretypeName - the feature type nameIOException - if typeName is not availablepublic void dispose()
DataAccessA DataStore cannot be used after dispose has been called,
neither can any data access object it helped create, such as FeatureReader, FeatureSource or FeatureCollection.
This operation can be called more than once without side effects.
There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.
dispose in interface DataAccess<SimpleFeatureType,SimpleFeature>public void updateSchema(String typeName, SimpleFeatureType featureType) throws IOException
DataStoreupdateSchema in interface DataStoretypeName - name of the feature type to updatefeatureType - the new schema to applyIOException - on errorpublic void removeSchema(Name typeName) throws IOException
DataAccessThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>IOException - if the operation failedpublic void removeSchema(String typeName) throws IOException
DataStoreThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema in interface DataStoreIOException - if the operation failedpublic String[] getTypeNames() throws IOException
DataStoreDataStore. 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.getTypeNames in interface DataStoreDataStoreIOException - if data access errors occurpublic SimpleFeatureSource getFeatureSource(String typeName) throws IOException
DataStoreSimpleFeatureSource 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");
}
getFeatureSource in interface DataStoretypeName - the feature typeSimpleFeatureSource (or possibly a subclass) providing operations for
features of the specified typeIOException - if data access errors occurSimpleFeatureSource,
SimpleFeatureStorepublic SimpleFeatureSource getFeatureSource(Name typeName) throws IOException
DataStoreSimpleFeatureSource for features of the type specified by a qualified name
(namespace plus type name).getFeatureSource in interface DataAccess<SimpleFeatureType,SimpleFeature>getFeatureSource in interface DataStoretypeName - the qualified name of the feature typeSimpleFeatureSource (or possibly a subclass) providing operations for
features of the specified typeIOException - if data access errors occurDataStore.getFeatureSource(String),
SimpleFeatureSource,
SimpleFeatureStoreprotected SimpleFeatureSource transformFeatureStore(SimpleFeatureStore source, FeatureTypeMapper mapper) throws IOException
IOExceptionpublic FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction) throws IOException
DataStoreFeatureReader 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.
getFeatureReader in interface DataStorequery - a query providing the schema and constraints for features that the reader will
returntransaction - a transaction that this reader will operate againstFeatureReaderIOException - if data access errors occurpublic FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction) throws IOException
DataStoreFeatureWriter to modify features in this DataStore. FeatureWriter provides an iterator style API to features.
The returned writer does not allow features to be added.
getFeatureWriter in interface DataStoretypeName - the type name for features that will be accessiblefilter - defines additional constraints on the features that will be accessibletransaction - the transaction that the returned writer operates againstFeatureWriterIOException - if data access errors occurDataStore.getFeatureWriterAppend(String, Transaction)public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction) throws IOException
DataStoreFeatureWriter to modify features in this DataStore. FeatureWriter provides an iterator style API to features.
The returned writer does not allow features to be added.
getFeatureWriter in interface DataStoretypeName - the type name for features that will be accessibletransaction - the transaction that the returned writer operates againstFeatureWriterIOException - if data access errors occurDataStore.getFeatureWriterAppend(String, Transaction)public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction) throws IOException
DataStoreFeatureWriter 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.
getFeatureWriterAppend in interface DataStoretypeName - name of the feature type for which features will be addedtransaction - the transaction to operate againstFeatureWriter that can only be used to append new featuresIOException - if data access errors occurpublic LockingManager getLockingManager()
DataStoreDataStore.getLockingManager in interface DataStoreLockingManager; or null if locking is handled by the
DataStore in a different fashionprotected void storeMapper(FeatureTypeMapper mapper)
FeatureTypeMapper instanceprotected FeatureTypeMapper getFeatureTypeMapper(Properties props) throws Exception
FeatureTypeMapper by parsing mapping properties contained within
the specified Properties objectExceptionprotected abstract FeatureTypeMapper getFeatureTypeMapper(SimpleFeatureType featureType) throws Exception
FeatureTypeMapper instance on top of an input featureTypeExceptionCopyright © 1996–2021 Geotools. All rights reserved.