EnterpriseElements Logo

Launching Applications With Java Web Start (JNLP)

The JNLP servlet, dynamically generates JNLP used to launch Java applications using Java Web Start. Starting with version 3.5, Elements allows you to register Java applications. Registered applications receive hyperlinks in the "Applications" section of the home page, and can contain special configuration parameters, and command line arguments.

Data

This is a summary of the data and configuration required to use the JNLP launching servlet.

The applications are registered as named text entries, this is specified by type id = 10. The Label column represents the text shown in the application list of the webapp, and the value is the url for the specific application. Access to specific applications can be controlled by named text security.

Named Text Table
ID LABEL VALUE TYPE_ID EDITED_BY
? eExplorer explorer.jnlp 10 -1

In addition to the named text registry each application will need some specific parameters. Type id 11 is assigned for this purpose. The id column should reference the named text, text_id under which the application is registered.

Parameter Table
ID TYPE_ID PARAMETER VALUE Note
-? 11 JNLP_WEB_ICON images/app_explore.gif Icon appearing in the web application link that launches this application.
-1 11 JNLP_CLASS_NAME com.ee.client The Java class name of the application.
? 11 JNLP_APP_CLASS com.ee.client.applications.eexplorer.EExplorer For Enterprise Elements applications the application to be launched by com.ee.client.
-1 11 JNLP_JAR_FILE ee.jar The jar file holding the JNLP_CLASS_NAME java class file.
? 11 JNLP_DESCRIPTION Elements Repository Explorer.
-1 11 JNLP_TITLE Enterprise Elements
-1 11 JNLP_VENDOR Redefining the Repository
-1 11 JNLP_ICON images/logo.jpg The application icon (not shown in the web application).
-1 11 JNLP_DEPENDENT_JAR_FILES Semi colon separated list of dependent jar files..
-1 11 JNLP_JAVA_VERSION 1.5+ Java runtime required for application. See Sun's documentation on JNLP for the exact syntax of this value.

Id parameters of -1 are common to all apps, id parameters of ? are specific to an individual application, at least for Enterprise Elements applications. Third party applications may override any/all of these. It may look like the jnlp_vendor and jnlp_title are reversed, but that is the way we set them currently to get the desired display on the Web Start dialog.

Additional request parameters to this servlet will be passed through the JNLP as command line arguments to the application defined by the JNLP_CLASS_NAME parameter. For example:

http://mocha:8082/ee/explorer.jnlp?id=5&name=test

The query string of the url will add id=5 and name=test to the command line args of the application.

The existing jnlp servlet will be refactored to query for this data. The key for the query is the combination of named text type_id and value. For the parameter table keying is through the id and type_id.

As with other product extensions, cutom gui could be written, but more likely just mananged by documentation and sample sql statements to add, modify, or remove enteries.

Sample SQL

Register an application. This is the eExplorer as an example.
INSERT INTO named_text (text_id,label,value,type_id, edited_by) VALUES(646,'eExplorer','explorer.jnlp',10,-1);
Setting parameters for the eExplorer application. The application will also inherit all of the parameters with id = -1 that start with JNLP_
INSERT INTO parameter( id, parameter, value, type_id ) VALUES(646, 'JNLP_APP_NAME', 'com.ee.client.applications.eexplorer.EExplorer', 11);
INSERT INTO parameter( id, parameter, value, type_id ) VALUES(646, 'JNLP_WEB_ICON', 'images/app_explore.gif', 11);
Register a third party application.
INSERT INTO named_text (text_id,label,value,type_id, edited_by) VALUES(?,'AppName','AppName.jnlp',10,-1);
Setting parameters for the third party application. The application will inherit any of the parameters with id = -1 that start with JNLP_, that are not specifically overriden. This example overrides the JNLP_CLASS_NAME, JNLP_WEB_ICON, and JNLP_JAR_FILE. To add a third party application you should look carefully at the parameter list to decide exactly what your application needs.
INSERT INTO parameter( id, parameter, value, type_id ) VALUES(?, 'JNLP_CLASS_NAME', 'com.thirdparty.AppName', 11);
INSERT INTO parameter( id, parameter, value, type_id ) VALUES(?, 'JNLP_WEB_ICON', 'images/app_explore.gif', 11);
INSERT INTO parameter( id, parameter, value, type_id ) VALUES(?, 'JNLP_JAR_FILE', 'App.jar', 11);
Add or remove applications from a User's list, by role.
The applications are mapped to users, through roles. This mapping is acheived through type 126 parameters. For example, if you wish to give eExplorer to members of EE_ADMIN role, but not EE_USER you could change the default mapping with the following update: UPDATE parameter SET value = 'EE_ADMIN' WHERE type_id = 126 and id = 646 This replaces the default role (EE_USER) for eExplorer ( id = 646 ) with the EE_ADMIN role.