1 24 25 package org.objectweb.cjdbc.console.text.commands.dbadmin; 26 27 import java.util.ArrayList ; 28 import java.util.Iterator ; 29 30 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 31 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean; 32 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 33 34 43 public class Enable extends AbstractAdminCommand 44 { 45 46 51 public Enable(VirtualDatabaseAdmin module) 52 { 53 super(module); 54 } 55 56 59 public void parse(String commandText) throws Exception 60 { 61 String backendName = null; 62 63 backendName = commandText.trim(); 64 65 if ("".equals(backendName)) 66 { 67 console.printError(getUsage()); 68 return; 69 } 70 VirtualDatabaseMBean vdjc = jmxClient.getVirtualDatabaseProxy(dbName, user, 71 password); 72 if ("*".equals(backendName)) 73 { 74 console.println(ConsoleTranslate 75 .get("admin.command.enable.all.with.checkpoint")); 76 ArrayList backendNames = vdjc.getAllBackendNames(); 77 for (Iterator iter = backendNames.iterator(); iter.hasNext();) 78 { 79 String backend = (String ) iter.next(); 80 vdjc.enableBackendFromCheckpoint(backend); 81 } 82 } 83 else 84 { 85 console.println(ConsoleTranslate.get( 86 "admin.command.enable.with.checkpoint", backendName)); 87 vdjc.enableBackendFromCheckpoint(backendName); 88 } 89 } 90 91 94 public String getCommandName() 95 { 96 97 return "enable"; 98 } 99 100 103 public String getCommandDescription() 104 { 105 return ConsoleTranslate.get("admin.command.enable.description"); 106 } 107 108 111 public String getCommandParameters() 112 { 113 return ConsoleTranslate.get("admin.command.enable.params"); 114 } 115 } 116 | Popular Tags |