dods.servers.agg
Class AggDataset

java.lang.Object
  extended by dods.servers.agg.Dataset
      extended by dods.servers.agg.AggDataset
All Implemented Interfaces:
GuardedDataset

public class AggDataset
extends Dataset

This creates a logical dataset, by combining a list of Datasets specified in an "aggregation" element of an InvCatalog.Dataset. The Datasets may be other DODS Datasets (DODSDataset) or local netcdf files (NcDataset). Since they all implement Dataset interface, this is a Composite design pattern. Currently can do: Type 1: combine datasets, creating a new coordinate variable, one dataset per coord Type 2: combine all the variables in a set of datasets Type 3: combine datasets based on an existing coordinate variable,

Version:
$Id: AggDataset.java,v 1.3 2004/02/06 15:23:49 donm Exp $
Author:
John Caron

Nested Class Summary
static class AggDataset.AggFactory
          This is public as an artifact of implementing an interface.
 class AggDataset.AggFile
           
 
Method Summary
static Dataset acquire(String extPath, String intPath, InvCatalog.Dataset invDS)
          This finds the named dataset and gets a lock on it.
 void close()
           
 ArrayList getAggFiles()
           
static Iterator getCache()
           
static int getCacheSize()
          get current size of the cache.
protected  DDS getClientDDS()
           
 DAS getDAS()
          Get the DAS for this Dataset.
 String getDateFormat()
           
 ServerDDS getDDS()
          Get the DDS for this Dataset.
 AggDataset.AggFile getFileForVar(String varName)
           
 String getVariableName()
           
 void mapVarToFile(String varName, AggDataset.AggFile af)
           
 void release()
          Release the lock on this dataset.
static void setCacheMax(int maxCached)
          set the size of the open dataset cache.
static void setWaitTime(long wait)
          set maximum time to wait before opening another copy of the dataset.
 
Methods inherited from class dods.servers.agg.Dataset
acquire, attempt, getCatalogDataset, getExternalPath, getInternalPath, isLockedByMe, setDebug, whoHasLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setCacheMax

public static void setCacheMax(int maxCached)
set the size of the open dataset cache. Default is 100.


setWaitTime

public static void setWaitTime(long wait)
set maximum time to wait before opening another copy of the dataset.

Parameters:
wait - : time in msec

getCacheSize

public static int getCacheSize()
get current size of the cache.


getCache

public static Iterator getCache()

acquire

public static Dataset acquire(String extPath,
                              String intPath,
                              InvCatalog.Dataset invDS)
                       throws IOException
This finds the named dataset and gets a lock on it. This is the only way to obtain an AggDataset object. WARNING: you better call ds.release() when you are done or you are SOL!!!

Parameters:
extPath - : external URL of dataset
intPath - : internal URL of dataset
invDS - : InvCatalog.Dataset object
Returns:
locked dataset
Throws:
IOException

release

public void release()
Release the lock on this dataset.

Specified by:
release in interface GuardedDataset
Overrides:
release in class Dataset

getDDS

public ServerDDS getDDS()
Description copied from interface: GuardedDataset
Get the DDS for this Dataset.

Specified by:
getDDS in interface GuardedDataset
Specified by:
getDDS in class Dataset
Returns:
the ServerDDS

getDAS

public DAS getDAS()
Description copied from interface: GuardedDataset
Get the DAS for this Dataset.

Specified by:
getDAS in interface GuardedDataset
Specified by:
getDAS in class Dataset
Returns:
the DAS

getAggFiles

public ArrayList getAggFiles()

getClientDDS

protected DDS getClientDDS()
Specified by:
getClientDDS in class Dataset

getVariableName

public String getVariableName()

getDateFormat

public String getDateFormat()

close

public void close()
Specified by:
close in class Dataset

mapVarToFile

public void mapVarToFile(String varName,
                         AggDataset.AggFile af)

getFileForVar

public AggDataset.AggFile getFileForVar(String varName)