< prev index next >

jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java

Print this page




  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 
  26 package jdk.tools.jmod;
  27 
  28 import java.io.ByteArrayInputStream;
  29 import java.io.ByteArrayOutputStream;
  30 import java.io.File;
  31 import java.io.IOException;
  32 import java.io.InputStream;
  33 import java.io.OutputStream;
  34 import java.io.PrintStream;

  35 import java.io.UncheckedIOException;
  36 import java.lang.module.Configuration;
  37 import java.lang.module.ModuleReader;
  38 import java.lang.module.ModuleReference;
  39 import java.lang.module.ModuleFinder;
  40 import java.lang.module.ModuleDescriptor;
  41 import java.lang.module.ModuleDescriptor.Exports;
  42 import java.lang.module.ModuleDescriptor.Provides;
  43 import java.lang.module.ModuleDescriptor.Requires;
  44 import java.lang.module.ModuleDescriptor.Version;
  45 import java.lang.module.ResolutionException;
  46 import java.lang.module.ResolvedModule;
  47 import java.net.URI;
  48 import java.nio.file.FileSystems;
  49 import java.nio.file.FileVisitResult;
  50 import java.nio.file.Files;
  51 import java.nio.file.InvalidPathException;
  52 import java.nio.file.Path;
  53 import java.nio.file.PathMatcher;
  54 import java.nio.file.Paths;


 119         }
 120 
 121         CommandException showUsage(boolean b) {
 122             showUsage = b;
 123             return this;
 124         }
 125 
 126         private static String getMessageOrKey(String key, Object... args) {
 127             try {
 128                 return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
 129             } catch (MissingResourceException e) {
 130                 return key;
 131             }
 132         }
 133     }
 134 
 135     private static final String PROGNAME = "jmod";
 136     private static final String MODULE_INFO = "module-info.class";
 137 
 138     private Options options;
 139     private PrintStream out = System.out;
 140     void setLog(PrintStream out) {
 141         this.out = out;
 142     }
 143 
 144     /* Result codes. */
 145     static final int EXIT_OK = 0, // Completed with no errors.
 146                      EXIT_ERROR = 1, // Completed but reported errors.
 147                      EXIT_CMDERR = 2, // Bad command-line arguments
 148                      EXIT_SYSERR = 3, // System error or resource exhaustion.
 149                      EXIT_ABNORMAL = 4;// terminated abnormally
 150 
 151     enum Mode {
 152         CREATE,
 153         LIST,
 154         DESCRIBE,
 155         HASH
 156     };
 157 
 158     static class Options {
 159         Mode mode;
 160         Path jmodFile;




  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 
  26 package jdk.tools.jmod;
  27 
  28 import java.io.ByteArrayInputStream;
  29 import java.io.ByteArrayOutputStream;
  30 import java.io.File;
  31 import java.io.IOException;
  32 import java.io.InputStream;
  33 import java.io.OutputStream;
  34 import java.io.PrintStream;
  35 import java.io.PrintWriter;
  36 import java.io.UncheckedIOException;
  37 import java.lang.module.Configuration;
  38 import java.lang.module.ModuleReader;
  39 import java.lang.module.ModuleReference;
  40 import java.lang.module.ModuleFinder;
  41 import java.lang.module.ModuleDescriptor;
  42 import java.lang.module.ModuleDescriptor.Exports;
  43 import java.lang.module.ModuleDescriptor.Provides;
  44 import java.lang.module.ModuleDescriptor.Requires;
  45 import java.lang.module.ModuleDescriptor.Version;
  46 import java.lang.module.ResolutionException;
  47 import java.lang.module.ResolvedModule;
  48 import java.net.URI;
  49 import java.nio.file.FileSystems;
  50 import java.nio.file.FileVisitResult;
  51 import java.nio.file.Files;
  52 import java.nio.file.InvalidPathException;
  53 import java.nio.file.Path;
  54 import java.nio.file.PathMatcher;
  55 import java.nio.file.Paths;


 120         }
 121 
 122         CommandException showUsage(boolean b) {
 123             showUsage = b;
 124             return this;
 125         }
 126 
 127         private static String getMessageOrKey(String key, Object... args) {
 128             try {
 129                 return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
 130             } catch (MissingResourceException e) {
 131                 return key;
 132             }
 133         }
 134     }
 135 
 136     private static final String PROGNAME = "jmod";
 137     private static final String MODULE_INFO = "module-info.class";
 138 
 139     private Options options;
 140     private PrintWriter out = new PrintWriter(System.out, true);
 141     void setLog(PrintWriter out, PrintWriter err) {
 142         this.out = out;
 143     }
 144 
 145     /* Result codes. */
 146     static final int EXIT_OK = 0, // Completed with no errors.
 147                      EXIT_ERROR = 1, // Completed but reported errors.
 148                      EXIT_CMDERR = 2, // Bad command-line arguments
 149                      EXIT_SYSERR = 3, // System error or resource exhaustion.
 150                      EXIT_ABNORMAL = 4;// terminated abnormally
 151 
 152     enum Mode {
 153         CREATE,
 154         LIST,
 155         DESCRIBE,
 156         HASH
 157     };
 158 
 159     static class Options {
 160         Mode mode;
 161         Path jmodFile;


< prev index next >