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 ForceEnable extends AbstractAdminCommand 41 { 42 43 48 public ForceEnable(VirtualDatabaseAdmin module) 49 { 50 super(module); 51 } 52 53 56 public void parse(String commandText) throws Exception 57 { 58 59 if (commandText.trim().length() == 0) 60 { 61 console.printError(getUsage()); 62 return; 63 } 64 65 String [] backendNames; 66 VirtualDatabaseMBean vjdc = jmxClient.getVirtualDatabaseProxy(dbName, user, 67 password); 68 69 if (("*").equals(commandText.trim())) 70 { 71 ArrayList backendNamesList = vjdc.getAllBackendNames(); 72 backendNames = (String []) backendNamesList 73 .toArray(new String [backendNamesList.size()]); 74 } 75 else 76 { 77 String backendName = commandText.trim(); 78 backendNames = new String []{backendName}; 79 } 80 for (int i = 0; i < backendNames.length; i++) 81 { 82 String backendName = backendNames[i]; 83 console.println(ConsoleTranslate.get( 84 "admin.command.force.enable.backend", backendName)); 85 vjdc.forceEnableBackend(backendName); 86 } 87 } 88 89 92 public String getCommandName() 93 { 94 95 return "force enable"; 96 } 97 98 101 public String getCommandDescription() 102 { 103 return ConsoleTranslate.get("admin.command.force.enable.description"); 104 } 105 106 109 public String getCommandParameters() 110 { 111 return ConsoleTranslate.get("admin.command.force.enable.params"); 112 } 113 } 114 | Popular Tags |