thredds.inventory
Interface CollectionManager

All Known Implementing Classes:
DatasetCollectionFromCatalog, DatasetCollectionManager

public interface CollectionManager

Manages a dynamic collection of MFile objects. Allows storing key/value pairs on MFiles. An MFile must have the property that

  NetcdfDataset.open(MFile.getPath, ...); 
should work.

Since:
Jan 19, 2010
Author:
caron

Method Summary
 void close()
          release any resources
 Date extractRunDate(MFile mfile)
          Use the date extractor to extract the date from the filename
 String getCollectionName()
           
 List<MFile> getFiles()
          Get the current collection of MFile, since last scan or rescan.
 long getLastChanged()
          Get the last time files changed
 long getLastScanned()
          Get the last time scanned
 byte[] getMetadata(MFile file, String key)
           
 TimeUnit getRecheck()
          Get how often to rescan
 String getRoot()
          Get common root of all MFiles in the collection - may be null
 boolean isRescanNeeded()
          Compute if rescan is needed.
 void putMetadata(MFile file, String key, byte[] value)
           
 boolean rescan()
          Rescan directories.
 void resetProto()
           
 void scan(CancelTask cancelTask)
          Scan the directory(ies) and create MFile objects.
 

Method Detail

getCollectionName

String getCollectionName()

scan

void scan(CancelTask cancelTask)
          throws IOException
Scan the directory(ies) and create MFile objects. Get the results from getFiles()

Parameters:
cancelTask - allow user to cancel
Throws:
IOException - if io error

isRescanNeeded

boolean isRescanNeeded()
Compute if rescan is needed.

Returns:
true if rescan is needed.

rescan

boolean rescan()
               throws IOException
Rescan directories. Files may be deleted or added. If the MFile already exists in the current list, leave it in the list. If returns true, get the results from getFiles(), otherwise nothing has changed.

Returns:
true if anything actually changed.
Throws:
IOException - on I/O error

resetProto

void resetProto()

getRecheck

TimeUnit getRecheck()
Get how often to rescan

Returns:
time duration of rescan period, or null if none.

getLastScanned

long getLastScanned()
Get the last time scanned

Returns:
msecs since 1970

getLastChanged

long getLastChanged()
Get the last time files changed

Returns:
msecs since 1970

getRoot

String getRoot()
Get common root of all MFiles in the collection - may be null

Returns:
msecs since 1970

getFiles

List<MFile> getFiles()
Get the current collection of MFile, since last scan or rescan.

Returns:
current list of MFile, sorted by name

extractRunDate

Date extractRunDate(MFile mfile)
Use the date extractor to extract the date from the filename

Parameters:
mfile - extract from here
Returns:
Date, or null if none

close

void close()
release any resources


putMetadata

void putMetadata(MFile file,
                 String key,
                 byte[] value)

getMetadata

byte[] getMetadata(MFile file,
                   String key)


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