# Interface WritableTiledResource

All Superinterfaces:
  `Resource`, `TiledResource`

public interface WritableTiledResource extends TiledResource
A `TiledResource` that can write and delete tile matrix sets.

All methods in this interface expect non-null arguments are return non-null values.

Since:
  1.2

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Resource

  `Resource​.FileSet`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WritableTileMatrixSet`
  `createTileMatrixSet(TileMatrixSet tiles)`
  Adds the given tile matrix set to this resource and returns a writable instance for later completion.
  `void`
  `deleteTileMatrixSet(String identifier)`
  Deletes a `TileMatrixSet` identified by the given name.
  `Collection<? extends WritableTileMatrixSet>`
  `getTileMatrixSets()`
  Returns the collection of all available tile matrix sets in this resource.

  ### Methods inherited from interface Resource

  `addListener, getFileSet, getIdentifier, getMetadata, removeListener`

- ## Method Details

  - ### getTileMatrixSets

    Collection<? extends WritableTileMatrixSet> getTileMatrixSets() throws DataStoreException
    Returns the collection of all available tile matrix sets in this resource. The returned collection is unmodifiable but live: additions or removals of tile matrix sets in this resource are reflected in the returned collection.
    Specified by:
      `getTileMatrixSets` in interface `TiledResource`
    Returns:
      an unmodifiable view of all `TileMatrixSet` instances in this resource.
    Throws:
      `DataStoreException` - if an error occurred while fetching the tile matrix sets.

  - ### createTileMatrixSet

    WritableTileMatrixSet createTileMatrixSet(TileMatrixSet tiles) throws DataStoreException
    Adds the given tile matrix set to this resource and returns a writable instance for later completion. Typically the given `TileMatrixSet` instance contains no tile and is used only as a template. If the `TileMatrixSet` is not empty, then the tiles that it contains are written immediately.

    This method returns a writable tile matrix set with the same tiles as the given `TileMatrixSet`. The identifier and the envelope of the returned set may be different, but the CRS and tiling scheme shall be equivalent with a tolerance for rounding errors.

    Parameters:
      `tiles` - the (potentially empty) tile matrix set to create.
    Returns:
      a writable tile matrix set to use for adding more tiles.
    Throws:
      `ReadOnlyStorageException` - if this resource is not writable. It may be caused by insufficient credentials.
      `IncompatibleResourceException` - if the given tile matrix set is incompatible with this resource.
      `DataStoreException` - if creating the tile matrix set failed for another reason.

  - ### deleteTileMatrixSet

    void deleteTileMatrixSet(String identifier) throws DataStoreException
    Deletes a `TileMatrixSet` identified by the given name. The given identifier shall be the `TileMatrixSet​.getIdentifier().toString()` value of the set to delete.
    Parameters:
      `identifier` - identifier of the `TileMatrixSet` to delete.
    Throws:
      `NoSuchDataException` - if there is no tile matrix set associated to the given identifier in this resource.
      `ReadOnlyStorageException` - if this resource is not writable. It may be caused by insufficient credentials.
      `DataStoreException` - if deleting the tile matrix set failed for another reason.