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): Olivier Fambon.
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 copy the local virtual database
29: * recovery log onto a remote controller's peer virtual database log. The copy
30: * is performed from the specified checkpoint uptil 'now' (a new global
31: * checkpoint). The copy is sent to the specified remote node.
32: *
33: * @author <a href="mailto:Olivier.Fambon@emicnetworks.com">Olivier Fambon </a>
34: * @version 1.0
35: */
36: public class CopyLogFromCheckpoint extends AbstractAdminCommand {
37: /**
38: * Creates a new <code>Disable.java</code> object
39: *
40: * @param module the command is attached to
41: */
42: public CopyLogFromCheckpoint(VirtualDatabaseAdmin module) {
43: super (module);
44: }
45:
46: /**
47: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
48: */
49: public void parse(String commandText) throws Exception {
50: StringTokenizer st = new StringTokenizer(commandText);
51: String checkpointName = null, controllerName = null;
52: try {
53: checkpointName = st.nextToken();
54: controllerName = st.nextToken();
55: } catch (Exception e) {
56: console.printError(getUsage());
57: return;
58: }
59:
60: jmxClient.getVirtualDatabaseProxy(dbName, user, password)
61: .copyLogFromCheckpoint(checkpointName, controllerName);
62: console.printInfo(ConsoleTranslate
63: .get("admin.command.restore.log.done")); //$NON-NLS-1$
64: }
65:
66: /**
67: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
68: */
69: public String getCommandParameters() {
70: return ConsoleTranslate.get("admin.command.restore.log.params"); //$NON-NLS-1$
71: }
72:
73: /**
74: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
75: */
76: public String getCommandName() {
77: return "restore log"; //$NON-NLS-1$
78: }
79:
80: /**
81: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
82: */
83: public String getCommandDescription() {
84: return ConsoleTranslate
85: .get("admin.command.restore.log.description"); //$NON-NLS-1$
86: }
87:
88: }
|