KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * Sequoia: Database clustering technology.
3  * Contact: sequoia@continuent.org
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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  */

20
21 package org.continuent.sequoia.console.text.commands.dbadmin;
22
23 import org.continuent.sequoia.common.i18n.ConsoleTranslate;
24 import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean;
25 import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
26
27 /**
28  * This class defines a ShowControllers
29  *
30  * @author <a HREF="mailto:nick@torchbox.com">Nick Burch </a>
31  * @version 1.0
32  */

33 public class ShowControllers extends AbstractAdminCommand
34 {
35
36   /**
37    * Creates a new <code>ShowControllers.java</code> object
38    *
39    * @param module the commands is attached to
40    */

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

49   public void parse(String JavaDoc commandText) throws Exception JavaDoc
50   {
51     VirtualDatabaseMBean db = jmxClient.getVirtualDatabaseProxy(dbName, user,
52         password);
53     String JavaDoc[] controllers = db.viewControllerList();
54     console.println(ConsoleTranslate.get(
55         "admin.command.show.controllers.number", new Object JavaDoc[]{dbName, //$NON-NLS-1$
56
new Integer JavaDoc(controllers.length)}));
57     for (int i = 0; i < controllers.length; i++)
58     {
59       console.println("\t" + controllers[i]); //$NON-NLS-1$
60
}
61   }
62
63   /**
64    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
65    */

66   public String JavaDoc getCommandName()
67   {
68     return "show controllers"; //$NON-NLS-1$
69
}
70
71   /**
72    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
73    */

74   public String JavaDoc getCommandDescription()
75   {
76     return ConsoleTranslate.get("admin.command.show.controllers.description"); //$NON-NLS-1$
77
}
78 }
Popular Tags