Class ResourceManager
- All Implemented Interfaces:
ActionListener
,EventListener
,HyperlinkListener
,IdvConstants
IdvResourceManager
are supporting "default" McIDAS-V
bundles, and some initial attempts at safer resource handling.-
Nested Class Summary
Nested classes/interfaces inherited from class ucar.unidata.idv.IdvResourceManager
IdvResourceManager.IdvResource, IdvResourceManager.XmlIdvResource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
static final IdvResourceManager.IdvResource
static final IdvResourceManager.IdvResource
static final IdvResourceManager.XmlIdvResource
Points to the adde image defaultsstatic final IdvResourceManager.IdvResource
Fields inherited from class ucar.unidata.idv.IdvResourceManager
ATTR_ID, ATTR_LABEL, ATTR_LOADMORE, ATTR_LOCATION, ATTR_NAME, ATTR_REMOVEPREVIOUS, ATTR_RESOURCETYPE, ATTR_VALUE, hasInitializedTranslations, resources, RSC_ACTIONS, RSC_ADDESERVER, RSC_ALIASES, RSC_AUTODISPLAYS, RSC_BACKGROUNDWMS, RSC_BUNDLES, RSC_BUNDLEXML, RSC_CHOOSERS, RSC_COLORPAIRS, RSC_COLORTABLES, RSC_CONTROLS, RSC_DATASOURCE, RSC_DERIVED, RSC_DISPLAYSETTINGS, RSC_GEMPAKGRIDPARAMTABLES, RSC_GLOBEMAPS, RSC_GRIB1LOOKUPTABLES, RSC_GRIB2LOOKUPTABLES, RSC_HELPTIPS, RSC_IMAGEDEFAULTS, RSC_IMAGESETS, RSC_JYTHON, RSC_JYTHONTOCOPY, RSC_LOCATIONS, RSC_MAPS, RSC_MENUBAR, RSC_MESSAGES, RSC_NJCONFIG, RSC_PARAMDEFAULTS, RSC_PARAMGROUPS, RSC_PLUGININDEX, RSC_PLUGINS, RSC_PREFERENCES, RSC_PROJECTIONS, RSC_PROTOTYPES, RSC_PUBLISHERS, RSC_PUBLISHERTYPES, RSC_QUICKLINKS, RSC_SKIN, RSC_STATIONMODELS, RSC_STATIONSYMBOLS, RSC_TOOLBAR, RSC_TRANSECTS, RSC_TRANSLATIONS, RSC_URLMAPS, RSC_USERCHOOSER, RSC_VARIABLERENAMER, RSC_VIEWPOINTS, TAG_PROPERTY, TAG_RESOURCE, TAG_RESOURCEBUNDLE, TAG_RESOURCES, translationTables
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Look for existing "default.mcv" and "default.xidv" bundles in root userpath If they exist, move them to the "bundles" directory, preferring "default.mcv"private static String
Utility method that callsStateManager.fixIds(String)
.private ResourceCollection
getCollection
(Element rsrc, String name) Checks an individual map resource (typically fromRSC_MAPS
) to verify that all of the specified maps exist?getNodeAttributes
(Element resourceNode) getNodeProperties
(Element resourceNode) "Resource" elements within a RBI file are allowed to have an arbitrary number of "property" child elements (or none at all).ExpandsorigPath
(if needed) and builds aList
of paths.getResourcePath
(String path) Adds support for McIDAS-V macros.protected void
Overridden so that McIDAS-V can attempt to verify "critical" resources without causing crashes.private boolean
isPathValid
(String path) Pretty much relies uponIOUtil.getInputStream(String, Class)
to determine ifpath
exists.protected void
processRbi
(Element root, boolean observeLoadMore) Processes the top-level "root" of a RBI XML file.protected void
Loops through all of theResourceCollection
s that the IDV knows about.Methods inherited from class ucar.unidata.idv.IdvResourceManager
addDisplaySetting, clearDefaultBundles, clearResourceMacros, createMapInfo, createResourceCollection, createXmlResourceCollection, displaySettingChanged, findDisplaySetting, findLocations, findLocationsByType, getAppResourcePath, getDataResourcePath, getDefaultStations, getDisplaySettings, getDisplaySettingsTimestamp, getHtmlView, getIdvResourcePath, getLocationList, getMacroMap, getMapResources, getMaps, getResourceList, getResourcePaths, getResources, getResources, getResources, getResourcesForUser, getResourceUrlBase, getSitePath, getTransects, getTranslationsHashtable, getUserHome, getUserPath, getXmlResources, getXmlResources, hyperlinkUpdate, processRbi, removeDisplaySetting, removeDisplaySettings, removeLocalMaps, removeResources, showHtmlView, writeMapState, writeTransects
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDone
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
-
Field Details
-
logger
-
RSC_PARAMETERSETS
Points to the adde image defaults -
RSC_SITESERVERS
-
RSC_NEW_USERSERVERS
-
RSC_OLD_USERSERVERS
-
-
Constructor Details
-
ResourceManager
-
-
Method Details
-
init
Overridden so that McIDAS-V can attempt to verify "critical" resources without causing crashes.Currently doesn't do a whole lot.
- Overrides:
init
in classIdvResourceManager
- See Also:
-
verifyResources
Loops through all of theResourceCollection
s that the IDV knows about.I realize that this could balloon into a really tedious thing... there could potentially be verification steps for each type of resource collection! the better approach is probably to identify a few key collections (like the (default?) maps).
-
isPathValid
Pretty much relies uponIOUtil.getInputStream(String, Class)
to determine ifpath
exists.- Parameters:
path
- Path to an arbitrary file. It can be a remote URL, normal file on disk, or a file included in a JAR. Just so long as it's notnull
!- Returns:
true
iff there were no problems.false
otherwise.
-
getResourcePath
Adds support for McIDAS-V macros. Specifically:- Overrides:
getResourcePath
in classIdvResourceManager
- Parameters:
path
- Path that contains a macro to be translated.- Returns:
- Resource with our macros applied.
- See Also:
-
checkMoveOutdatedDefaultBundle
Look for existing "default.mcv" and "default.xidv" bundles in root userpath If they exist, move them to the "bundles" directory, preferring "default.mcv" -
getInvalidMapsInResource
Checks an individual map resource (typically fromRSC_MAPS
) to verify that all of the specified maps exist?Currently a no-op. The intention is to return a
List
so that the set of missing resources can eventually be sent off in a support request...We could also decide to allow the user to search the list of plugins or ignore any missing resources (simply remove the bad stuff from the list of available xml).
- Parameters:
path
- Path to a map resource. URLs are allowed, butnull
is not.- Returns:
- List of map paths that could not be read. If there were no errors the list is merely empty.
- See Also:
-
getCollection
- Parameters:
rsrc
- XML representation of a resource collection. Should not benull
.name
- "name" to associate with the returnedResourceCollection
. Should not benull
.- Returns:
ResourceCollection
represented byrsrc
.
-
getNodeProperties
"Resource" elements within a RBI file are allowed to have an arbitrary number of "property" child elements (or none at all). The property elements must have "name" and "value" attributes.This method iterates through any property elements and creates a
Map
ofname:value
pairs.- Parameters:
resourceNode
- The "resource" element to examine. Should not benull
. Resources withoutproperty
s are permitted.- Returns:
- Either a
Map
ofname:value
pairs or an emptyMap
.
-
getNodeAttributes
Builds anattribute:value
Map
based upon the contents ofresourceNode
.Be aware that "location" and "id" attributes are ignored, as the IDV apparently considers them to be special.
- Parameters:
resourceNode
- The XML element to examine. Should not benull
.- Returns:
- Either a
Map
ofattribute:value
pairs or an emptyMap
.
-
getPaths
ExpandsorigPath
(if needed) and builds aList
of paths. Paths beginning with "index:" or "http:" may be in need of expansion."Index" files contain a list of paths. These paths should be used instead of
origPath
.Files that reside on a webserver (these begin with "http:") may be inaccessible for a variety of reasons. McIDAS-V allows a RBI file to specify a "property" named "default" whose "value" is a path to use as a backup.
For example:
<resources name="idv.resource.pluginindex"> <resource label="Plugin Index" location="https://www.ssec.wisc.edu/mcidas/software/v/resources/plugins/plugins.xml"> <property name="default" value="%APPPATH%/plugins.xml"/> </resource> </resources>
TheorigPath
parameter will be the value of the "location" attribute. IforigPath
is inaccessible, then the path given by the "default" property will be used.- Parameters:
origPath
- Typically the value of the "location" attribute associated with a given resource. Cannot benull
.props
- Contains the propertyname:value
pairs associated with the resource whose path is being examined. Cannot benull
.- Returns:
List
of paths associated with a given resource.- See Also:
-
fixId
Utility method that callsStateManager.fixIds(String)
.- Parameters:
resource
- Resource whose ID should be fixed.- Returns:
- "Fixed" ID for
resource
. - See Also:
-
processRbi
Processes the top-level "root" of a RBI XML file. Overridden in McIDAS-V so that remote resources can have a backup location.- Overrides:
processRbi
in classIdvResourceManager
- Parameters:
root
- The "root" element. Should not benull
.observeLoadMore
- Whether or not processing should continue if a "loadmore" tag is encountered.- See Also:
-