Class 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.
Author:
IDV development team
  • Field Details

    • PROP_IMAGETYPE

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

      public static final String TYPE_RADAR
      radar type
      See Also:
    • TYPE_SATELLITE

      public static final String TYPE_SATELLITE
      satellite type
      See Also:
    • PROP_BANDINFO

      public static final String PROP_BANDINFO
      satellite type
      See Also:
    • imageList

      protected List imageList
      list of images
    • imageTimes

      protected List imageTimes
      list of image times
  • Constructor Details

    • 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 Details

    • reloadData

      public void reloadData(Object object, Hashtable properties)
      Reload data
      Specified by:
      reloadData in interface DataSource
      Overrides:
      reloadData in class DataSourceImpl
      Parameters:
      object - the object to reload
      properties - the properties
    • setNewFiles

      public void setNewFiles(List files)
      Handle when this data source gets new files to use at runtime (e.g., from isl)
      Specified by:
      setNewFiles in interface DataSource
      Overrides:
      setNewFiles in class DataSourceImpl
      Parameters:
      files - List of files
    • updateState

      public void updateState(Object newObject, Hashtable newProperties)
      Update the state
      Specified by:
      updateState in interface DataSource
      Overrides:
      updateState in class DataSourceImpl
      Parameters:
      newObject - the new object
      newProperties - the new properties
    • 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
    • getDescriptor

      public AddeImageDescriptor getDescriptor(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.
      Parameters:
      object - May be an AddeImageDescriptor (for new bundles) or a String that is converted to an image descriptor.
      Returns:
      The image descriptor.
    • 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.
    • getDescriptorsToUse

      public List getDescriptorsToUse()
      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
    • 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 - AddeImageDescriptor
      rangeType - This is the sample rangeType. For the first image this is null and this method will immediately read the data
      fromSequence - from a sequence
      readLabel - the label
      Returns:
      The data.
      Throws:
      RemoteException - Java RMI problem
      VisADException - VisAD problem
    • reloadData

      public void reloadData()
      Reload the data
      Specified by:
      reloadData in interface DataSource
      Overrides:
      reloadData in class DataSourceImpl
    • getCacheDataToDisk

      public boolean getCacheDataToDisk()
      Get whether we should cache to disk
      Overrides:
      getCacheDataToDisk in class DataSourceImpl
      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 problem
      VisADException - VisAD problem
    • getDescriptors

      protected List getDescriptors(DataChoice dataChoice, DataSelection subset)
      Get a list of descriptors from the choice and subset
      Parameters:
      dataChoice - Data choice
      subset - subsetting info
      Returns:
      list of descriptors matching the selection
    • 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.
    • 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.
    • doRemove

      public void doRemove()
      Called when Datasource is removed.
      Specified by:
      doRemove in interface DataSource
      Overrides:
      doRemove in class DataSourceImpl