1 3 27 28 30 package de.qfs.apps.qflog.command; 31 32 34 import java.io.FileOutputStream ; 35 import java.rmi.Naming ; 36 37 import de.qfs.lib.command.Command; 38 import de.qfs.lib.command.CommandException; 39 import de.qfs.lib.command.Invokable; 40 import de.qfs.lib.config.Configuration; 41 import de.qfs.lib.log.Log; 42 import de.qfs.lib.log.Logger; 43 import de.qfs.lib.logrmi.RemoteLogFilter; 44 45 import de.qfs.apps.qflog.App; 46 47 49 56 public class CommandFileExit extends Command 57 implements Invokable 58 { 59 61 64 private final static Logger logger = new Logger (CommandFileExit.class); 65 66 67 69 71 76 public CommandFileExit (Object source) 77 { 78 super (source); 79 } 80 81 83 85 92 public Object invoke() 93 throws CommandException 94 { 95 if (logger.level >= Log.MTD) { 96 logger.log(Log.MTD, "invoke()", ""); 97 } 98 99 102 try { 103 FileOutputStream fos = 105 new FileOutputStream (App.instance().getConfigFile()); 106 Configuration.instance().save(fos); 108 fos.close(); 110 if (logger.level >= Log.MSG) { 111 logger.log(Log.MSG, "invoke()", 112 "Configuration saved"); 113 } 114 Naming.unbind ("//"+ App.instance().getServerHost() + 116 "/" + App.instance().getServerName()); 117 if (logger.level >= Log.MSG) { 118 logger.log(Log.MSG, "main(String[])", 119 "TestServer unbound"); 120 } 121 } catch (Exception ex) { 122 if (logger.level >= Log.ERR) { 123 logger.log("invoke()", ex); 124 } 125 } 126 Log.setQueueing(false); 127 RemoteLogFilter.stopLogging(); 128 System.exit(0); 129 130 return null; 132 } 133 134 } 136 | Popular Tags |