01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2005 Emic Networks.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: * Initial developer(s): Jeff Mesnil.
19: * Contributor(s): ______________________.
20: */package org.continuent.sequoia.console.text.commands.dbadmin;
21:
22: import java.util.StringTokenizer;
23:
24: import org.continuent.sequoia.common.i18n.ConsoleTranslate;
25: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
26:
27: /**
28: * This class defines the command used to transfer a dump (identified by a dump
29: * name ) from the current controller to another one.
30: *
31: * @author <a href="mailto:jeff.mesnil@emicnetworks.com">Jeff Mesnil</a>
32: */
33: public class TransferDump extends AbstractAdminCommand {
34: /**
35: * Creates a new <code>TransferDump</code> object
36: *
37: * @param module the command is attached to
38: */
39: public TransferDump(VirtualDatabaseAdmin module) {
40: super (module);
41: }
42:
43: /**
44: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
45: */
46: public void parse(String commandText) throws Exception {
47: StringTokenizer st = new StringTokenizer(commandText);
48: String dumpName = null;
49: String controllerName = null;
50: boolean noCopy = false;
51: try {
52: dumpName = st.nextToken();
53: controllerName = st.nextToken();
54: if (st.hasMoreTokens()) {
55: noCopy = st.nextToken().equalsIgnoreCase("nocopy"); //$NON-NLS-1$
56: }
57: } catch (Exception e) {
58: console.printError(getUsage());
59: return;
60: }
61:
62: console.printInfo(ConsoleTranslate.get(
63: "admin.command.transfer.dump.echo", //$NON-NLS-1$
64: new String[] { dumpName, controllerName }));
65: jmxClient.getVirtualDatabaseProxy(dbName, user, password)
66: .transferDump(dumpName, controllerName, noCopy);
67: console.printInfo(ConsoleTranslate
68: .get("admin.command.transfer.dump.done")); //$NON-NLS-1$
69: }
70:
71: /**
72: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
73: */
74: public String getCommandParameters() {
75: return ConsoleTranslate
76: .get("admin.command.transfer.dump.params"); //$NON-NLS-1$
77: }
78:
79: /**
80: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
81: */
82: public String getCommandName() {
83: return "transfer dump"; //$NON-NLS-1$
84: }
85:
86: /**
87: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
88: */
89: public String getCommandDescription() {
90: return ConsoleTranslate
91: .get("admin.command.transfer.dump.description"); //$NON-NLS-1$
92: }
93:
94: }
|