openInstaller Feature Overview: Installation over HTTP using JNLP
Java Web Start & JNLP
One of the most exciting features that Java offers is the ability to execute Swing-based applications that reside on a remote server from a client's system using Java Web Start (JWS). Java Network Launching Protocol (JNLP) is the underlying protocol that specifies how JWS applications are launched.
A JNLP file is an XML file that includes information such as the URL codebase of the source, general information about the application, the location of all the required JAR files & other resources and the main class that serves as the entry point for the application, etc.
JNLP in openInstaller
openInstaller 0.9.4 introduces basic JNLP support for creating single-click installers. A customizable JNLP template named product-installer.jnlp can be found in the openInstaller source under “sample_product/resources”. Individual product installers could copy this template to their product metadata location, customize it by making very minimal changes & then use it to create a WebStart-version of their product installer.
Here are the steps to create a WebStart-based installer for the sample product that comes with the openInstaller source:
1. Download and extract the latest openInstaller source onto your local filesystem.
2. Build the source as per the instructions.
3. Create a JAR file called resources.jar with the entire contents of the "build/proto/install/lib/resources" directory and place it under build/proto/install/lib/resources. After creating the resources.jar file should have a structure like this.
resources.jar
|_ dependency
|_ model
|_ org
|_ templates
|_ view
4. All the JAR files under “build/proto/install/lib” and its subdirectories need to be signed before they can used by Java Web Start. This is a security requirement that prevents unauthorized access to the application. The JARs can also be signed using the 'jarsigner' utility that comes with Java SDK.
5. Host the created build directory using a Web Server. After hosting, the URL that points to the build directory is referred to as the BASE_URL of the installer.
6. Open the file “build/proto_metadata/Metadata/product-installer.jnlp” and replace all occurrences of ${BASE_URL} with the URL that points to the build directory.
7. Start the Web Server.
8. Use Java Web Start (javaws) to invoke the installer. For example, if the BASE_URL is http://somehost.com:8080/sampleproduct, then the command for invoking the installer would be
javaws http://somehost.com:8080/sampleproduct/proto_metadata/Metadata/product-installer.jnlp
Note: openInstaller makes extensive use of JAXB, which is included as part of the Java SDK only from version 1.6.0. So, the sample product installer would only work with Java Web Start version 1.6.0 or higher.
Future Enhancements to JNLP support
1. The EngineBootstrap and Orchestrator classes have code that does things differently for the WebStart mode and the normal mode. The ideal design and implementation should allow the installer to run seamlessly in both modes, without having to write mode-specific code. The use of constructs like
if (webstart) {
// do like this
} else {
// do it differently
}
would be eliminated.
2. The use of platform-independent product zip files for the sample product installer would introduce the flexibility to test the installer hosted at a particular source on any client machine.
3. Moving forward, it would be ideal to have the product and installer metadata packaged as jars. It has two advantages: a) Hosting and maintaining a single jar file is easier than having to maintain hordes of individual files. b) Enhances installer performance by eliminating latency / response gaps while navigating between pages.
4. A WebStart-based installation that uses stream-formatted packages on Solaris causes pkgadd to fail since the -r option (that is used to specify response files) doesn't work for web-based sources. This would be fixed so that stream-formatted packages are successfully installed over HTTP.
