01: /**
02: * Sequoia: Database clustering technology.
03: * Contact: sequoia@continuent.org
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * Initial developer(s): Nick Burch
18: * Contributor(s): ______________________.
19: */package org.continuent.sequoia.console.text.commands.dbadmin;
20:
21: import org.continuent.sequoia.common.i18n.ConsoleTranslate;
22: import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean;
23: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
24:
25: /**
26: * This class defines a ShowControllers
27: *
28: * @author <a href="mailto:nick@torchbox.com">Nick Burch </a>
29: * @version 1.0
30: */
31: public class ShowControllers extends AbstractAdminCommand {
32:
33: /**
34: * Creates a new <code>ShowControllers.java</code> object
35: *
36: * @param module the commands is attached to
37: */
38: public ShowControllers(VirtualDatabaseAdmin module) {
39: super (module);
40: }
41:
42: /**
43: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(String)
44: */
45: public void parse(String commandText) throws Exception {
46: VirtualDatabaseMBean db = jmxClient.getVirtualDatabaseProxy(
47: dbName, user, password);
48: String[] controllers = db.getControllers();
49: console
50: .println(ConsoleTranslate
51: .get(
52: "admin.command.show.controllers.number", new Object[] { dbName, //$NON-NLS-1$
53: new Integer(controllers.length) }));
54: for (int i = 0; i < controllers.length; i++) {
55: console.println("\t" + controllers[i]); //$NON-NLS-1$
56: }
57: }
58:
59: /**
60: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
61: */
62: public String getCommandName() {
63: return "show controllers"; //$NON-NLS-1$
64: }
65:
66: /**
67: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
68: */
69: public String getCommandDescription() {
70: return ConsoleTranslate
71: .get("admin.command.show.controllers.description"); //$NON-NLS-1$
72: }
73: }
|