modules/jdk.packager/src/main/java/com/oracle/tools/packager/AbstractImageBundler.java

Print this page




  27 import java.io.File;
  28 import java.io.FileOutputStream;
  29 import java.io.IOException;
  30 import java.io.PrintStream;
  31 import java.nio.file.Files;
  32 import java.text.MessageFormat;
  33 import java.util.Collections;
  34 import java.util.List;
  35 import java.util.Map;
  36 import java.util.ResourceBundle;
  37 import java.util.regex.Matcher;
  38 import java.util.regex.Pattern;
  39 
  40 import jdk.packager.internal.legacy.JLinkBundlerHelper;
  41 
  42 
  43 import static com.oracle.tools.packager.StandardBundlerParam.*;
  44 
  45 /**
  46  * Common utility methods used by app image bundlers.


  47  */

  48 public abstract class AbstractImageBundler extends AbstractBundler {
  49 
  50     private static final ResourceBundle I18N =
  51             ResourceBundle.getBundle(AbstractImageBundler.class.getName());
  52 
  53     public void imageBundleValidation(Map<String, ? super Object> p) throws ConfigException {
  54         StandardBundlerParam.validateMainClassInfoFromAppResources(p);
  55 
  56         Map<String, String> userJvmOptions = USER_JVM_OPTIONS.fetchFrom(p);
  57         if (userJvmOptions != null) {
  58             for (Map.Entry<String, String> entry : userJvmOptions.entrySet()) {
  59                 if (entry.getValue() == null || entry.getValue().isEmpty()) {
  60                     throw new ConfigException(
  61                             MessageFormat.format(I18N.getString("error.empty-user-jvm-option-value"), entry.getKey()),
  62                             I18N.getString("error.empty-user-jvm-option-value.advice"));
  63                 }
  64             }
  65         }
  66 
  67         boolean hasMainJar = MAIN_JAR.fetchFrom(p) != null;




  27 import java.io.File;
  28 import java.io.FileOutputStream;
  29 import java.io.IOException;
  30 import java.io.PrintStream;
  31 import java.nio.file.Files;
  32 import java.text.MessageFormat;
  33 import java.util.Collections;
  34 import java.util.List;
  35 import java.util.Map;
  36 import java.util.ResourceBundle;
  37 import java.util.regex.Matcher;
  38 import java.util.regex.Pattern;
  39 
  40 import jdk.packager.internal.legacy.JLinkBundlerHelper;
  41 
  42 
  43 import static com.oracle.tools.packager.StandardBundlerParam.*;
  44 
  45 /**
  46  * Common utility methods used by app image bundlers.
  47  * 
  48  * @deprecated use {@link ToolProvider} to locate the {@code "javapackager"} tool instead.
  49  */
  50 @Deprecated(since="10", forRemoval=true)
  51 public abstract class AbstractImageBundler extends AbstractBundler {
  52 
  53     private static final ResourceBundle I18N =
  54             ResourceBundle.getBundle(AbstractImageBundler.class.getName());
  55 
  56     public void imageBundleValidation(Map<String, ? super Object> p) throws ConfigException {
  57         StandardBundlerParam.validateMainClassInfoFromAppResources(p);
  58 
  59         Map<String, String> userJvmOptions = USER_JVM_OPTIONS.fetchFrom(p);
  60         if (userJvmOptions != null) {
  61             for (Map.Entry<String, String> entry : userJvmOptions.entrySet()) {
  62                 if (entry.getValue() == null || entry.getValue().isEmpty()) {
  63                     throw new ConfigException(
  64                             MessageFormat.format(I18N.getString("error.empty-user-jvm-option-value"), entry.getKey()),
  65                             I18N.getString("error.empty-user-jvm-option-value.advice"));
  66                 }
  67             }
  68         }
  69 
  70         boolean hasMainJar = MAIN_JAR.fetchFrom(p) != null;