01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2002-2004 French National Institute For Research In Computer
04: * Science And Control (INRIA).
05: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
06: * Contact: sequoia@continuent.org
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: * Initial developer(s): Nicolas Modrzyk.
21: * Contributor(s): Mathieu Peltier, Emmanuel Cecchet.
22: */package org.continuent.sequoia.console.text.commands.controller;
23:
24: import java.io.IOException;
25:
26: import org.continuent.sequoia.common.i18n.ConsoleTranslate;
27: import org.continuent.sequoia.console.text.ConsoleException;
28: import org.continuent.sequoia.console.text.commands.ConsoleCommand;
29: import org.continuent.sequoia.console.text.module.AbstractConsoleModule;
30:
31: /**
32: * This class defines a Shutdown
33: *
34: * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
35: * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
36: * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet
37: * </a>
38: * @version 1.0
39: */
40: public class Shutdown extends ConsoleCommand {
41:
42: /**
43: * Creates a new <code>Shutdown.java</code> object
44: *
45: * @param module the command is attached to
46: */
47: public Shutdown(AbstractConsoleModule module) {
48: super (module);
49: }
50:
51: /**
52: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
53: */
54: public void parse(String commandText) throws IOException,
55: ConsoleException {
56: checkJmxConnectionToController();
57: try {
58: jmxClient.getControllerProxy().shutdown();
59:
60: console.printInfo("Shutdown was complete");
61: } catch (Exception e) {
62: console.printError("Could not shutdown the controller", e);
63: }
64: }
65:
66: /**
67: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
68: */
69: public String getCommandName() {
70: return "shutdown"; //$NON-NLS-1$
71: }
72:
73: /**
74: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
75: */
76: public String getCommandDescription() {
77: return ConsoleTranslate.get("controller.command.shutdown"); //$NON-NLS-1$
78: }
79: }
|