Class SimpleFeatureStore
- All Implemented Interfaces:
AutoCloseable,Aggregate,Resource,Localized
A concrete data store capable to read and write features from/to a spatial SQL database.
All resources created by this class are
FeatureSets.
The data are specified by two main arguments given at construction time:
- A
DataSource(specified indirectly) providing connections to the database. While not mandatory, a pooled data source is recommended becauseSimpleFeatureStoremay open and close connections many times. - A list of tables, views or queries to view as
FeatureSets. This list is provided byResourceDefinitionobjects. Only the main tables need to be specified. Dependencies inferred by foreigner keys will be followed automatically.
SimpleFeatureStore class name, this class supports complex features,
i.e. features having associations to other features.
The associations are discovered automatically by following the foreigner keys.- Since:
- 1.5
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Resource
Resource.FileSet -
Field Summary
Fields inherited from class SQLStore
contentLocale, source -
Constructor Summary
ConstructorsConstructorDescriptionSimpleFeatureStore(DataStoreProvider provider, StorageConnector connector, ResourceDefinition... resources) Creates a newSimpleFeatureStorefor the given data source and tables, views or queries. -
Method Summary
Modifier and TypeMethodDescriptionReturns the tables (feature sets) in this SQL store.findResource(String identifier) Searches for a resource identified by the given identifier.Returns parameters that can be used for opening this Simple Features data store.protected ResourceDefinition[]Returns the resource definitions equivalent to the ones specified at construction time.Methods inherited from class SQLStore
addListener, close, getDatabaseSoftwareVersions, getDataSource, getIdentifier, getMetadata, initialize, newDataAccess, vacuumMethods inherited from class DataStore
getDisplayName, getLocale, getNativeMetadata, getProvider, removeListener, setLocale, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Resource
getFileSet, removeListener
-
Constructor Details
-
SimpleFeatureStore
public SimpleFeatureStore(DataStoreProvider provider, StorageConnector connector, ResourceDefinition... resources) throws DataStoreException Creates a newSimpleFeatureStorefor the given data source and tables, views or queries. The givenconnectorshall contain aDataSourceinstance. Tables or views to include in the store are specified by theresourcesargument. Only the main tables need to be specified, as dependencies will be followed automatically.- Parameters:
provider- the factory that created thisDataStoreinstance, ornullif unspecified.connector- information about the storage (JDBC data source, etc).resources- tables, views or queries to include in this store.- Throws:
DataStoreException- if an error occurred while creating the data store for the given storage.
-
-
Method Details
-
getOpenParameters
Returns parameters that can be used for opening this Simple Features data store. The parameters are described bySQLStoreProvider.getOpenParameters()and can contain some or all of the following:- A parameter named "location" with a
DataSourcevalue. SQLStoreProvider.TABLES_PARAMwithResourceDefinitions specified at construction time for tables.SQLStoreProvider.QUERIES_PARAMwithResourceDefinitions specified at construction time for queries.
- Overrides:
getOpenParametersin classSQLStore- Returns:
- parameters used for opening this data store.
- See Also:
- A parameter named "location" with a
-
components
Returns the tables (feature sets) in this SQL store. The collection contains only the tables matching aResourceDefinitiongiven at construction time.- Specified by:
componentsin interfaceAggregate- Overrides:
componentsin classSQLStore- Returns:
- children resources that are components of this SQL store.
- Throws:
DataStoreException- if an error occurred while fetching the components.
-
findResource
Searches for a resource identified by the given identifier. The given identifier shall match the name of one of the tables, views or queries inferred at construction time. It may be a table named explicitly at construction time, or a dependency inferred by following foreigner keys. The given identifier may be qualified with the schema name, or may be only the table name if there is no ambiguity.- Overrides:
findResourcein classSQLStore- Parameters:
identifier- identifier of the resource to fetch. Must be non-null.- Returns:
- resource associated to the given identifier (never
null). - See Also:
-
readResourceDefinitions
Returns the resource definitions equivalent to the ones specified at construction time. This method is defined for completness, but is not used bySimpleFeatureStore.- Specified by:
readResourceDefinitionsin classSQLStore- Parameters:
dao- ignored.- Returns:
- tables or views to include in the store. Only the main tables need to be specified. Dependencies (inferred from the foreigner keys) will be followed automatically.
- See Also:
-