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
FeatureSet
s.
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 becauseSimpleFeatureStore
may open and close connections many times. - A list of tables, views or queries to view as
FeatureSet
s. This list is provided byResourceDefinition
objects. 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 newSimpleFeatureStore
for 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, vacuum
Methods inherited from class DataStore
getDisplayName, getLocale, getNativeMetadata, getProvider, removeListener, setLocale, toString
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface Resource
getFileSet, removeListener
-
Constructor Details
-
SimpleFeatureStore
public SimpleFeatureStore(DataStoreProvider provider, StorageConnector connector, ResourceDefinition... resources) throws DataStoreException Creates a newSimpleFeatureStore
for the given data source and tables, views or queries. The givenconnector
shall contain aDataSource
instance. Tables or views to include in the store are specified by theresources
argument. Only the main tables need to be specified, as dependencies will be followed automatically.- Parameters:
provider
- the factory that created thisDataStore
instance, ornull
if 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
DataSource
value. SQLStoreProvider.TABLES_PARAM
withResourceDefinition
s specified at construction time for tables.SQLStoreProvider.QUERIES_PARAM
withResourceDefinition
s specified at construction time for queries.
- Overrides:
getOpenParameters
in 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 aResourceDefinition
given at construction time.- Specified by:
components
in interfaceAggregate
- Overrides:
components
in 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:
findResource
in 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:
readResourceDefinitions
in 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:
-