ucar.unidata.data
Class FilesDataSource

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.data.DataSourceImpl
          extended by ucar.unidata.data.FilesDataSource
All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable
Direct Known Subclasses:
CDMProfilerDataSource, DemDataSource, DrawingDataSource, FrontDataSource, GeotiffDataSource, GridDataSource, ImageXmlDataSource, 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 Summary
protected  List adapters
          List of sources files
protected  String oldSourceFromBundles
          for unpersistence
protected  List sources
          List of sources files
 
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
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_TITLE
 
Constructor Summary
FilesDataSource()
          Default Constructor
FilesDataSource(DataSourceDescriptor descriptor)
           
FilesDataSource(DataSourceDescriptor descriptor, List newSources, String description, Hashtable properties)
          Ctor
FilesDataSource(DataSourceDescriptor descriptor, List newSources, String name, String description, Hashtable properties)
          Create a TrackDataSource from the specification given.
FilesDataSource(DataSourceDescriptor descriptor, String name, String description, Hashtable properties)
          Ctor
 
Method Summary
 void doRemove()
          Called when Datasource is removed.
 boolean equals(Object that)
          Are we equals
protected  String getDataFileExtension(String file)
          Get the file extension
 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
protected  String getFilePath()
          Get the first file path in the sources list
 String getFullDescription()
          get the detailed description
protected  List getInputStreams(List processedSources)
          Get a list of input streams, one for each given file
protected  List getLocationsForPolling()
          Get the location where we poll.
 String getPartialDescription()
          Return the human readable description of this DataSource
protected  String getSource()
          Get the string value of the first entry in the sources list
 List getSources()
          Get the source property (filename or URL).
 boolean haveSources()
          Do I have any sources
 void initAfterCreation()
          Initialize after we have been directly created
 void initAfterUnpersistence()
          Initialize after XML decoding.
protected  void initWithPollingInfo()
          Initialze sources from polling info
protected  boolean isFileBased()
          Are we getting data from a file or from server
 void newFilesFromPolling(List files)
          If we are polling some directory this method gets called when there is a new file.
protected  String processDataFilename(String filename, int index)
          Process the file name to get a file that we can use to write to local disk
protected  void propertiesChanged()
          The user changed the properties.
 void reloadData()
          Clear out and reinitialize the track
 void reloadData(Object object, Hashtable properties)
          Reload data
protected  List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks)
          Save the data source files to local disk
 void setNewFiles(List files)
          Used to change the files we use when loaded in from a bundle
 void setSource(String value)
          Set the list of sources to be a list containing the given value
 void setSources(List value)
          Set the sources property (filename or URL).
protected  void sourcesChanged()
          Something changed
 void updateState(Object newObject, Hashtable newProperties)
          This gets called when the user interactively does a Change data
 
Methods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addPropertiesTabs, addReloadTab, applyFieldMask, applyProperties, beginWritingDataToLocalDisk, canAddCurrentName, canCacheDataToDisk, canChangeData, canDoAllLevels, canDoFieldMask, canDoGeoSelection, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canSaveDataToLocalDisk, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertSourceFile, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeDataChoices, doMakeDateTimes, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllDateTimes, getAllLevels, getAllLevels, getAllTimesForTimeDriver, getCache, getCache, getCacheClearDelay, getCacheDataToDisk, getCompositeDataChoices, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDescription, getDescriptor, getErrorMessage, getEverChangedName, getExtraGeoSelectionComponent, getExtraTimesComponent, getFileFilterForPolling, getid, getIdv, getInError, getLocalDirectory, getLocationForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, 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, initDataChoice, initDataSelectionComponents, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeDerivedDataChoices, makeSaveLocalActions, newFileFromPolling, notifyDataChange, putCache, putCache, reloadProperties, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, saveDataToLocalDisk, saveDataToLocalDisk, selectTimesFromList, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, 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, writeFieldMaskFile
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, 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

sources

protected List sources
List of sources files


adapters

protected List adapters
List of sources files


oldSourceFromBundles

protected String oldSourceFromBundles
for unpersistence

Constructor Detail

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 Detail

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