1 24 25 package org.objectweb.cjdbc.console.text.commands.dbadmin; 26 27 import java.util.StringTokenizer ; 28 29 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 30 import org.objectweb.cjdbc.common.jmx.mbeans.DatabaseBackendMBean; 31 import org.objectweb.cjdbc.console.text.ConsoleException; 32 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 33 34 40 public class DisableWrite extends AbstractAdminCommand 41 { 42 43 48 public DisableWrite(VirtualDatabaseAdmin module) 49 { 50 super(module); 51 } 52 53 56 public void parse(String commandText) throws Exception 57 { 58 StringTokenizer st = new StringTokenizer (commandText); 59 if (st.countTokens() < 1 || st.countTokens() > 2) 60 throw new ConsoleException(ConsoleTranslate 61 .get("console.error.invalid.comment.argument")); 62 String backendName = st.nextToken(); 63 String checkpoint = null; 64 if (st.hasMoreTokens()) 65 checkpoint = st.nextToken(); 66 console.println(ConsoleTranslate.get("admin.command.disable.write.echo", 67 backendName)); 68 DatabaseBackendMBean mbean = jmxClient.getDatabaseBackendProxy(dbName, 69 backendName, user, password); 70 mbean.disableWrite(); 71 if (checkpoint != null) 72 mbean.setLastKnownCheckpoint(checkpoint); 73 } 74 75 78 public String getCommandName() 79 { 80 return "disableWrite"; 81 } 82 83 86 public String getCommandDescription() 87 { 88 return ConsoleTranslate.get("admin.command.disable.write"); 89 } 90 91 94 public String getCommandParameters() 95 { 96 return "<backendName> [<checkpoint>]"; 97 } 98 99 } | Popular Tags |