00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.console.text.commands.dbadmin;
00026
00027 import java.util.StringTokenizer;
00028
00029 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate;
00030 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean;
00031 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin;
00032
00033
00034
00035
00036
00037
00038
00039 public class TransferBackend extends AbstractAdminCommand
00040 {
00041
00042
00043
00044
00045
00046
00047 public TransferBackend(VirtualDatabaseAdmin module)
00048 {
00049 super(module);
00050 }
00051
00052
00053
00054
00055 public void parse(String commandText) throws Exception
00056 {
00057 String controller = null;
00058 String backendName = null;
00059 StringTokenizer st = new StringTokenizer(commandText.trim());
00060
00061 try
00062 {
00063 backendName = st.nextToken();
00064 controller = st.nextToken();
00065
00066 console.println(ConsoleTranslate.get("admin.command.transfer.echo",
00067 new String[]{backendName, controller}));
00068 VirtualDatabaseMBean vjdc = jmxClient.getVirtualDatabaseProxy(dbName,
00069 user, password);
00070 vjdc.transferBackend(backendName,controller);
00071 }
00072 catch (Exception e)
00073 {
00074 console.println(ConsoleTranslate
00075 .get("admin.command.transfer.error",e));
00076 }
00077 }
00078
00079
00080
00081
00082 public String getCommandName()
00083 {
00084 return "transfer";
00085 }
00086
00087
00088
00089
00090 public String getCommandDescription()
00091 {
00092 return ConsoleTranslate.get("admin.command.transfer");
00093 }
00094
00095
00096
00097
00098 public String getCommandParameters()
00099 {
00100 return "<backend> <controller>";
00101 }
00102 }