KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdic > packager > Jnlp2Rpm


1 /*
2  * Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
3  * subject to license terms.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the Lesser GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  */

20
21 package org.jdesktop.jdic.packager;
22
23 import java.io.IOException JavaDoc;
24 import org.jdesktop.jdic.packager.impl.Jnlp2Package;
25 import org.jdesktop.jdic.packager.impl.JnlpConstants;
26 import org.jdesktop.jdic.packager.impl.JnlpUtility;
27
28
29 /**
30  * Command line entry point into JDIC Packager to package a JNLP application
31  * into a RPM package. This class is entered via the canonical `public static
32  * void main` entry point and reads the command line arguments.
33  *
34  * <pre>
35  * The command line to use this class is:
36  * java [property options] org.jdesktop.jdic.packager.Jnlp2Rpm &lt;JNLP file path&gt;
37  *
38  * &lt;JNLP file path&gt;: the path of the JNLP file.
39  * [property options] include:
40  * -DResourceDir=&lt;value&gt;: set the directory of the JNLP resource files.
41  * The default value is the parent path of the given JNLP file.
42  * -DLicenseDir=&lt;value&gt;: set the directory of the license files if available.
43  * -DPackageName=&lt;value&gt;: set the name of the generated rpm package.
44  * The default value is the jnlp file name without extension.
45  * -DOutputDir=&lt;value&gt;: set the directory where the generated rpm package
46  * is put. The default value is the current directory.
47  * -DVersion=&lt;value&gt;: set the version number of the generated package.
48  * The default value is 1.0.
49  * -DRelease=&lt;value&gt;: set the release number of the generated package,
50  * The default value is 1.
51  * -DEnableShortcut=&lt;true|false&gt;: if true, create shortcut on the desktop after
52  * the generated package is installed; if false, no shortcut will be created.
53  * The default value is false.
54  * -DEnableAssociation=&lt;true|false&gt;: if true, associate the file extension .jnlp with
55  * Java Web Start executable after the generated package is installed; if false, no
56  * association will be created. The default value is false.
57  * -DEnableSystemCache=&lt;true|false&gt;: if true, install the JNLP application into
58  * the system cache of Java Web Start; if false, it's installed in the user cache.
59  * The default value is false.
60  * </pre>
61  * <p>
62  * While the end-user installs the generated package, Java Web Start executable (javaws)
63  * will run to install the JNLP application to the system or user cache of Java Web Start.
64  * It will then be displayed in the "Application Manager" dialog of Java Web Start.
65  * <p>
66  * While the end-user uninstalls the installed package, javaws will run to remove the JNLP
67  * application from the system or user cache, as well as the "Application Manager"
68  * dialog of Java Web Start.
69  *
70  * @see Jnlp2Msi
71  * @see Jnlp2Pkg
72  */

73 public class Jnlp2Rpm {
74     /**
75      * Command line entry point. This method starts generating a RPM package
76      * using the given JNLP application and specified properties.
77      *
78      * @param args command line arguments.
79      */

80     public static void main(final String JavaDoc[] args) {
81         // Check if this class/tool could be used on the platform.
82
JnlpUtility.checkPlatformCompatibility(JnlpConstants.OS_LINUX);
83
84         // Generate an installable package.
85
try {
86             Jnlp2Package.generatePackage(args);
87         } catch (IOException JavaDoc e1) {
88             System.out.println(e1.getMessage());
89         } catch (IllegalArgumentException JavaDoc e2) {
90             System.out.println(e2.getMessage());
91         } catch (Exception JavaDoc e) {
92             e.printStackTrace();
93         } catch (Error JavaDoc err) {
94             err.printStackTrace();
95         } finally {
96             System.exit(0);
97         }
98     }
99 }
100
Popular Tags