Class DataStoreWrapper
- All Implemented Interfaces:
DataAccess<SimpleFeatureType,,SimpleFeature> DataStore
- Direct Known Subclasses:
OracleDatastoreWrapper,PostgisDatastoreWrapper,SQLServerDatastoreWrapper
DataStore object.- Author:
- Daniele Romagnoli, GeoSolutions SAS @TODO move that class on gt-transform once ready
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileAuxiliary folder which contains properties file with mapping informationprotected static final Stringprotected final DataStoreThe underlying datastoreprotected static final Stringprotected static final Loggerprotected static final Stringprotected final Map<Name,FeatureTypeMapper> Mapping between typeNames and FeatureTypeMapperprotected static final Stringprotected static final String -
Constructor Summary
ConstructorsConstructorDescriptionDataStoreWrapper(DataStore datastore, String auxFolderPath) Base constructorDataStoreWrapper(DataStore datastore, String auxFolderPath, String subFolderName) Base constructor with custom hidden folder -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateSchema(SimpleFeatureType featureType) Creates storage for a newfeatureType.voiddispose()Disposes of this data store and releases any resource that it is using.getFeatureReader(Query query, Transaction transaction) Gets aFeatureReaderfor features selected by the givenQuery.getFeatureSource(String typeName) Gets aSimpleFeatureSourcefor features of the specified type.getFeatureSource(Name typeName) Gets aSimpleFeatureSourcefor features of the type specified by a qualified name (namespace plus type name).protected FeatureTypeMappergetFeatureTypeMapper(Properties props) Return a specificFeatureTypeMapperby parsing mapping properties contained within the specifiedPropertiesobjectprotected abstract FeatureTypeMappergetFeatureTypeMapper(SimpleFeatureType featureType) Return a specificFeatureTypeMapperinstance on top of an input featureTypegetFeatureWriter(String typeName, Transaction transaction) Gets aFeatureWriterto modify features in thisDataStore.getFeatureWriter(String typeName, Filter filter, Transaction transaction) Gets aFeatureWriterto modify features in thisDataStore.getFeatureWriterAppend(String typeName, Transaction transaction) Gets aFeatureWriterthat can add new features to theDataStore.getInfo()Information about this service.Retrieve a per featureID based locking service from thisDataStore.getNames()Names of the available Resources.Gets the type information (schema) for the specified feature type.Description of the named resource.String[]Gets the names of feature types available in thisDataStore.voidremoveSchema(String typeName) Used to permanently remove a schema from the underlying storagevoidremoveSchema(Name typeName) Used to permanently remove a schema from the underlying storageprotected voidstoreMapper(FeatureTypeMapper mapper) Store theFeatureTypeMapperinstanceprotected voidstoreProperties(Properties properties, String typeName) Store the properties on diskprotected SimpleFeatureSourcetransformFeatureStore(SimpleFeatureStore source, FeatureTypeMapper mapper) voidupdateSchema(String typeName, SimpleFeatureType featureType) Applies a new schema to the given feature type.voidupdateSchema(Name typeName, SimpleFeatureType featureType) Used to update a schema in place.
-
Field Details
-
HIDDEN_FOLDER
- See Also:
-
NAME
- See Also:
-
MAPPEDNAME
- See Also:
-
SCHEMA
- See Also:
-
COORDINATE_REFERENCE_SYSTEM
- See Also:
-
LOGGER
-
auxiliaryFolder
Auxiliary folder which contains properties file with mapping information -
datastore
The underlying datastore -
mapping
Mapping between typeNames and FeatureTypeMapper
-
-
Constructor Details
-
DataStoreWrapper
Base constructor -
DataStoreWrapper
Base constructor with custom hidden folder
-
-
Method Details
-
getInfo
Description copied from interface:DataAccessInformation about this service.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).
- Specified by:
getInfoin interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Returns:
- SeviceInfo
-
createSchema
Description copied from interface:DataAccessCreates storage for a newfeatureType.The provided
featureTypewe be accessable by the typeName provided by featureType.getTypeName().- Specified by:
createSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Parameters:
featureType- FetureType to add to DataStore- Throws:
IOException- If featureType cannot be created
-
storeProperties
Store the properties on disk -
updateSchema
Description copied from interface:DataAccessUsed to update a schema in place.This functionality is similar to an "alter table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
- Specified by:
updateSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Throws:
IOException- if the operation failed
-
getNames
Description copied from interface:DataAccessNames of the available Resources.For additional information please see getInfo( Name ) and getSchema( Name ).
- Specified by:
getNamesin interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Returns:
- Names of the available contents.
- Throws:
IOException
-
getSchema
Description copied from interface:DataAccessDescription of the named resource.The FeatureType returned describes the contents being published. For additional metadata please review getInfo( Name ).
- Specified by:
getSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Parameters:
name- Type name a the resource from getNames()- Returns:
- Description of the FeatureType being made avaialble
- Throws:
IOException
-
getSchema
Description copied from interface:DataStoreGets the type information (schema) for the specified feature type.- Specified by:
getSchemain interfaceDataStore- Parameters:
typeName- the feature type name- Returns:
- the requested feature type
- Throws:
IOException- iftypeNameis not available
-
dispose
public void dispose()Description copied from interface:DataAccessDisposes of this data store and releases any resource that it is using.A
DataStorecannot be used afterdisposehas been called, neither can any data access object it helped create, such asFeatureReader,FeatureSourceorFeatureCollection.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.
- Specified by:
disposein interfaceDataAccess<SimpleFeatureType,SimpleFeature>
-
updateSchema
Description copied from interface:DataStoreApplies a new schema to the given feature type. This can be used to add or remove properties. The resulting update will be persistent.- Specified by:
updateSchemain interfaceDataStore- Parameters:
typeName- name of the feature type to updatefeatureType- the new schema to apply- Throws:
IOException- on error
-
removeSchema
Description copied from interface:DataAccessUsed to permanently remove a schema from the underlying storageThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
- Specified by:
removeSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Throws:
IOException- if the operation failed
-
removeSchema
Description copied from interface:DataStoreUsed to permanently remove a schema from the underlying storageThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
- Specified by:
removeSchemain interfaceDataStore- Throws:
IOException- if the operation failed
-
getTypeNames
Description copied from interface:DataStoreGets the names of feature types available in thisDataStore. 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 theDataStore.- Specified by:
getTypeNamesin interfaceDataStore- Returns:
- names of feature types available in this
DataStore - Throws:
IOException- if data access errors occur
-
getFeatureSource
Description copied from interface:DataStoreGets aSimpleFeatureSourcefor features of the specified type.SimpleFeatureSourceprovides a high-level API for feature operations.The resulting
SimpleFeatureSourcemay 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"); }- Specified by:
getFeatureSourcein interfaceDataStore- 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:
-
getFeatureSource
Description copied from interface:DataStoreGets aSimpleFeatureSourcefor features of the type specified by a qualified name (namespace plus type name).- Specified by:
getFeatureSourcein interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Specified by:
getFeatureSourcein interfaceDataStore- 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:
-
transformFeatureStore
protected SimpleFeatureSource transformFeatureStore(SimpleFeatureStore source, FeatureTypeMapper mapper) throws IOException - Throws:
IOException
-
getFeatureReader
public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction) throws IOException Description copied from interface:DataStoreGets aFeatureReaderfor features selected by the givenQuery.FeatureReaderprovies an iterator-style API to feature data.The
Queryprovides the schema for the form of the returned features as well as aFilterto constrain the features available via the reader.The
Transactioncan be used to externalize the state of theDataStore. Examples of this include aJDBCDataStoresharing a connection for use across severalFeatureReaderrequests; and aShapefileDataStoreredirecting requests to an alternate file during the course of aTransaction.- Specified by:
getFeatureReaderin interfaceDataStore- Parameters:
query- a query providing the schema and constraints for features that the reader will returntransaction- a transaction that this reader will operate against- Returns:
- an instance of
FeatureReader - Throws:
IOException- if data access errors occur
-
getFeatureWriter
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction) throws IOException Description copied from interface:DataStoreGets aFeatureWriterto modify features in thisDataStore.FeatureWriterprovides an iterator style API to features.The returned writer does not allow features to be added.
- Specified by:
getFeatureWriterin interfaceDataStore- Parameters:
typeName- 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 against- Returns:
- an instance of
FeatureWriter - Throws:
IOException- if data access errors occur- See Also:
-
getFeatureWriter
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction) throws IOException Description copied from interface:DataStoreGets aFeatureWriterto modify features in thisDataStore.FeatureWriterprovides an iterator style API to features.The returned writer does not allow features to be added.
- Specified by:
getFeatureWriterin interfaceDataStore- Parameters:
typeName- the type name for features that will be accessibletransaction- the transaction that the returned writer operates against- Returns:
- an instance of
FeatureWriter - Throws:
IOException- if data access errors occur- See Also:
-
getFeatureWriterAppend
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction) throws IOException Description copied from interface:DataStoreGets aFeatureWriterthat can add new features to theDataStore.The
FeatureWriterwill returnfalsewhen itshasNext()method is called, butnext()can be used to acquire new features.- Specified by:
getFeatureWriterAppendin interfaceDataStore- Parameters:
typeName- name of the feature type for which features will be addedtransaction- the transaction to operate against- Returns:
- an instance of
FeatureWriterthat can only be used to append new features - Throws:
IOException- if data access errors occur
-
getLockingManager
Description copied from interface:DataStoreRetrieve a per featureID based locking service from thisDataStore.- Specified by:
getLockingManagerin interfaceDataStore- Returns:
- an instance of
LockingManager; ornullif locking is handled by theDataStorein a different fashion
-
storeMapper
Store theFeatureTypeMapperinstance -
getFeatureTypeMapper
Return a specificFeatureTypeMapperby parsing mapping properties contained within the specifiedPropertiesobject- Throws:
Exception
-
getFeatureTypeMapper
protected abstract FeatureTypeMapper getFeatureTypeMapper(SimpleFeatureType featureType) throws Exception Return a specificFeatureTypeMapperinstance on top of an input featureType- Throws:
Exception
-