1 23 24 package org.objectweb.cjdbc.console.text.commands.dbadmin; 25 26 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 27 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 28 import org.objectweb.cjdbc.common.xml.XmlComponent; 29 import org.objectweb.cjdbc.common.xml.XmlTools; 30 import org.objectweb.cjdbc.console.text.ConsoleException; 31 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 32 33 41 public class GetXml extends AbstractAdminCommand 42 { 43 44 49 public GetXml(VirtualDatabaseAdmin module) 50 { 51 super(module); 52 } 53 54 57 public void parse(String commandText) throws Exception 58 { 59 try 60 { 61 String vdbXml = jmxClient.getVirtualDatabaseProxy(dbName, user, password) 62 .getXml(); 63 StringBuffer validXml = new StringBuffer (XmlComponent.XML_VERSION); 64 validXml.append("\n"); 65 validXml.append("<" + DatabasesXmlTags.ELT_CJDBC + ">\n"); 66 validXml.append(vdbXml); 67 validXml.append("</" + DatabasesXmlTags.ELT_CJDBC + ">"); 68 69 String prettyXml = XmlTools.prettyXml(validXml.toString()); 70 prettyXml = XmlTools.insertCjdbcDoctype(prettyXml); 71 console.println(prettyXml); 72 } 73 catch (Exception e) 74 { 75 throw new ConsoleException(ConsoleTranslate 76 .get("controller.command.get.xml.error")); 77 } 78 79 } 80 81 84 public String getCommandName() 85 { 86 return "show virtualdatabase config"; 87 } 88 89 92 public String getCommandDescription() 93 { 94 return ConsoleTranslate.get("admin.command.get.xml.description"); 95 } 96 97 } | Popular Tags |