1 24 25 package org.objectweb.cjdbc.console.text.commands; 26 27 import java.io.BufferedReader ; 28 import java.io.InputStreamReader ; 29 30 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 31 import org.objectweb.cjdbc.console.text.module.AbstractConsoleModule; 32 33 39 public class Native extends ConsoleCommand 40 { 41 42 47 public Native(AbstractConsoleModule module) 48 { 49 super(module); 50 } 51 52 55 public void parse(String commandText) throws Exception 56 { 57 } 60 61 64 public String getCommandName() 65 { 66 return "native"; 67 } 68 69 72 public String getCommandDescription() 73 { 74 return ConsoleTranslate.get("console.command.native"); 75 } 76 77 80 public void execute(String commandText) throws Exception 81 { 82 Runtime rt = Runtime.getRuntime(); 83 Process proc = rt.exec(commandText.trim()); 84 proc.waitFor(); 85 BufferedReader in = new BufferedReader (new InputStreamReader (proc 86 .getInputStream())); 87 String line; 88 while ((line = in.readLine()) != null) 89 console.println(ConsoleTranslate.get("console.command.native.output", 90 line)); 91 } 92 } | Popular Tags |