Package ucar.unidata.data.imagery
Class ImageDataSource
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.data.DataSourceImpl
ucar.unidata.data.imagery.ImageDataSource
- All Implemented Interfaces:
Sharable,DataSource,DataSourceFactory,XmlPersistable
- Direct Known Subclasses:
AddeImageDataSource,McIDASImageDataSource
Abstract DataSource class for images files.
- Author:
- IDV development team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass ImageDataInfo Holds an index and an AddeImageDescriptor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Listlist of imagesprotected Listlist of image timesstatic final Stringsatellite typestatic final StringType of image, radar or satellite.static final Stringradar typestatic final Stringsatellite typeFields inherited from class ucar.unidata.data.DataSourceImpl
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YESFields inherited from interface ucar.unidata.data.DataSource
DATAPATH_DATE_FORMAT, DATAPATH_DATE_PATTERN, 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_TIMESTRIDE, PROP_TITLE -
Constructor Summary
ConstructorsConstructorDescriptionThe parameterless constructor for unpersisting.ImageDataSource(DataSourceDescriptor descriptor, String[] images, Hashtable properties) Create a new ImageDataSource with a list of (String) images.ImageDataSource(DataSourceDescriptor descriptor, List images, Hashtable properties) Create a new ImageDataSource with a list of (String) images.ImageDataSource(DataSourceDescriptor descriptor, ImageDataset ids, Hashtable properties) Create a new ImageDataSource with the givenImageDataset. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCan this data source cache itsbooleanIs this data source capable of saving its data to local diskvoidCreate the set ofDataChoicethat represent the data held by this data source.Override the base class method to return the list of times we created.voiddoRemove()Called when Datasource is removed.booleanCheck to see if this ImageDataSource is equal to the object in question.getAllDateTimes(DataChoice dataChoice) Override the base class method for the non composite choices.Return the list ofDataCategoryused for single time step data with band information.Return the list ofDataCategoryused for multiple time step data with band information.booleanGet whether we should cache to diskgetCompositeDataChoices(CompositeDataChoice compositeDataChoice, List dataChoices) This is used when we are unbundled and we may have different times than when we were saved.protected DatagetDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Create the actual data represented by the givenDataChoice.Get the name for the main data objectGet the paths for saving data filesgetDescriptor(Object object) A utility method that helps us deal with legacy bundles that used to have String file names as the id of a data choice.protected ListgetDescriptors(DataChoice dataChoice, DataSelection subset) Get a list of descriptors from the choice and subsetReturn the list ofAddeImageDescriptors that define this data source.Get an expanded description for the details display.abstract StringA hook for the derived classes to return their specific name (eg, ADDE data source, McIDAS data source.Return the list ofAddeImageDescriptors that define this data source.protected ListGet the location where we poll.getSelectedDateTimes(DataChoice dataChoice) Override the base class method for the non-composite choices.Return the list ofDataCategoryused for single time step data.Return the list ofDataCategoryused for multiple time step data.inthashCode()Override the hashCode method.voidOverride the init method for when this data source is unpersisted.protected booleanMethod for intializing the data.protected booleanAre we getting images from a file or from addeprotected final SingleBandedImagemakeImage(DataChoice dataChoice, DataSelection subset) Create the single image defined by the given dataChoice.protected SingleBandedImagemakeImage(AddeImageDescriptor aid, MathType rangeType, boolean fromSequence, String readLabel) Create the single image defined by the given dataChoice.static ImageDatasetmakeImageDataset(String[] addeURLs) Make an ImageDataset from an array of ADDE URLs or AREA file namesstatic ListmakeImageDescriptors(String[] addeURLs) Make a list of image descriptorsprotected ImageSequencemakeImageSequence(DataChoice dataChoice, DataSelection subset) Create the image sequence defined by the given dataChoice.voidnewFileFromPolling(File file) If we are polling some directory this method gets called when there is a new file.protected voidThe user changed the properties.voidReload the datavoidreloadData(Object object, Hashtable properties) Reload dataprotected ListsaveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) Save files to local diskvoidsetImageList(List l) Set the list ofAddeImageDescriptors that define this data source.voidsetNewFiles(List files) Handle when this data source gets new files to use at runtime (e.g., from isl)voidupdateState(Object newObject, Hashtable newProperties) Update the stateMethods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addPropertiesTabs, addReloadTab, applyFieldMask, applyProperties, beginWritingDataToLocalDisk, canAddCurrentName, canChangeData, canDoAllLevels, canDoFieldMask, canDoGeoSelection, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertSourceFile, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllLevels, getAllLevels, getAllTimesForTimeDriver, getCache, getCache, getCacheClearDelay, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDefaultSave, getDescription, getDescriptor, getErrorMessage, getEverChangedName, getExtraGeoSelectionComponent, getExtraTimesComponent, getFileFilterForPolling, getid, getIdv, 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, putCache, reloadProperties, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, saveDataToLocalDisk, saveDataToLocalDisk, selectTimesFromList, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, setDefaultSave, setDescription, setDescriptor, setDirectory, setEverChangedName, setInError, setInError, setInError, setName, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setTmpPaths, setUserName, shouldCache, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFile, writeFieldMaskFileMethods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialogMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ucar.unidata.data.DataSource
getUniqueId
-
Field Details
-
PROP_IMAGETYPE
Type of image, radar or satellite. Set by the chooser to disambiguate between types- See Also:
-
TYPE_RADAR
radar type- See Also:
-
TYPE_SATELLITE
satellite type- See Also:
-
PROP_BANDINFO
satellite type- See Also:
-
imageList
list of images -
imageTimes
list of image times
-
-
Constructor Details
-
ImageDataSource
public ImageDataSource()The parameterless constructor for unpersisting. -
ImageDataSource
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
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
Create a new ImageDataSource with the givenImageDataset. 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 Details
-
reloadData
Reload data- Specified by:
reloadDatain interfaceDataSource- Overrides:
reloadDatain classDataSourceImpl- Parameters:
object- the object to reloadproperties- the properties
-
setNewFiles
Handle when this data source gets new files to use at runtime (e.g., from isl)- Specified by:
setNewFilesin interfaceDataSource- Overrides:
setNewFilesin classDataSourceImpl- Parameters:
files- List of files
-
updateState
Update the state- Specified by:
updateStatein interfaceDataSource- Overrides:
updateStatein classDataSourceImpl- Parameters:
newObject- the new objectnewProperties- the new properties
-
getDataPaths
Get the paths for saving data files- Specified by:
getDataPathsin interfaceDataSource- Overrides:
getDataPathsin classDataSourceImpl- 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:
initAfterUnpersistencein interfaceDataSource- Overrides:
initAfterUnpersistencein classDataSourceImpl
-
canCacheDataToDisk
public boolean canCacheDataToDisk()Can this data source cache its- Overrides:
canCacheDataToDiskin classDataSourceImpl- Returns:
- can cache data to disk
-
canSaveDataToLocalDisk
public boolean canSaveDataToLocalDisk()Is this data source capable of saving its data to local disk- Specified by:
canSaveDataToLocalDiskin interfaceDataSource- Overrides:
canSaveDataToLocalDiskin classDataSourceImpl- Returns:
- Can save to local disk
-
saveDataToLocalDisk
protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) throws Exception Save files to local disk- Overrides:
saveDataToLocalDiskin classDataSourceImpl- Parameters:
prefix- destination dir and file prefixloadId- For JobManagerchangeLinks- 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:
propertiesChangedin classDataSourceImpl
-
makeImageDataset
Make an ImageDataset from an array of ADDE URLs or AREA file names- Parameters:
addeURLs- array of ADDE URLs- Returns:
- ImageDataset
-
makeImageDescriptors
Make a list of image descriptors- Parameters:
addeURLs- array of ADDE URLs- Returns:
- ImageDataset
-
getLocationsForPolling
Get the location where we poll.- Overrides:
getLocationsForPollingin classDataSourceImpl- 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
-
getDescriptor
A utility method that helps us deal with legacy bundles that used to have String file names as the id of a data choice.- Parameters:
object- May be an AddeImageDescriptor (for new bundles) or a String that is converted to an image descriptor.- Returns:
- The image descriptor.
-
getCompositeDataChoices
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:
getCompositeDataChoicesin interfaceDataSource- Overrides:
getCompositeDataChoicesin classDataSourceImpl- Parameters:
compositeDataChoice- The compositedataChoices- Its choices- Returns:
- The current choices
-
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
Return the list ofAddeImageDescriptors that define this data source.- Returns:
- The list of image descriptors.
-
getDescriptorsToUse
Return the list ofAddeImageDescriptors that define this data source.- Returns:
- The list of image descriptors.
-
setImageList
Set the list ofAddeImageDescriptors that define this data source.- Parameters:
l- The list of image descriptors.
-
doMakeDateTimes
Override the base class method to return the list of times we created.- Overrides:
doMakeDateTimesin classDataSourceImpl- Returns:
- The list of times held by this data source.
-
getTwoDCategories
Return the list ofDataCategoryused for single time step data.- Returns:
- A list of categories.
-
getTwoDTimeSeriesCategories
Return the list ofDataCategoryused for multiple time step data.- Returns:
- A list of categories.
-
getBandCategories
Return the list ofDataCategoryused for single time step data with band information.- Returns:
- A list of categories.
-
getBandTimeSeriesCategories
Return the list ofDataCategoryused for multiple time step data with band information.- Returns:
- A list of categories.
-
doMakeDataChoices
public void doMakeDataChoices()Create the set ofDataChoicethat represent the data held by this data source. We create one top-levelCompositeDataChoicethat represents all of the image time steps. We create a set of childrenDirectDataChoice, one for each time step.- Overrides:
doMakeDataChoicesin classDataSourceImpl
-
getDataInner
protected Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException Create the actual data represented by the givenDataChoice.- Overrides:
getDataInnerin classDataSourceImpl- Parameters:
dataChoice- Either theCompositeDataChoicerepresenting all time steps or aDirectDataChoicerepresenting 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 problemVisADException- VisAD problem
-
getAllDateTimes
Override the base class method for the non composite choices.- Specified by:
getAllDateTimesin interfaceDataSource- Overrides:
getAllDateTimesin classDataSourceImpl- Parameters:
dataChoice- Either theCompositeDataChoicerepresenting all time steps or aDirectDataChoicerepresenting a single time step.- Returns:
- The list of times represented by the given dataChoice.
-
getSelectedDateTimes
Override the base class method for the non-composite choices.- Specified by:
getSelectedDateTimesin interfaceDataSource- Overrides:
getSelectedDateTimesin classDataSourceImpl- Parameters:
dataChoice- Either theCompositeDataChoicerepresenting all time steps or aDirectDataChoicerepresenting 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 problemVisADException- VisAD problem
-
makeImage
protected SingleBandedImage makeImage(AddeImageDescriptor aid, MathType rangeType, boolean fromSequence, String readLabel) throws VisADException, RemoteException Create the single image defined by the given dataChoice.- Parameters:
aid- AddeImageDescriptorrangeType- This is the sample rangeType. For the first image this is null and this method will immediately read the datafromSequence- from a sequencereadLabel- the label- Returns:
- The data.
- Throws:
RemoteException- Java RMI problemVisADException- VisAD problem
-
reloadData
public void reloadData()Reload the data- Specified by:
reloadDatain interfaceDataSource- Overrides:
reloadDatain classDataSourceImpl
-
getCacheDataToDisk
public boolean getCacheDataToDisk()Get whether we should cache to disk- Overrides:
getCacheDataToDiskin classDataSourceImpl- Returns:
- true
-
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 problemVisADException- VisAD problem
-
getDescriptors
Get a list of descriptors from the choice and subset- Parameters:
dataChoice- Data choicesubset- subsetting info- Returns:
- list of descriptors matching the selection
-
equals
Check to see if this ImageDataSource is equal to the object in question.- Overrides:
equalsin classDataSourceImpl- 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. -
getDataName
Get the name for the main data object- Returns:
- name of main data object
-
getFullDescription
Get an expanded description for the details display. Override base class implementation to add more info.- Specified by:
getFullDescriptionin interfaceDataSource- Overrides:
getFullDescriptionin classDataSourceImpl- Returns:
- full description of this data source
-
newFileFromPolling
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:
newFileFromPollingin classDataSourceImpl- Parameters:
file- new File to use.
-
doRemove
public void doRemove()Called when Datasource is removed.- Specified by:
doRemovein interfaceDataSource- Overrides:
doRemovein classDataSourceImpl
-