Class FilesDataSource

All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable
Direct Known Subclasses:
CDMProfilerDataSource, DemDataSource, DrawingDataSource, FrontDataSource, GeotiffDataSource, GridDataSource, ImageXmlDataSource, JsonDataSource, KmlDataSource, MovieDataSource, PlaceFileDataSource, PointCloudDataSource, PointDataSource, RadarDataSource, SerializedDataSource, ShapeFileDataSource, TextDataSource, TextProductDataSource, TrackDataSource, VisadDataSource

public abstract class FilesDataSource extends DataSourceImpl
A data source for balloon and aircraft tracks
Version:
$Revision: 1.26 $ $Date: 2007/06/21 12:30:01 $
Author:
IDV Development Team
  • Field Details

    • sources

      protected List sources
      List of sources files
    • adapters

      protected List adapters
      List of sources files
    • oldSourceFromBundles

      protected String oldSourceFromBundles
      for unpersistence
  • Constructor Details

    • FilesDataSource

      public FilesDataSource()
      Default Constructor
    • FilesDataSource

      public FilesDataSource(DataSourceDescriptor descriptor)
    • FilesDataSource

      public FilesDataSource(DataSourceDescriptor descriptor, String name, String description, Hashtable properties)
      Ctor
      Parameters:
      descriptor - The descriptor
      name - The name
      description - The long name
      properties - properties
    • FilesDataSource

      public FilesDataSource(DataSourceDescriptor descriptor, List newSources, String description, Hashtable properties)
      Ctor
      Parameters:
      descriptor - The descriptor
      newSources - List of files or urls
      description - The long name
      properties - properties
    • FilesDataSource

      public FilesDataSource(DataSourceDescriptor descriptor, List newSources, String name, String description, Hashtable properties)
      Create a TrackDataSource from the specification given.
      Parameters:
      descriptor - data source descriptor
      newSources - List of sources of data (filename/URL)
      name - my name
      description - description of the data
      properties - extra properties for initialization
  • Method Details

    • getDataPaths

      public List getDataPaths()
      Get the file paths (or urls or whatever) that are to be changed when we are unpersisted and are in data relative mode
      Specified by:
      getDataPaths in interface DataSource
      Overrides:
      getDataPaths in class DataSourceImpl
      Returns:
      file paths to changed
    • isFileBased

      protected boolean isFileBased()
      Are we getting data from a file or from server
      Returns:
      is the data from files
    • getDataFileExtension

      protected String getDataFileExtension(String file)
      Get the file extension
      Parameters:
      file - The file
      Returns:
      its extension
    • processDataFilename

      protected String processDataFilename(String filename, int index)
      Process the file name to get a file that we can use to write to local disk
      Parameters:
      filename - Filename
      index - Which file it it. This can be used by derived classes to add more info to the file name
      Returns:
      The processed filename
    • saveDataToLocalDisk

      protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) throws Exception
      Save the data source files to local disk
      Overrides:
      saveDataToLocalDisk in class DataSourceImpl
      Parameters:
      prefix - The directory prefix and unique file prefix
      loadId - For stopping the load through the JobManager
      changeLinks - Should this data source also change its internal data references
      Returns:
      List of the files that were written
      Throws:
      Exception - On badness
    • getInputStreams

      protected List getInputStreams(List processedSources) throws Exception
      Get a list of input streams, one for each given file
      Parameters:
      processedSources - The sources
      Returns:
      List of input streams
      Throws:
      Exception - On badness
    • initAfterCreation

      public void initAfterCreation()
      Initialize after we have been directly created
      Specified by:
      initAfterCreation in interface DataSource
      Overrides:
      initAfterCreation in class DataSourceImpl
    • getPartialDescription

      public String getPartialDescription()
      Return the human readable description of this DataSource
      Specified by:
      getPartialDescription in interface DataSource
      Overrides:
      getPartialDescription in class DataSourceImpl
      Returns:
      the description
    • getFullDescription

      public String getFullDescription()
      get the detailed description
      Specified by:
      getFullDescription in interface DataSource
      Overrides:
      getFullDescription in class DataSourceImpl
      Returns:
      description
    • haveSources

      public boolean haveSources()
      Do I have any sources
      Returns:
      Has sources
    • initAfterUnpersistence

      public void initAfterUnpersistence()
      Initialize after XML decoding.
      Specified by:
      initAfterUnpersistence in interface DataSource
      Overrides:
      initAfterUnpersistence in class DataSourceImpl
    • updateState

      public void updateState(Object newObject, Hashtable newProperties)
      This gets called when the user interactively does a Change data
      Specified by:
      updateState in interface DataSource
      Overrides:
      updateState in class DataSourceImpl
      Parameters:
      newObject - The new data object. May be a string or a list
      newProperties - new properties
    • initWithPollingInfo

      protected void initWithPollingInfo()
      Initialze sources from polling info
    • propertiesChanged

      protected void propertiesChanged()
      The user changed the properties. Reinitialize from polling info if we have it
      Overrides:
      propertiesChanged in class DataSourceImpl
    • setNewFiles

      public void setNewFiles(List files)
      Used to change the files we use when loaded in from a bundle
      Specified by:
      setNewFiles in interface DataSource
      Overrides:
      setNewFiles in class DataSourceImpl
      Parameters:
      files - Files to use
    • sourcesChanged

      protected void sourcesChanged()
      Something changed
    • reloadData

      public void reloadData(Object object, Hashtable properties)
      Description copied from class: DataSourceImpl
      Reload data
      Specified by:
      reloadData in interface DataSource
      Overrides:
      reloadData in class DataSourceImpl
      Parameters:
      object - the object
      properties - the properties
    • getLocationsForPolling

      protected List getLocationsForPolling()
      Get the location where we poll.
      Overrides:
      getLocationsForPolling in class DataSourceImpl
      Returns:
      Directory to poll on.
    • newFilesFromPolling

      public void newFilesFromPolling(List files)
      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:
      newFilesFromPolling in class DataSourceImpl
      Parameters:
      files - New files
    • doRemove

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

      public void reloadData()
      Clear out and reinitialize the track
      Specified by:
      reloadData in interface DataSource
      Overrides:
      reloadData in class DataSourceImpl
    • getFilePath

      protected String getFilePath()
      Get the first file path in the sources list
      Returns:
      file path
    • setSources

      public void setSources(List value)
      Set the sources property (filename or URL). Used by persistence
      Parameters:
      value - data sources
    • getSources

      public List getSources()
      Get the source property (filename or URL). Used by persistence
      Returns:
      data source
    • getSource

      protected String getSource()
      Get the string value of the first entry in the sources list
      Returns:
      The first source
    • setSource

      public void setSource(String value)
      Set the list of sources to be a list containing the given value
      Parameters:
      value - value
    • equals

      public boolean equals(Object that)
      Are we equals
      Overrides:
      equals in class DataSourceImpl
      Parameters:
      that - that
      Returns:
      is equals