1 24 25 package org.objectweb.cjdbc.console.text.commands.controller; 26 27 import java.io.IOException ; 28 29 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 30 import org.objectweb.cjdbc.common.util.Constants; 31 import org.objectweb.cjdbc.console.text.ConsoleException; 32 import org.objectweb.cjdbc.console.text.commands.ConsoleCommand; 33 import org.objectweb.cjdbc.console.text.module.AbstractConsoleModule; 34 35 44 public class Shutdown extends ConsoleCommand 45 { 46 47 52 public Shutdown(AbstractConsoleModule module) 53 { 54 super(module); 55 } 56 57 60 public void parse(String commandText) throws IOException , ConsoleException 61 { 62 try 63 { 64 if (commandText.indexOf(String.valueOf(Constants.SHUTDOWN_SAFE)) != -1) 65 jmxClient.getControllerProxy().shutdown(Constants.SHUTDOWN_SAFE); 66 else if (commandText.indexOf(String.valueOf(Constants.SHUTDOWN_WAIT)) != -1) 67 jmxClient.getControllerProxy().shutdown(Constants.SHUTDOWN_WAIT); 68 else if (commandText.indexOf(String.valueOf(Constants.SHUTDOWN_FORCE)) != -1) 69 jmxClient.getControllerProxy().shutdown(Constants.SHUTDOWN_FORCE); 70 else 71 jmxClient.getControllerProxy().shutdown(Constants.SHUTDOWN_SAFE); 73 74 console.println("Shutdown was complete"); 75 } 76 catch (Exception e) 77 { 78 if (jmxClient.isValidConnection()) 79 console.printError("Could not shutdown the controller:" 80 + e.getMessage()); 81 else 82 console.printInfo("Controller has shutdown"); 83 } 84 } 85 86 89 public String getCommandName() 90 { 91 return "shutdown"; 92 } 93 94 97 public String getCommandParameters() 98 { 99 return "[mode]"; 100 } 101 102 105 public String getCommandDescription() 106 { 107 return ConsoleTranslate.get("controller.command.shutdown"); 108 } 109 } | Popular Tags |