Class OGRDataStore
- All Implemented Interfaces:
DataAccess<SimpleFeatureType,,SimpleFeature> DataStore
- Author:
- Andrea Aime - GeoSolutions
-
Field Summary
Fields inherited from class ContentDataStore
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, LOGGER, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE -
Constructor Summary
ConstructorsConstructorDescriptionOGRDataStore(String ogrName, String ogrDriver, URI namespace, OGR ogr) OGRDataStore(String ogrName, String ogrDriver, URI namespace, OGR ogr, OGRDataSourcePool dataSourcePool) -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentFeatureSourcecreateFeatureSource(ContentEntry entry) Instantiates new feature source for the entry.voidcreateSchema(SimpleFeatureType schema) Creates a new schema in the datastore.voidcreateSchema(SimpleFeatureType schema, boolean approximateFields, String[] options) Creates a new OGR layer with provided schema and optionsvoidcreateSchema(SimpleFeatureCollection data, boolean approximateFields, String[] options) Creates a new OGR layer with provided data and options.Creates a set of qualified names corresponding to the types that the datastore provides.voiddispose()Disposes of this data store and releases any resource that it is using.booleansupportsInPlaceWrite(String typeName) Methods inherited from class ContentDataStore
createContentState, ensureEntry, ensureFeatureStore, entry, getDataStoreFactory, getEntry, getFeatureFactory, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureTypeFactory, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getFilterFactory, getGeometryFactory, getInfo, getLockingManager, getLogger, getNames, getNamespaceURI, getSchema, getSchema, getTypeNames, name, removeEntry, removeSchema, removeSchema, setDataStoreFactory, setFeatureFactory, setFeatureTypeFactory, setFilterFactory, setGeometryFactory, setNamespaceURI, updateSchema, updateSchema
-
Constructor Details
-
OGRDataStore
-
OGRDataStore
- Throws:
IOException
-
-
Method Details
-
createTypeNames
Description copied from class:ContentDataStoreCreates a set of qualified names corresponding to the types that the datastore provides.Namespaces may be left
nullfor data stores which do not support namespace qualified type names.- Specified by:
createTypeNamesin classContentDataStore- Returns:
- A list of
Name. - Throws:
IOException- Any errors occuring connecting to data.
-
createFeatureSource
Description copied from class:ContentDataStoreInstantiates new feature source for the entry.Subclasses should override this method to return a specific subclass of
ContentFeatureSource.- Specified by:
createFeatureSourcein classContentDataStore- Parameters:
entry- The entry.- Returns:
- An new instance of
ContentFeatureSourcefor the entry. - Throws:
IOException
-
supportsInPlaceWrite
- Throws:
IOException
-
createSchema
Description copied from class:ContentDataStoreCreates a new schema in the datastore.This implementation throws a
UnsupportedOperationException. Subclasses should override to support schema creation.- Specified by:
createSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Overrides:
createSchemain classContentDataStore- Parameters:
schema- FetureType to add to DataStore- Throws:
IOException- If featureType cannot be created- See Also:
-
createSchema
public void createSchema(SimpleFeatureType schema, boolean approximateFields, String[] options) throws IOException Creates a new OGR layer with provided schema and options- Parameters:
schema- the geotools schemaapproximateFields- if true, OGR will try to create fields that are approximations of the required ones when an exact match cannt be providedoptions- OGR data source/layer creation options- Throws:
IOException
-
createSchema
public void createSchema(SimpleFeatureCollection data, boolean approximateFields, String[] options) throws IOException Creates a new OGR layer with provided data and options. This call is specifically made available for the OGC store since for some data source types, such as GML or KML, it is not possible to call createSchema() independently from a write, as the result will not contain the schema definition without having data too. Also, in those formats, the output is writable only so as long as it's empty, it's not possible to write against an existing GML file for example.- Parameters:
data- The data to fill into the newly created layerapproximateFields- if true, OGR will try to create fields that are approximations of the required ones when an exact match cannt be providedoptions- OGR data source/layer creation options- Throws:
IOException
-
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> - Overrides:
disposein classContentDataStore
-