01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2006 Continuent.
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): Jeff Mesnil.
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.common.jmx.mbeans.BackendTaskQueuesControlMBean;
24: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
25:
26: /**
27: * This class defines the command used to dump the backend task queues.
28: */
29: public class DumpQueues extends AbstractAdminCommand {
30:
31: /**
32: * Creates a new <code>DumpQueues</code> object
33: *
34: * @param module the commands is attached to
35: */
36: public DumpQueues(VirtualDatabaseAdmin module) {
37: super (module);
38: }
39:
40: /**
41: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
42: */
43: public void parse(String commandText) throws Exception {
44: if (commandText.trim().length() == 0) {
45: console.printError(getUsage());
46: return;
47: }
48:
49: String backend = commandText.trim();
50: BackendTaskQueuesControlMBean taskQueues = null;
51: try {
52: taskQueues = jmxClient.getBackendTaskQueues(dbName,
53: backend, user, password);
54: } catch (Exception e) {
55: console.printInfo(ConsoleTranslate
56: .get("DumpQueues.noQueues")); //$NON-NLS-1$
57: }
58: console.print(taskQueues.dump());
59: }
60:
61: /**
62: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
63: */
64: public String getCommandName() {
65:
66: return "dump queues"; //$NON-NLS-1$
67: }
68:
69: /**
70: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
71: */
72: public String getCommandParameters() {
73: return ConsoleTranslate.get("DumpQueues.params"); //$NON-NLS-1$
74: }
75:
76: /**
77: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
78: */
79: public String getCommandDescription() {
80: return ConsoleTranslate.get("DumpQueues.description"); //$NON-NLS-1$
81: }
82: }
|