Contains methods to parse an XML document into a JNLPFile.
Implements JNLP specification version 1.0.
addInfo
protected void addInfo(InformationDesc info,
Node node,
String mod,
Object value)
Adds a key,value pair to the information object.
info
- the information objectnode
- node name to be used as the keymod
- key name appended with "-"+mod if not nullvalue
- the info object to add (icon or string)
getAttribute
public String getAttribute(Node node,
String name,
String defaultValue)
Retuns an attribute or the specified defaultValue if there is
no such attribute.
node
- the nodename
- the attributedefaultValue
- default if no such attribute
getChildNode
public static Node getChildNode(Node node,
String name)
Returns the first child node with the specified name.
getChildNodes
public static Node[] getChildNodes(Node node,
String name)
Returns all child nodes with the specified name.
getCodeBase
public URL getCodeBase()
Returns the codebase.
getComponent
public ComponentDesc getComponent(Node node)
Returns the component descriptor.
getExtension
public ExtensionDesc getExtension(Node node)
throws ParseException
Returns the Extension element at the specified node.
node
- the extension node
getFileLocation
public URL getFileLocation()
Returns the file location.
getFileVersion
public Version getFileVersion()
Returns the file version.
getInfo
public List getInfo(Node parent)
throws ParseException
Returns all of the information elements under the specified
node.
parent
- the parent node (jnlp)
getInformationDesc
public InformationDesc getInformationDesc(Node node)
throws ParseException
Returns the information element at the specified node.
node
- the information node
getInstaller
public InstallerDesc getInstaller(Node node)
Returns the installer descriptor.
getJAR
public JARDesc getJAR(Node node)
throws ParseException
Returns the JAR element at the specified node.
node
- the jar or nativelib node
getLauncher
public Object getLauncher(Node parent)
throws ParseException
Returns the launch descriptor element, either AppletDesc,
ApplicationDesc, ComponentDesc, or InstallerDesc.
getLocale
public Locale getLocale(String localeStr)
Returns a Locale from a single locale.
getLocales
public Locale[] getLocales(Node node)
Returns the Locale object(s) from a node's locale attribute.
node
- the node with a locale attribute
getRequiredAttribute
public String getRequiredAttribute(Node node,
String name,
String defaultValue)
throws ParseException
Returns the same result as getAttribute except that if strict
mode is enabled or the default value is null a parse
exception is thrown instead of returning the default value.
node
- the nodename
- the attributedefaultValue
- default value
getRequiredURL
public URL getRequiredURL(Node node,
String name,
URL base)
throws ParseException
Returns the same result as getURL except that a
ParseException is thrown if the attribute is null or empty.
node
- the nodename
- the attribute containing an hrefbase
- the base URL
getResources
public List getResources(Node parent,
boolean j2se)
throws ParseException
Returns all of the ResourcesDesc elements under the specified
node (jnlp or j2se).
parent
- the parent node (either jnlp or j2se)j2se
- true if the resources are located under a j2se node
getResourcesDesc
public ResourcesDesc getResourcesDesc(Node node,
boolean j2se)
throws ParseException
Returns the ResourcesDesc element at the specified node.
node
- the resources nodej2se
- true if the resources are located under a j2se node
getRootNode
public static Node getRootNode(InputStream input)
throws ParseException
Return the root node from the XML document in the specified
input stream.
getSecurity
public SecurityDesc getSecurity(Node parent)
throws ParseException
Returns the security descriptor element. If no security
element was specified in the JNLP file then a SecurityDesc
with applet permissions is returned.
getSpanText
public String getSpanText(Node node)
throws ParseException
Returns the implied text under a node, for example "text" in
"text".
node
- the node with text under it
getSpecVersion
public Version getSpecVersion()
Returns the specification version.
getSupportedVersions
public static Version getSupportedVersions()
Return the JNLP specification versions supported.
getURL
public URL getURL(Node node,
String name,
URL base)
throws ParseException
Returns a URL object from a href string relative to the
code base. If the href denotes a relative URL, it must
reference a location that is a subdirectory of the
codebase.
node
- the nodename
- the attribute containing an hrefbase
- the base URL
getVersion
public Version getVersion(Node node,
String name,
String defaultValue)
Returns a Version from the specified attribute and default
value.
node
- the nodename
- the attributedefaultValue
- default if no such attribute
- a Version, or null if no such attribute and default is null
isTrustedEnvironment
protected boolean isTrustedEnvironment()
Returns whether the JNLP file requests a trusted execution
environment.
splitString
public String[] splitString(String source)
Returns an array of substrings seperated by spaces (spaces
escaped with backslash do not separate strings). This method
splits strings as per the spec except that it does replace
escaped other characters with their own value.