Package org.apache.sis.storage.landsat
Class LandsatStore
java.lang.Object
org.apache.sis.storage.DataStore
org.apache.sis.storage.landsat.LandsatStore
- All Implemented Interfaces:
AutoCloseable
,Aggregate
,Resource
,Localized
Reads Landsat metadata and bands.
Landsat data are distributed as a collection of TIFF files,
together with a single text file like below:
This class reads the content from the given input until the first occurrence of the
END
keyword.
Lines beginning with the #
character (ignoring spaces) are treated as comment lines and ignored.- Since:
- 1.1
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BandGroup[]
The array of aggregates for each Landsat band group, ornull
if not yet created.(package private) final Path
The root directory where this file is located, ornull
if unknown.private org.opengis.util.GenericName
The identifier, cached when first requested.private final URI
TheDataStoreProvider.LOCATION
parameter value, ornull
if none.private org.opengis.metadata.Metadata
The object returned bygetMetadata()
, created when first needed and cached.private Reader
The reader, ornull
if closed. -
Constructor Summary
ConstructorsConstructorDescriptionLandsatStore
(LandsatStoreProvider provider, StorageConnector connector) Creates a new Landsat store from the given file, URL, stream or character reader. -
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 Landsat store and releases any underlying resources.Returns the resources for each group of Landsat bands.final String
Returns the name of the directory that contains this data set.Optional
<org.opengis.util.GenericName> Returns the value associated toLANDSAT_SCENE_ID
in the Landsat metadata file.org.opengis.metadata.Metadata
Returns information about the dataset as a whole.Optional
<org.opengis.parameter.ParameterValueGroup> Returns the parameters used to open this Landsat data store.private void
Parses the main Landsat text file.Methods inherited from class org.apache.sis.storage.DataStore
findResource, getLocale, getNativeMetadata, getProvider, removeListener, setLocale, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.storage.Resource
removeListener
-
Field Details
-
source
The reader, ornull
if closed. -
directory
The root directory where this file is located, ornull
if unknown. -
location
TheDataStoreProvider.LOCATION
parameter value, ornull
if none. -
metadata
private org.opengis.metadata.Metadata metadataThe object returned bygetMetadata()
, created when first needed and cached. -
identifier
private org.opengis.util.GenericName identifierThe identifier, cached when first requested. -
components
The array of aggregates for each Landsat band group, ornull
if not yet created. This array is created together with metadata and is unmodifiable.
-
-
Constructor Details
-
LandsatStore
public LandsatStore(LandsatStoreProvider provider, StorageConnector connector) throws DataStoreException Creates a new Landsat store from the given file, URL, stream or character reader. This constructor invokesStorageConnector.closeAllExcept(Object)
, keeping open only the needed resource.- Parameters:
provider
- the factory that created thisDataStore
instance, ornull
if unspecified.connector
- information about the storage (URL, stream, reader instance, etc).- Throws:
DataStoreException
- if an error occurred while opening the Landsat file.
-
-
Method Details
-
getDisplayName
Returns the name of the directory that contains this data set. The directory may not exist, for example if the data are read from a ZIP file. The returned name can be used in user interfaces or in error messages.- Overrides:
getDisplayName
in classDataStore
- Returns:
- a short name of label for this data store, or
null
if unknown. - See Also:
-
getOpenParameters
Returns the parameters used to open this Landsat data store. The parameters are described byLandsatStoreProvider.getOpenParameters()
and contains at least a parameter named "location" with aURI
value. The return value may be empty if the storage input cannot be described by a URI (for example a Landsat file reading directly from aReadableByteChannel
).- Specified by:
getOpenParameters
in classDataStore
- Returns:
- parameters used for opening this data store.
- Since:
- 0.8
- See Also:
-
getIdentifier
Returns the value associated toLANDSAT_SCENE_ID
in the Landsat metadata file. This value is fetched fromgetMetadata()/identificationInfo/citation/identifier
.- Specified by:
getIdentifier
in interfaceResource
- Overrides:
getIdentifier
in classDataStore
- Returns:
- the identifier fetched from metadata, or
null
if none. - Throws:
DataStoreException
- if an error occurred while reading the metadata.- Since:
- 1.0
- See Also:
-
loadMetadata
Parses the main Landsat text file. Also creates the array of components, but without loading GeoTIFF data yet.- Throws:
DataStoreException
-
getMetadata
Returns information about the dataset as a whole. The returned metadata object can contain information such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, data quality, usage constraints and more.- Specified by:
getMetadata
in interfaceResource
- Specified by:
getMetadata
in classDataStore
- Returns:
- information about the dataset.
- Throws:
DataStoreException
- if an error occurred while reading the metadata.- See Also:
-
components
Returns the resources for each group of Landsat bands.- Specified by:
components
in interfaceAggregate
- Returns:
- all group of bands that are components of this aggregate. Never
null
. - Throws:
DataStoreException
- if an error occurred while fetching the components.- Since:
- 1.1
-
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 Landsat 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 Landsat file.- See Also:
-