KickJava   Java API By Example, From Geeks To Geeks.

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


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): Emmanuel Cecchet
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.ConsoleException;
26 import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
27
28 /**
29  * This class defines a GetXml command that gather an XML dump of the virtual
30  * database.
31  *
32  * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet
33  * </a>
34  * @version 1.0
35  */

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

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

52   public void parse(String JavaDoc commandText) throws Exception JavaDoc
53   {
54     try
55     {
56       String JavaDoc vdbXml = jmxClient.getVirtualDatabaseProxy(dbName, user, password).getXml();
57       console.println(vdbXml);
58     }
59     catch (Exception JavaDoc e)
60     {
61       throw new ConsoleException(ConsoleTranslate
62           .get("controller.command.get.xml.error")); //$NON-NLS-1$
63
}
64
65   }
66
67   /**
68    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
69    */

70   public String JavaDoc getCommandName()
71   {
72     return "show virtualdatabase config"; //$NON-NLS-1$
73
}
74
75   /**
76    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
77    */

78   public String JavaDoc getCommandDescription()
79   {
80     return ConsoleTranslate.get("admin.command.get.xml.description"); //$NON-NLS-1$
81
}
82
83 }
Popular Tags