# Class GDALStore

Object
DataStore
GDALStore

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

public class GDALStore extends DataStore implements Aggregate
A data store using the GDAL library for all data accesses.

Since:
  1.5

- ## 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
  `GDALStore(GDALStoreProvider provider, StorageConnector connector)`
  Creates a new data store for reading the file specified by the given connector.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes this data store and releases any underlying resources.
  `Collection<? extends Resource>`
  `components()`
  Returns the children resources of this aggregate.
  `Driver`
  `getDriver()`
  Returns the GDAL driver used for opening the file.
  `Optional<Resource​.FileSet>`
  `getFileSet()`
  Returns an array of files believed to be part of this resource.
  `final Optional<GenericName>`
  `getIdentifier()`
  Returns an identifier for the root resource of this data store, or an empty value if none.
  `Metadata`
  `getMetadata()`
  Returns information about the data store as a whole.
  `Optional<ParameterValueGroup>`
  `getOpenParameters()`
  Returns the parameters used for opening this GDAL data store.
  `final GDALStoreProvider`
  `getProvider()`
  Returns the factory that created this `DataStore` instance.

  ### Methods inherited from class DataStore

  `addListener, findResource, getDisplayName, getLocale, getNativeMetadata, removeListener, setLocale, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Resource

  `addListener, removeListener`

- ## Constructor Details

  - ### GDALStore

    public GDALStore(GDALStoreProvider provider, StorageConnector connector) throws DataStoreException
    Creates a new data store for reading the file specified by the given connector. The `provider` argument is mandatory for this data store, because it provides the links to the GDAL library.
    Parameters:
      `provider` - the factory that created this `GDALStore` instance.
      `connector` - information about the storage. Should be convertible to a URL.
    Throws:
      `DataStoreException` - if an error occurred while creating the data store for the given storage.

- ## Method Details

  - ### getProvider

    public final GDALStoreProvider getProvider()
    Returns the factory that created this `DataStore` instance. The provider determines which GDAL library is used.
    Overrides:
      `getProvider` in class `DataStore`
    Returns:
      the factory that created this `DataStore` instance.
    See Also:
      - `DataStore​.provider`

  - ### getDriver

    public Driver getDriver() throws DataStoreException
    Returns the GDAL driver used for opening the file.
    Returns:
      the GDAL driver used for opening the file.
    Throws:
      `DataStoreException` - if this data store is closed.

  - ### getOpenParameters

    public Optional<ParameterValueGroup> getOpenParameters()
    Returns the parameters used for opening this GDAL data store. The parameters are described by `GDALStoreProvider​.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.
    Specified by:
      `getOpenParameters` in class `DataStore`
    Returns:
      parameters used for opening this data store.
    See Also:
      - `DataStoreProvider​.getOpenParameters()`

  - ### getFileSet

    public Optional<Resource.FileSet> getFileSet() throws DataStoreException
    Returns an array of files believed to be part of this resource.
    Specified by:
      `getFileSet` in interface `Resource`
    Returns:
      files used by this resource, or an empty value if unknown.
    Throws:
      `DataStoreException` - if the list of files cannot be obtained.
    "TODO:"
      This method is often used for copying a resources from one location to another. GDAL provides a `GDALCopyDatasetFiles` function for this purpose. That function is not yet used by Apache SIS.

  - ### getIdentifier

    public final Optional<GenericName> getIdentifier() throws DataStoreException
    Returns an identifier for the root resource of this data store, or an empty value if none.
    Specified by:
      `getIdentifier` in interface `Resource`
    Overrides:
      `getIdentifier` in class `DataStore`
    Returns:
      an identifier for the root resource of this data store.
    Throws:
      `DataStoreException` - if an error occurred while fetching the identifier.
    See Also:
      - `DataStore​.getMetadata()`
      - `DataStore​.getDisplayName()`

  - ### getMetadata

    public Metadata getMetadata() throws DataStoreException
    Returns information about the data store as a whole.
    Specified by:
      `getMetadata` in interface `Resource`
    Specified by:
      `getMetadata` in class `DataStore`
    Returns:
      information about resources in the data store.
    Throws:
      `DataStoreException` - if an error occurred while reading the metadata.
    See Also:
      - `DataStore​.getIdentifier()`
      - `DefaultMetadata​.deepCopy(Metadata)`

  - ### components

    public Collection<? extends Resource> components() throws DataStoreException
    Returns the children resources of this aggregate.
    Specified by:
      `components` in interface `Aggregate`
    Returns:
      the resources that are contained in this aggregate.
    Throws:
      `DataStoreException` - if an error occurred in a GDAL function.

  - ### close

    public void close() throws DataStoreException
    Closes this data store and releases any underlying resources. A
    invalid reference

        CloseEvent

    is sent to listeners before the data store is closed. Any attempt to use this store after closing will result in `DataStoreClosedException`.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in class `DataStore`
    Throws:
      `DataStoreException` - if an error occurred while closing this data store.
    See Also:
      - `StoreListeners​.close()`