equal
deleted
inserted
replaced
26 package jdk.jpackage.internal; |
26 package jdk.jpackage.internal; |
27 |
27 |
28 import java.io.File; |
28 import java.io.File; |
29 import java.nio.file.Path; |
29 import java.nio.file.Path; |
30 import java.text.MessageFormat; |
30 import java.text.MessageFormat; |
31 import java.util.Arrays; |
31 import java.util.*; |
32 import java.util.Collection; |
|
33 import java.util.Map; |
|
34 import java.util.ResourceBundle; |
|
35 |
32 |
36 import static jdk.jpackage.internal.WindowsBundlerParam.*; |
33 import static jdk.jpackage.internal.WindowsBundlerParam.*; |
37 import static jdk.jpackage.internal.WinMsiBundler.WIN_APP_IMAGE; |
34 import static jdk.jpackage.internal.WinMsiBundler.WIN_APP_IMAGE; |
38 |
35 |
39 public class WinAppBundler extends AbstractImageBundler { |
36 public class WinAppBundler extends AbstractImageBundler { |
58 |
55 |
59 @Override |
56 @Override |
60 public boolean validate(Map<String, ? super Object> params) |
57 public boolean validate(Map<String, ? super Object> params) |
61 throws ConfigException { |
58 throws ConfigException { |
62 try { |
59 try { |
63 if (params == null) throw new ConfigException( |
60 Objects.requireNonNull(params); |
64 I18N.getString("error.parameters-null"), |
|
65 I18N.getString("error.parameters-null.advice")); |
|
66 |
|
67 return doValidate(params); |
61 return doValidate(params); |
68 } catch (RuntimeException re) { |
62 } catch (RuntimeException re) { |
69 if (re.getCause() instanceof ConfigException) { |
63 if (re.getCause() instanceof ConfigException) { |
70 throw (ConfigException) re.getCause(); |
64 throw (ConfigException) re.getCause(); |
71 } else { |
65 } else { |
78 // skipping validation if p.type does not include "image" |
72 // skipping validation if p.type does not include "image" |
79 private boolean doValidate(Map<String, ? super Object> p) |
73 private boolean doValidate(Map<String, ? super Object> p) |
80 throws ConfigException { |
74 throws ConfigException { |
81 |
75 |
82 imageBundleValidation(p); |
76 imageBundleValidation(p); |
83 |
|
84 if (StandardBundlerParam.getPredefinedAppImage(p) != null) { |
|
85 return true; |
|
86 } |
|
87 |
|
88 // Make sure that jpackage.exe exists. |
|
89 File tool = new File( |
|
90 System.getProperty("java.home") + "\\bin\\jpackage.exe"); |
|
91 |
|
92 if (!tool.exists()) { |
|
93 throw new ConfigException( |
|
94 I18N.getString("error.no-windows-resources"), |
|
95 I18N.getString("error.no-windows-resources.advice")); |
|
96 } |
|
97 |
|
98 return true; |
77 return true; |
99 } |
78 } |
100 |
79 |
101 public boolean bundle(Map<String, ? super Object> p, File outputDirectory) |
80 public boolean bundle(Map<String, ? super Object> p, File outputDirectory) |
102 throws PackagerException { |
81 throws PackagerException { |