1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   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 package com.sun.java.util.jar.pack;
  26 
  27 import java.util.ListResourceBundle;
  28 
  29 public class DriverResource extends ListResourceBundle {
  30 
  31     public static final String VERSION = "VERSION";
  32     public static final String BAD_ARGUMENT = "BAD_ARGUMENT";
  33     public static final String BAD_OPTION = "BAD_OPTION";
  34     public static final String BAD_REPACK_OUTPUT = "BAD_REPACK_OUTPUT";
  35     public static final String DETECTED_ZIP_COMMENT = "DETECTED_ZIP_COMMENT";
  36     public static final String SKIP_FOR_REPACKED = "SKIP_FOR_REPACKED";
  37     public static final String WRITE_PACK_FILE = "WRITE_PACK_FILE";
  38     public static final String WRITE_PACKGZ_FILE = "WRITE_PACKGZ_FILE";
  39     public static final String SKIP_FOR_MOVE_FAILED = "SKIP_FOR_MOVE_FAILED";
  40     public static final String PACK_HELP = "PACK_HELP";
  41     public static final String UNPACK_HELP = "UNPACK_HELP";
  42     public static final String MORE_INFO = "MORE_INFO";
  43     public static final String DUPLICATE_OPTION = "DUPLICATE_OPTION";
  44     public static final String BAD_SPEC = "BAD_SPEC";
  45     public static final String DEPRECATED = "DEPRECATED";
  46 
  47     /*
  48      * The following are the output of 'pack200' and 'unpack200' commands.
  49      * Do not translate command arguments and words with a prefix of '-' or '--'.
  50      */
  51     private static final Object[][] resource = {
  52         {VERSION, "{0} version {1}"}, // parameter 0:class name;parameter 1: version value
  53         {BAD_ARGUMENT, "Bad argument: {0}"},
  54         {BAD_OPTION, "Bad option: {0}={1}"}, // parameter 0:option name;parameter 1:option value
  55         {BAD_REPACK_OUTPUT, "Bad --repack output: {0}"}, // parameter 0:filename
  56         {DETECTED_ZIP_COMMENT, "Detected ZIP comment: {0}"}, // parameter 0:comment
  57         {SKIP_FOR_REPACKED, "Skipping because already repacked: {0}"}, // parameter 0:filename
  58         {WRITE_PACK_FILE, "To write a *.pack file, specify --no-gzip: {0}"}, // parameter 0:filename
  59         {WRITE_PACKGZ_FILE, "To write a *.pack.gz file, specify --gzip: {0}"}, // parameter 0:filename
  60         {SKIP_FOR_MOVE_FAILED, "Skipping unpack because move failed: {0}"}, // parameter 0:filename
  61         {PACK_HELP, new String[] {
  62                 "Usage:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar",
  63                 "",
  64                 "Packing Options",
  65                 "  -r, --repack                    repack or normalize a jar, suitable for ",
  66                 "                                  signing with jarsigner",
  67                 "  -g, --no-gzip                   output a plain pack file, suitable to be",
  68                 "                                  compressed with a file compression utility",
  69                 "  --gzip                          (default) post compress the pack output",
  70                 "                                  with gzip",
  71                 "  -G, --strip-debug               remove debugging attributes (SourceFile,",
  72                 "                                  LineNumberTable, LocalVariableTable",
  73                 "                                  and LocalVariableTypeTable) while packing",
  74                 "  -O, --no-keep-file-order        do not transmit file ordering information",
  75                 "  --keep-file-order               (default) preserve input file ordering",
  76                 "  -S{N}, --segment-limit={N}      limit segment sizes (default unlimited)",
  77                 "  -E{N}, --effort={N}             packing effort (default N=5)",
  78                 "  -H{h}, --deflate-hint={h}       transmit deflate hint: true, false,",
  79                 "                                  or keep (default)",
  80                 "  -m{V}, --modification-time={V}  transmit modtimes: latest or keep (default)",
  81                 "  -P{F}, --pass-file={F}          transmit the given input element(s) unchanged",
  82                 "  -U{a}, --unknown-attribute={a}  unknown attribute action: error, strip,",
  83                 "                                  or pass (default)",
  84                 "  -C{N}={L}, --class-attribute={N}={L}  (user-defined attribute)",
  85                 "  -F{N}={L}, --field-attribute={N}={L}  (user-defined attribute)",
  86                 "  -M{N}={L}, --method-attribute={N}={L} (user-defined attribute)",
  87                 "  -D{N}={L}, --code-attribute={N}={L}   (user-defined attribute)",
  88                 "  -f{F}, --config-file={F}        read file F for Pack200.Packer properties",
  89                 "  -v, --verbose                   increase program verbosity",
  90                 "  -q, --quiet                     set verbosity to lowest level",
  91                 "  -l{F}, --log-file={F}           output to the given log file, ",
  92                 "                                  or '-' for System.out",
  93                 "  -?, -h, --help                  print this help message",
  94                 "  -V, --version                   print program version",
  95                 "  -J{X}                           pass option X to underlying Java VM",
  96                 "",
  97                 "Notes:",
  98                 "  The -P, -C, -F, -M, and -D options accumulate.",
  99                 "  Example attribute definition:  -C SourceFile=RUH .",
 100                 "  Config. file properties are defined by the Pack200 API.",
 101                 "  For meaning of -S, -E, -H-, -m, -U values, see Pack200 API.",
 102                 "  Layout definitions (like RUH) are defined by JSR 200.",
 103                 "",
 104                 "Repacking mode updates the JAR file with a pack/unpack cycle:",
 105                 "    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n",
 106                 "",
 107                 "Exit Status:",
 108                 "  0 if successful, >0 if an error occurred"
 109             }
 110         },
 111         {UNPACK_HELP, new String[] {
 112                 "Usage:  unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n",
 113                 "",
 114                 "Unpacking Options",
 115                 "  -H{h}, --deflate-hint={h}     override transmitted deflate hint:",
 116                 "                                true, false, or keep (default)",
 117                 "  -r, --remove-pack-file        remove input file after unpacking",
 118                 "  -v, --verbose                 increase program verbosity",
 119                 "  -q, --quiet                   set verbosity to lowest level",
 120                 "  -l{F}, --log-file={F}         output to the given log file, or",
 121                 "                                '-' for System.out",
 122                 "  -?, -h, --help                print this help message",
 123                 "  -V, --version                 print program version",
 124                 "  -J{X}                         pass option X to underlying Java VM"
 125             }
 126         },
 127         {MORE_INFO, "(For more information, run {0} --help .)"}, // parameter 0:command name
 128         {DUPLICATE_OPTION, "duplicate option: {0}"}, // parameter 0:option
 129         {BAD_SPEC, "bad spec for {0}: {1}"}, // parameter 0:option;parameter 1:specifier
 130         {DEPRECATED, "\nWarning: The {0} tool is planned to be removed in a future JDK release.\n"} // parameter 0:command name
 131     };
 132 
 133     protected Object[][] getContents() {
 134         return resource;
 135     }
 136 }