ucar.unidata.data.imagery
Class ImageDataSource

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.data.DataSourceImpl
          extended by ucar.unidata.data.imagery.ImageDataSource
All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable
Direct Known Subclasses:
AddeImageDataSource, McIDASImageDataSource

public abstract class ImageDataSource
extends DataSourceImpl

Abstract DataSource class for images files.

Version:
$Revision: 1.76 $ $Date: 2007/08/20 22:33:05 $
Author:
IDV development team

Nested Class Summary
static class ImageDataSource.ImageDataInfo
          Class ImageDataInfo Holds an index and an AddeImageDescriptor
 
Field Summary
protected  List imageList
          list of images
protected  List imageTimes
          list of image times
static String PROP_BANDINFO
          satellite type
static String PROP_IMAGETYPE
          Type of image, radar or satellite.
static String TYPE_RADAR
          radar type
static String TYPE_SATELLITE
          satellite type
 
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
ImageDataSource()
          The parameterless constructor for unpersisting.
ImageDataSource(DataSourceDescriptor descriptor, ImageDataset ids, Hashtable properties)
          Create a new ImageDataSource with the given ImageDataset.
ImageDataSource(DataSourceDescriptor descriptor, List images, Hashtable properties)
          Create a new ImageDataSource with a list of (String) images.
ImageDataSource(DataSourceDescriptor descriptor, String[] images, Hashtable properties)
          Create a new ImageDataSource with a list of (String) images.
 
Method Summary
 boolean canCacheDataToDisk()
          Can this data source cache its
 boolean canSaveDataToLocalDisk()
          Is this data source capable of saving its data to local disk
 void doMakeDataChoices()
          Create the set of DataChoice that represent the data held by this data source.
 List doMakeDateTimes()
          Override the base class method to return the list of times we created.
 void doRemove()
          Called when Datasource is removed.
 boolean equals(Object o)
          Check to see if this ImageDataSource is equal to the object in question.
 List getAllDateTimes(DataChoice dataChoice)
          Override the base class method for the non composite choices.
 List getBandCategories()
          Return the list of DataCategory used for single time step data with band information.
 List getBandTimeSeriesCategories()
          Return the list of DataCategory used for multiple time step data with band information.
 List getCompositeDataChoices(CompositeDataChoice compositeDataChoice, List dataChoices)
          This is used when we are unbundled and we may have different times than when we were saved.
protected  Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties)
          Create the actual data represented by the given DataChoice.
 String getDataName()
          Get the name for the main data object
 List getDataPaths()
          Get the paths for saving data files
 String getFullDescription()
          Get an expanded description for the details display.
abstract  String getImageDataSourceName()
          A hook for the derived classes to return their specific name (eg, ADDE data source, McIDAS data source.
 List getImageList()
          Return the list of AddeImageDescriptors that define this data source.
protected  List getLocationsForPolling()
          Get the location where we poll.
 List getSelectedDateTimes(DataChoice dataChoice)
          Override the base class method for the non-composite choices.
 List getTwoDCategories()
          Return the list of DataCategory used for single time step data.
 List getTwoDTimeSeriesCategories()
          Return the list of DataCategory used for multiple time step data.
 int hashCode()
          Override the hashCode method.
 void initAfterUnpersistence()
          Override the init method for when this data source is unpersisted.
protected  boolean initDataFromPollingInfo()
          Method for intializing the data.
protected  boolean isFileBased()
          Are we getting images from a file or from adde
protected  SingleBandedImage makeImage(DataChoice dataChoice, DataSelection subset)
          Create the single image defined by the given dataChoice.
static ImageDataset makeImageDataset(String[] addeURLs)
          Make an ImageDataset from an array of ADDE URLs or AREA file names
static List makeImageDescriptors(String[] addeURLs)
          Make a list of image descriptors
protected  ImageSequence makeImageSequence(DataChoice dataChoice, DataSelection subset)
          Create the image sequence defined by the given dataChoice.
 void newFileFromPolling(File file)
          If we are polling some directory this method gets called when there is a new file.
protected  void propertiesChanged()
          The user changed the properties.
protected  List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks)
          Save files to local disk
 void setImageList(List l)
          Set the list of AddeImageDescriptors that define this data source.
 void updateState(Object newObject, Hashtable newProperties)
          Update the state
 
Methods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addPropertiesTabs, applyFieldMask, applyProperties, beginWritingDataToLocalDisk, canChangeData, canDoFieldMask, canDoGeoSelection, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllLevels, getAllLevels, getCache, getCacheClearDelay, getCacheDataToDisk, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDescription, getDescriptor, getErrorMessage, getExtraGeoSelectionComponent, getFileFilterForPolling, getid, getInError, getLocalDirectory, getLocationForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, getPartialDescription, getPassword, getPathsThatCanBeRelative, getPollingInfo, getProperties, getPropertiesComponents, getPropertiesHeader, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRelativePaths, getSampleDataProjection, getSaveDataFileLabel, getSelectedDateTimes, getTimesFromDataSelection, getTmpPaths, getTypeName, getUserName, handlePropertiesAction, hasPollingInfo, holdsDateTimes, holdsIndices, identifiedBy, identifiedByName, incrOutstandingGetDataCalls, initAfter, initAfterCreation, initDataChoice, initDataSelectionComponents, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeDerivedDataChoices, makeSaveLocalActions, newFilesFromPolling, notifyDataChange, putCache, reloadData, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, 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, 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, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.unidata.data.DataSource
getUniqueId
 

Field Detail

PROP_IMAGETYPE

public static final String PROP_IMAGETYPE
Type of image, radar or satellite. Set by the chooser to disambiguate between types

See Also:
Constant Field Values

TYPE_RADAR

public static final String TYPE_RADAR
radar type

See Also:
Constant Field Values

TYPE_SATELLITE

public static final String TYPE_SATELLITE
satellite type

See Also:
Constant Field Values

PROP_BANDINFO

public static final String PROP_BANDINFO
satellite type

See Also:
Constant Field Values

imageList

protected List imageList
list of images


imageTimes

protected List imageTimes
list of image times

Constructor Detail

ImageDataSource

public ImageDataSource()
The parameterless constructor for unpersisting.


ImageDataSource

public ImageDataSource(DataSourceDescriptor descriptor,
                       String[] images,
                       Hashtable properties)
Create a new ImageDataSource with a list of (String) images. These can either be AREA files or ADDE URLs.

Parameters:
descriptor - The descriptor for this data source.
images - Array of file anmes or urls.
properties - The properties for this data source.

ImageDataSource

public ImageDataSource(DataSourceDescriptor descriptor,
                       List images,
                       Hashtable properties)
Create a new ImageDataSource with a list of (String) images. These can either be AREA files or ADDE URLs.

Parameters:
descriptor - The descriptor for this data source.
images - Array of file anmes or urls.
properties - The properties for this data source.

ImageDataSource

public ImageDataSource(DataSourceDescriptor descriptor,
                       ImageDataset ids,
                       Hashtable properties)
Create a new ImageDataSource with the given ImageDataset. The dataset may hold eight AREA file filepaths or ADDE URLs.

Parameters:
descriptor - The descriptor for this data source.
ids - The dataset.
properties - The properties for this data source.
Method Detail

updateState

public void updateState(Object newObject,
                        Hashtable newProperties)
Description copied from class: DataSourceImpl
Update the state

Specified by:
updateState in interface DataSource
Overrides:
updateState in class DataSourceImpl
Parameters:
newObject - new object
newProperties - new properties to add

getDataPaths

public List getDataPaths()
Get the paths for saving data files

Specified by:
getDataPaths in interface DataSource
Overrides:
getDataPaths in class DataSourceImpl
Returns:
data paths

initAfterUnpersistence

public void initAfterUnpersistence()
Override the init method for when this data source is unpersisted. We simply check the imageList to see if this object came from a legacy bundle.

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

canCacheDataToDisk

public boolean canCacheDataToDisk()
Can this data source cache its

Overrides:
canCacheDataToDisk in class DataSourceImpl
Returns:
can cache data to disk

canSaveDataToLocalDisk

public boolean canSaveDataToLocalDisk()
Is this data source capable of saving its data to local disk

Specified by:
canSaveDataToLocalDisk in interface DataSource
Overrides:
canSaveDataToLocalDisk in class DataSourceImpl
Returns:
Can save to local disk

saveDataToLocalDisk

protected List saveDataToLocalDisk(String prefix,
                                   Object loadId,
                                   boolean changeLinks)
                            throws Exception
Save files to local disk

Overrides:
saveDataToLocalDisk in class DataSourceImpl
Parameters:
prefix - destination dir and file prefix
loadId - For JobManager
changeLinks - Change internal file references
Returns:
Files copied
Throws:
Exception - On badness

initDataFromPollingInfo

protected boolean initDataFromPollingInfo()
Method for intializing the data.

Returns:
result

propertiesChanged

protected void propertiesChanged()
The user changed the properties. Update me.

Overrides:
propertiesChanged in class DataSourceImpl

makeImageDataset

public static ImageDataset makeImageDataset(String[] addeURLs)
Make an ImageDataset from an array of ADDE URLs or AREA file names

Parameters:
addeURLs - array of ADDE URLs
Returns:
ImageDataset

makeImageDescriptors

public static List makeImageDescriptors(String[] addeURLs)
Make a list of image descriptors

Parameters:
addeURLs - array of ADDE URLs
Returns:
ImageDataset

getLocationsForPolling

protected List getLocationsForPolling()
Get the location where we poll.

Overrides:
getLocationsForPolling in class DataSourceImpl
Returns:
Directory to poll on.

isFileBased

protected boolean isFileBased()
Are we getting images from a file or from adde

Returns:
is the data from files

getCompositeDataChoices

public List getCompositeDataChoices(CompositeDataChoice compositeDataChoice,
                                    List dataChoices)
This is used when we are unbundled and we may have different times than when we were saved. Use the current set of data choices.

Specified by:
getCompositeDataChoices in interface DataSource
Overrides:
getCompositeDataChoices in class DataSourceImpl
Parameters:
compositeDataChoice - The composite
dataChoices - Its choices
Returns:
The current choices

getImageDataSourceName

public abstract String getImageDataSourceName()
A hook for the derived classes to return their specific name (eg, ADDE data source, McIDAS data source.

Returns:
The name of this data source.

getImageList

public List getImageList()
Return the list of AddeImageDescriptors that define this data source.

Returns:
The list of image descriptors.

setImageList

public void setImageList(List l)
Set the list of AddeImageDescriptors that define this data source.

Parameters:
l - The list of image descriptors.

doMakeDateTimes

public List doMakeDateTimes()
Override the base class method to return the list of times we created.

Overrides:
doMakeDateTimes in class DataSourceImpl
Returns:
The list of times held by this data source.

getTwoDCategories

public List getTwoDCategories()
Return the list of DataCategory used for single time step data.

Returns:
A list of categories.

getTwoDTimeSeriesCategories

public List getTwoDTimeSeriesCategories()
Return the list of DataCategory used for multiple time step data.

Returns:
A list of categories.

getBandCategories

public List getBandCategories()
Return the list of DataCategory used for single time step data with band information.

Returns:
A list of categories.

getBandTimeSeriesCategories

public List getBandTimeSeriesCategories()
Return the list of DataCategory used for multiple time step data with band information.

Returns:
A list of categories.

doMakeDataChoices

public void doMakeDataChoices()
Create the set of DataChoice that represent the data held by this data source. We create one top-level CompositeDataChoice that represents all of the image time steps. We create a set of children DirectDataChoice, one for each time step.

Overrides:
doMakeDataChoices in class DataSourceImpl

getDataInner

protected Data getDataInner(DataChoice dataChoice,
                            DataCategory category,
                            DataSelection dataSelection,
                            Hashtable requestProperties)
                     throws VisADException,
                            RemoteException
Create the actual data represented by the given DataChoice.

Overrides:
getDataInner in class DataSourceImpl
Parameters:
dataChoice - Either the CompositeDataChoice representing all time steps or a DirectDataChoice representing a single time step.
category - Not really used.
dataSelection - Defines any time subsets.
requestProperties - extra request properties
Returns:
The image or image sequence data.
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getAllDateTimes

public List getAllDateTimes(DataChoice dataChoice)
Override the base class method for the non composite choices.

Specified by:
getAllDateTimes in interface DataSource
Overrides:
getAllDateTimes in class DataSourceImpl
Parameters:
dataChoice - Either the CompositeDataChoice representing all time steps or a DirectDataChoice representing a single time step.
Returns:
The list of times represented by the given dataChoice.

getSelectedDateTimes

public List getSelectedDateTimes(DataChoice dataChoice)
Override the base class method for the non-composite choices.

Specified by:
getSelectedDateTimes in interface DataSource
Overrides:
getSelectedDateTimes in class DataSourceImpl
Parameters:
dataChoice - Either the CompositeDataChoice representing all time steps or a DirectDataChoice representing a single time step.
Returns:
The list of times represented by the given dataChoice.

makeImage

protected final SingleBandedImage makeImage(DataChoice dataChoice,
                                            DataSelection subset)
                                     throws VisADException,
                                            RemoteException
Create the single image defined by the given dataChoice.

Parameters:
dataChoice - The choice.
subset - any time subsets.
Returns:
The data.
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

makeImageSequence

protected ImageSequence makeImageSequence(DataChoice dataChoice,
                                          DataSelection subset)
                                   throws VisADException,
                                          RemoteException
Create the image sequence defined by the given dataChoice.

Parameters:
dataChoice - The choice.
subset - any time subsets.
Returns:
The image sequence.
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

equals

public boolean equals(Object o)
Check to see if this ImageDataSource is equal to the object in question.

Overrides:
equals in class DataSourceImpl
Parameters:
o - object in question
Returns:
true if they are the same or equivalent objects

hashCode

public int hashCode()
Override the hashCode method. Use name and imageList.

Overrides:
hashCode in class Object
Returns:
The hashcode.

doRemove

public void doRemove()
Called when Datasource is removed.

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

getDataName

public String getDataName()
Get the name for the main data object

Returns:
name of main data object

getFullDescription

public String getFullDescription()
Get an expanded description for the details display. Override base class implementation to add more info.

Specified by:
getFullDescription in interface DataSource
Overrides:
getFullDescription in class DataSourceImpl
Returns:
full description of this data source

newFileFromPolling

public void newFileFromPolling(File file)
If we are polling some directory this method gets called when there is a new file. We set the file name, clear our state, reload the metadata and tell listeners of the change.

Overrides:
newFileFromPolling in class DataSourceImpl
Parameters:
file - new File to use.