|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.collab.SharableImpl
ucar.unidata.data.DataSourceImpl
public class DataSourceImpl
An abstract class that implements the DataSource interface. Holds a DataContext, name and description and manages a list of DataChoice-s.
This class is thread-compatible but not thread-safe. Concurrent access to instances of this class should be externally symchronized by the client.
| Field Summary | |
|---|---|
protected JCheckBox |
changeDataPathsCbx
change data paths checkbox |
protected Object |
dataCacheKey
Use this so this object is unique in the data cache |
protected 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 |
| 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 | |
|---|---|
DataSourceImpl()
Bean constructor |
|
DataSourceImpl(DataSourceDescriptor descriptor)
Create a DataSourceImpl |
|
DataSourceImpl(DataSourceDescriptor descriptor,
String name,
String description,
Hashtable properties)
Create this DataSourceImpl, setting the dataContext, name and description attributes. |
|
| Method Summary | |
|---|---|
protected void |
addActions(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(JTabbedPane tabbedPane)
Add any extra tabs into the properties tab |
protected void |
addReloadTab(JTabbedPane tabbedPane)
Add a reload tab |
protected void |
applyFieldMask(Element root)
Load any parameter nodes in the given mask xml |
boolean |
applyProperties()
Apply properties components |
protected Object |
beginWritingDataToLocalDisk(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(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 |
String |
convertSourceFile(String source)
If this datasource has an ncml template this method will wrap the actual data file in ncml and return the ncml |
protected List |
convertToFilesIfDirectory(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(String displayType,
DataContext dataContext)
Automatically create the given display on initialization. |
protected Object |
createCacheKey(DataChoice dataChoice,
DataSelection dataSelection,
Hashtable requestProperties)
Utility to create the key used when caching |
Element |
createElement(XmlEncoder encoder)
Create the XML element for persisting this DataSource |
static void |
decrOutstandingGetDataCalls()
Decrement the static count of get data calls |
protected File |
doDirectory(File file)
Deprecated. Use loadLatestFile |
protected void |
doMakeDataChoices()
A stub for the derived classes to overwrite. |
protected 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 JComponent |
doMakeGeoSubsetPropertiesComponent()
Make the geo subset properties component |
void |
doRemove()
Gets called by the DataManager when this DataSource has
been removed. |
protected void |
endWritingDataToLocalDisk(Object loadId)
Stop the JobManager load dialog |
boolean |
equals(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(Object id)
Search through the list of DataChoice-s and return the DataChoice object whose id equals the given id parameter. |
List |
findDataChoices(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 |
List |
getAbsoluteDateTimes(List selected)
Get the absolute times. |
List |
getActions()
Get any Action-s associated with this DataSource. |
String |
getAlias()
Get the Alias property. |
List |
getAllDateTimes()
Return an array of DateTimes representing all the times in the DataSource. |
List |
getAllDateTimes(DataChoice dataChoice)
Get all the times for the given DataChoice |
List |
getAllLevels(DataChoice dataChoice)
Get the list of all levels available from this DataSource |
List |
getAllLevels(DataChoice dataChoice,
DataSelection dataSelection)
Get all of the levels |
protected List<DateTime> |
getAllTimesForTimeDriver(DataChoice dataChoice,
DataSelection selection,
List<DateTime> timeDriverTimes)
Get the list of times to compare to the time driver times |
Object |
getCache(Object key)
Get an Object from the cache. |
Object |
getCache(Object key,
boolean force)
Get an Object from the cache. |
long |
getCacheClearDelay()
Get the CacheClearDelay property. |
boolean |
getCacheDataToDisk()
Get the CacheFlatFields property. |
List |
getCompositeDataChoices(CompositeDataChoice compositeDataChoice,
List dataChoices)
This is called by the composite data choice to update the list of children. |
Data |
getData(DataChoice dataChoice,
DataCategory category,
DataSelection incomingDataSelection,
Hashtable requestProperties)
Get the data applicable to the DataChoice and selection criteria. |
Data |
getData(DataChoice dataChoice,
DataCategory dataCategory,
Hashtable requestProperties)
Get the data applicable to the DataChoice and selection criteria. |
String |
getDataCachePath()
Where do we write cached data to |
protected List |
getDataChangeListeners()
Get the data change listeners |
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 Data |
getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection)
Have this one around for other, non-unidata, datasource implementations. |
protected Data |
getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection,
Hashtable requestProperties)
Actually get the data identified by the given DataChoce. |
boolean |
getDataIsEditable()
Get the DataIsEditable property. |
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 String |
getDataPrefix()
Get the file prefix to use for when saving data to local disk |
DataSelection |
getDataSelection()
Return the DataSelection for this DataSource. |
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 List |
getDateTimes(List selected,
List allTimes)
A utility method that returns a list of times. |
List |
getDateTimeSelection()
Return the list of times held by the DataSelection member. |
String |
getDescription()
Return the human readable description of this DataSource |
DataSourceDescriptor |
getDescriptor()
Get the DataSourceDescriptor for this DataSource. |
String |
getErrorMessage()
Get the error message (if there is one) or create one. |
boolean |
getEverChangedName()
Get the EverChangedName property. |
protected JComponent |
getExtraGeoSelectionComponent()
Return the extra component for the geo selection panel. |
protected JComponent |
getExtraTimesComponent()
This gets pu at the bottom of the times properties tab |
protected FileFilter |
getFileFilterForPolling()
Return the file fitler that the polling info uses. |
String |
getFullDescription()
Get the full description for this data source. |
String |
getid()
Get a unique id for this DataSource |
IntegratedDataViewer |
getIdv()
Get the IDV |
boolean |
getInError()
Return whether this DataSource is in error |
protected String |
getLocalDirectory(String label,
String prefix)
Get the directory to write the localized data files to |
protected File |
getLocationForPolling()
Get the location, either a file or a directory, that is where we poll on. |
protected List |
getLocationsForPolling()
Get the locations to use for polling |
protected List |
getMostRecentFiles(File dir,
int cnt)
Find the most recent cnt number of files in the given directory that match the fileFIlterForPolling |
String |
getName()
Returns the human readable name of this DataSource. |
static 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 |
String |
getPartialDescription()
Return the human readable description of this DataSource |
String |
getPassword()
Get the Password property. |
List |
getPathsThatCanBeRelative()
Return the paths that can be saved off relative to wehre the bundle is. |
PollingInfo |
getPollingInfo()
Get the PollingInfo property. |
Hashtable |
getProperties()
Get the associated properties |
void |
getPropertiesComponents(List comps)
Add the gui components into the list for the properties dialog |
protected JComponent |
getPropertiesHeader(String label)
Utility to create a header for the properties dialog |
Object |
getProperty(String name)
Get a property. |
boolean |
getProperty(String name,
boolean dflt)
Get the named boolean property |
double |
getProperty(String name,
double dflt)
Get the named double property |
int |
getProperty(String name,
int dflt)
Get the named int property |
long |
getProperty(String name,
long dflt)
Get the named long property |
Object |
getProperty(String name,
Object dflt)
Get the object property |
String |
getProperty(String name,
String dflt)
Get the named String property. |
List |
getRelativePaths()
Get the RelativePaths property. |
protected ucar.unidata.geoloc.ProjectionImpl |
getSampleDataProjection()
Used for the geo subsetting property gui |
protected String |
getSaveDataFileLabel()
Get the save data to a file label |
List |
getSelectedDateTimes()
Get the list of selected times. |
List |
getSelectedDateTimes(DataChoice dataChoice)
Get the selected times for the given DataChoice. |
protected List |
getTimesFromDataSelection(DataSelection givenDataSelection,
DataChoice dataChoice)
If givenDataSelection is non-null and has a non-null times list then return that. |
List |
getTmpPaths()
Get the TmpPaths property. |
String |
getTypeName()
Get the type name for this DataSource |
String |
getUserName()
Get the UserName property. |
void |
handlePropertiesAction(String cmd)
Handle the properties action |
protected boolean |
hasPollingInfo()
Do we have polling info object |
static boolean |
holdsDateTimes(List selectedTimes)
See if the selection list is a set of times or indices |
static boolean |
holdsIndices(List selectedTimes)
A utility to determine whether the given list holds a set of Integer indices. |
boolean |
identifiedBy(Object definingObject)
See if this DataSource is identified by the definingObject. |
boolean |
identifiedByName(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(List<DataSelectionComponent> components,
DataChoice dataChoice)
Add any data selection components |
boolean |
initFromXml(XmlEncoder encoder,
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(String maskFile)
Load the field mask |
protected File |
loadLatestFile(File file)
Load the latest file. |
void |
logException(String msg,
Exception exc)
Shortcut to logging facility for subclasses to use |
void |
logException(String msg,
Exception exc,
byte[] fileBytes)
Log the exception with the file bytes |
protected void |
makeDerivedDataChoices(List dataChoices)
Add to the given list the set of derived data choices |
protected void |
makeSaveLocalActions(List actions)
Make save local actions |
void |
newFileFromPolling(File f)
This gets called by the FilePoller ActionListener to notify DataSource-s of a change to the file system. |
void |
newFilesFromPolling(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(Object key,
Object value)
Put an object in the cache if caching is enabled. |
void |
putCache(Object key,
Object value,
boolean force)
Put an object in the cache. |
void |
reloadData()
Flush the cache and tell listeners we have changed. |
void |
reloadData(Object object,
Hashtable properties)
Reload data |
void |
reloadProperties(Hashtable newProperties)
Reload properties |
void |
removeCache(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(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 |
List |
saveDataToLocalDisk()
Save dat to local disk |
List |
saveDataToLocalDisk(boolean changeLinks,
String uniqueFilePath)
Save the data to local disk. |
protected List |
saveDataToLocalDisk(String filePrefix,
Object loadId,
boolean changeLinks)
Save the data source files to local disk |
List<DateTime> |
selectTimesFromList(DataSelection dataSelection,
List sourceTimes,
List<DateTime> selectionTimes)
For each time in selectionTimes this method finds the closest time in sourceTimes |
void |
setAlias(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(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(List strings)
Used when loading from a bundle with relative file paths |
void |
setDataSelection(DataSelection s)
Set the DataSelection for this DataSource. |
void |
setDateTimeSelection(List selectedTimes)
Set the list of selected times for this data source. |
void |
setDescription(String n)
Set the description for this DataSource |
void |
setDescriptor(DataSourceDescriptor d)
Set the DataSourceDescriptor for this DataSource. |
void |
setDirectory(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,
String msg)
Set the inError |
void |
setInError(boolean e,
String msg)
Set whether this DataSource is in error |
void |
setName(String n)
Set the name of this DataSource |
void |
setNewFiles(List files)
Used for when we dynamically change the data source files form a bundle or from image generation |
void |
setObjectProperties(Hashtable properties)
set the properties |
void |
setObjectProperty(String name,
String value)
Set the property on this object. |
void |
setPassword(String value)
Set the Password property. |
void |
setPollingInfo(PollingInfo value)
Set the PollingInfo property. |
void |
setPollLocation(String value)
Deprecated. |
void |
setProperties(Hashtable p)
Get the associated properties |
void |
setProperty(String prop,
boolean value)
Set a boolean property. |
void |
setProperty(String prop,
Object value)
Set a string property. |
void |
setRelativePaths(List value)
Set the RelativePaths property. |
void |
setTemplateName(String n)
Keep around for legacy bundles |
void |
setTmpPaths(List value)
Set the TmpPaths property. |
void |
setUserName(String value)
Set the UserName property. |
protected boolean |
shouldCache(Data data)
See if this DataSource should cache or not |
protected boolean |
shouldCache(DataChoice dataChoice,
Data data)
See if this DataSource should cache or not |
boolean |
showPasswordDialog(String title,
String label)
Show the password dialog |
boolean |
showPropertiesDialog()
Show the properties dialog |
boolean |
showPropertiesDialog(String initTabName)
Show the properties dialog |
boolean |
showPropertiesDialog(String initTabName,
boolean modal)
Show the dialog |
protected void |
showWaitDialog(int count)
Show a wait dialog. |
protected void |
tick()
Stub method. |
String |
toString()
Return a String representation of this DataSource |
String |
toStringTruncated()
Return a truncated string for the name if too long |
protected void |
updateDetailsText()
Update the properties dialog details page |
void |
updateState(Object newObject,
Hashtable newProperties)
Update the state |
void |
writeFieldMaskFile()
Write a mask file |
protected void |
writeFieldMaskFile(Document doc,
Element root)
Write the field mask file. |
| 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 |
|---|
public static int PARAM_SHOW_YES
public static int PARAM_SHOW_HIDE
public static int PARAM_SHOW_NO
protected Object dataCacheKey
protected List<DataChoice> dataChoices
protected JCheckBox changeDataPathsCbx
protected GeoSelectionPanel geoSelectionPanel
protected boolean haveBeenUnPersisted
protected boolean okToContinue
| Constructor Detail |
|---|
public DataSourceImpl()
public DataSourceImpl(DataSourceDescriptor descriptor)
descriptor - the descriptor for this DataSource
public DataSourceImpl(DataSourceDescriptor descriptor,
String name,
String description,
Hashtable properties)
descriptor - the descriptor for this DataSourcename - the name for thisdescription - the descriptionproperties - extra properties| Method Detail |
|---|
public void reloadData(Object object,
Hashtable properties)
reloadData in interface DataSourceobject - the objectproperties - the propertiespublic void reloadProperties(Hashtable newProperties)
newProperties - new properties
public String convertSourceFile(String source)
throws Exception
source - the original file or url
Exception - On badnessprotected boolean canDoFieldMask()
public boolean canDoAllLevels()
canDoAllLevels in interface DataSourcepublic IntegratedDataViewer getIdv()
protected void loadFieldMask()
protected void loadFieldMask(String maskFile)
maskFile - the field maskprotected void applyFieldMask(Element root)
root - xml rootpublic boolean canAddCurrentName(DataChoice dataChoice)
canAddCurrentName in interface DataSourcedataChoice - the data choice
public void writeFieldMaskFile()
protected void writeFieldMaskFile(Document doc,
Element root)
doc - document to write toroot - root elementpublic int canShowParameter(String name)
name - parameter name
public void setObjectProperties(Hashtable properties)
DataSource
setObjectProperties in interface DataSourceproperties - Specification of the name=value properties.
public void setObjectProperty(String name,
String value)
name - property namevalue - value
public List getCompositeDataChoices(CompositeDataChoice compositeDataChoice,
List dataChoices)
getCompositeDataChoices in interface DataSourcecompositeDataChoice - The compositedataChoices - List of children choices
protected void initAfter()
public void initAfterUnpersistence()
initAfterUnpersistence in interface DataSourcepublic void initAfterCreation()
initAfterCreation in interface DataSourcepublic void setNewFiles(List files)
setNewFiles in interface DataSourcefiles - List of new files to usepublic Element createElement(XmlEncoder encoder)
createElement in interface XmlPersistableencoder - encoder to use
public boolean initFromXml(XmlEncoder encoder,
Element element)
initFromXml in interface XmlPersistableencoder - encoder for XMLelement - the XML representation
public Hashtable getProperties()
public void setProperties(Hashtable p)
p - the new propertiespublic void removeProperty(String name)
name - property name to removepublic Object getProperty(String name)
getProperty in interface DataSourcename - name of property
null
public void setProperty(String prop,
Object value)
prop - property namevalue - property value
public String getProperty(String name,
String dflt)
name - name of propertydflt - default value
public long getProperty(String name,
long dflt)
name - name of propertydflt - default value
public int getProperty(String name,
int dflt)
name - name of propertydflt - default value
public double getProperty(String name,
double dflt)
name - name of propertydflt - default value
public Object getProperty(String name,
Object dflt)
name - name of propertydflt - default value
public boolean getProperty(String name,
boolean dflt)
name - name of propertydflt - default value
public void setProperty(String prop,
boolean value)
prop - name of propertyvalue - value of propertypublic boolean getNeedToShowErrorToUser()
getNeedToShowErrorToUser in interface DataSourcepublic boolean getInError()
getInError in interface DataSource
public void setInError(boolean e,
String msg)
e - true for errormsg - error message
public void setInError(boolean inError,
boolean needToShowErrorToUser,
String msg)
inError - Is in errorneedToShowErrorToUser - SHould show to usermsg - Any messagepublic void setInError(boolean e)
setInError in interface DataSourcee - true for errorpublic String getErrorMessage()
getErrorMessage in interface DataSourcepublic void clearCachedData()
clearCachedData in interface DataSourceprotected void flushCache()
public void putCache(Object key,
Object value)
key - cache keyvalue - associated key value
public void putCache(Object key,
Object value,
boolean force)
key - cache keyvalue - associated key valueforce - force a cachepublic Object getCache(Object key)
key - key for the object
null
public Object getCache(Object key,
boolean force)
key - key for the objectforce - force a lookup even if not caching
nullpublic void removeCache(Object key)
key - key for the object
protected boolean shouldCache(DataChoice dataChoice,
Data data)
dataChoice - The data choice we got this data fromdata - Data to cache
protected boolean shouldCache(Data data)
data - Data to cache
public void doRemove()
DataManager when this DataSource has
been removed.
doRemove in interface DataSourceprotected File loadLatestFile(File file)
file - file to load
protected File doDirectory(File file)
file - directory
public void newFilesFromPolling(List files)
files - List of filespublic void newFileFromPolling(File f)
f - new filepublic String toString()
toString in class Objectpublic String toStringTruncated()
public String getid()
public void setDescriptor(DataSourceDescriptor d)
DataSourceDescriptor for this DataSource.
d - new descriptorpublic DataSourceDescriptor getDescriptor()
DataSourceDescriptor for this DataSource.
protected 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 data
notifyDataChange in interface DataSourcepublic DataContext getDataContext()
DataContext for this DataSource.
null.public DataSource getDataSource()
getDataSource in interface DataSourceFactorypublic boolean equals(Object o)
equals in class Objecto - Object in question
public boolean identifiedByName(String name)
identifiedByName in interface DataSourcename - the name.
public boolean identifiedBy(Object definingObject)
identifiedBy in interface DataSourcedefiningObject - definingObject to check
definingObjectpublic final String getTypeName()
getTypeName in interface DataSourcenull
public void createAutoDisplay(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(Object id)
findDataChoice in interface DataSourceid - id of DataChoice
nullpublic List findDataChoices(Object id)
findDataChoices in interface DataSourceid - id of DataChoice
nullprotected void checkForInitAfterUnPersistence()
protected void makeDerivedDataChoices(List dataChoices)
dataChoices - base list of choicespublic List getDataChoices()
getDataChoices in interface DataSourcepublic List getAllLevels(DataChoice dataChoice)
getAllLevels in interface DataSourcedataChoice - The data choice to get levels for
public List getAllLevels(DataChoice dataChoice,
DataSelection dataSelection)
getAllLevels in interface DataSourcedataChoice - The data choice to get levels fordataSelection - data selection
public void clearTimes()
public List getAllDateTimes()
getAllDateTimes in interface DataSourcepublic List getSelectedDateTimes()
getSelectedDateTimes in interface DataSourcepublic List getSelectedDateTimes(DataChoice dataChoice)
getSelectedDateTimes in interface DataSourcedataChoice - DataChoice in question
public List getAllDateTimes(DataChoice dataChoice)
getAllDateTimes in interface DataSourcedataChoice - DataChoice in question
public DataSelection getDataSelection()
getDataSelection in interface DataSourcepublic void setDataSelection(DataSelection s)
s - new selectionpublic static boolean holdsDateTimes(List selectedTimes)
selectedTimes - list to check
public static boolean holdsIndices(List selectedTimes)
selectedTimes - A list of Integer indices or DateTime.
public static List getDateTimes(List selected,
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 List getAbsoluteDateTimes(List selected)
selected - list of selected times
public void setDateTimeSelection(List selectedTimes)
setDateTimeSelection in interface DataSourceselectedTimes - List of selected timespublic List getDateTimeSelection()
getDateTimeSelection in interface DataSource
public List<DateTime> selectTimesFromList(DataSelection dataSelection,
List sourceTimes,
List<DateTime> selectionTimes)
throws Exception
dataSelection - The data selection. Not used right now.sourceTimes - Needs to be a list of DateTime or Date objectsselectionTimes - The selection times
Exception - On badness
protected List getTimesFromDataSelection(DataSelection givenDataSelection,
DataChoice dataChoice)
givenDataSelection - the given DataSelectiondataChoice - the given DataChoice
protected List<DateTime> getAllTimesForTimeDriver(DataChoice dataChoice,
DataSelection selection,
List<DateTime> timeDriverTimes)
dataChoice - the data choiceselection - the selection (for things like level)timeDriverTimes - the time driver times (use range for server query)
public Data getData(DataChoice dataChoice,
DataCategory dataCategory,
Hashtable requestProperties)
throws VisADException,
RemoteException
getData in interface DataSourcedataChoice - choice that defines the datadataCategory - the data categoryrequestProperties - extra request properties
RemoteException - Java RMI problem
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 Object createCacheKey(DataChoice dataChoice,
DataSelection dataSelection,
Hashtable requestProperties)
dataChoice - data choicedataSelection - data selectionrequestProperties - properties on request
public Data getData(DataChoice dataChoice,
DataCategory category,
DataSelection incomingDataSelection,
Hashtable requestProperties)
throws VisADException,
RemoteException
getData in interface DataSourcedataChoice - choice that defines the datacategory - the data categoryincomingDataSelection - DataSelection for subsettingrequestProperties - extra request properties
RemoteException - Java RMI problem
VisADException - VisAD problem
protected Data getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection)
throws VisADException,
RemoteException
dataChoice - The data choice that identifies the requested data.category - The data category of the request.dataSelection - Identifies any subsetting of the data.
RemoteException - Java RMI problem
VisADException - VisAD problem
protected Data getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection,
Hashtable requestProperties)
throws VisADException,
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.
RemoteException - Java RMI problem
VisADException - VisAD problempublic int getNextId()
public void setName(String n)
n - new namepublic void setTemplateName(String n)
n - template namepublic String getName()
DataSourceImpl(DataSourceDescriptor, String, String,
Hashtable).
getName in interface DataSourcepublic void setDescription(String n)
n - the descriptionpublic String getDescription()
getDescription in interface DataSourcepublic String getPartialDescription()
getPartialDescription in interface DataSourcepublic 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 choice
public void replaceDataChoice(DataChoice oldDataChoice,
DataChoice newDataChoice)
oldDataChoice - The old data choicenewDataChoice - The new oneprotected void doMakeDataChoices()
protected List doMakeDateTimes()
public void logException(String msg,
Exception exc)
msg - error messageexc - error Exception
public void logException(String msg,
Exception exc,
byte[] fileBytes)
msg - messageexc - exceptionfileBytes - bytes to write to a tmp file. May be null.public void setAlias(String value)
setAlias in interface DataSourcevalue - The new value for Aliaspublic String getAlias()
getAlias in interface DataSourcepublic 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(String initTabName)
initTabName - If non null then show this tab
public boolean canSaveDataToLocalDisk()
canSaveDataToLocalDisk in interface DataSourcepublic boolean canChangeData()
protected List saveDataToLocalDisk(String filePrefix,
Object loadId,
boolean changeLinks)
throws 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 references
Exception - On badnesspublic List saveDataToLocalDisk()
public List saveDataToLocalDisk(boolean changeLinks,
String uniqueFilePath)
saveDataToLocalDisk in interface DataSourcechangeLinks - Should this data source also change its internal data referencesuniqueFilePath - Where to write the files to
protected String getSaveDataFileLabel()
protected Object beginWritingDataToLocalDisk(String msg)
msg - Message to show in dialog
protected void endWritingDataToLocalDisk(Object loadId)
loadId - The JobManager load idprotected String getDataPrefix()
protected String getLocalDirectory(String label,
String prefix)
label - Label to show userprefix - File prefix
public boolean showPropertiesDialog(String initTabName,
boolean modal)
initTabName - What tab should we show. May be null.modal - Is dialog modal
protected void propertiesChanged()
public void handlePropertiesAction(String cmd)
cmd - Actionprotected JComponent getPropertiesHeader(String label)
label - Header label
public void getPropertiesComponents(List comps)
comps - List of componentspublic boolean canCacheDataToDisk()
public boolean canDoGeoSelection()
canDoGeoSelection in interface DataSourceprotected boolean canDoGeoSelectionStride()
public List<DataSelectionComponent> getDataSelectionComponents(DataChoice dataChoice)
getDataSelectionComponents in interface DataSourcedataChoice - the data choice
protected void initDataSelectionComponents(List<DataSelectionComponent> components,
DataChoice dataChoice)
components - list of componentsdataChoice - the data choiceprotected JComponent getExtraTimesComponent()
public void addPropertiesTabs(JTabbedPane tabbedPane)
tabbedPane - The properties tabprotected void addReloadTab(JTabbedPane tabbedPane)
tabbedPane - the reload tabprotected JComponent doMakeGeoSubsetPropertiesComponent()
protected void updateDetailsText()
public GeoSelectionPanel doMakeGeoSelectionPanel()
public GeoSelectionPanel doMakeGeoSelectionPanel(boolean forProperties)
forProperties - true if for the properties widget
public GeoSelectionPanel doMakeGeoSelectionPanel(boolean forProperties,
GeoSelection geoSelection)
forProperties - true if for the properties widgetgeoSelection - geoselection to populate the panel
protected JComponent getExtraGeoSelectionComponent()
protected ucar.unidata.geoloc.ProjectionImpl getSampleDataProjection()
protected boolean canDoGeoSelectionMap()
public boolean applyProperties()
protected void addActions(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(List actions)
actions - list of actionsprotected FileFilter getFileFilterForPolling()
protected File getLocationForPolling()
protected 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(String n)
n - directory namepublic void setPollLocation(String value)
value - The new value for PollLocationprotected List convertToFilesIfDirectory(List sources)
sources - List of File-s or String file names
protected List getMostRecentFiles(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 List getDataPaths()
getDataPaths in interface DataSourcepublic void setDataEditableStrings(List strings)
strings - List of pathspublic void setDataRelativeStrings(List strings)
strings - Relative file pathspublic List getPathsThatCanBeRelative()
public void setRelativePaths(List value)
value - The new value for RelativePathspublic List getRelativePaths()
public void updateState(Object newObject,
Hashtable newProperties)
updateState in interface DataSourcenewObject - new objectnewProperties - new properties to addpublic void resetTmpState()
resetTmpState in interface DataSourcepublic void setTmpPaths(List value)
setTmpPaths in interface DataSourcevalue - The new value for TmpPathspublic List getTmpPaths()
getTmpPaths in interface DataSource
public static 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 url
public void setCacheDataToDisk(boolean value)
value - The new value for CacheFlatFieldspublic boolean getCacheDataToDisk()
public String getDataCachePath()
public void setCacheClearDelay(long value)
value - The new value for CacheClearDelaypublic long getCacheClearDelay()
public boolean showPasswordDialog(String title,
String label)
title - titlelabel - label
public void setUserName(String value)
value - The new value for UserNamepublic String getUserName()
public void setPassword(String value)
value - The new value for Passwordpublic String getPassword()
public void setEverChangedName(boolean value)
value - The new value for EverChangedNamepublic boolean getEverChangedName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||