01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2005 Emic Networks.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
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: */package org.continuent.sequoia.console.text.commands.dbadmin;
21:
22: import org.continuent.sequoia.common.i18n.ConsoleTranslate;
23: import org.continuent.sequoia.console.text.ConsoleException;
24: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
25:
26: /**
27: * This class defines a GetXml command that gather an XML dump of the virtual
28: * database.
29: *
30: * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet
31: * </a>
32: * @version 1.0
33: */
34: public class GetXml extends AbstractAdminCommand {
35:
36: /**
37: * Creates a new <code>GetXml.java</code> object
38: *
39: * @param module the command is attached to
40: */
41: public GetXml(VirtualDatabaseAdmin module) {
42: super (module);
43: }
44:
45: /**
46: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
47: */
48: public void parse(String commandText) throws Exception {
49: try {
50: String vdbXml = jmxClient.getVirtualDatabaseProxy(dbName,
51: user, password).getXml();
52: console.println(vdbXml);
53: } catch (Exception e) {
54: throw new ConsoleException(ConsoleTranslate
55: .get("controller.command.get.xml.error")); //$NON-NLS-1$
56: }
57:
58: }
59:
60: /**
61: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
62: */
63: public String getCommandName() {
64: return "show virtualdatabase config"; //$NON-NLS-1$
65: }
66:
67: /**
68: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
69: */
70: public String getCommandDescription() {
71: return ConsoleTranslate
72: .get("admin.command.get.xml.description"); //$NON-NLS-1$
73: }
74:
75: }
|