KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.StringTokenizer JavaDoc;
27
28 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate;
29 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin;
30
31 /**
32  * This class defines the command used to copy the local virtual database
33  * recovery log onto a remote controller's peer virtual database log. The copy
34  * is performed from the specified checkpoint uptil 'now' (a new global
35  * checkpoint). The copy is sent to the specified remote node.
36  *
37  * @author <a HREF="mailto:Olivier.Fambon@emicnetworks.com">Olivier Fambon </a>
38  * @version 1.0
39  */

40 public class CopyLogFromCheckpoint extends AbstractAdminCommand
41 {
42   /**
43    * Creates a new <code>Disable.java</code> object
44    *
45    * @param module the command is attached to
46    */

47   public CopyLogFromCheckpoint(VirtualDatabaseAdmin module)
48   {
49     super(module);
50   }
51
52   /**
53    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#parse(java.lang.String)
54    */

55   public void parse(String JavaDoc commandText) throws Exception JavaDoc
56   {
57     StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(commandText);
58     String JavaDoc checkpointName = null, controllerName = null;
59     try
60     {
61       checkpointName = st.nextToken();
62       controllerName = st.nextToken();
63     }
64     catch (Exception JavaDoc e)
65     {
66       console.printError(getUsage());
67     }
68
69     jmxClient.getVirtualDatabaseProxy(dbName, user, password)
70         .copyLogFromCheckpoint(checkpointName, controllerName);
71     /*
72      * console.println(ConsoleTranslate.get(
73      * "admin.command.disableBackend.with.checkpoint", new String[]{
74      * backendName, checkpoint}));
75      */

76   }
77
78   /**
79    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandParameters()
80    */

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

89   public String JavaDoc getCommandName()
90   {
91     return "restore log";
92   }
93
94   /**
95    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandDescription()
96    */

97   public String JavaDoc getCommandDescription()
98   {
99     return ConsoleTranslate.get("admin.command.restore.log.description");
100   }
101
102 }
103
Popular Tags