author | herrick |
Fri, 08 Nov 2019 14:53:03 -0500 | |
branch | JDK-8200758-branch |
changeset 58994 | b09ba68c6a19 |
parent 57741 | src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java@38856ef4a19c |
permissions | -rw-r--r-- |
57038 | 1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57099
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
57038 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
58994
b09ba68c6a19
8233636 : Make jpackage an incubator and remove tool provider implementation
herrick
parents:
57741
diff
changeset
|
26 |
package jdk.incubator.jpackage.internal; |
57038 | 27 |
|
28 |
import java.io.File; |
|
29 |
import java.io.IOException; |
|
30 |
import java.util.*; |
|
31 |
import java.util.jar.Attributes; |
|
32 |
import java.util.jar.JarFile; |
|
33 |
import java.util.jar.Manifest; |
|
34 |
||
58994
b09ba68c6a19
8233636 : Make jpackage an incubator and remove tool provider implementation
herrick
parents:
57741
diff
changeset
|
35 |
import static jdk.incubator.jpackage.internal.StandardBundlerParam.*; |
57038 | 36 |
|
37 |
public class BundleParams { |
|
38 |
||
39 |
final protected Map<String, ? super Object> params; |
|
40 |
||
41 |
// RelativeFileSet |
|
42 |
public static final String PARAM_APP_RESOURCES = "appResources"; |
|
43 |
||
57414
6eda749d3117
8225428: CLI change to remove "mode", rename to "package", and build only one target
herrick
parents:
57396
diff
changeset
|
44 |
// String - Icon file name |
57038 | 45 |
public static final String PARAM_ICON = "icon"; |
46 |
||
47 |
// String - Name of bundle file and native launcher |
|
48 |
public static final String PARAM_NAME = "name"; |
|
49 |
||
50 |
// String - application vendor, used by most of the bundlers |
|
51 |
public static final String PARAM_VENDOR = "vendor"; |
|
52 |
||
53 |
// String - email name and email, only used for debian */ |
|
54 |
public static final String PARAM_EMAIL = "email"; |
|
55 |
||
57255
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57213
diff
changeset
|
56 |
// String - vendor <email>, only used for debian */ |
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57213
diff
changeset
|
57 |
public static final String PARAM_MAINTAINER = "maintainer"; |
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57213
diff
changeset
|
58 |
|
57038 | 59 |
/* String - Copyright. Used on Mac */ |
60 |
public static final String PARAM_COPYRIGHT = "copyright"; |
|
61 |
||
62 |
// String - GUID on windows for MSI, CFBundleIdentifier on Mac |
|
63 |
// If not compatible with requirements then bundler either do not bundle |
|
64 |
// or autogenerate |
|
65 |
public static final String PARAM_IDENTIFIER = "identifier"; |
|
66 |
||
67 |
/* boolean - shortcut preferences */ |
|
68 |
public static final String PARAM_SHORTCUT = "shortcutHint"; |
|
69 |
// boolean - menu shortcut preference |
|
70 |
public static final String PARAM_MENU = "menuHint"; |
|
71 |
||
72 |
// String - Application version. Format may differ for different bundlers |
|
73 |
public static final String PARAM_VERSION = "appVersion"; |
|
74 |
||
57741
38856ef4a19c
8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents:
57438
diff
changeset
|
75 |
// String - Application release. Used on Linux. |
38856ef4a19c
8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents:
57438
diff
changeset
|
76 |
public static final String PARAM_RELEASE = "appRelease"; |
38856ef4a19c
8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents:
57438
diff
changeset
|
77 |
|
57038 | 78 |
// String - Optional application description. Used by MSI and on Linux |
79 |
public static final String PARAM_DESCRIPTION = "description"; |
|
80 |
||
81 |
// String - License type. Needed on Linux (rpm) |
|
82 |
public static final String PARAM_LICENSE_TYPE = "licenseType"; |
|
83 |
||
57080 | 84 |
// String - File with license. Format is OS/bundler specific |
57038 | 85 |
public static final String PARAM_LICENSE_FILE = "licenseFile"; |
86 |
||
87 |
// String Main application class. |
|
88 |
// Not used directly but used to derive default values |
|
89 |
public static final String PARAM_APPLICATION_CLASS = "applicationClass"; |
|
90 |
||
91 |
// boolean - Adds a dialog to let the user choose a directory |
|
92 |
// where the product will be installed. |
|
93 |
public static final String PARAM_INSTALLDIR_CHOOSER = "installdirChooser"; |
|
94 |
||
95 |
/** |
|
96 |
* create a new bundle with all default values |
|
97 |
*/ |
|
98 |
public BundleParams() { |
|
99 |
params = new HashMap<>(); |
|
100 |
} |
|
101 |
||
102 |
/** |
|
103 |
* Create a bundle params with a copy of the params |
|
104 |
* @param params map of initial parameters to be copied in. |
|
105 |
*/ |
|
106 |
public BundleParams(Map<String, ?> params) { |
|
107 |
this.params = new HashMap<>(params); |
|
108 |
} |
|
109 |
||
57396
3944e4c2f779
8223586: remove jpackage dead code and other cleanup
herrick
parents:
57392
diff
changeset
|
110 |
public void addAllBundleParams(Map<String, ? super Object> params) { |
3944e4c2f779
8223586: remove jpackage dead code and other cleanup
herrick
parents:
57392
diff
changeset
|
111 |
this.params.putAll(params); |
57038 | 112 |
} |
113 |
||
114 |
// NOTE: we do not care about application parameters here |
|
115 |
// as they will be embeded into jar file manifest and |
|
116 |
// java launcher will take care of them! |
|
117 |
||
118 |
public Map<String, ? super Object> getBundleParamsAsMap() { |
|
119 |
return new HashMap<>(params); |
|
120 |
} |
|
121 |
||
122 |
public String getName() { |
|
57438
4a31db8d42bd
8226599: use code coverage results to remove dead code
herrick
parents:
57414
diff
changeset
|
123 |
return APP_NAME.fetchFrom(params); |
57038 | 124 |
} |
125 |
||
126 |
public void setAppResourcesList( |
|
58994
b09ba68c6a19
8233636 : Make jpackage an incubator and remove tool provider implementation
herrick
parents:
57741
diff
changeset
|
127 |
List<jdk.incubator.jpackage.internal.RelativeFileSet> rfs) { |
57038 | 128 |
putUnlessNull(APP_RESOURCES_LIST.getID(), rfs); |
129 |
} |
|
130 |
||
57438
4a31db8d42bd
8226599: use code coverage results to remove dead code
herrick
parents:
57414
diff
changeset
|
131 |
private void putUnlessNull(String param, Object value) { |
57038 | 132 |
if (value != null) { |
133 |
params.put(param, value); |
|
134 |
} |
|
135 |
} |
|
136 |
} |