KickJava   Java API By Example, From Geeks To Geeks.

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


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): Jeff Mesnil.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.console.text.commands.dbadmin;
23
24 import java.util.StringTokenizer JavaDoc;
25
26 import org.continuent.sequoia.common.i18n.ConsoleTranslate;
27 import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
28
29 /**
30  * This class defines the command used to transfer a dump (identified by a dump
31  * name ) from the current controller to another one.
32  *
33  * @author <a HREF="mailto:jeff.mesnil@emicnetworks.com">Jeff Mesnil</a>
34  */

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

42   public TransferDump(VirtualDatabaseAdmin module)
43   {
44     super(module);
45   }
46
47   /**
48    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
49    */

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

81   public String JavaDoc getCommandParameters()
82   {
83     return ConsoleTranslate.get("admin.command.transfer.dump.params"); //$NON-NLS-1$
84
}
85
86   /**
87    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
88    */

89   public String JavaDoc getCommandName()
90   {
91     return "transfer dump"; //$NON-NLS-1$
92
}
93
94   /**
95    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
96    */

97   public String JavaDoc getCommandDescription()
98   {
99     return ConsoleTranslate.get("admin.command.transfer.dump.description"); //$NON-NLS-1$
100
}
101
102 }
103
Popular Tags