- All Implemented Interfaces:
AutoCloseable
,Aggregate
,Resource
,Localized
A data store capable to read and create features from a spatial database.
SQLStore
requires a DataSource
to be specified (indirectly) at construction time.
The DataSource
should provide pooled connections, because SQLStore
will frequently
opens and closes them.- Since:
- 1.0
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSQLStore
(SQLStoreProvider provider, StorageConnector connector, ResourceDefinition... resources) Creates a newSQLStore
for the given data source and tables, views or queries. -
Method Summary
Modifier and TypeMethodDescription<T extends StoreEvent>
voidaddListener
(Class<T> eventType, StoreListener<? super T> listener) Registers a listener to notify when the specified kind of event occurs in this data store.void
close()
Closes this SQL store and releases any underlying resources.Returns the tables (feature sets) in this SQL store.findResource
(String identifier) Searches for a resource identified by the given identifier.SQL data store root resource has no identifier.Returns information about the dataset as a whole.Returns the parameters used to open this netCDF data store.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
removeListener
-
Constructor Details
-
SQLStore
public SQLStore(SQLStoreProvider provider, StorageConnector connector, ResourceDefinition... resources) throws DataStoreException Creates a newSQLStore
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; 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.- Since:
- 1.1
-
-
Method Details
-
getOpenParameters
Returns the parameters used to open this netCDF data store. The parameters are described bySQLStoreProvider.getOpenParameters()
and contains at least a parameter named "location" with aDataSource
value.- Specified by:
getOpenParameters
in classDataStore
- Returns:
- parameters used for opening this data store.
- See Also:
-
getIdentifier
SQL data store root resource has no identifier.- Specified by:
getIdentifier
in interfaceResource
- Overrides:
getIdentifier
in classDataStore
- Returns:
- empty.
- Throws:
DataStoreException
- if an error occurred while fetching the identifier.- See Also:
-
getMetadata
Returns information about the dataset as a whole. The returned metadata object can contain information such as the list of feature types.- Specified by:
getMetadata
in interfaceResource
- Specified by:
getMetadata
in classDataStore
- Returns:
- information about the dataset.
- Throws:
DataStoreException
- if an error occurred while reading the data.- See Also:
-
components
Returns the tables (feature sets) in this SQL store. The list contains only the tables explicitly named at construction time.- Specified by:
components
in interfaceAggregate
- 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 should match one of the table names. It may be one of the tables named at construction time, or one of the dependencies. The given name may be qualified with the schema name, or may be only the table name if there is no ambiguity.- Overrides:
findResource
in classDataStore
- Parameters:
identifier
- identifier of the resource to fetch. Must be non-null.- Returns:
- resource associated to the given identifier (never
null
). - Throws:
IllegalNameException
- if no resource is found for the given identifier, or if more than one resource is found.DataStoreException
- if another kind of error occurred while searching resources.- See Also:
-
addListener
public <T extends StoreEvent> void addListener(Class<T> eventType, StoreListener<? super T> listener) Registers a listener to notify when the specified kind of event occurs in this data store. The current implementation of this data store can emit onlyWarningEvent
s; any listener specified for another kind of events will be ignored.- Specified by:
addListener
in interfaceResource
- Overrides:
addListener
in classDataStore
- Type Parameters:
T
- compile-time value of theeventType
argument.- Parameters:
eventType
- type ofStoreEvent
to listen (cannot benull
).listener
- listener to notify about events.
-
close
Closes this SQL store and releases any underlying resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classDataStore
- Throws:
DataStoreException
- if an error occurred while closing the SQL store.- See Also:
-