|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.IdvResourceManager
edu.wisc.ssec.mcidasv.ResourceManager
public class ResourceManager
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ucar.unidata.idv.IdvResourceManager |
---|
IdvResourceManager.IdvResource, IdvResourceManager.XmlIdvResource |
Field Summary | |
---|---|
private static org.slf4j.Logger |
logger
|
static IdvResourceManager.IdvResource |
RSC_NEW_USERSERVERS
|
static IdvResourceManager.IdvResource |
RSC_OLD_USERSERVERS
|
static IdvResourceManager.XmlIdvResource |
RSC_PARAMETERSETS
Points to the adde image defaults |
static IdvResourceManager.IdvResource |
RSC_SITESERVERS
|
Fields inherited from class ucar.unidata.ui.WindowHolder |
---|
contents, dialog, frame, window |
Constructor Summary | |
---|---|
ResourceManager(IntegratedDataViewer idv)
|
Method Summary | |
---|---|
private void |
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" |
private static String |
fixId(Element resource)
Utility method that calls StateManager.fixIds(String) . |
private ResourceCollection |
getCollection(Element rsrc,
String name)
Returns either a "normal" ResourceCollection or a
XmlResourceCollection , based upon rsrc . |
private List<String> |
getInvalidMapsInResource(String path)
Checks an individual map resource (typically from RSC_MAPS ) to
verify that all of the specified maps exist? |
private Map<String,String> |
getNodeAttributes(Element resourceNode)
Builds an attribute:value Map based upon the contents of
resourceNode . |
private Map<String,String> |
getNodeProperties(Element resourceNode)
"Resource" elements within a RBI file are allowed to have an arbitrary number of "property" child elements (or none at all). |
private List<String> |
getPaths(String origPath,
Map<String,String> props)
Expands origPath (if needed) and builds a List of paths. |
String |
getResourcePath(String path)
Adds support for McIDAS-V macros. |
protected void |
init(List rbiFiles)
Overridden so that McIDAS-V can attempt to verify "critical" resources without causing crashes. |
private boolean |
isPathValid(String path)
Pretty much relies upon IOUtil.getInputStream(String, Class)
to determine if path exists. |
protected void |
processRbi(Element root,
boolean observeLoadMore)
Processes the top-level "root" of a RBI XML file. |
protected void |
verifyResources()
Loops through all of the ResourceCollection s that the IDV knows
about. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.slf4j.Logger logger
public static final IdvResourceManager.XmlIdvResource RSC_PARAMETERSETS
public static final IdvResourceManager.IdvResource RSC_SITESERVERS
public static final IdvResourceManager.IdvResource RSC_NEW_USERSERVERS
public static final IdvResourceManager.IdvResource RSC_OLD_USERSERVERS
Constructor Detail |
---|
public ResourceManager(IntegratedDataViewer idv)
Method Detail |
---|
protected void init(List rbiFiles)
Currently doesn't do a whole lot.
init
in class IdvResourceManager
verifyResources()
protected void verifyResources()
ResourceCollection
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).
private boolean isPathValid(String path)
IOUtil.getInputStream(String, Class)
to determine if path
exists.
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 not
null
!
true
iff there were no problems. false
otherwise.public String getResourcePath(String path)
getResourcePath
in class IdvResourceManager
path
- Path that contains a macro to be translated.
IdvResourceManager.getResourcePath(String)
private void checkMoveOutdatedDefaultBundle()
private List<String> getInvalidMapsInResource(String path)
RSC_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).
path
- Path to a map resource. URLs are allowed, but null
is not.
IdvResourceManager.RSC_MAPS
private ResourceCollection getCollection(Element rsrc, String name)
ResourceCollection
or a
XmlResourceCollection
, based upon rsrc
.
rsrc
- XML representation of a resource collection. Should not be
null
.name
- The "name" to associate with the returned
ResourceCollection
. Should not be null
.private Map<String,String> getNodeProperties(Element resourceNode)
This method iterates through any property elements and creates a Map
of name:value
pairs.
resourceNode
- The "resource" element to examine. Should
not be null
. Resources without property
s are permitted.
Map
of name:value
pairs or an empty
Map
.private Map<String,String> getNodeAttributes(Element resourceNode)
attribute:value
Map
based upon the contents of
resourceNode
.
Be aware that "location" and "id" attributes are ignored, as the IDV apparently considers them to be special.
resourceNode
- The XML element to examine. Should not be
null
.
Map
of attribute:value
pairs or an
empty Map
.private List<String> getPaths(String origPath, Map<String,String> props)
origPath
(if needed) and builds a List
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>The
origPath
parameter will be the value of the "location"
attribute. If origPath
is inaccessible, then the path given by
the "default" property will be used.
origPath
- Typically the value of the "location"
attribute associated with a given resource. Cannot be null
.props
- Contains the property name:value
pairs associated with
the resource whose path is being examined. Cannot be null
.
List
of paths associated with a given resource.isPathValid(String)
private static String fixId(Element resource)
StateManager.fixIds(String)
.
protected void processRbi(Element root, boolean observeLoadMore)
processRbi
in class IdvResourceManager
root
- The "root" element. Should not be null
.observeLoadMore
- Whether or not processing should continue if a
"loadmore" tag is encountered.getPaths(String, Map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |