1 23 24 package org.objectweb.cjdbc.console.text.commands.dbadmin; 25 26 import java.util.ArrayList ; 27 28 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 29 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean; 30 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 31 32 40 public class ForceDisable extends AbstractAdminCommand 41 { 42 47 public ForceDisable(VirtualDatabaseAdmin module) 48 { 49 super(module); 50 } 51 52 55 public void parse(String commandText) throws Exception 56 { 57 if (commandText.trim().length() == 0) 58 { 59 console.printError(getUsage()); 60 return; 61 } 62 63 String [] backendNames; 64 VirtualDatabaseMBean vjdc = jmxClient.getVirtualDatabaseProxy(dbName, user, 65 password); 66 67 if (("*").equals(commandText.trim())) 68 { 69 ArrayList backendNamesList = vjdc.getAllBackendNames(); 70 backendNames = (String []) backendNamesList 71 .toArray(new String [backendNamesList.size()]); 72 } 73 else 74 { 75 String backendName = commandText.trim(); 76 backendNames = new String []{backendName}; 77 } 78 for (int i = 0; i < backendNames.length; i++) 79 { 80 String backendName = backendNames[i]; 81 vjdc.forceDisableBackend(backendName); 82 console.println(ConsoleTranslate.get( 83 "admin.command.force.disable.backend", backendName)); 84 } 85 } 86 87 90 public String getCommandDescription() 91 { 92 return ConsoleTranslate.get("admin.command.force.disable.description"); 93 } 94 95 98 public String getCommandName() 99 { 100 return "force disable"; 101 } 102 103 106 public String getCommandParameters() 107 { 108 return ConsoleTranslate.get("admin.command.force.disable.params"); 109 } 110 111 } 112 | Popular Tags |