ucar.unidata.data
Class CacheDataSource

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.data.DataSourceImpl
          extended by ucar.unidata.data.CacheDataSource
All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable

public class CacheDataSource
extends DataSourceImpl

Used to cache a data choice and its data

Version:
$Revision: 1.12 $
Author:
IDV development team

Nested Class Summary
static class CacheDataSource.DataChoiceHolder
          Class DataChoiceHolder holds a data chocie and a unique id and a name
 
Field Summary
static String PROP_DATA
          data property
static String PROP_DATACHOICE
          datachoice property
 
Fields inherited from class ucar.unidata.data.DataSourceImpl
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YES
 
Fields inherited from interface ucar.unidata.data.DataSource
MOST_RECENT, ordinalNames, PROP_AUTOCREATEDISPLAY, PROP_BASEDIRECTORY, PROP_CACHEABLE, PROP_DATACHOICENAME, PROP_DISPLAYPROPERTIES, PROP_DOCUMENTLINKS, PROP_FILEPATTERN, PROP_GEOLOCATION, PROP_ICON, PROP_NAME, PROP_POLLINFO, PROP_RESOLVERURL, PROP_SERVICE_HTTP, PROP_SUBPROPERTIES, PROP_TIMELABELS, PROP_TITLE
 
Constructor Summary
CacheDataSource()
          Default bean constructor; does nothing
CacheDataSource(DataSourceDescriptor descriptor, String name, Hashtable properties)
          Create a CacheDataSource
 
Method Summary
protected  void addActions(List actions)
          add menu actions
 void addDataChoice(DataChoice dataChoice, String name, Data data)
          Add a data choice into the list with the given name.
 void addDataChoice(DataChoice dataChoice, String name, Data data, DataSelection dataSelection)
          add the data choice
 void clearCachedData()
          clear the cache
 Object getCache(Object key)
          Get an Object from the cache.
 List getDataChoices()
          Get the DataChoices.
protected  Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties)
          Actually get the data identified by the given DataChoce.
 List getHolders()
          Get the Holders property.
 void putCache(Object key, Object value)
          Put the cache
 void removeCache(Object key)
          Remove an Object from the cache.
 void setHolders(List value)
          Set the Holders property.
 void writeIser()
          write out the iser file
 
Methods inherited from class ucar.unidata.data.DataSourceImpl
addDataChangeListener, addDataChoice, addPropertiesTabs, applyFieldMask, applyProperties, beginWritingDataToLocalDisk, canCacheDataToDisk, canChangeData, canDoFieldMask, canDoGeoSelection, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canSaveDataToLocalDisk, canShowParameter, checkForInitAfterUnPersistence, clearFileCache, clearTimes, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeDataChoices, doMakeDateTimes, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, doRemove, endWritingDataToLocalDisk, equals, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllDateTimes, getAllLevels, getAllLevels, getCacheClearDelay, getCacheDataToDisk, getCompositeDataChoices, getData, getData, getDataCachePath, getDataChangeListeners, getDataContext, getDataInner, getDataIsEditable, getDataPaths, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDescription, getDescriptor, getErrorMessage, getExtraGeoSelectionComponent, getFileFilterForPolling, getFullDescription, getid, getInError, getLocalDirectory, getLocationForPolling, getLocationsForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, getPartialDescription, getPassword, getPathsThatCanBeRelative, getPollingInfo, getProperties, getPropertiesComponents, getPropertiesHeader, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRelativePaths, getSampleDataProjection, getSaveDataFileLabel, getSelectedDateTimes, getSelectedDateTimes, getTimesFromDataSelection, getTmpPaths, getTypeName, getUserName, handlePropertiesAction, hasPollingInfo, holdsDateTimes, holdsIndices, identifiedBy, identifiedByName, incrOutstandingGetDataCalls, initAfter, initAfterCreation, initAfterUnpersistence, initDataChoice, initDataSelectionComponents, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeDerivedDataChoices, makeSaveLocalActions, newFileFromPolling, newFilesFromPolling, notifyDataChange, propertiesChanged, reloadData, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, saveDataToLocalDisk, saveDataToLocalDisk, saveDataToLocalDisk, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, setDescription, setDescriptor, setDirectory, setInError, setInError, setInError, setName, setNewFiles, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setTmpPaths, setUserName, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, updateState, writeFieldMaskFile, writeFieldMaskFile
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.unidata.data.DataSource
getUniqueId
 

Field Detail

PROP_DATACHOICE

public static final String PROP_DATACHOICE
datachoice property

See Also:
Constant Field Values

PROP_DATA

public static final String PROP_DATA
data property

See Also:
Constant Field Values
Constructor Detail

CacheDataSource

public CacheDataSource()
Default bean constructor; does nothing


CacheDataSource

public CacheDataSource(DataSourceDescriptor descriptor,
                       String name,
                       Hashtable properties)
Create a CacheDataSource

Parameters:
descriptor - the datasource descriptor
name - my name
properties - my properties
Method Detail

addActions

protected void addActions(List actions)
add menu actions

Overrides:
addActions in class DataSourceImpl
Parameters:
actions - list of actions

writeIser

public void writeIser()
write out the iser file


addDataChoice

public void addDataChoice(DataChoice dataChoice,
                          String name,
                          Data data)
Add a data choice into the list with the given name. If data is non-null then cache it

Parameters:
dataChoice - The datachoice
name - The name
data - The data to cache

addDataChoice

public void addDataChoice(DataChoice dataChoice,
                          String name,
                          Data data,
                          DataSelection dataSelection)
add the data choice

Parameters:
dataChoice - data choice
name - name
data - the data
dataSelection - data selection

clearCachedData

public void clearCachedData()
clear the cache

Specified by:
clearCachedData in interface DataSource
Overrides:
clearCachedData in class DataSourceImpl

putCache

public void putCache(Object key,
                     Object value)
Put the cache

Overrides:
putCache in class DataSourceImpl
Parameters:
key - key
value - value

getCache

public Object getCache(Object key)
Get an Object from the cache.

Overrides:
getCache in class DataSourceImpl
Parameters:
key - key for the object
Returns:
the key value, or null

removeCache

public void removeCache(Object key)
Remove an Object from the cache.

Overrides:
removeCache in class DataSourceImpl
Parameters:
key - key for the object

getDataInner

protected Data getDataInner(DataChoice dataChoice,
                            DataCategory category,
                            DataSelection dataSelection,
                            Hashtable requestProperties)
                     throws VisADException,
                            RemoteException
Description copied from class: DataSourceImpl
Actually get the data identified by the given DataChoce. The default is to call the getDataInner that does not take the requestProperties. This allows other, non unidata.data DataSource-s (that follow the old API) to work.

Overrides:
getDataInner in class DataSourceImpl
Parameters:
dataChoice - The data choice that identifies the requested data.
category - The data category of the request.
dataSelection - Identifies any subsetting of the data.
requestProperties - Hashtable that holds any detailed request properties.
Returns:
The data
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getDataChoices

public List getDataChoices()
Get the DataChoices.

Specified by:
getDataChoices in interface DataSource
Overrides:
getDataChoices in class DataSourceImpl
Returns:
List of DataChoices.

setHolders

public void setHolders(List value)
Set the Holders property.

Parameters:
value - The new value for Holders

getHolders

public List getHolders()
Get the Holders property.

Returns:
The Holders