1 19 20 package org.netbeans.core.startup; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.PrintStream ; 25 import java.io.PrintWriter ; 26 import org.netbeans.CLIHandler; 27 28 32 public final class CLITestModuleReload extends CLIHandler { 33 34 public CLITestModuleReload() { 35 super(CLIHandler.WHEN_INIT); 36 } 37 38 protected int cli(CLIHandler.Args args) { 39 String [] argv = args.getArguments(); 40 for (int i = 0; i < argv.length; i++) { 41 if (argv[i] == null) { 42 continue; 43 } 44 if (argv[i].equals("--reload")) { argv[i++] = null; 46 if (i == argv.length || argv[i].startsWith("--")) { log("Argument --reload must be followed by a file name", args); return 2; 49 } 50 File module = new File (argv[i]); 51 argv[i] = null; 52 try { 53 TestModuleDeployer.deployTestModule(module); 54 } catch (IOException e) { 55 e.printStackTrace(new PrintStream (args.getOutputStream())); 56 return 2; 57 } 58 } 59 } 60 return 0; 62 } 63 64 private static void log(String msg, CLIHandler.Args args) { 65 PrintWriter w = new PrintWriter (args.getOutputStream()); 66 w.println(msg); 67 w.flush(); 68 } 69 70 protected void usage(PrintWriter w) { 71 w.println("Module reload options:"); w.println(" --reload /path/to/module.jar Installs or reinstalls a module JAR file."); } 74 75 } 76 | Popular Tags |