27 |
27 |
28 import java.io.File; |
28 import java.io.File; |
29 import java.io.IOException; |
29 import java.io.IOException; |
30 import java.text.MessageFormat; |
30 import java.text.MessageFormat; |
31 import java.util.ArrayList; |
31 import java.util.ArrayList; |
32 import java.util.Arrays; |
|
33 import java.util.Collection; |
|
34 import java.util.LinkedHashSet; |
|
35 import java.util.List; |
32 import java.util.List; |
36 import java.util.Map; |
33 import java.util.Map; |
37 import java.util.Optional; |
34 import java.util.Optional; |
38 import java.util.ResourceBundle; |
35 import java.util.ResourceBundle; |
39 |
36 |
40 import static jdk.jpackage.internal.StandardBundlerParam.*; |
37 import static jdk.jpackage.internal.StandardBundlerParam.*; |
41 import static jdk.jpackage.internal.MacAppBundler.*; |
38 import static jdk.jpackage.internal.MacAppBundler.*; |
|
39 import static jdk.jpackage.internal.OverridableResource.createResource; |
42 |
40 |
43 public class MacAppStoreBundler extends MacBaseInstallerBundler { |
41 public class MacAppStoreBundler extends MacBaseInstallerBundler { |
44 |
42 |
45 private static final ResourceBundle I18N = ResourceBundle.getBundle( |
43 private static final ResourceBundle I18N = ResourceBundle.getBundle( |
46 "jdk.jpackage.internal.resources.MacResources"); |
44 "jdk.jpackage.internal.resources.MacResources"); |
60 "3rd Party Mac Developer Application: " + |
58 "3rd Party Mac Developer Application: " + |
61 SIGNING_KEY_USER.fetchFrom(params), |
59 SIGNING_KEY_USER.fetchFrom(params), |
62 SIGNING_KEYCHAIN.fetchFrom(params), |
60 SIGNING_KEYCHAIN.fetchFrom(params), |
63 VERBOSE.fetchFrom(params)); |
61 VERBOSE.fetchFrom(params)); |
64 if (result != null) { |
62 if (result != null) { |
65 MacCertificate certificate = new MacCertificate(result, |
63 MacCertificate certificate = new MacCertificate(result); |
66 VERBOSE.fetchFrom(params)); |
|
67 |
64 |
68 if (!certificate.isValid()) { |
65 if (!certificate.isValid()) { |
69 Log.error(MessageFormat.format( |
66 Log.error(MessageFormat.format( |
70 I18N.getString("error.certificate.expired"), |
67 I18N.getString("error.certificate.expired"), |
71 result)); |
68 result)); |
86 SIGNING_KEY_USER.fetchFrom(params), |
83 SIGNING_KEY_USER.fetchFrom(params), |
87 SIGNING_KEYCHAIN.fetchFrom(params), |
84 SIGNING_KEYCHAIN.fetchFrom(params), |
88 VERBOSE.fetchFrom(params)); |
85 VERBOSE.fetchFrom(params)); |
89 |
86 |
90 if (result != null) { |
87 if (result != null) { |
91 MacCertificate certificate = new MacCertificate( |
88 MacCertificate certificate = new MacCertificate(result); |
92 result, VERBOSE.fetchFrom(params)); |
|
93 |
89 |
94 if (!certificate.isValid()) { |
90 if (!certificate.isValid()) { |
95 Log.error(MessageFormat.format( |
91 Log.error(MessageFormat.format( |
96 I18N.getString("error.certificate.expired"), |
92 I18N.getString("error.certificate.expired"), |
97 result)); |
93 result)); |
207 APP_NAME.fetchFrom(params) + "_Inherit.entitlements"); |
203 APP_NAME.fetchFrom(params) + "_Inherit.entitlements"); |
208 } |
204 } |
209 |
205 |
210 private void prepareEntitlements(Map<String, ? super Object> params) |
206 private void prepareEntitlements(Map<String, ? super Object> params) |
211 throws IOException { |
207 throws IOException { |
212 File entitlements = MAC_APP_STORE_ENTITLEMENTS.fetchFrom(params); |
208 createResource(DEFAULT_ENTITLEMENTS, params) |
213 if (entitlements == null || !entitlements.exists()) { |
209 .setCategory( |
214 fetchResource(getEntitlementsFileName(params), |
210 I18N.getString("resource.mac-app-store-entitlements")) |
215 I18N.getString("resource.mac-app-store-entitlements"), |
211 .setExternal(MAC_APP_STORE_ENTITLEMENTS.fetchFrom(params)) |
216 DEFAULT_ENTITLEMENTS, |
212 .saveToFile(getConfig_Entitlements(params)); |
217 getConfig_Entitlements(params), |
213 |
218 VERBOSE.fetchFrom(params), |
214 createResource(DEFAULT_INHERIT_ENTITLEMENTS, params) |
219 RESOURCE_DIR.fetchFrom(params)); |
215 .setCategory(I18N.getString( |
220 } else { |
216 "resource.mac-app-store-inherit-entitlements")) |
221 fetchResource(getEntitlementsFileName(params), |
217 .saveToFile(getConfig_Entitlements(params)); |
222 I18N.getString("resource.mac-app-store-entitlements"), |
218 } |
223 entitlements, |
|
224 getConfig_Entitlements(params), |
|
225 VERBOSE.fetchFrom(params), |
|
226 RESOURCE_DIR.fetchFrom(params)); |
|
227 } |
|
228 fetchResource(getInheritEntitlementsFileName(params), |
|
229 I18N.getString("resource.mac-app-store-inherit-entitlements"), |
|
230 DEFAULT_INHERIT_ENTITLEMENTS, |
|
231 getConfig_Inherit_Entitlements(params), |
|
232 VERBOSE.fetchFrom(params), |
|
233 RESOURCE_DIR.fetchFrom(params)); |
|
234 } |
|
235 |
|
236 private String getEntitlementsFileName(Map<String, ? super Object> params) { |
|
237 return APP_NAME.fetchFrom(params) + ".entitlements"; |
|
238 } |
|
239 |
|
240 private String getInheritEntitlementsFileName( |
|
241 Map<String, ? super Object> params) { |
|
242 return APP_NAME.fetchFrom(params) + "_Inherit.entitlements"; |
|
243 } |
|
244 |
|
245 |
219 |
246 /////////////////////////////////////////////////////////////////////// |
220 /////////////////////////////////////////////////////////////////////// |
247 // Implement Bundler |
221 // Implement Bundler |
248 /////////////////////////////////////////////////////////////////////// |
222 /////////////////////////////////////////////////////////////////////// |
249 |
223 |