author | herrick |
Mon, 05 Nov 2018 17:32:00 -0500 | |
branch | JDK-8200758-branch |
changeset 57017 | 1b08af362a30 |
parent 57015 | src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java@5d2008115309 |
permissions | -rw-r--r-- |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
1 |
/* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
4 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
10 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
15 |
* accompanied this code). |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
16 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
20 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
23 |
* questions. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
24 |
*/ |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
25 |
|
57017 | 26 |
package jdk.jpackager.internal.bundlers; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
27 |
|
57017 | 28 |
import jdk.jpackager.internal.*; |
29 |
import jdk.jpackager.internal.bundlers.BundlerType; |
|
30 |
import jdk.jpackager.internal.JLinkBundlerHelper; |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
31 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
32 |
import java.io.File; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
33 |
import java.io.IOException; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
34 |
import java.util.*; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
35 |
import java.util.jar.Attributes; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
36 |
import java.util.jar.JarFile; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
37 |
import java.util.jar.Manifest; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
38 |
|
57017 | 39 |
import static jdk.jpackager.internal.StandardBundlerParam.*; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
40 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
41 |
public class BundleParams { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
42 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
43 |
final protected Map<String, ? super Object> params; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
44 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
45 |
// RelativeFileSet |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
46 |
public static final String PARAM_APP_RESOURCES = "appResources"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
47 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
48 |
// BundlerType |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
49 |
public static final String PARAM_TYPE = "type"; |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
50 |
|
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
51 |
// String |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
52 |
public static final String PARAM_BUNDLE_FORMAT = "bundleFormat"; |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
53 |
// String |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
54 |
public static final String PARAM_ICON = "icon"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
55 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
56 |
// String - Name of bundle file and native launcher |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
57 |
public static final String PARAM_NAME = "name"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
58 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
59 |
// String - application vendor, used by most of the bundlers |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
60 |
public static final String PARAM_VENDOR = "vendor"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
61 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
62 |
// String - email name and email, only used for debian */ |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
63 |
public static final String PARAM_EMAIL = "email"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
64 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
65 |
/* String - Copyright. Used on Mac */ |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
66 |
public static final String PARAM_COPYRIGHT = "copyright"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
67 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
68 |
// String - GUID on windows for MSI, CFBundleIdentifier on Mac |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
69 |
// If not compatible with requirements then bundler either do not bundle |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
70 |
// or autogenerate |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
71 |
public static final String PARAM_IDENTIFIER = "identifier"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
72 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
73 |
/* boolean - shortcut preferences */ |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
74 |
public static final String PARAM_SHORTCUT = "shortcutHint"; |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
75 |
// boolean - menu shortcut preference |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
76 |
public static final String PARAM_MENU = "menuHint"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
77 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
78 |
// String - Application version. Format may differ for different bundlers |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
79 |
public static final String PARAM_VERSION = "appVersion"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
80 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
81 |
// String - Application category. Used at least on Mac/Linux. |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
82 |
// Value is platform specific |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
83 |
public static final String PARAM_CATEGORY = "applicationCategory"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
84 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
85 |
// String - Optional short application |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
86 |
public static final String PARAM_TITLE = "title"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
87 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
88 |
// String - Optional application description. Used by MSI and on Linux |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
89 |
public static final String PARAM_DESCRIPTION = "description"; |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
90 |
|
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
91 |
// String - License type. Needed on Linux (rpm) |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
92 |
public static final String PARAM_LICENSE_TYPE = "licenseType"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
93 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
94 |
// List<String> - File(s) with license. Format is OS/bundler specific |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
95 |
public static final String PARAM_LICENSE_FILE = "licenseFile"; |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
96 |
|
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
97 |
// boolean - service/daemon install. null means "default" |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
98 |
public static final String PARAM_SERVICE_HINT = "serviceHint"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
99 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
100 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
101 |
// String Main application class. |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
102 |
// Not used directly but used to derive default values |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
103 |
public static final String PARAM_APPLICATION_CLASS = "applicationClass"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
104 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
105 |
// boolean - Adds a dialog to let the user choose a directory |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
106 |
// where the product will be installed. |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
107 |
public static final String PARAM_INSTALLDIR_CHOOSER = "installdirChooser"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
108 |
|
56987 | 109 |
// boolean - Prevents from launching multiple instances of application. |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
110 |
public static final String PARAM_SINGLETON = "singleton"; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
111 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
112 |
/** |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
113 |
* create a new bundle with all default values |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
114 |
*/ |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
115 |
public BundleParams() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
116 |
params = new HashMap<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
117 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
118 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
119 |
/** |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
120 |
* Create a bundle params with a copy of the params |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
121 |
* @param params map of initial parameters to be copied in. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
122 |
*/ |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
123 |
public BundleParams(Map<String, ?> params) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
124 |
this.params = new HashMap<>(params); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
125 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
126 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
127 |
public void addAllBundleParams(Map<String, ? super Object> p) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
128 |
params.putAll(p); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
129 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
130 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
131 |
public <C> C fetchParam(BundlerParamInfo<C> paramInfo) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
132 |
return paramInfo.fetchFrom(params); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
133 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
134 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
135 |
@SuppressWarnings("unchecked") |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
136 |
public <C> C fetchParamWithDefault( |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
137 |
Class<C> klass, C defaultValue, String... keys) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
138 |
for (String key : keys) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
139 |
Object o = params.get(key); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
140 |
if (klass.isInstance(o)) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
141 |
return (C) o; |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
142 |
} else if (params.containsKey(key) && o == null) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
143 |
return null; |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
144 |
} else if (o != null) { |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
145 |
Log.debug("Bundle param " + key + " is not type " + klass); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
146 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
147 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
148 |
return defaultValue; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
149 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
150 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
151 |
public <C> C fetchParam(Class<C> klass, String... keys) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
152 |
return fetchParamWithDefault(klass, null, keys); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
153 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
154 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
155 |
// NOTE: we do not care about application parameters here |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
156 |
// as they will be embeded into jar file manifest and |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
157 |
// java launcher will take care of them! |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
158 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
159 |
public Map<String, ? super Object> getBundleParamsAsMap() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
160 |
return new HashMap<>(params); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
161 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
162 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
163 |
public void setJvmargs(List<String> jvmargs) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
164 |
putUnlessNullOrEmpty(JVM_OPTIONS.getID(), jvmargs); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
165 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
166 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
167 |
public void setJvmProperties(Map<String, String> jvmProperties) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
168 |
putUnlessNullOrEmpty(JVM_PROPERTIES.getID(), jvmProperties); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
169 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
170 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
171 |
public void setArguments(List<String> arguments) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
172 |
putUnlessNullOrEmpty(ARGUMENTS.getID(), arguments); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
173 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
174 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
175 |
public void setAddModules(String value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
176 |
putUnlessNull(StandardBundlerParam.ADD_MODULES.getID(), value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
177 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
178 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
179 |
public void setLimitModules(String value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
180 |
putUnlessNull(StandardBundlerParam.LIMIT_MODULES.getID(), value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
181 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
182 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
183 |
public void setStripNativeCommands(boolean value) { |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
184 |
putUnlessNull(StandardBundlerParam.STRIP_NATIVE_COMMANDS.getID(), |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
185 |
value); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
186 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
187 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
188 |
public void setModulePath(String value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
189 |
putUnlessNull(StandardBundlerParam.MODULE_PATH.getID(), value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
190 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
191 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
192 |
public void setMainModule(String value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
193 |
putUnlessNull(StandardBundlerParam.MODULE.getID(), value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
194 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
195 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
196 |
public void setDebug(String value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
197 |
putUnlessNull(JLinkBundlerHelper.DEBUG.getID(), value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
198 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
199 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
200 |
public String getApplicationID() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
201 |
return fetchParam(IDENTIFIER); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
202 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
203 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
204 |
public String getPreferencesID() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
205 |
return fetchParam(PREFERENCES_ID); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
206 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
207 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
208 |
public String getTitle() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
209 |
return fetchParam(TITLE); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
210 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
211 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
212 |
public void setTitle(String title) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
213 |
putUnlessNull(PARAM_TITLE, title); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
214 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
215 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
216 |
public String getApplicationClass() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
217 |
return fetchParam(MAIN_CLASS); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
218 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
219 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
220 |
public void setApplicationClass(String applicationClass) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
221 |
putUnlessNull(PARAM_APPLICATION_CLASS, applicationClass); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
222 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
223 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
224 |
public String getAppVersion() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
225 |
return fetchParam(VERSION); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
226 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
227 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
228 |
public void setAppVersion(String version) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
229 |
putUnlessNull(PARAM_VERSION, version); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
230 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
231 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
232 |
public String getDescription() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
233 |
return fetchParam(DESCRIPTION); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
234 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
235 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
236 |
public void setDescription(String s) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
237 |
putUnlessNull(PARAM_DESCRIPTION, s); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
238 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
239 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
240 |
//path is relative to the application root |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
241 |
public void addLicenseFile(String path) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
242 |
List<String> licenseFiles = fetchParam(LICENSE_FILE); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
243 |
if (licenseFiles == null || licenseFiles.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
244 |
licenseFiles = new ArrayList<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
245 |
params.put(PARAM_LICENSE_FILE, licenseFiles); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
246 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
247 |
licenseFiles.add(path); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
248 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
249 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
250 |
public void setServiceHint(Boolean b) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
251 |
putUnlessNull(PARAM_SERVICE_HINT, b); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
252 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
253 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
254 |
public void setInstalldirChooser(Boolean b) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
255 |
putUnlessNull(PARAM_INSTALLDIR_CHOOSER, b); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
256 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
257 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
258 |
public void setSingleton(Boolean b) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
259 |
putUnlessNull(PARAM_SINGLETON, b); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
260 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
261 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
262 |
public String getName() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
263 |
return fetchParam(APP_NAME); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
264 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
265 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
266 |
public void setName(String name) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
267 |
putUnlessNull(PARAM_NAME, name); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
268 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
269 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
270 |
@SuppressWarnings("deprecation") |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
271 |
public BundlerType getType() { |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
272 |
return fetchParam(BundlerType.class, PARAM_TYPE); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
273 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
274 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
275 |
@SuppressWarnings("deprecation") |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
276 |
public void setType(BundlerType type) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
277 |
putUnlessNull(PARAM_TYPE, type); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
278 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
279 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
280 |
public String getBundleFormat() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
281 |
return fetchParam(String.class, PARAM_BUNDLE_FORMAT); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
282 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
283 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
284 |
public void setBundleFormat(String t) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
285 |
putUnlessNull(PARAM_BUNDLE_FORMAT, t); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
286 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
287 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
288 |
public boolean getVerbose() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
289 |
return fetchParam(VERBOSE); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
290 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
291 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
292 |
public List<String> getLicenseFile() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
293 |
return fetchParam(LICENSE_FILE); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
294 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
295 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
296 |
public List<String> getJvmargs() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
297 |
return JVM_OPTIONS.fetchFrom(params); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
298 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
299 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
300 |
public List<String> getArguments() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
301 |
return ARGUMENTS.fetchFrom(params); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
302 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
303 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
304 |
// Validation approach: |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
305 |
// - javac and |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
306 |
// |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
307 |
// - /jmods dir |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
308 |
// or |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
309 |
// - JRE marker (rt.jar) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
310 |
// - FX marker (jfxrt.jar) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
311 |
// - JDK marker (tools.jar) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
312 |
private static boolean checkJDKRoot(File jdkRoot) { |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
313 |
String exe = (Platform.getPlatform() == Platform.WINDOWS) ? |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
314 |
".exe" : ""; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
315 |
File javac = new File(jdkRoot, "bin/javac" + exe); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
316 |
if (!javac.exists()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
317 |
Log.verbose("javac is not found at " + javac.getAbsolutePath()); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
318 |
return false; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
319 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
320 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
321 |
File jmods = new File(jdkRoot, "jmods"); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
322 |
if (!jmods.exists()) { |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
323 |
Log.verbose("jmods is not found in " + jdkRoot.getAbsolutePath()); |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
324 |
return false; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
325 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
326 |
return true; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
327 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
328 |
|
57017 | 329 |
public jdk.jpackager.internal.RelativeFileSet getAppResource() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
330 |
return fetchParam(APP_RESOURCES); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
331 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
332 |
|
57017 | 333 |
public void setAppResource(jdk.jpackager.internal.RelativeFileSet fs) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
334 |
putUnlessNull(PARAM_APP_RESOURCES, fs); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
335 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
336 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
337 |
public void setAppResourcesList( |
57017 | 338 |
List<jdk.jpackager.internal.RelativeFileSet> rfs) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
339 |
putUnlessNull(APP_RESOURCES_LIST.getID(), rfs); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
340 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
341 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
342 |
public String getApplicationCategory() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
343 |
return fetchParam(CATEGORY); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
344 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
345 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
346 |
public void setApplicationCategory(String category) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
347 |
putUnlessNull(PARAM_CATEGORY, category); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
348 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
349 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
350 |
public String getMainClassName() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
351 |
String applicationClass = getApplicationClass(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
352 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
353 |
if (applicationClass == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
354 |
return null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
355 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
356 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
357 |
int idx = applicationClass.lastIndexOf("."); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
358 |
if (idx >= 0) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
359 |
return applicationClass.substring(idx+1); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
360 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
361 |
return applicationClass; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
362 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
363 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
364 |
public String getCopyright() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
365 |
return fetchParam(COPYRIGHT); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
366 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
367 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
368 |
public void setCopyright(String c) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
369 |
putUnlessNull(PARAM_COPYRIGHT, c); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
370 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
371 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
372 |
public String getIdentifier() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
373 |
return fetchParam(IDENTIFIER); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
374 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
375 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
376 |
public void setIdentifier(String s) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
377 |
putUnlessNull(PARAM_IDENTIFIER, s); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
378 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
379 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
380 |
private String mainJar = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
381 |
private String mainJarClassPath = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
382 |
private boolean useFXPackaging = true; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
383 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
384 |
// For regular executable Jars we need to take care of classpath |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
385 |
// For JavaFX executable jars we do not need to pay attention to |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
386 |
// ClassPath entry in manifest |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
387 |
public String getAppClassPath() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
388 |
if (mainJar == null) { |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
389 |
// this will find out answer |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
390 |
getMainApplicationJar(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
391 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
392 |
if (useFXPackaging || mainJarClassPath == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
393 |
return ""; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
394 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
395 |
return mainJarClassPath; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
396 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
397 |
|
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
398 |
// assuming that application was packaged according to the rules |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
399 |
// we must have application jar, i.e. jar where we embed launcher |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
400 |
// and have main application class listed as main class! |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
401 |
// If there are more than one, or none - it will be treated as |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
402 |
// deployment error |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
403 |
// |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
404 |
// Note we look for both JavaFX executable jars and regular executable jars |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
405 |
// As long as main "application" entry point is the same it is main class |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
406 |
// (i.e. for FX jar we will use JavaFX manifest entry ...) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
407 |
public String getMainApplicationJar() { |
57017 | 408 |
jdk.jpackager.internal.RelativeFileSet appResources = getAppResource(); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
409 |
if (mainJar != null) { |
56882
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
410 |
if (getApplicationClass() == null) try { |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
411 |
if (appResources != null) { |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
412 |
File srcdir = appResources.getBaseDirectory(); |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
413 |
JarFile jf = new JarFile(new File(srcdir, mainJar)); |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
414 |
Manifest m = jf.getManifest(); |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
415 |
Attributes attrs = (m != null) ? |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
416 |
m.getMainAttributes() : null; |
56882
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
417 |
if (attrs != null) { |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
418 |
setApplicationClass( |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
419 |
attrs.getValue(Attributes.Name.MAIN_CLASS)); |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
420 |
} |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
421 |
} |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
422 |
} catch (IOException ignore) { |
0ec8559f599a
8210439: Unable to create an installer from a previously created app image on Windows
herrick
parents:
56821
diff
changeset
|
423 |
} |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
424 |
return mainJar; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
425 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
426 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
427 |
String applicationClass = getApplicationClass(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
428 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
429 |
if (appResources == null || applicationClass == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
430 |
return null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
431 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
432 |
File srcdir = appResources.getBaseDirectory(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
433 |
for (String fname : appResources.getIncludedFiles()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
434 |
JarFile jf; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
435 |
try { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
436 |
jf = new JarFile(new File(srcdir, fname)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
437 |
Manifest m = jf.getManifest(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
438 |
Attributes attrs = (m != null) ? m.getMainAttributes() : null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
439 |
if (attrs != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
440 |
boolean javaMain = applicationClass.equals( |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
441 |
attrs.getValue(Attributes.Name.MAIN_CLASS)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
442 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
443 |
if (javaMain) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
444 |
mainJar = fname; |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
445 |
mainJarClassPath = attrs.getValue( |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
446 |
Attributes.Name.CLASS_PATH); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
447 |
return mainJar; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
448 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
449 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
450 |
} catch (IOException ignore) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
451 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
452 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
453 |
return null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
454 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
455 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
456 |
public String getVendor() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
457 |
return fetchParam(VENDOR); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
458 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
459 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
460 |
public void setVendor(String vendor) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
461 |
putUnlessNull(PARAM_VENDOR, vendor); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
462 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
463 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
464 |
public String getEmail() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
465 |
return fetchParam(String.class, PARAM_EMAIL); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
466 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
467 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
468 |
public void setEmail(String email) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
469 |
putUnlessNull(PARAM_EMAIL, email); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
470 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
471 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
472 |
public void putUnlessNull(String param, Object value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
473 |
if (value != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
474 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
475 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
476 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
477 |
|
57015
5d2008115309
JDK-8213244: Fix all warnings in jpackager java code
herrick
parents:
56994
diff
changeset
|
478 |
public void putUnlessNullOrEmpty(String param, Collection<?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
479 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
480 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
481 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
482 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
483 |
|
57015
5d2008115309
JDK-8213244: Fix all warnings in jpackager java code
herrick
parents:
56994
diff
changeset
|
484 |
public void putUnlessNullOrEmpty(String param, Map<?,?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
485 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
486 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
487 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
488 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
489 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
490 |
} |