|
Homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--netx.jnlp.Parser
Contains methods to parse an XML document into a JNLPFile. Implements JNLP specification version 1.0.
Constructor Summary | |
Parser(JNLPFile file,
java.net.URL base,
Node root,
boolean strict,
boolean allowExtensions)
Create a parser for the JNLP file. |
Method Summary | |
protected void |
addInfo(InformationDesc info,
Node node,
java.lang.String mod,
java.lang.Object value)
Adds a key,value pair to the information object. |
AppletDesc |
getApplet(Node node)
Returns the applet descriptor. |
ApplicationDesc |
getApplication(Node node)
Returns the application descriptor. |
java.lang.String |
getAttribute(Node node,
java.lang.String name,
java.lang.String defaultValue)
Retuns an attribute or the specified defaultValue if there is no such attribute. |
static Node |
getChildNode(Node node,
java.lang.String name)
Returns the first child node with the specified name. |
static Node[] |
getChildNodes(Node node,
java.lang.String name)
Returns all child nodes with the specified name. |
java.net.URL |
getCodeBase()
Returns the codebase. |
ComponentDesc |
getComponent(Node node)
Returns the component descriptor. |
ExtensionDesc |
getExtension(Node node)
Returns the Extension element at the specified node. |
java.net.URL |
getFileLocation()
Returns the file location. |
Version |
getFileVersion()
Returns the file version. |
IconDesc |
getIcon(Node node)
Returns the icon element at the specified node. |
java.util.List |
getInfo(Node parent)
Returns all of the information elements under the specified node. |
InformationDesc |
getInformationDesc(Node node)
Returns the information element at the specified node. |
InstallerDesc |
getInstaller(Node node)
Returns the installer descriptor. |
JARDesc |
getJAR(Node node)
Returns the JAR element at the specified node. |
JREDesc |
getJRE(Node node)
Returns the JRE element at the specified node. |
java.lang.Object |
getLauncher(Node parent)
Returns the launch descriptor element, either AppletDesc, ApplicationDesc, ComponentDesc, or InstallerDesc. |
java.util.Locale |
getLocale(java.lang.String localeStr)
Returns a Locale from a single locale. |
java.util.Locale[] |
getLocales(Node node)
Returns the Locale object(s) from a node's locale attribute. |
PackageDesc |
getPackage(Node node)
Returns the Package element at the specified node. |
PropertyDesc |
getProperty(Node node)
Returns the Property element at the specified node. |
java.lang.String |
getRequiredAttribute(Node node,
java.lang.String name,
java.lang.String defaultValue)
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. |
java.net.URL |
getRequiredURL(Node node,
java.lang.String name,
java.net.URL base)
Returns the same result as getURL except that a ParseException is thrown if the attribute is null or empty. |
java.util.List |
getResources(Node parent,
boolean j2se)
Returns all of the ResourcesDesc elements under the specified node (jnlp or j2se). |
ResourcesDesc |
getResourcesDesc(Node node,
boolean j2se)
Returns the ResourcesDesc element at the specified node. |
static Node |
getRootNode(java.io.InputStream input)
Return the root node from the XML document in the specified input stream. |
SecurityDesc |
getSecurity(Node parent)
Returns the security descriptor element. |
java.lang.String |
getSpanText(Node node)
Returns the implied text under a node, for example "text" in " |
Version |
getSpecVersion()
Returns the specification version. |
static Version |
getSupportedVersions()
Return the JNLP specification versions supported. |
java.net.URL |
getURL(Node node,
java.lang.String name,
java.net.URL base)
Returns a URL object from a href string relative to the code base. |
Version |
getVersion(Node node,
java.lang.String name,
java.lang.String defaultValue)
Returns a Version from the specified attribute and default value. |
protected boolean |
isTrustedEnvironment()
Returns whether the JNLP file requests a trusted execution environment. |
java.lang.String[] |
splitString(java.lang.String source)
Returns an array of substrings seperated by spaces (spaces escaped with backslash do not separate strings). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Parser(JNLPFile file, java.net.URL base, Node root, boolean strict, boolean allowExtensions) throws ParseException
The root node may be normalized as a side effect of this constructor.
file
- the (uninitialized) file referencebase
- if codebase is not specified, a default base for relative URLsroot
- the root nodestrict
- whether to enforce strict compliance with the JNLP specallowExtensions
- whether to allow extensions to the JNLP spec
ParseException
- if the JNLP file is invalidMethod Detail |
public static Version getSupportedVersions()
public Version getFileVersion()
public java.net.URL getFileLocation()
public java.net.URL getCodeBase()
public Version getSpecVersion()
public java.util.List getResources(Node parent, boolean j2se) throws ParseException
parent
- the parent node (either jnlp or j2se)j2se
- true if the resources are located under a j2se node
ParseException
- if the JNLP file is invalidpublic ResourcesDesc getResourcesDesc(Node node, boolean j2se) throws ParseException
node
- the resources nodej2se
- true if the resources are located under a j2se node
ParseException
- if the JNLP file is invalidpublic JREDesc getJRE(Node node) throws ParseException
node
- the j2se node
ParseException
- if the JNLP file is invalidpublic JARDesc getJAR(Node node) throws ParseException
node
- the jar or nativelib node
ParseException
- if the JNLP file is invalidpublic ExtensionDesc getExtension(Node node) throws ParseException
node
- the extension node
ParseException
- if the JNLP file is invalidpublic PropertyDesc getProperty(Node node) throws ParseException
node
- the property node
ParseException
- if the JNLP file is invalidpublic PackageDesc getPackage(Node node) throws ParseException
node
- the package node
ParseException
- if the JNLP file is invalidpublic java.util.List getInfo(Node parent) throws ParseException
parent
- the parent node (jnlp)
ParseException
- if the JNLP file is invalidpublic InformationDesc getInformationDesc(Node node) throws ParseException
node
- the information node
ParseException
- if the JNLP file is invalidprotected void addInfo(InformationDesc info, Node node, java.lang.String mod, java.lang.Object value)
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)public IconDesc getIcon(Node node) throws ParseException
node
- the icon node
ParseException
- if the JNLP file is invalidpublic SecurityDesc getSecurity(Node parent) throws ParseException
parent
- the parent node
ParseException
- if the JNLP file is invalidprotected boolean isTrustedEnvironment()
public java.lang.Object getLauncher(Node parent) throws ParseException
parent
- the parent node
ParseException
- if the JNLP file is invalidpublic AppletDesc getApplet(Node node) throws ParseException
ParseException
- if the JNLP file is invalidpublic ApplicationDesc getApplication(Node node) throws ParseException
ParseException
- if the JNLP file is invalidpublic ComponentDesc getComponent(Node node)
public InstallerDesc getInstaller(Node node)
public java.lang.String[] splitString(java.lang.String source)
public java.util.Locale[] getLocales(Node node)
node
- the node with a locale attributepublic java.util.Locale getLocale(java.lang.String localeStr)
public java.lang.String getSpanText(Node node) throws ParseException
node
- the node with text under it
ParseException
- if the JNLP file is invalidpublic static Node getChildNode(Node node, java.lang.String name)
public static Node[] getChildNodes(Node node, java.lang.String name)
public java.net.URL getRequiredURL(Node node, java.lang.String name, java.net.URL base) throws ParseException
node
- the nodename
- the attribute containing an hrefbase
- the base URL
ParseException
- if the JNLP file is invalidpublic java.net.URL getURL(Node node, java.lang.String name, java.net.URL base) throws ParseException
node
- the nodename
- the attribute containing an hrefbase
- the base URL
ParseException
- if the JNLP file is invalidpublic Version getVersion(Node node, java.lang.String name, java.lang.String defaultValue)
node
- the nodename
- the attributedefaultValue
- default if no such attribute
public java.lang.String getRequiredAttribute(Node node, java.lang.String name, java.lang.String defaultValue) throws ParseException
node
- the nodename
- the attributedefaultValue
- default value
ParseException
- if the attribute does not exist or is emptypublic java.lang.String getAttribute(Node node, java.lang.String name, java.lang.String defaultValue)
node
- the nodename
- the attributedefaultValue
- default if no such attributepublic static Node getRootNode(java.io.InputStream input) throws ParseException
ParseException
- if the JNLP file is invalid
|
Homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |