KickJava   Java API By Example, From Geeks To Geeks.

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


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): Jeff Mesnil.
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 transfer a dump (identified by a dump
33  * name ) from the current controller to another one.
34  *
35  * @author <a HREF="mailto:jeff.mesnil@emicnetworks.com">Jeff Mesnil</a>
36  */

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

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

52   public void parse(String JavaDoc commandText) throws Exception JavaDoc
53   {
54     StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(commandText);
55     String JavaDoc dumpName = null;
56     String JavaDoc controllerName = null;
57     boolean noCopy = false;
58     try
59     {
60       dumpName = st.nextToken();
61       controllerName = st.nextToken();
62       if (st.hasMoreTokens())
63       {
64         noCopy = st.nextToken().equalsIgnoreCase("nocopy");
65       }
66     }
67     catch (Exception JavaDoc e)
68     {
69       console.printError(getUsage());
70       return;
71     }
72
73     console.print(ConsoleTranslate.get("admin.command.transfer.dump.echo",
74         new String JavaDoc[]{dumpName, controllerName}));
75     jmxClient.getVirtualDatabaseProxy(dbName, user, password).transferDump(
76         dumpName, controllerName, noCopy);
77     console.print(ConsoleTranslate.get("admin.command.transfer.dump.done"));
78   }
79
80   /**
81    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandParameters()
82    */

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

91   public String JavaDoc getCommandName()
92   {
93     return "transfer dump";
94   }
95
96   /**
97    * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandDescription()
98    */

99   public String JavaDoc getCommandDescription()
100   {
101     return ConsoleTranslate.get("admin.command.transfer.dump.description");
102   }
103
104 }
105
Popular Tags