public class JsonDataSource extends FilesDataSource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_NAME
xml attribute
|
static java.lang.String |
ATTR_PARENT
xml attribute
|
protected java.util.List |
cachedData
A local cache
|
protected java.util.List |
cachedUrls
The urls
|
protected java.util.List |
colorMap
The colorMap
|
static java.lang.String |
EXT_KML
For ximg files
|
static PatternFileFilter |
FILTER_KML
For ximg files
|
protected java.util.HashMap |
jsonInfo
The jsonInfo
|
static java.lang.String |
SUFFIX_KML
For ximg files
|
static java.lang.String |
TAG_DOCUMENT
kml tag id
|
static java.lang.String |
TAG_FOLDER
kml tag id
|
static java.lang.String |
TAG_GROUNDOVERLAY
kml tag id
|
static java.lang.String |
TAG_HREF
xml tag
|
static java.lang.String |
TAG_KML
xml tag
|
static java.lang.String |
TAG_LINESTRING
xml tag
|
static java.lang.String |
TAG_LINK
xml tag
|
static java.lang.String |
TAG_MULTIGEOMETRY
kml tag id
|
static java.lang.String |
TAG_NAME
kml tag id
|
static java.lang.String |
TAG_NETWORKLINK
kml tag id
|
static java.lang.String |
TAG_PHOTOOVERLAY
kml tag
|
static java.lang.String |
TAG_PLACEMARK
kml tag id
|
static java.lang.String |
TAG_SCHEMA
xml tag
|
static java.lang.String |
TAG_STYLEURL
kml tag id
|
static java.lang.String |
TAG_URL
xml tag
|
protected java.util.List |
timeList
The timeList
|
protected java.util.List |
times |
boolean |
useDriverTime
_more_
|
adapters, oldSourceFromBundles, sources
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YES
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 |
---|
JsonDataSource()
Dummy constructor so this object can get unpersisted.
|
JsonDataSource(DataSourceDescriptor descriptor,
java.util.List newSources,
java.util.Hashtable properties)
Create a KmlDataSource from the specification given.
|
JsonDataSource(DataSourceDescriptor descriptor,
java.lang.String probSevereUrl,
java.util.Hashtable properties)
Create a KmlDataSource from the specification given.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createKml(GeoLocationInfo bounds,
java.lang.String imageFileName)
Create some kml from the given bounds and image file
|
static void |
createLatLonBox(GeoLocationInfo bounds,
java.lang.StringBuffer sb)
Utility to create a latlonbox kml
|
protected void |
doMakeDataChoices()
Create the data choices associated with this source.
|
protected java.util.List |
doMakeDateTimes()
Create a list of times for this data source.
|
void |
expandIfNeeded(CompositeDataChoice parent)
Expand the data choice if its a networklink
|
java.util.List |
getAllDateTimes()
Try to merge children up into parents of only one child
|
java.util.List |
getAllDateTimes(DataChoice dataChoice)
Get all the times for the given DataChoice
|
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
|
protected visad.Data |
getDataInner(DataChoice dataChoice,
DataCategory category,
DataSelection dataSelection,
java.util.Hashtable requestProperties)
Actually get the data identified by the given DataChoce.
|
protected java.io.InputStream |
getInputStream(java.lang.String path)
Create the input stream.
|
int |
getTimeIndexWithBounds(visad.DateTime dateTime,
java.util.List<visad.DateTime> allTimes,
ucar.nc2.ft2.coverage.CoverageCoordAxis1D cca) |
void |
init(java.lang.String probSevereUrl)
init KmlDataSource from the specification given.
|
void |
initAfterUnpersistence()
Initialize after we have been unpersisted
|
protected void |
initPolygonColorMap()
load probsevere color map
|
java.lang.String |
jsonObjToString(org.json.simple.JSONObject jsonObj)
build the json object string
|
static void |
main(java.lang.String[] args)
test main
|
protected void |
parseJSON(java.lang.String jsonUrl)
Get the kml root element
|
protected void |
parseJSONHead(java.lang.String jsonUrl)
Get the time list information
|
java.util.HashMap |
parseJSONModel(org.json.simple.JSONArray coords,
org.json.simple.JSONObject probJSON)
parsing the json object coordinate and properties
|
java.util.List |
processXml(org.w3c.dom.Element root)
Get color map from xml file
|
protected byte[] |
readBytes(java.lang.String path)
Utility to read the bytes from the file or url
|
protected org.w3c.dom.Document |
readColorMapXml(java.lang.String href)
Get color map from xml file
|
protected java.awt.Image |
readImage(java.lang.String url,
java.lang.String baseUrl)
Read the image
|
void |
reloadData()
reload
|
protected boolean |
shouldCache(visad.Data data)
See if this DataSource should cache or not
|
static void |
writeToFile(java.lang.String kmlFilename,
GeoLocationInfo bounds,
java.lang.String imageFileName)
write image as a kml to file
|
doRemove, equals, getDataFileExtension, getDataPaths, getFilePath, getFullDescription, getInputStreams, getLocationsForPolling, getPartialDescription, getSource, getSources, haveSources, initAfterCreation, initWithPollingInfo, isFileBased, newFilesFromPolling, processDataFilename, propertiesChanged, reloadData, saveDataToLocalDisk, setNewFiles, setSource, setSources, sourcesChanged, updateState
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, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllLevels, getAllLevels, getCache, getCache, getCacheClearDelay, getCacheDataToDisk, getCompositeDataChoices, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDefaultSave, 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, setDefaultSave, setDescription, setDescriptor, setDirectory, setEverChangedName, setInError, setInError, setInError, setName, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setTmpPaths, setUserName, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFile, writeFieldMaskFile
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getUniqueId
public static final PatternFileFilter FILTER_KML
public static final java.lang.String EXT_KML
public static final java.lang.String SUFFIX_KML
public static final java.lang.String ATTR_PARENT
public static final java.lang.String ATTR_NAME
public static final java.lang.String TAG_GROUNDOVERLAY
public static final java.lang.String TAG_PHOTOOVERLAY
public static final java.lang.String TAG_URL
public static final java.lang.String TAG_HREF
public static final java.lang.String TAG_LINK
public static final java.lang.String TAG_LINESTRING
public static final java.lang.String TAG_SCHEMA
public static final java.lang.String TAG_NETWORKLINK
public static final java.lang.String TAG_MULTIGEOMETRY
public static final java.lang.String TAG_DOCUMENT
public static final java.lang.String TAG_FOLDER
public static final java.lang.String TAG_KML
public static final java.lang.String TAG_PLACEMARK
public static final java.lang.String TAG_NAME
public static final java.lang.String TAG_STYLEURL
protected java.util.List cachedData
protected java.util.List cachedUrls
protected java.util.HashMap jsonInfo
protected java.util.List colorMap
protected java.util.List timeList
protected java.util.List times
public boolean useDriverTime
public JsonDataSource()
public JsonDataSource(DataSourceDescriptor descriptor, java.util.List newSources, java.util.Hashtable properties) throws visad.VisADException, java.lang.Exception
descriptor
- descriptor for the data sourcenewSources
- Where the json came fromproperties
- extra propertiesvisad.VisADException
- some problem occurred creating datajava.lang.Exception
public JsonDataSource(DataSourceDescriptor descriptor, java.lang.String probSevereUrl, java.util.Hashtable properties) throws visad.VisADException, java.lang.Exception
descriptor
- descriptor for the data sourceprobSevereUrl
- Where the kml came fromproperties
- extra propertiesvisad.VisADException
- some problem occurred creating datajava.lang.Exception
public void init(java.lang.String probSevereUrl) throws visad.VisADException, java.lang.Exception
probSevereUrl
- Where the json came fromvisad.VisADException
- some problem occurred creating datajava.lang.Exception
public java.util.List<visad.DateTime> getAllTimesForTimeDriver(DataChoice dataChoice, DataSelection selection, java.util.List<visad.DateTime> timeDriverTimes)
getAllTimesForTimeDriver
in class DataSourceImpl
dataChoice
- the data choiceselection
- the selection (for things like level)timeDriverTimes
- the time driver times (use range for server query)public static void writeToFile(java.lang.String kmlFilename, GeoLocationInfo bounds, java.lang.String imageFileName) throws java.io.FileNotFoundException, java.io.IOException
kmlFilename
- kml filenamebounds
- _image boundsimageFileName
- image filenamejava.io.FileNotFoundException
- On badnessjava.io.IOException
- On badnesspublic static java.lang.String createKml(GeoLocationInfo bounds, java.lang.String imageFileName) throws java.io.FileNotFoundException, java.io.IOException
bounds
- boundsimageFileName
- imagejava.io.FileNotFoundException
- On badnessjava.io.IOException
- On badnesspublic static void createLatLonBox(GeoLocationInfo bounds, java.lang.StringBuffer sb)
bounds
- boundssb
- buffer to add topublic static void main(java.lang.String[] args)
args
- cmd line argsprotected void initPolygonColorMap()
public java.util.List processXml(org.w3c.dom.Element root)
protected org.w3c.dom.Document readColorMapXml(java.lang.String href) throws java.lang.Exception
java.lang.Exception
public void reloadData()
reloadData
in interface DataSource
reloadData
in class FilesDataSource
public void initAfterUnpersistence()
initAfterUnpersistence
in interface DataSource
initAfterUnpersistence
in class FilesDataSource
protected java.awt.Image readImage(java.lang.String url, java.lang.String baseUrl)
url
- image urlbaseUrl
- Where the kml came from_protected byte[] readBytes(java.lang.String path) throws java.lang.Exception
path
- file or urljava.lang.Exception
- On badnessprotected java.io.InputStream getInputStream(java.lang.String path) throws java.lang.Exception
path
- file or urljava.lang.Exception
- On badnessprotected void parseJSON(java.lang.String jsonUrl) throws java.lang.Exception
jsonUrl
- json urljava.lang.Exception
- On badnessprotected void parseJSONHead(java.lang.String jsonUrl) throws java.lang.Exception
jsonUrl
- json urljava.lang.Exception
- On badnesspublic java.util.HashMap parseJSONModel(org.json.simple.JSONArray coords, org.json.simple.JSONObject probJSON)
public java.lang.String jsonObjToString(org.json.simple.JSONObject jsonObj)
public java.util.List getAllDateTimes(DataChoice dataChoice)
getAllDateTimes
in interface DataSource
getAllDateTimes
in class DataSourceImpl
public java.util.List getAllDateTimes()
getAllDateTimes
in interface DataSource
getAllDateTimes
in class DataSourceImpl
protected void doMakeDataChoices()
doMakeDataChoices
in class DataSourceImpl
public void expandIfNeeded(CompositeDataChoice parent)
expandIfNeeded
in interface DataSource
expandIfNeeded
in class DataSourceImpl
parent
- data choiceprotected visad.Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, java.util.Hashtable requestProperties) throws visad.VisADException, java.rmi.RemoteException
getDataInner
in class DataSourceImpl
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 getTimeIndexWithBounds(visad.DateTime dateTime, java.util.List<visad.DateTime> allTimes, ucar.nc2.ft2.coverage.CoverageCoordAxis1D cca)
protected boolean shouldCache(visad.Data data)
shouldCache
in class DataSourceImpl
data
- Data to cacheprotected java.util.List doMakeDateTimes()
doMakeDateTimes
in class DataSourceImpl