Homepage

netx.jnlp
Class JNLPFile

    java.lang.Object
    |
    +--netx.jnlp.JNLPFile

public class JNLPFile
extends java.lang.Object

Provides methods to access the information in a Java Network Launching Protocol (JNLP) file. The Java Network Launching Protocol specifies in an XML file the information needed to load, cache, and run Java code over the network and in a secure environment.

This class represents the overall information about a JNLP file from the jnlp element. Other information is accessed through objects that represent the elements of a JNLP file (information, resources, application-desc, etc). References to these objects are obtained by calling the getInformation, getResources, getSecurity, etc methods.

Version:
$Revision: 1.1 $
Author:
Jon A. Maxwell (JAM) - initial author

Constructor Summary
JNLPFile(java.io.InputStream input, boolean strict)
          Create a JNLPFile from an input stream.
JNLPFile(java.net.URL location)
          Create a JNLPFile from a URL.
JNLPFile(java.net.URL location, boolean strict)
          Create a JNLPFile from a URL checking for updates using the default policy.
JNLPFile(java.net.URL location, boolean strict, UpdatePolicy policy)
          Create a JNLPFile from a URL checking for updates using the specified policy.
 
Method Summary
 AppletDesc getApplet()
          Returns the launch information for an applet.
 ApplicationDesc getApplication()
          Returns the launch information for an application.
 java.net.URL getCodeBase()
          Returns the codebase URL for the JNLP file.
 ComponentDesc getComponent()
          Returns the launch information for a component.
 java.net.URL getFileLocation()
          Returns the location of the file parsed to create the JNLP file, or null if it was not created from a URL.
 Version getFileVersion()
          Returns the JNLP file's version.
 InformationDesc getInformation()
          Returns the information section of the JNLP file as viewed through the default locale.
 InformationDesc getInformation(java.util.Locale locale)
          Returns the information section of the JNLP file as viewed through the specified locale.
 InstallerDesc getInstaller()
          Returns the launch information for an installer.
 java.lang.Object getLaunchInfo()
          Returns an object of one of the following types: AppletDesc, ApplicationDesc, InstallerDesc, and ComponentDesc.
 ResourcesDesc getResources()
          Returns the resources section of the JNLP file as viewed through the default locale and the os.name and os.arch properties.
 ResourcesDesc getResources(java.util.Locale locale, java.lang.String os, java.lang.String arch)
          Returns the information section of the JNLP file for the specified locale, os, and arch.
 SecurityDesc getSecurity()
          Returns the security section of the JNLP file.
 java.net.URL getSourceLocation()
          Returns the JNLP file's network location as specified in the JNLP file.
 Version getSpecVersion()
          Returns the specification version required by the file.
static Version getSupportedVersions()
          Returns the JNLP specification versions supported.
 java.lang.String getTitle()
          Returns the JNLP file's title.
 boolean isApplet()
          Returns whether the lauch descriptor describes an Applet.
 boolean isApplication()
          Returns whether the lauch descriptor describes an Application.
 boolean isComponent()
          Returns whether the lauch descriptor describes a Component.
 boolean isInstaller()
          Returns whether the lauch descriptor describes an Installer.
 void setDefaults(java.lang.String os, java.lang.String arch, java.util.Locale locale)
          Sets the default view of the JNLP file returned by getInformation, getResources, etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNLPFile

    public JNLPFile(java.net.URL location)
    throws java.io.IOException,
    ParseException
Create a JNLPFile from a URL.

Parameters:
location - the location of the JNLP file
Throws:
java.io.IOException - if an IO exception occurred
ParseException - if the JNLP file was invalid

JNLPFile

    public JNLPFile(java.net.URL location,
    boolean strict)
    throws java.io.IOException,
    ParseException
Create a JNLPFile from a URL checking for updates using the default policy.

Parameters:
location - the location of the JNLP file
strict - whether to enforce the spec when
Throws:
java.io.IOException - if an IO exception occurred
ParseException - if the JNLP file was invalid

JNLPFile

    public JNLPFile(java.net.URL location,
    boolean strict,
    UpdatePolicy policy)
    throws java.io.IOException,
    ParseException
Create a JNLPFile from a URL checking for updates using the specified policy.

Parameters:
location - the location of the JNLP file
strict - whether to enforce the spec when
policy - the update policy
Throws:
java.io.IOException - if an IO exception occurred
ParseException - if the JNLP file was invalid

JNLPFile

    public JNLPFile(java.io.InputStream input,
    boolean strict)
    throws ParseException
Create a JNLPFile from an input stream.

Throws:
java.io.IOException - if an IO exception occurred
ParseException - if the JNLP file was invalid
Method Detail

getSupportedVersions

    public static Version getSupportedVersions()
Returns the JNLP specification versions supported.


getTitle

    public java.lang.String getTitle()
Returns the JNLP file's title. This method returns the same value as InformationDesc.getTitle().


getSourceLocation

    public java.net.URL getSourceLocation()
Returns the JNLP file's network location as specified in the JNLP file.


getFileLocation

    public java.net.URL getFileLocation()
Returns the location of the file parsed to create the JNLP file, or null if it was not created from a URL.


getFileVersion

    public Version getFileVersion()
Returns the JNLP file's version.


getSpecVersion

    public Version getSpecVersion()
Returns the specification version required by the file.


getCodeBase

    public java.net.URL getCodeBase()
Returns the codebase URL for the JNLP file.


getInformation

    public InformationDesc getInformation()
Returns the information section of the JNLP file as viewed through the default locale.


getInformation

    public InformationDesc getInformation(java.util.Locale locale)
Returns the information section of the JNLP file as viewed through the specified locale.


getSecurity

    public SecurityDesc getSecurity()
Returns the security section of the JNLP file.


getResources

    public ResourcesDesc getResources()
Returns the resources section of the JNLP file as viewed through the default locale and the os.name and os.arch properties.


getResources

    public ResourcesDesc getResources(java.util.Locale locale,
    java.lang.String os,
    java.lang.String arch)
Returns the information section of the JNLP file for the specified locale, os, and arch.


getLaunchInfo

    public java.lang.Object getLaunchInfo()
Returns an object of one of the following types: AppletDesc, ApplicationDesc, InstallerDesc, and ComponentDesc.


getApplet

    public AppletDesc getApplet()
Returns the launch information for an applet.

Throws:
java.lang.UnsupportedOperationException - if there is no applet information

getApplication

    public ApplicationDesc getApplication()
Returns the launch information for an application.

Throws:
java.lang.UnsupportedOperationException - if there is no application information

getComponent

    public ComponentDesc getComponent()
Returns the launch information for a component.

Throws:
java.lang.UnsupportedOperationException - if there is no component information

getInstaller

    public InstallerDesc getInstaller()
Returns the launch information for an installer.

Throws:
java.lang.UnsupportedOperationException - if there is no installer information

isApplet

    public boolean isApplet()
Returns whether the lauch descriptor describes an Applet.


isApplication

    public boolean isApplication()
Returns whether the lauch descriptor describes an Application.


isComponent

    public boolean isComponent()
Returns whether the lauch descriptor describes a Component.


isInstaller

    public boolean isInstaller()
Returns whether the lauch descriptor describes an Installer.


setDefaults

    public void setDefaults(java.lang.String os,
    java.lang.String arch,
    java.util.Locale locale)
Sets the default view of the JNLP file returned by getInformation, getResources, etc. If unset, the defaults are the properties os.name, os.arch, and the locale returned by Locale.getDefault().


Homepage