# Class LandsatStore

Object
DataStore
LandsatStore

All Implemented Interfaces:
  `AutoCloseable`, `Aggregate`, `Resource`, `Localized`

public class LandsatStore extends DataStore implements Aggregate
Reads Landsat metadata and bands. Landsat data are distributed as a collection of TIFF files, together with a single text file like below:

     GROUP = L1_METADATA_FILE
       GROUP = METADATA_FILE_INFO
         ORIGIN = "Image courtesy of the U.S. Geological Survey"
         REQUEST_ID = "0501403126384_00011"
         LANDSAT_SCENE_ID = "LC81230522014071LGN00"
         FILE_DATE = 2014-03-12T06:06:35Z
         STATION_ID = "LGN"
         PROCESSING_SOFTWARE_VERSION = "LPGS_2.3.0"
       END_GROUP = METADATA_FILE_INFO
       GROUP = PRODUCT_METADATA
         DATA_TYPE = "L1T"
         ELEVATION_SOURCE = "GLS2000"
         OUTPUT_FORMAT = "GEOTIFF"
         SPACECRAFT_ID = "LANDSAT_8"
         SENSOR_ID = "OLI_TIRS"
         etc...

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

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Resource

  `Resource​.FileSet`

- ## Field Summary

  ### Fields inherited from class DataStore

  `listeners, provider`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LandsatStore(DataStoreProvider provider, StorageConnector connector)`
  Creates a new Landsat store from the given file, URL, stream or character reader.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<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.
  `void`
  `close()`
  Closes this Landsat store and releases any underlying resources.
  `List<Aggregate>`
  `components()`
  Returns the resources for each group of Landsat bands.
  `final String`
  `getDisplayName()`
  Returns the name of the directory that contains this data set.
  `Optional<Resource​.FileSet>`
  `getFileSet()`
  Returns the list of band files and the `*_MTL​.txt` file.
  `Optional<GenericName>`
  `getIdentifier()`
  Returns the value associated to `LANDSAT_SCENE_ID` in the Landsat metadata file.
  `Metadata`
  `getMetadata()`
  Returns information about the dataset as a whole.
  `Optional<ParameterValueGroup>`
  `getOpenParameters()`
  Returns the parameters used to open this Landsat data store.

  ### Methods inherited from class DataStore

  `findResource, 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

  - ### LandsatStore

    public LandsatStore(DataStoreProvider provider, StorageConnector connector) throws DataStoreException
    Creates a new Landsat store from the given file, URL, stream or character reader. This constructor invokes `StorageConnector​.closeAllExcept(Object)`, keeping open only the needed resource.
    Parameters:
      `provider` - the factory that created this `DataStore` instance, or `null` if unspecified.
      `connector` - information about the storage (URL, stream, reader instance, etc).
    Throws:
      `DataStoreException` - if an error occurred while opening the Landsat file.
    Since:
      1.5

- ## Method Details

  - ### getDisplayName

    public final String 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 class `DataStore`
    Returns:
      a short name of label for this data store, or `null` if unknown.
    See Also:
      - `DataStore​.getIdentifier()`
      - `DataStore​.getLocale()`

  - ### getOpenParameters

    public Optional<ParameterValueGroup> getOpenParameters()
    Returns the parameters used to open this Landsat data store. The parameters are described by `LandsatStoreProvider​.getOpenParameters()` and contains at least a parameter named "location" with a `URI` 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 a `ReadableByteChannel`).
    Specified by:
      `getOpenParameters` in class `DataStore`
    Returns:
      parameters used for opening this data store.
    Since:
      0.8
    See Also:
      - `DataStoreProvider​.getOpenParameters()`

  - ### getIdentifier

    public Optional<GenericName> getIdentifier() throws DataStoreException
    Returns the value associated to `LANDSAT_SCENE_ID` in the Landsat metadata file. This value is fetched from `getMetadata()/identificationInfo/citation/identifier`.
    Specified by:
      `getIdentifier` in interface `Resource`
    Overrides:
      `getIdentifier` in class `DataStore`
    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:
      - `DataStore​.getMetadata()`
      - `DataStore​.getDisplayName()`

  - ### getMetadata

    public Metadata getMetadata() throws DataStoreException
    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 interface `Resource`
    Specified by:
      `getMetadata` in class `DataStore`
    Returns:
      information about the dataset.
    Throws:
      `DataStoreException` - if an error occurred while reading the metadata.
    See Also:
      - Mapping from Landsat to ISO 19115 metadata

  - ### components

    public List<Aggregate> components() throws DataStoreException
    Returns the resources for each group of Landsat bands.
    Specified by:
      `components` in interface `Aggregate`
    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 only `WarningEvent`s; any listener specified for another kind of events will be ignored.
    Specified by:
      `addListener` in interface `Resource`
    Overrides:
      `addListener` in class `DataStore`
    Type Parameters:
      `T` - compile-time value of the `eventType` argument.
    Parameters:
      `eventType` - type of `StoreEvent` to listen (cannot be `null`).
      `listener` - listener to notify about events.

  - ### getFileSet

    public Optional<Resource.FileSet> getFileSet() throws DataStoreException
    Returns the list of band files and the `*_MTL​.txt` file.
    Specified by:
      `getFileSet` in interface `Resource`
    Returns:
      files used by this resource.
    Throws:
      `DataStoreException` - if an error occurred while preparing the set of files.

  - ### close

    public void close() throws DataStoreException
    Closes this Landsat store and releases any underlying resources. This method can be invoked asynchronously for interrupting a long reading process.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in class `DataStore`
    Throws:
      `DataStoreException` - if an error occurred while closing the Landsat file.
    See Also:
      - `StoreListeners​.close()`