KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > console > text > commands > dbadmin > DeleteLogUpToCheckpoint


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 Emic Networks.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
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  */

21
22 package org.continuent.sequoia.console.text.commands.dbadmin;
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 cleanup the recovery log upto a
29  * specified checkpoint.
30  *
31  * @author <a HREF="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon </a>
32  * @version 1.0
33  */

34 public class DeleteLogUpToCheckpoint extends AbstractAdminCommand
35 {
36   /**
37    * Creates a new <code>RemoveCheckpoint.java</code> object
38    *
39    * @param module the command is attached to
40    */

41   public DeleteLogUpToCheckpoint(VirtualDatabaseAdmin module)
42   {
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 JavaDoc commandText) throws Exception JavaDoc
50   {
51     String JavaDoc checkpointName = commandText.trim();
52
53     if ("".equals(checkpointName)) //$NON-NLS-1$
54
{
55       console.printError(getUsage());
56       return;
57     }
58
59     jmxClient.getVirtualDatabaseProxy(dbName, user, password)
60         .deleteLogUpToCheckpoint(checkpointName);
61   }
62
63   /**
64    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
65    */

66   public String JavaDoc getCommandName()
67   {
68     return "truncate log"; //$NON-NLS-1$
69
}
70
71   /**
72    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
73    */

74   public String JavaDoc getCommandParameters()
75   {
76     return ConsoleTranslate.get("admin.command.deleteLogUpToCheckpoint.params"); //$NON-NLS-1$
77
}
78
79   /**
80    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
81    */

82   public String JavaDoc getCommandDescription()
83   {
84     return ConsoleTranslate
85         .get("admin.command.deleteLogUpToCheckpoint.description"); //$NON-NLS-1$
86
}
87
88 }
Popular Tags