ucar.nc2.util.cache
Interface FileCacheable

All Known Subinterfaces:
FeatureDataset, FeatureDatasetPoint, RadialDatasetSweep, StationRadialDataset, StationRadialDataset
All Known Implementing Classes:
AreaServiceProvider.MakeNetcdfFile, CdmRemote, CFnetCDF2Dataset, DODSNetcdfFile, Dorade2Dataset, FeatureDatasetImpl, FileCacheRaf.Raf, GempakGridServiceProvider.MakeNetcdfFile, GempakSoundingIOSP.MakeNetcdfFile, GempakSurfaceIOSP.MakeNetcdfFile, GridDataset, LevelII2Dataset, Netcdf2Dataset, NetcdfDataset, NetcdfFile, NetcdfFileWriteable, Nids2Dataset, PointDatasetImpl, PointDatasetRemote, RadialDatasetSweepAdapter, UF2Dataset, Vis5DIosp.MakeNetcdfFile

public interface FileCacheable

Interface for files that are cacheable.

Since:
Jun 2, 2008
Author:
caron

Method Summary
 void close()
          Close the FileCacheable, release all resources.
 String getLocation()
          The location of the FileCacheable, used only for debug and log messages.
 void setFileCache(FileCache fileCache)
          If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.close():
 boolean sync()
          Sync() is called when the FileCacheable is found in the cache, before returning the object to the application.
 

Method Detail

getLocation

String getLocation()
The location of the FileCacheable, used only for debug and log messages.

Returns:
location

close

void close()
           throws IOException
Close the FileCacheable, release all resources. Also must honor contract with setFileCache().

Throws:
IOException

sync

boolean sync()
             throws IOException
Sync() is called when the FileCacheable is found in the cache, before returning the object to the application. FileCacheable has an opportunity to freshen itself. FileCacheable mag ignore this call.

Returns:
true if FileCacheable was changed
Throws:
IOException - on i/o error.

setFileCache

void setFileCache(FileCache fileCache)
If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.close():
  public synchronized void close() throws java.io.IOException {
    if (isClosed) return;
    if (cache != null) {
      cache.release(this);
    } else {
      reallyClose();
    }
    isClosed = true;
   

Parameters:
fileCache - must store this, use it on close as above.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.