1 22 23 package org.continuent.sequoia.console.text.commands.dbadmin; 24 25 import java.util.StringTokenizer ; 26 27 import org.continuent.sequoia.common.i18n.ConsoleTranslate; 28 import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean; 29 import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin; 30 31 36 public class RenameDump extends AbstractAdminCommand 37 { 38 39 44 public RenameDump(VirtualDatabaseAdmin module) 45 { 46 super(module); 47 } 48 49 52 public void parse(String commandText) throws Exception 53 { 54 String oldDumpName = null; 55 String newDumpName = null; 56 StringTokenizer st = new StringTokenizer (commandText.trim()); 57 58 if (st.countTokens() != 2) 59 { 60 console.printError(getUsage()); 61 return; 62 } 63 try 64 { 65 oldDumpName = st.nextToken(); 66 newDumpName = st.nextToken(); 67 if (oldDumpName == null || newDumpName == null) 68 { 69 console.printError(getUsage()); 70 return; 71 } 72 73 console.printInfo(ConsoleTranslate.get( 74 "admin.command.rename.dump.path.echo", new String []{oldDumpName, newDumpName})); 76 VirtualDatabaseMBean vdjc = jmxClient.getVirtualDatabaseProxy(dbName, 77 user, password); 78 vdjc.renameDump(oldDumpName, newDumpName); 79 console.printInfo(ConsoleTranslate.get( 80 "admin.command.rename.dump.path.done", new String []{oldDumpName, newDumpName})); 82 } 83 catch (Exception e) 84 { 85 console.printError( 86 "Problem while renaming dump (" + e.getMessage() + ")", e); 87 } 88 } 89 90 93 public String getCommandName() 94 { 95 return "rename dump"; } 97 98 101 public String getCommandDescription() 102 { 103 return ConsoleTranslate.get("admin.command.rename.dump.path.description"); } 105 106 109 public String getCommandParameters() 110 { 111 return ConsoleTranslate.get("admin.command.rename.dump.path.parameters"); } 113 } 114 | Popular Tags |