public class DataSourceImpl extends SharableImpl implements DataSource, DataSourceFactory, XmlPersistable
This class is thread-compatible but not thread-safe. Concurrent access to instances of this class should be externally symchronized by the client.
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.JCheckBox |
changeDataPathsCbx
change data paths checkbox
|
protected java.lang.Object |
dataCacheKey
Use this so this object is unique in the data cache
|
protected java.util.List<DataChoice> |
dataChoices
List of associated DataChoices
|
protected GeoSelectionPanel |
geoSelectionPanel
geoselection panel
|
protected boolean |
haveBeenUnPersisted
Has this data source been created from a bundle
|
protected boolean |
okToContinue
flag for continuation
|
static int |
PARAM_SHOW_HIDE
flag for hiding a parameter
|
static int |
PARAM_SHOW_NO
flag for hiding a parameter
|
static int |
PARAM_SHOW_YES
flag for showing a parameter
|
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 and Description |
|---|
DataSourceImpl()
Bean constructor
|
DataSourceImpl(DataSourceDescriptor descriptor)
Create a DataSourceImpl
|
DataSourceImpl(DataSourceDescriptor descriptor,
java.lang.String name,
java.lang.String description,
java.util.Hashtable properties)
Create this DataSourceImpl, setting the dataContext, name and description
attributes.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addActions(java.util.List actions)
Get any
Action-s associated with this DataSource. |
void |
addDataChangeListener(DataChangeListener listener)
Add the data change listener
|
protected void |
addDataChoice(DataChoice choice)
Insert the new DataChoice into the dataChoice list.
|
void |
addPropertiesTabs(javax.swing.JTabbedPane tabbedPane)
Add any extra tabs into the properties tab
|
protected void |
addReloadTab(javax.swing.JTabbedPane tabbedPane)
Add a reload tab
|
protected void |
applyFieldMask(org.w3c.dom.Element root)
Load any parameter nodes in the given mask xml
|
boolean |
applyProperties()
Apply properties components
|
protected java.lang.Object |
beginWritingDataToLocalDisk(java.lang.String msg)
Start the JobManager load dialog
|
boolean |
canAddCurrentName(DataChoice dataChoice)
Can we add the data choice name to the global list of parameter names (used in the station model editor)
|
boolean |
canCacheDataToDisk()
Can this data source cache its
|
boolean |
canChangeData()
Can the data be changed? Subclasses should override if they can't.
|
boolean |
canDoAllLevels()
Can this handle "All levels"?
|
protected boolean |
canDoFieldMask()
Can this do a field mask?
|
boolean |
canDoGeoSelection()
Can this datasource do the geoselection subsetting and decimation
|
protected boolean |
canDoGeoSelectionMap()
Used for the geo subsetting property gui as to whether to
show the map selection or not
|
protected boolean |
canDoGeoSelectionStride()
Used for the geo subsetting property gui as to whether to
show the stride or not
|
boolean |
canPoll()
See if this data source can poll
|
boolean |
canSaveDataToLocalDisk()
Is this data source capable of saving its data to local disk
|
int |
canShowParameter(java.lang.String name)
Should we show the given parameter name
|
protected void |
checkForInitAfterUnPersistence()
some method to initialize
|
void |
clearCachedData()
This is called when the CacheManager detects the need ot clear memory.
|
protected void |
clearFileCache()
Clear the cache
|
void |
clearTimes()
Clear the times list
|
java.lang.String |
convertSourceFile(java.lang.String source)
If this datasource has an ncml template this method will wrap the actual data file in ncml and return the ncml
|
protected java.util.List |
convertToFilesIfDirectory(java.util.List sources)
If the given list is of size 1 and it is a directory
then find all files in the directory that match
the filePatternForPolling and return them.
|
void |
createAutoDisplay(java.lang.String displayType,
DataContext dataContext)
Automatically create the given display on initialization.
|
protected java.lang.Object |
createCacheKey(DataChoice dataChoice,
DataSelection dataSelection,
java.util.Hashtable requestProperties)
Utility to create the key used when caching
|
org.w3c.dom.Element |
createElement(XmlEncoder encoder)
Create the XML element for persisting this DataSource
|
static void |
decrOutstandingGetDataCalls()
Decrement the static count of get data calls
|
protected java.io.File |
doDirectory(java.io.File file)
Deprecated.
Use loadLatestFile
|
protected void |
doMakeDataChoices()
A stub for the derived classes to overwrite.
|
protected java.util.List |
doMakeDateTimes()
A stub for the derived classes to overwrite.
|
GeoSelectionPanel |
doMakeGeoSelectionPanel()
Make the subset component
|
GeoSelectionPanel |
doMakeGeoSelectionPanel(boolean forProperties)
Make the geoselection panel
|
GeoSelectionPanel |
doMakeGeoSelectionPanel(boolean forProperties,
GeoSelection geoSelection)
Make the geoselection panel
|
protected javax.swing.JComponent |
doMakeGeoSubsetPropertiesComponent()
Make the geo subset properties component
|
void |
doRemove()
Gets called by the
DataManager when this DataSource has
been removed. |
protected void |
endWritingDataToLocalDisk(java.lang.Object loadId)
Stop the JobManager load dialog
|
boolean |
equals(java.lang.Object o)
See if the Object in question is equal to this DataSource.
|
void |
expandIfNeeded(CompositeDataChoice cdc)
Gets called by the DataSelection tree gui when a CompositeDataChoice
is first opened.
|
DataChoice |
findDataChoice(java.lang.Object id)
Search through the list of DataChoice-s and return the
DataChoice object whose id equals the given id parameter.
|
java.util.List |
findDataChoices(java.lang.Object id)
Search through the list of DataChoice-s and return the
DataChoice object whose id equals the given id parameter.
|
protected void |
flushCache()
Flush the data cache for this DataSource
|
java.util.List |
getAbsoluteDateTimes(java.util.List selected)
Get the absolute times.
|
java.util.List |
getActions()
Get any
Action-s associated with this DataSource. |
java.lang.String |
getAlias()
Get the Alias property.
|
java.util.List |
getAllDateTimes()
Return an array of DateTimes representing all the times
in the DataSource.
|
java.util.List |
getAllDateTimes(DataChoice dataChoice)
Get all the times for the given DataChoice
|
java.util.List |
getAllLevels(DataChoice dataChoice)
Get the list of all levels available from this DataSource
|
java.util.List |
getAllLevels(DataChoice dataChoice,
DataSelection dataSelection)
Get all of the levels
|
protected java.util.List<visad.DateTime> |
getAllTimesForTimeDriver(DataChoice dataChoice,
DataSelection selection,
java.util.List<visad.DateTime> timeDriverTimes)
Get the list of times to compare to the time driver times
|
java.lang.Object |
getCache(java.lang.Object key)
Get an Object from the cache.
|
java.lang.Object |
getCache(java.lang.Object key,
boolean force)
Get an Object from the cache.
|
long |
getCacheClearDelay()
Get the CacheClearDelay property.
|
boolean |
getCacheDataToDisk()
Get the CacheFlatFields property.
|
java.util.List |
getCompositeDataChoices(CompositeDataChoice compositeDataChoice,
java.util.List dataChoices)
This is called by the composite data choice to update the list of children.
|
visad.Data |
getData(DataChoice dataChoice,
DataCategory category,
DataSelection incomingDataSelection,
java.util.Hashtable requestProperties)
Get the data applicable to the DataChoice and selection criteria.
|
visad.Data |
getData(DataChoice dataChoice,
DataCategory dataCategory,
java.util.Hashtable requestProperties)
Get the data applicable to the DataChoice and selection criteria.
|
java.lang.String |
getDataCachePath()
Where do we write cached data to
|
protected java.util.List |
getDataChangeListeners()
Get the data change listeners
|
java.util.List |
getDataChoices()
This will lazily create the actual list of DataChoice-s
with a call to doMakeDataChoices which creates the
DataChoice objects concretely defined by this DataSource (e.g., the
fields within an netCdf file).
|
DataContext |
getDataContext()
Get the
DataContext for this DataSource. |
protected visad.Data |
getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection)
Have this one around for other, non-unidata, datasource implementations.
|
protected visad.Data |
getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection,
java.util.Hashtable requestProperties)
Actually get the data identified by the given DataChoce.
|
boolean |
getDataIsEditable()
Get the DataIsEditable property.
|
java.util.List |
getDataPaths()
Get the file paths (or urls or whatever) that are to be changed
when we re unpersisted and are in data editable mode
|
protected java.lang.String |
getDataPrefix()
Get the file prefix to use for when saving data to local disk
|
DataSelection |
getDataSelection()
Return the DataSelection for this DataSource.
|
java.util.List<DataSelectionComponent> |
getDataSelectionComponents(DataChoice dataChoice)
A hook to allow this data source to add data selection components
to the IDV field selector
|
DataSource |
getDataSource()
This is the method defined for the DataSourceFactory interface.
|
static java.util.List |
getDateTimes(java.util.List selected,
java.util.List allTimes)
A utility method that returns a list of times.
|
java.util.List |
getDateTimeSelection()
Return the list of times held by the DataSelection member.
|
boolean |
getDefaultSave()
Gets the default save.
|
java.lang.String |
getDescription()
Return the human readable description of this DataSource
|
DataSourceDescriptor |
getDescriptor()
Get the
DataSourceDescriptor for this DataSource. |
java.lang.String |
getErrorMessage()
Get the error message (if there is one) or create one.
|
boolean |
getEverChangedName()
Get the EverChangedName property.
|
protected javax.swing.JComponent |
getExtraGeoSelectionComponent()
Return the extra component for the geo selection panel.
|
protected javax.swing.JComponent |
getExtraTimesComponent()
This gets pu at the bottom of the times properties tab
|
protected javax.swing.filechooser.FileFilter |
getFileFilterForPolling()
Return the file fitler that the polling info uses.
|
java.lang.String |
getFullDescription()
Get the full description for this data source.
|
java.lang.String |
getid()
Get a unique id for this DataSource
|
IntegratedDataViewer |
getIdv()
Get the IDV
|
boolean |
getInError()
Return whether this DataSource is in error
|
protected java.lang.String |
getLocalDirectory(java.lang.String label,
java.lang.String prefix)
Get the directory to write the localized data files to
|
protected java.io.File |
getLocationForPolling()
Get the location, either a file or a directory, that is where we poll on.
|
protected java.util.List |
getLocationsForPolling()
Get the locations to use for polling
|
protected java.util.List |
getMostRecentFiles(java.io.File dir,
int cnt)
Find the most recent cnt number of files in the given directory
that match the fileFIlterForPolling
|
java.lang.String |
getName()
Returns the human readable name of this DataSource.
|
static java.lang.String |
getNameForDataSource(DataSource ds,
int length,
boolean alwaysDoIt)
A helper method to find the label to use for the given
DataSource. |
boolean |
getNeedToShowErrorToUser()
Should we show the error to the user.
|
int |
getNextId()
A unique identifier for DataSource objects.
|
static int |
getOutstandingGetDataCalls()
How many get data calls are we currently waiting on
|
java.lang.String |
getPartialDescription()
Return the human readable description of this DataSource
|
java.lang.String |
getPassword()
Get the Password property.
|
java.util.List |
getPathsThatCanBeRelative()
Return the paths that can be saved off relative to wehre the bundle is.
|
PollingInfo |
getPollingInfo()
Get the PollingInfo property.
|
java.util.Hashtable |
getProperties()
Get the associated properties
|
void |
getPropertiesComponents(java.util.List comps)
Add the gui components into the list for the properties dialog
|
protected javax.swing.JComponent |
getPropertiesHeader(java.lang.String label)
Utility to create a header for the properties dialog
|
java.lang.Object |
getProperty(java.lang.String name)
Get a property.
|
boolean |
getProperty(java.lang.String name,
boolean dflt)
Get the named boolean property
|
double |
getProperty(java.lang.String name,
double dflt)
Get the named double property
|
int |
getProperty(java.lang.String name,
int dflt)
Get the named int property
|
long |
getProperty(java.lang.String name,
long dflt)
Get the named long property
|
java.lang.Object |
getProperty(java.lang.String name,
java.lang.Object dflt)
Get the object property
|
java.lang.String |
getProperty(java.lang.String name,
java.lang.String dflt)
Get the named String property.
|
java.util.List |
getRelativePaths()
Get the RelativePaths property.
|
protected ucar.unidata.geoloc.ProjectionImpl |
getSampleDataProjection()
Used for the geo subsetting property gui
|
protected java.lang.String |
getSaveDataFileLabel()
Get the save data to a file label
|
java.util.List |
getSelectedDateTimes()
Get the list of selected times.
|
java.util.List |
getSelectedDateTimes(DataChoice dataChoice)
Get the selected times for the given DataChoice.
|
protected java.util.List |
getTimesFromDataSelection(DataSelection givenDataSelection,
DataChoice dataChoice)
If givenDataSelection is non-null and has a non-null
times list then return that.
|
java.util.List |
getTmpPaths()
Get the TmpPaths property.
|
java.lang.String |
getTypeName()
Get the type name for this DataSource
|
java.lang.String |
getUserName()
Get the UserName property.
|
void |
handlePropertiesAction(java.lang.String cmd)
Handle the properties action
|
protected boolean |
hasPollingInfo()
Do we have polling info object
|
static boolean |
holdsDateTimes(java.util.List selectedTimes)
See if the selection list is a set of times or indices
|
static boolean |
holdsIndices(java.util.List selectedTimes)
A utility to determine whether the given list holds a set of Integer
indices.
|
boolean |
identifiedBy(java.lang.Object definingObject)
See if this DataSource is identified by the definingObject.
|
boolean |
identifiedByName(java.lang.String name)
Is this datasource identified by the given label.
|
static void |
incrOutstandingGetDataCalls()
Increment the static count of get data calls
|
protected void |
initAfter()
Init after
|
void |
initAfterCreation()
Gets called after creation.
|
void |
initAfterUnpersistence()
Implement the XmlPersistable interface method that is called after
this object has been fully created and initialized after being
unpersisted by the XmlEncoder.
|
void |
initDataChoice(DataChoice dataChoice)
Sets the global id of the given dataChoice to be a per process
unique string value.
|
protected void |
initDataSelectionComponents(java.util.List<DataSelectionComponent> components,
DataChoice dataChoice)
Add any data selection components
|
boolean |
initFromXml(XmlEncoder encoder,
org.w3c.dom.Element element)
Initialize this from XML
|
protected boolean |
isPolling()
Are we currently polling.
|
protected void |
loadFieldMask()
Check to see if there is a field maskfile defined.
|
protected void |
loadFieldMask(java.lang.String maskFile)
Load the field mask
|
protected java.io.File |
loadLatestFile(java.io.File file)
Load the latest file.
|
void |
logException(java.lang.String msg,
java.lang.Exception exc)
Shortcut to logging facility for subclasses to use
|
void |
logException(java.lang.String msg,
java.lang.Exception exc,
byte[] fileBytes)
Log the exception with the file bytes
|
protected void |
makeDerivedDataChoices(java.util.List dataChoices)
Add to the given list the set of derived data choices
|
protected void |
makeSaveLocalActions(java.util.List actions)
Make save local actions
|
void |
newFileFromPolling(java.io.File f)
This gets called by the FilePoller ActionListener to notify
DataSource-s of a change to the file system.
|
void |
newFilesFromPolling(java.util.List files)
This gets called by the FilePoller ActionListener to notify
DataSource-s of a change to the file system.
|
void |
notifyDataChange()
Notify all
DataChangeListeners of some change to the data |
protected void |
propertiesChanged()
The properties changed
|
void |
putCache(java.lang.Object key,
java.lang.Object value)
Put an object in the cache if caching is enabled.
|
void |
putCache(java.lang.Object key,
java.lang.Object value,
boolean force)
Put an object in the cache.
|
void |
reloadData()
Flush the cache and tell listeners we have changed.
|
void |
reloadData(java.lang.Object object,
java.util.Hashtable properties)
Reload data
|
void |
reloadProperties(java.util.Hashtable newProperties)
Reload properties
|
void |
removeCache(java.lang.Object key)
Remove an Object from the cache.
|
void |
removeDataChangeListener(DataChangeListener listener)
Remove the data change listener
|
protected void |
removeDataChoice(DataChoice choice)
Remove the choice
|
void |
removeProperty(java.lang.String name)
Remove the property
|
void |
replaceDataChoice(DataChoice oldDataChoice,
DataChoice newDataChoice)
Replace the given child with the given chold
|
void |
resetTmpState()
This gets called after we have been saved in a zidv bundle to reset us back to any original state
|
java.util.List |
saveDataToLocalDisk()
Save dat to local disk
|
java.util.List |
saveDataToLocalDisk(boolean changeLinks,
java.lang.String uniqueFilePath)
Save the data to local disk.
|
protected java.util.List |
saveDataToLocalDisk(java.lang.String filePrefix,
java.lang.Object loadId,
boolean changeLinks)
Save the data source files to local disk
|
java.util.List<visad.DateTime> |
selectTimesFromList(DataSelection dataSelection,
java.util.List sourceTimes,
java.util.List<visad.DateTime> selectionTimes)
For each time in selectionTimes this method finds the closest time in sourceTimes
|
void |
setAlias(java.lang.String value)
Set the Alias property.
|
void |
setAskToUpdate(boolean value)
Deprecated.
Keep around for bundles
|
void |
setCacheClearDelay(long value)
Set the CacheClearDelay property.
|
void |
setCacheDataToDisk(boolean value)
Set the CacheFlatFields property.
|
void |
setDataEditableStrings(java.util.List strings)
Set the changed file or url paths
|
void |
setDataIsEditable(boolean value)
Set the DataIsEditable property.
|
void |
setDataIsRelative(boolean value)
Set the DataIsEditable property.
|
void |
setDataRelativeStrings(java.util.List strings)
Used when loading from a bundle with relative file paths
|
void |
setDataSelection(DataSelection s)
Set the DataSelection for this DataSource.
|
void |
setDateTimeSelection(java.util.List selectedTimes)
Set the list of selected times for this data source.
|
void |
setDefaultSave(boolean defaultsave)
Sets the default save.
|
void |
setDescription(java.lang.String n)
Set the description for this DataSource
|
void |
setDescriptor(DataSourceDescriptor d)
Set the
DataSourceDescriptor for this DataSource. |
void |
setDirectory(java.lang.String n)
Deprecated.
|
void |
setEverChangedName(boolean value)
Set the EverChangedName property.
|
void |
setInError(boolean e)
Set whether this DataSource is in error
|
void |
setInError(boolean inError,
boolean needToShowErrorToUser,
java.lang.String msg)
Set the inError
|
void |
setInError(boolean e,
java.lang.String msg)
Set whether this DataSource is in error
|
void |
setName(java.lang.String n)
Set the name of this DataSource
|
void |
setNewFiles(java.util.List files)
Used for when we dynamically change the data source files form a bundle
or from image generation
|
void |
setObjectProperties(java.util.Hashtable properties)
set the properties
|
void |
setObjectProperty(java.lang.String name,
java.lang.String value)
Set the property on this object.
|
void |
setPassword(java.lang.String value)
Set the Password property.
|
void |
setPollingInfo(PollingInfo value)
Set the PollingInfo property.
|
void |
setPollLocation(java.lang.String value)
Deprecated.
|
void |
setProperties(java.util.Hashtable p)
Get the associated properties
|
void |
setProperty(java.lang.String prop,
boolean value)
Set a boolean property.
|
void |
setProperty(java.lang.String prop,
java.lang.Object value)
Set a string property.
|
void |
setRelativePaths(java.util.List value)
Set the RelativePaths property.
|
void |
setTemplateName(java.lang.String n)
Keep around for legacy bundles
|
void |
setTmpPaths(java.util.List value)
Set the TmpPaths property.
|
void |
setUserName(java.lang.String value)
Set the UserName property.
|
protected boolean |
shouldCache(visad.Data data)
See if this DataSource should cache or not
|
protected boolean |
shouldCache(DataChoice dataChoice,
visad.Data data)
See if this DataSource should cache or not
|
boolean |
showPasswordDialog(java.lang.String title,
java.lang.String label)
Show the password dialog
|
boolean |
showPropertiesDialog()
Show the properties dialog
|
boolean |
showPropertiesDialog(java.lang.String initTabName)
Show the properties dialog
|
boolean |
showPropertiesDialog(java.lang.String initTabName,
boolean modal)
Show the dialog
|
protected void |
showWaitDialog(int count)
Show a wait dialog.
|
protected void |
tick()
Stub method.
|
java.lang.String |
toString()
Return a String representation of this DataSource
|
java.lang.String |
toStringTruncated()
Return a truncated string for the name if too long
|
protected void |
updateDetailsText()
Update the properties dialog details page
|
void |
updateState(java.lang.Object newObject,
java.util.Hashtable newProperties)
Update the state
|
void |
writeFieldMaskFile()
Write a mask file
|
protected void |
writeFieldMaskFile(org.w3c.dom.Document doc,
org.w3c.dom.Element root)
Write the field mask file.
|
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialogclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetUniqueIdpublic static int PARAM_SHOW_YES
public static int PARAM_SHOW_HIDE
public static int PARAM_SHOW_NO
protected java.lang.Object dataCacheKey
protected java.util.List<DataChoice> dataChoices
protected javax.swing.JCheckBox changeDataPathsCbx
protected GeoSelectionPanel geoSelectionPanel
protected boolean haveBeenUnPersisted
protected boolean okToContinue
public DataSourceImpl()
public DataSourceImpl(DataSourceDescriptor descriptor)
descriptor - the descriptor for this DataSourcepublic DataSourceImpl(DataSourceDescriptor descriptor, java.lang.String name, java.lang.String description, java.util.Hashtable properties)
descriptor - the descriptor for this DataSourcename - the name for thisdescription - the descriptionproperties - extra propertiespublic void reloadData(java.lang.Object object,
java.util.Hashtable properties)
reloadData in interface DataSourceobject - the objectproperties - the propertiespublic void reloadProperties(java.util.Hashtable newProperties)
newProperties - new propertiespublic java.lang.String convertSourceFile(java.lang.String source)
throws java.lang.Exception
source - the original file or urljava.lang.Exception - On badnessprotected boolean canDoFieldMask()
public boolean canDoAllLevels()
canDoAllLevels in interface DataSourcepublic IntegratedDataViewer getIdv()
protected void loadFieldMask()
protected void loadFieldMask(java.lang.String maskFile)
maskFile - the field maskprotected void applyFieldMask(org.w3c.dom.Element root)
root - xml rootpublic boolean canAddCurrentName(DataChoice dataChoice)
canAddCurrentName in interface DataSourcedataChoice - the data choicepublic void writeFieldMaskFile()
protected void writeFieldMaskFile(org.w3c.dom.Document doc,
org.w3c.dom.Element root)
doc - document to write toroot - root elementpublic int canShowParameter(java.lang.String name)
name - parameter namepublic void setObjectProperties(java.util.Hashtable properties)
DataSourcesetObjectProperties in interface DataSourceproperties - Specification of the name=value properties.public void setObjectProperty(java.lang.String name,
java.lang.String value)
name - property namevalue - valuepublic java.util.List getCompositeDataChoices(CompositeDataChoice compositeDataChoice, java.util.List dataChoices)
getCompositeDataChoices in interface DataSourcecompositeDataChoice - The compositedataChoices - List of children choicesprotected void initAfter()
public void initAfterUnpersistence()
initAfterUnpersistence in interface DataSourcepublic void initAfterCreation()
initAfterCreation in interface DataSourcepublic void setNewFiles(java.util.List files)
setNewFiles in interface DataSourcefiles - List of new files to usepublic org.w3c.dom.Element createElement(XmlEncoder encoder)
createElement in interface XmlPersistableencoder - encoder to usepublic boolean initFromXml(XmlEncoder encoder, org.w3c.dom.Element element)
initFromXml in interface XmlPersistableencoder - encoder for XMLelement - the XML representationpublic java.util.Hashtable getProperties()
public void setProperties(java.util.Hashtable p)
p - the new propertiespublic void removeProperty(java.lang.String name)
name - property name to removepublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface DataSourcename - name of propertynullpublic void setProperty(java.lang.String prop,
java.lang.Object value)
prop - property namevalue - property valuepublic java.lang.String getProperty(java.lang.String name,
java.lang.String dflt)
name - name of propertydflt - default valuepublic long getProperty(java.lang.String name,
long dflt)
name - name of propertydflt - default valuepublic int getProperty(java.lang.String name,
int dflt)
name - name of propertydflt - default valuepublic double getProperty(java.lang.String name,
double dflt)
name - name of propertydflt - default valuepublic java.lang.Object getProperty(java.lang.String name,
java.lang.Object dflt)
name - name of propertydflt - default valuepublic boolean getProperty(java.lang.String name,
boolean dflt)
name - name of propertydflt - default valuepublic void setProperty(java.lang.String prop,
boolean value)
prop - name of propertyvalue - value of propertypublic boolean getNeedToShowErrorToUser()
getNeedToShowErrorToUser in interface DataSourcepublic boolean getInError()
getInError in interface DataSourcepublic void setInError(boolean e,
java.lang.String msg)
e - true for errormsg - error messagepublic void setInError(boolean inError,
boolean needToShowErrorToUser,
java.lang.String msg)
inError - Is in errorneedToShowErrorToUser - SHould show to usermsg - Any messagepublic void setInError(boolean e)
setInError in interface DataSourcee - true for errorpublic java.lang.String getErrorMessage()
getErrorMessage in interface DataSourcepublic void clearCachedData()
clearCachedData in interface DataSourceprotected void flushCache()
public void putCache(java.lang.Object key,
java.lang.Object value)
key - cache keyvalue - associated key valuepublic void putCache(java.lang.Object key,
java.lang.Object value,
boolean force)
key - cache keyvalue - associated key valueforce - force a cachepublic java.lang.Object getCache(java.lang.Object key)
key - key for the objectnullpublic java.lang.Object getCache(java.lang.Object key,
boolean force)
key - key for the objectforce - force a lookup even if not cachingnullpublic void removeCache(java.lang.Object key)
key - key for the objectprotected boolean shouldCache(DataChoice dataChoice, visad.Data data)
dataChoice - The data choice we got this data fromdata - Data to cacheprotected boolean shouldCache(visad.Data data)
data - Data to cachepublic void doRemove()
DataManager when this DataSource has
been removed.doRemove in interface DataSourceprotected java.io.File loadLatestFile(java.io.File file)
file - file to loadprotected java.io.File doDirectory(java.io.File file)
file - directorypublic void newFilesFromPolling(java.util.List files)
files - List of filespublic void newFileFromPolling(java.io.File f)
f - new filepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringTruncated()
public java.lang.String getid()
public void setDescriptor(DataSourceDescriptor d)
DataSourceDescriptor for this DataSource.d - new descriptorpublic DataSourceDescriptor getDescriptor()
DataSourceDescriptor for this DataSource.protected java.util.List getDataChangeListeners()
public void addDataChangeListener(DataChangeListener listener)
addDataChangeListener in interface DataSourcelistener - listener to addpublic void removeDataChangeListener(DataChangeListener listener)
removeDataChangeListener in interface DataSourcelistener - listener to removepublic void reloadData()
reloadData in interface DataSourceprotected void clearFileCache()
public void notifyDataChange()
DataChangeListeners of some change to the datanotifyDataChange in interface DataSourcepublic DataContext getDataContext()
DataContext for this DataSource.null.public DataSource getDataSource()
getDataSource in interface DataSourceFactorypublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - Object in questionpublic boolean identifiedByName(java.lang.String name)
identifiedByName in interface DataSourcename - the name.public boolean identifiedBy(java.lang.Object definingObject)
identifiedBy in interface DataSourcedefiningObject - definingObject to checkdefiningObjectpublic final java.lang.String getTypeName()
getTypeName in interface DataSourcenullpublic void createAutoDisplay(java.lang.String displayType,
DataContext dataContext)
createAutoDisplay in interface DataSourcedisplayType - The display control type id.dataContext - Really, the IDVpublic void initDataChoice(DataChoice dataChoice)
dataChoice - dataChoice to initializepublic DataChoice findDataChoice(java.lang.Object id)
findDataChoice in interface DataSourceid - id of DataChoicenullpublic java.util.List findDataChoices(java.lang.Object id)
findDataChoices in interface DataSourceid - id of DataChoicenullprotected void checkForInitAfterUnPersistence()
protected void makeDerivedDataChoices(java.util.List dataChoices)
dataChoices - base list of choicespublic java.util.List getDataChoices()
getDataChoices in interface DataSourcepublic java.util.List getAllLevels(DataChoice dataChoice)
getAllLevels in interface DataSourcedataChoice - The data choice to get levels forpublic java.util.List getAllLevels(DataChoice dataChoice, DataSelection dataSelection)
getAllLevels in interface DataSourcedataChoice - The data choice to get levels fordataSelection - data selectionpublic void clearTimes()
public java.util.List getAllDateTimes()
getAllDateTimes in interface DataSourcepublic java.util.List getSelectedDateTimes()
getSelectedDateTimes in interface DataSourcepublic java.util.List getSelectedDateTimes(DataChoice dataChoice)
getSelectedDateTimes in interface DataSourcedataChoice - DataChoice in questionpublic java.util.List getAllDateTimes(DataChoice dataChoice)
getAllDateTimes in interface DataSourcedataChoice - DataChoice in questionpublic DataSelection getDataSelection()
getDataSelection in interface DataSourcepublic void setDataSelection(DataSelection s)
s - new selectionpublic static boolean holdsDateTimes(java.util.List selectedTimes)
selectedTimes - list to checkpublic static boolean holdsIndices(java.util.List selectedTimes)
selectedTimes - A list of Integer indices or DateTime.public static java.util.List getDateTimes(java.util.List selected,
java.util.List allTimes)
selected - Either a list of DateTime or a list of Integer indices.allTimes - The source list of DataTimes that may be indexed by
selected.public java.util.List getAbsoluteDateTimes(java.util.List selected)
selected - list of selected timespublic void setDateTimeSelection(java.util.List selectedTimes)
setDateTimeSelection in interface DataSourceselectedTimes - List of selected timespublic java.util.List getDateTimeSelection()
getDateTimeSelection in interface DataSourcepublic java.util.List<visad.DateTime> selectTimesFromList(DataSelection dataSelection, java.util.List sourceTimes, java.util.List<visad.DateTime> selectionTimes) throws java.lang.Exception
dataSelection - The data selection. Not used right now.sourceTimes - Needs to be a list of DateTime or Date objectsselectionTimes - The selection timesjava.lang.Exception - On badnessprotected java.util.List getTimesFromDataSelection(DataSelection givenDataSelection, DataChoice dataChoice)
givenDataSelection - the given DataSelectiondataChoice - the given DataChoiceprotected java.util.List<visad.DateTime> getAllTimesForTimeDriver(DataChoice dataChoice, DataSelection selection, java.util.List<visad.DateTime> timeDriverTimes)
dataChoice - the data choiceselection - the selection (for things like level)timeDriverTimes - the time driver times (use range for server query)public visad.Data getData(DataChoice dataChoice, DataCategory dataCategory, java.util.Hashtable requestProperties) throws visad.VisADException, java.rmi.RemoteException
getData in interface DataSourcedataChoice - choice that defines the datadataCategory - the data categoryrequestProperties - extra request propertiesjava.rmi.RemoteException - Java RMI problemvisad.VisADException - VisAD problemprotected void showWaitDialog(int count)
count - wait timeprotected void tick()
public static int getOutstandingGetDataCalls()
public static void incrOutstandingGetDataCalls()
public static void decrOutstandingGetDataCalls()
protected java.lang.Object createCacheKey(DataChoice dataChoice, DataSelection dataSelection, java.util.Hashtable requestProperties)
dataChoice - data choicedataSelection - data selectionrequestProperties - properties on requestpublic visad.Data getData(DataChoice dataChoice, DataCategory category, DataSelection incomingDataSelection, java.util.Hashtable requestProperties) throws visad.VisADException, java.rmi.RemoteException
getData in interface DataSourcedataChoice - choice that defines the datacategory - the data categoryincomingDataSelection - DataSelection for subsettingrequestProperties - extra request propertiesjava.rmi.RemoteException - Java RMI problemvisad.VisADException - VisAD problemprotected visad.Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection) throws visad.VisADException, java.rmi.RemoteException
dataChoice - The data choice that identifies the requested data.category - The data category of the request.dataSelection - Identifies any subsetting of the data.java.rmi.RemoteException - Java RMI problemvisad.VisADException - VisAD problemprotected visad.Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, java.util.Hashtable requestProperties) throws visad.VisADException, java.rmi.RemoteException
dataChoice - The data choice that identifies the requested
data.category - The data category of the request.dataSelection - Identifies any subsetting of the data.requestProperties - Hashtable that holds any detailed request
properties.java.rmi.RemoteException - Java RMI problemvisad.VisADException - VisAD problempublic int getNextId()
public void setName(java.lang.String n)
n - new namepublic void setTemplateName(java.lang.String n)
n - template namepublic java.lang.String getName()
DataSourceImpl(DataSourceDescriptor, String, String,
Hashtable).getName in interface DataSourcepublic void setDescription(java.lang.String n)
n - the descriptionpublic java.lang.String getDescription()
getDescription in interface DataSourcepublic java.lang.String getPartialDescription()
getPartialDescription in interface DataSourcepublic java.lang.String getFullDescription()
getFullDescription in interface DataSourceprotected void addDataChoice(DataChoice choice)
choice - new choice to addpublic void expandIfNeeded(CompositeDataChoice cdc)
expandIfNeeded in interface DataSourcecdc - the data choiceprotected void removeDataChoice(DataChoice choice)
choice - the choicepublic void replaceDataChoice(DataChoice oldDataChoice, DataChoice newDataChoice)
oldDataChoice - The old data choicenewDataChoice - The new oneprotected void doMakeDataChoices()
protected java.util.List doMakeDateTimes()
public void logException(java.lang.String msg,
java.lang.Exception exc)
msg - error messageexc - error Exceptionpublic void logException(java.lang.String msg,
java.lang.Exception exc,
byte[] fileBytes)
msg - messageexc - exceptionfileBytes - bytes to write to a tmp file. May be null.public void setAlias(java.lang.String value)
setAlias in interface DataSourcevalue - The new value for Aliaspublic java.lang.String getAlias()
getAlias in interface DataSourcepublic java.util.List getActions()
Action-s associated with this DataSource. The actions
can be used to create menus, buttons, etc. Subclasses should implement
this method making sure to call super.getActions()getActions in interface DataSourcepublic boolean showPropertiesDialog()
showPropertiesDialog in interface DataSourcepublic boolean showPropertiesDialog(java.lang.String initTabName)
initTabName - If non null then show this tabpublic boolean canSaveDataToLocalDisk()
canSaveDataToLocalDisk in interface DataSourcepublic boolean canChangeData()
protected java.util.List saveDataToLocalDisk(java.lang.String filePrefix,
java.lang.Object loadId,
boolean changeLinks)
throws java.lang.Exception
filePrefix - This is the directory path to write the files to with the unique file identifier
append to itloadId - For stopping the load through the JobManagerchangeLinks - Should this data source also change its internal data referencesjava.lang.Exception - On badnesspublic java.util.List saveDataToLocalDisk()
public java.util.List saveDataToLocalDisk(boolean changeLinks,
java.lang.String uniqueFilePath)
saveDataToLocalDisk in interface DataSourcechangeLinks - Should this data source also change its internal data referencesuniqueFilePath - Where to write the files toprotected java.lang.String getSaveDataFileLabel()
protected java.lang.Object beginWritingDataToLocalDisk(java.lang.String msg)
msg - Message to show in dialogprotected void endWritingDataToLocalDisk(java.lang.Object loadId)
loadId - The JobManager load idprotected java.lang.String getDataPrefix()
protected java.lang.String getLocalDirectory(java.lang.String label,
java.lang.String prefix)
label - Label to show userprefix - File prefixpublic boolean showPropertiesDialog(java.lang.String initTabName,
boolean modal)
initTabName - What tab should we show. May be null.modal - Is dialog modalprotected void propertiesChanged()
public void handlePropertiesAction(java.lang.String cmd)
cmd - Actionprotected javax.swing.JComponent getPropertiesHeader(java.lang.String label)
label - Header labelpublic void getPropertiesComponents(java.util.List comps)
comps - List of componentspublic boolean canCacheDataToDisk()
public boolean canDoGeoSelection()
canDoGeoSelection in interface DataSourceprotected boolean canDoGeoSelectionStride()
public java.util.List<DataSelectionComponent> getDataSelectionComponents(DataChoice dataChoice)
getDataSelectionComponents in interface DataSourcedataChoice - the data choiceprotected void initDataSelectionComponents(java.util.List<DataSelectionComponent> components, DataChoice dataChoice)
components - list of componentsdataChoice - the data choiceprotected javax.swing.JComponent getExtraTimesComponent()
public void addPropertiesTabs(javax.swing.JTabbedPane tabbedPane)
tabbedPane - The properties tabprotected void addReloadTab(javax.swing.JTabbedPane tabbedPane)
tabbedPane - the reload tabprotected javax.swing.JComponent doMakeGeoSubsetPropertiesComponent()
protected void updateDetailsText()
public GeoSelectionPanel doMakeGeoSelectionPanel()
public GeoSelectionPanel doMakeGeoSelectionPanel(boolean forProperties)
forProperties - true if for the properties widgetpublic GeoSelectionPanel doMakeGeoSelectionPanel(boolean forProperties, GeoSelection geoSelection)
forProperties - true if for the properties widgetgeoSelection - geoselection to populate the panelprotected javax.swing.JComponent getExtraGeoSelectionComponent()
protected ucar.unidata.geoloc.ProjectionImpl getSampleDataProjection()
protected boolean canDoGeoSelectionMap()
public boolean applyProperties()
protected void addActions(java.util.List actions)
Action-s associated with this DataSource. The actions
can be used to create menus, buttons, etc. Subclasses should implement
this method making sure to call super.getActions()actions - List of actionsprotected void makeSaveLocalActions(java.util.List actions)
actions - list of actionsprotected javax.swing.filechooser.FileFilter getFileFilterForPolling()
protected java.io.File getLocationForPolling()
protected java.util.List getLocationsForPolling()
public boolean canPoll()
protected boolean isPolling()
public void setPollingInfo(PollingInfo value)
value - The new value for PollingInfopublic PollingInfo getPollingInfo()
protected boolean hasPollingInfo()
public void setDirectory(java.lang.String n)
n - directory namepublic void setPollLocation(java.lang.String value)
value - The new value for PollLocationprotected java.util.List convertToFilesIfDirectory(java.util.List sources)
sources - List of File-s or String file namesprotected java.util.List getMostRecentFiles(java.io.File dir,
int cnt)
dir - Directory to look at. If it is not a directory
then use its parent.cnt - Number of files to find.public void setAskToUpdate(boolean value)
value - The new value for AskToUpdatepublic void setDataIsRelative(boolean value)
value - The new value for DataIsEditablepublic void setDataIsEditable(boolean value)
setDataIsEditable in interface DataSourcevalue - The new value for DataIsEditablepublic boolean getDataIsEditable()
getDataIsEditable in interface DataSourcepublic java.util.List getDataPaths()
getDataPaths in interface DataSourcepublic void setDataEditableStrings(java.util.List strings)
strings - List of pathspublic void setDataRelativeStrings(java.util.List strings)
strings - Relative file pathspublic java.util.List getPathsThatCanBeRelative()
public void setRelativePaths(java.util.List value)
value - The new value for RelativePathspublic java.util.List getRelativePaths()
public void updateState(java.lang.Object newObject,
java.util.Hashtable newProperties)
updateState in interface DataSourcenewObject - new objectnewProperties - new properties to addpublic void resetTmpState()
resetTmpState in interface DataSourcepublic void setTmpPaths(java.util.List value)
setTmpPaths in interface DataSourcevalue - The new value for TmpPathspublic java.util.List getTmpPaths()
getTmpPaths in interface DataSourcepublic static java.lang.String getNameForDataSource(DataSource ds, int length, boolean alwaysDoIt)
DataSource. If the length of
the toString of the data source is less than 30 just use that.
Else be a bit smart about truncating it.ds - The data soruce to get a label forlength - String length to clip toalwaysDoIt - If false then we only lip if this is a file or urlpublic void setCacheDataToDisk(boolean value)
value - The new value for CacheFlatFieldspublic boolean getCacheDataToDisk()
public java.lang.String getDataCachePath()
public void setCacheClearDelay(long value)
value - The new value for CacheClearDelaypublic long getCacheClearDelay()
public boolean showPasswordDialog(java.lang.String title,
java.lang.String label)
title - titlelabel - labelpublic void setUserName(java.lang.String value)
value - The new value for UserNamepublic java.lang.String getUserName()
public void setPassword(java.lang.String value)
value - The new value for Passwordpublic java.lang.String getPassword()
public void setEverChangedName(boolean value)
value - The new value for EverChangedNamepublic boolean getEverChangedName()
public void setDefaultSave(boolean defaultsave)
setDefaultSave in interface DataSourcedefaultsave - the new default savepublic boolean getDefaultSave()