KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > console > text > commands > controller > Shutdown


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * 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  */

23
24 package org.continuent.sequoia.console.text.commands.controller;
25
26 import java.io.IOException JavaDoc;
27
28 import org.continuent.sequoia.common.i18n.ConsoleTranslate;
29 import org.continuent.sequoia.console.text.ConsoleException;
30 import org.continuent.sequoia.console.text.commands.ConsoleCommand;
31 import org.continuent.sequoia.console.text.module.AbstractConsoleModule;
32
33 /**
34  * This class defines a Shutdown
35  *
36  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
37  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
38  * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet
39  * </a>
40  * @version 1.0
41  */

42 public class Shutdown extends ConsoleCommand
43 {
44
45   /**
46    * Creates a new <code>Shutdown.java</code> object
47    *
48    * @param module the command is attached to
49    */

50   public Shutdown(AbstractConsoleModule module)
51   {
52     super(module);
53   }
54
55   /**
56    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
57    */

58   public void parse(String JavaDoc commandText) throws IOException JavaDoc, ConsoleException
59   {
60     checkJmxConnectionToController();
61     try
62     {
63       jmxClient.getControllerProxy().shutdown();
64
65       console.printInfo("Shutdown was complete");
66     }
67     catch (Exception JavaDoc e)
68     {
69       console.printError("Could not shutdown the controller", e);
70     }
71   }
72
73   /**
74    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
75    */

76   public String JavaDoc getCommandName()
77   {
78     return "shutdown"; //$NON-NLS-1$
79
}
80
81   /**
82    * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
83    */

84   public String JavaDoc getCommandDescription()
85   {
86     return ConsoleTranslate.get("controller.command.shutdown"); //$NON-NLS-1$
87
}
88 }
Popular Tags