KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > console > text > commands > dbadmin > DeleteLogUpToCheckpoint


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2005 Emic Networks.
4  * Contact: c-jdbc@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or any later
9  * version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19  *
20  * Initial developer(s): Olivier Fambon.
21  * Contributor(s): ______________________.
22  */

23
24 package org.objectweb.cjdbc.console.text.commands.dbadmin;
25
26 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate;
27 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin;
28
29 /**
30  * This class defines the command used to cleanup the recovery log upto a
31  * specified checkpoint.
32  *
33  * @author <a HREF="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon </a>
34  * @version 1.0
35  */

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

43   public DeleteLogUpToCheckpoint(VirtualDatabaseAdmin module)
44   {
45     super(module);
46   }
47
48   /**
49    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#parse(java.lang.String)
50    */

51   public void parse(String JavaDoc commandText) throws Exception JavaDoc
52   {
53     String JavaDoc checkpointName = commandText.trim();
54
55     if ("".equals(checkpointName))
56     {
57       console.printError(getUsage());
58       return;
59     }
60
61     jmxClient.getVirtualDatabaseProxy(dbName, user, password)
62         .deleteLogUpToCheckpoint(checkpointName);
63     /*
64      * jmxClient.getVirtualDatabaseProxy(dbName, user, password).removeDumpFile(
65      * new File(commandText.trim()));
66      */

67   }
68
69   /**
70    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandName()
71    */

72   public String JavaDoc getCommandName()
73   {
74     return "purge log";
75   }
76
77   /**
78    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandParameters()
79    */

80   public String JavaDoc getCommandParameters()
81   {
82     return ConsoleTranslate.get("admin.command.deleteLogUpToCheckpoint.params");
83   }
84
85   /**
86    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandDescription()
87    */

88   public String JavaDoc getCommandDescription()
89   {
90     return ConsoleTranslate
91         .get("admin.command.deleteLogUpToCheckpoint.description");
92   }
93
94 }
Popular Tags