1 24 25 package org.objectweb.cjdbc.console.text.commands.dbadmin; 26 27 import java.util.ArrayList ; 28 import java.util.Iterator ; 29 import java.util.StringTokenizer ; 30 31 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 32 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean; 33 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 34 35 41 public class Disable extends AbstractAdminCommand 42 { 43 48 public Disable(VirtualDatabaseAdmin module) 49 { 50 super(module); 51 } 52 53 56 public void parse(String commandText) throws Exception 57 { 58 String backendName = null; 59 60 StringTokenizer st = new StringTokenizer (commandText); 61 if (st.countTokens() != 1) 62 { 63 console.printError(getUsage()); 64 return; 65 } 66 try 67 { 68 backendName = st.nextToken(); 69 } 70 catch (Exception e) 71 { 72 console.printError(getUsage()); 73 return; 74 } 75 76 VirtualDatabaseMBean vjdc = jmxClient.getVirtualDatabaseProxy(dbName, user, 77 password); 78 if ("*".equals(backendName)) 79 { 80 console.println(ConsoleTranslate 81 .get("admin.command.disable.backend.all.with.checkpoint")); 82 ArrayList backendNames = vjdc.getAllBackendNames(); 83 for (Iterator iter = backendNames.iterator(); iter.hasNext();) 84 { 85 String backend = (String ) iter.next(); 86 vjdc.disableBackendWithCheckpoint(backend); 87 } 88 } 89 else 90 { 91 vjdc.disableBackendWithCheckpoint(backendName); 92 console.println(ConsoleTranslate.get( 93 "admin.command.disable.backend.with.checkpoint", backendName)); 94 } 95 } 96 97 100 public String getCommandParameters() 101 { 102 return ConsoleTranslate.get("admin.command.disable.backend.params"); 103 } 104 105 108 public String getCommandName() 109 { 110 return "disable"; 111 } 112 113 116 public String getCommandDescription() 117 { 118 return ConsoleTranslate.get("admin.command.disable.backend.description"); 119 } 120 121 } 122 | Popular Tags |