1 24 25 package org.objectweb.cjdbc.console.text.commands.dbadmin; 26 27 import java.util.HashMap ; 28 import java.util.StringTokenizer ; 29 30 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 31 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 32 33 39 public class Replicate extends AbstractAdminCommand 40 { 41 42 47 public Replicate(VirtualDatabaseAdmin module) 48 { 49 super(module); 50 } 51 52 55 public void parse(String commandText) throws Exception 56 { 57 StringTokenizer st = new StringTokenizer (commandText, "; "); 58 if (st.countTokens() < 3) 59 { 60 console.printError(getUsage()); 61 return; 62 } 63 64 String backend1 = st.nextToken(); 65 String backend2 = st.nextToken(); 66 String url = st.nextToken(); 67 68 HashMap parameters = new HashMap (); 69 parameters.put("url",url); 70 StringTokenizer st2; 71 while (st.hasMoreTokens()) 72 { 73 st2 = new StringTokenizer (st.nextToken(), "="); 74 if (st2.countTokens() == 2) 75 { 76 String param = st2.nextToken(); 77 String value = st2.nextToken(); 78 parameters.put(param, value); 79 console.println(ConsoleTranslate.get("admin.command.replicate.param", 80 new String []{param, value})); 81 } 82 } 83 84 console.println(ConsoleTranslate.get("admin.command.replicate.echo", 85 new String []{backend1, backend2, url})); 86 jmxClient.getVirtualDatabaseProxy(dbName, user, password).replicateBackend( 87 backend1, backend2, parameters); 88 89 } 90 91 94 public String getCommandParameters() 95 { 96 return ConsoleTranslate.get("admin.command.replicate.params"); 97 } 98 99 102 public String getCommandName() 103 { 104 return "clone backend config"; 105 } 106 107 110 public String getCommandDescription() 111 { 112 return ConsoleTranslate.get("admin.command.replicate.description"); 113 } 114 115 } | Popular Tags |