1 24 25 package org.objectweb.cjdbc.console.text.commands.controller; 26 27 import java.io.BufferedReader ; 28 import java.io.FileReader ; 29 30 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 31 import org.objectweb.cjdbc.console.text.ConsoleException; 32 import org.objectweb.cjdbc.console.text.commands.ConsoleCommand; 33 import org.objectweb.cjdbc.console.text.module.AbstractConsoleModule; 34 35 41 public class Load extends ConsoleCommand 42 { 43 48 public Load(AbstractConsoleModule module) 49 { 50 super(module); 51 } 52 53 56 public void parse(String commandText) throws Exception 57 { 58 String filename = null; 59 if (commandText == null || commandText.trim().equals("")) 61 filename = console.readLine(ConsoleTranslate 62 .get("controller.command.load.vdb.input")); 63 else 64 filename = commandText.trim(); 65 if (filename == null) 66 throw new ConsoleException(ConsoleTranslate 67 .get("controller.command.load.vdb.file.null")); 68 FileReader fileReader; 69 fileReader = new FileReader (filename); 70 71 BufferedReader in = new BufferedReader (fileReader); 73 StringBuffer xml = new StringBuffer (); 74 String line; 75 do 76 { 77 line = in.readLine(); 78 if (line != null) 79 xml.append(line); 80 } 81 while (line != null); 82 83 jmxClient.getControllerProxy().addVirtualDatabases(xml.toString()); 85 console.println(ConsoleTranslate.get("controller.command.load.vdb.success", 86 filename)); 87 } 88 89 92 public String getCommandName() 93 { 94 return "load virtualdatabase config"; 95 } 96 97 100 public String getCommandDescription() 101 { 102 return ConsoleTranslate.get("controller.command.load.vdb.description"); 103 } 104 105 108 public String getCommandParameters() 109 { 110 return ConsoleTranslate.get("controller.command.load.vdb.params"); 111 } 112 } 113 | Popular Tags |