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 org.continuent.sequoia.common.i18n.ConsoleTranslate;
23: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
24:
25: /**
26: * This class defines the command used to cleanup the recovery log upto a
27: * specified checkpoint.
28: *
29: * @author <a href="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon </a>
30: * @version 1.0
31: */
32: public class DeleteLogUpToCheckpoint extends AbstractAdminCommand {
33: /**
34: * Creates a new <code>RemoveCheckpoint.java</code> object
35: *
36: * @param module the command is attached to
37: */
38: public DeleteLogUpToCheckpoint(VirtualDatabaseAdmin module) {
39: super (module);
40: }
41:
42: /**
43: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
44: */
45: public void parse(String commandText) throws Exception {
46: String checkpointName = commandText.trim();
47:
48: if ("".equals(checkpointName)) //$NON-NLS-1$
49: {
50: console.printError(getUsage());
51: return;
52: }
53:
54: jmxClient.getVirtualDatabaseProxy(dbName, user, password)
55: .deleteLogUpToCheckpoint(checkpointName);
56: }
57:
58: /**
59: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
60: */
61: public String getCommandName() {
62: return "truncate log"; //$NON-NLS-1$
63: }
64:
65: /**
66: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
67: */
68: public String getCommandParameters() {
69: return ConsoleTranslate
70: .get("admin.command.deleteLogUpToCheckpoint.params"); //$NON-NLS-1$
71: }
72:
73: /**
74: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
75: */
76: public String getCommandDescription() {
77: return ConsoleTranslate
78: .get("admin.command.deleteLogUpToCheckpoint.description"); //$NON-NLS-1$
79: }
80:
81: }
|