|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectCoverageDatabase
@ThreadSafe public class CoverageDatabase
A connection to a collection of coverages declared in a SQL database.
The connection to the database is specified by a DataSource.
Every query methods in this class are executed in a background thread. In order to get the result
immediately, the FutureQuery.result() convenience method can be used as in the example below:
CoverageDatabase database = ...; // Specify your database here.
Layer myLayer = database.getLayer("Temperature").result();
// Use the layer here...
However it is better to invoke FutureQuery.result() as late as possible,
in order to have more work executed concurrently.
| coverage/geotk-coverage-sql (download) | View source code for this class |
| Field Summary | |
|---|---|
static ParameterDescriptorGroup |
PARAMETERS
A description of the parameters expected by the CoverageDatabase constructors. |
| Constructor Summary | |
|---|---|
CoverageDatabase(DataSource datasource,
ParameterValueGroup parameters)
Creates a new instance using the given data source and configuration parameters. |
|
CoverageDatabase(DataSource datasource,
Properties properties)
Creates a new instance using the given data source and configuration properties. |
|
CoverageDatabase(ParameterValueGroup parameters)
Creates a new instance using the given parameters. |
|
CoverageDatabase(Properties properties)
Creates a new instance using the given properties. |
|
| Method Summary | |
|---|---|
FutureQuery<Boolean> |
addLayer(String name)
Adds a new layer of the given name, if it does not already exist. |
void |
addListener(CoverageDatabaseListener listener)
Adds the given object to the list of objects to notify about changes in database content. |
LayerCoverageReader |
createGridCoverageReader(String layer)
Configures and returns a GridCoverageReader for the given layer. |
LayerCoverageWriter |
createGridCoverageWriter(String layer)
Configures and returns a LayerCoverageWriter for the given layer. |
void |
dispose()
Disposes the resources used by this database. |
void |
flush()
Flushes the cache. |
FutureQuery<SortedSet<Number>> |
getAvailableElevations(String layer)
Returns the set of altitudes where a coverage is available. |
FutureQuery<SortedSet<Date>> |
getAvailableTimes(String layer)
Returns the set of dates when a coverage is available. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the Coordinate Reference System used by the database for indexing the coverages envelopes. |
CRSAuthorityFactory |
getCRSAuthorityFactory()
Returns the CRS authority factory used by this database. |
static CoverageDatabase |
getDefaultInstance()
Returns the default instance, or null if none. |
FutureQuery<Layer> |
getLayer(String name)
Returns the layer of the given name. |
FutureQuery<Set<String>> |
getLayers()
Returns the name of every layers is the database. |
CoverageDatabaseListener[] |
getListeners()
Returns all listeners to notify about changes in database constent, or an empty array if none. |
Locale |
getLocale()
Returns the locale used for formatting logging and error messages. |
FutureQuery<List<MeasurementRange<?>>> |
getSampleValueRanges(String layer)
Returns the ranges of valid geophysics values for each band of the given layer. |
FutureQuery<DateRange> |
getTimeRange(String layer)
Returns a time range encompassing all coverages in this layer. |
FutureQuery<GridCoverage2D> |
readSlice(String layer,
CoverageEnvelope envelope,
IIOListeners listeners)
Reads the data of a two-dimensional slice and returns them as a coverage. |
FutureQuery<Boolean> |
removeLayer(String name)
Removes the layer of the given name, if it exist. |
void |
removeListener(CoverageDatabaseListener listener)
Removes the given object from the list of objects to notify about changes in database content. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ParameterDescriptorGroup PARAMETERS
CoverageDatabase constructors.
See the package javadoc for an overview of
those parameters.
| Constructor Detail |
|---|
public CoverageDatabase(Properties properties)
"URL" key. The value of this entry shall be a JDBC URL
in the form of "jdbc:postgresql://host/database".
See the package javadoc for the list of parameters supported by this constructor.
properties - The configuration properties.public CoverageDatabase(ParameterValueGroup parameters)
CoverageDatabase(Properties), but using the ISO 19111
parameters construct instead than the Java properties.
See the package javadoc for the list of parameters supported by this constructor.
parameters - The configuration parameters.
public CoverageDatabase(DataSource datasource,
Properties properties)
datasource - The data source, or null for creating it from the URL.properties - The configuration properties, or null if none.
public CoverageDatabase(DataSource datasource,
ParameterValueGroup parameters)
This constructor provides the same functionality than
CoverageDatabase(DataSource, Properties), but using the ISO 19111
parameters construct instead than the Java properties.
datasource - The data source, or null for creating it from the URL.parameters - The configuration parameters, or null if none.| Method Detail |
|---|
public static CoverageDatabase getDefaultInstance()
throws CoverageStoreException
null if none. The default instance can be specified by
the geotk-setup
module.
null if none.
CoverageStoreException - If an error occurred while fetching the default instance.
public CRSAuthorityFactory getCRSAuthorityFactory()
throws FactoryException
"spatial_ref_sys" table - this is usually not the
standard EPSG factory used by default in the Geotk library. In particular, axis order are
often different.
FactoryException - If the factory can not be created.public CoordinateReferenceSystem getCoordinateReferenceSystem()
CoverageDatabase instance will
transform the requested envelopes before to execute the queries.
public FutureQuery<Set<String>> getLayers()
public FutureQuery<Layer> getLayer(String name)
name - The layer name.
public FutureQuery<Boolean> addLayer(String name)
false.
name - The name of the new layer.
true if the layer has been added, of false if a layer of
the given name already exists.public FutureQuery<Boolean> removeLayer(String name)
false.
This action removes all references to raster data declared in that layer, unless the foreigner key constraints in the database have been changed from their default values. Note that the raster files are never deleted by this method.
name - The name of the layer to remove.
true if the layer has been removed, of false if no layer of
the given name exists.public FutureQuery<DateRange> getTimeRange(String layer)
return getLayer(layer).result().getTimeRange();
layer - The layer for which the time range is desired.
Layer.getTimeRange()public FutureQuery<SortedSet<Date>> getAvailableTimes(String layer)
return getLayer(layer).result().getAvailableTimes();
layer - The layer for which the available times are desired.
Layer.getAvailableTimes()public FutureQuery<SortedSet<Number>> getAvailableElevations(String layer)
return getLayer(layer).result().getAvailableElevations();
layer - The layer for which the available elevations are desired.
Layer.getAvailableElevations()public FutureQuery<List<MeasurementRange<?>>> getSampleValueRanges(String layer)
return getLayer(layer).result().getSampleValueRanges();
layer - The layer for which the range of measurement values is desired.
Layer.getSampleValueRanges()
public FutureQuery<GridCoverage2D> readSlice(String layer,
CoverageEnvelope envelope,
IIOListeners listeners)
layer - The layer of the coverage to query.envelope - The desired envelope and resolution, or null for all data.listeners - The listeners, or null if none.
LayerCoverageReader.readSlice(int, GridCoverageReadParam)
public LayerCoverageReader createGridCoverageReader(String layer)
throws CoverageStoreException
GridCoverageReader for the given layer. This provides an
alternative way (as compared to readSlice) for reading two-dimensional
slices of coverage. This method is provided for inter-operability with libraries which want
to access to the data through the GridCoverageReader API only.
layer - The name of the initial layer to be read by the returned reader, or null.
CoverageStoreException - If an error occurred while querying the database.
public LayerCoverageWriter createGridCoverageWriter(String layer)
throws CoverageStoreException
LayerCoverageWriter for the given layer.
This method is provided for inter-operability with libraries which want
to add data through the LayerCoverageWriter API only.
layer - The name of the initial layer to be read by the returned writer, or null.
CoverageStoreException - If an error occurred while querying the database.public void addListener(CoverageDatabaseListener listener)
listener - The new listener to add.public void removeListener(CoverageDatabaseListener listener)
listener - The listener to remove.public CoverageDatabaseListener[] getListeners()
public Locale getLocale()
getLocale in interface Localizednull for the default locale.public void flush()
CoverageDatabase API.
public void dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||