Class TileCacheManager

java.lang.Object
noaa.coastwatch.io.tile.TileCacheManager

public class TileCacheManager extends Object
The TileCacheManager class provides convenient access to the default tile cache.
Since:
3.3.1
Author:
Peter Hollemans
  • Field Details

    • DEFAULT_MAX_CACHE_SIZE_PROP

      public static final String DEFAULT_MAX_CACHE_SIZE_PROP
      The default tile maximum cache size property (specified in Mb).
      See Also:
  • Constructor Details

    • TileCacheManager

      protected TileCacheManager(TileCache cache)
      Creates a new manager backed by the specified cache.
      Parameters:
      cache - the cache to use for this manager.
  • Method Details

    • getInstance

      public static TileCacheManager getInstance()
      Gets the singleton instance of this class using the default cache tile class.
      Returns:
      the singleton instance.
    • getTile

      public TilingScheme.Tile getTile(TileSource source, TilingScheme.TilePosition pos) throws IOException
      Gets a tile from the cache for the specified source and position. If no tile is available in the cache with a matching source and position, the tile is read from the source and cached for the next call to this method.
      Parameters:
      source - the source for the tile data.
      pos - the position of the tile in the scheme.
      Returns:
      the tile specified.
      Throws:
      IOException - if there was an error reading the tile from the source.
    • requestTiles

      public void requestTiles(TileSource source, int[] start, int[] length, Observer observer)
      Starts a delivery operation for the specified tiles. If any tiles are not already in the cache, they are read asynchronously.
      Parameters:
      source - the tile source.
      start - the starting data coordinates as [row, column].
      length - the size of the data rectangle as [rows, columns].
      observer - the tile delivery observer to notify of tiles becoming available. If some tiles are available immediately with no delay, Observer.update (Observable, Object) is called with a null value for the Observable, and the tile for the Object for each tile (synchronously, before this method exits). For the remaining tiles that are only available after a delay, Observer.update (Observable, Object) is called with the TileDeliveryOperation as the Observable and the tile for the Object.
    • removeTilesForSource

      public void removeTilesForSource(TileSource source)
      Removes all the tiles in the cache from the specified source.
      Parameters:
      source - the tile source to remove all tiles.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception