1 64 package com.jcorporate.expresso.kernel; 65 66 import com.jcorporate.expresso.core.misc.ConfigManager; 67 import com.jcorporate.expresso.kernel.exception.ConfigurationException; 68 import org.apache.log4j.Logger; 69 70 import javax.servlet.ServletConfig ; 71 import javax.servlet.ServletException ; 72 import javax.servlet.http.HttpServlet ; 73 74 81 public class RuntimeInitServlet extends HttpServlet { 82 83 86 private String loggingDirectory; 87 88 91 private String expressoServicesConfig; 92 93 96 private String loggingConfig; 97 98 101 private Logger log; 102 103 106 private RootContainerInterface root; 107 108 public RuntimeInitServlet() { 109 } 110 111 118 public void init(ServletConfig sc) throws javax.servlet.ServletException { 119 super.init(sc); 120 121 try { 122 long startTime = System.currentTimeMillis(); 123 loggingDirectory = sc.getInitParameter(ConfigManager.LOG_DIR_PARAM_NAME); 124 expressoServicesConfig = sc.getInitParameter("expressoConfig"); 125 loggingConfig = sc.getInitParameter("loggingConfig"); 126 root = SystemFactory.buildExpressoComponentSystem(expressoServicesConfig, 127 loggingConfig, loggingDirectory); 128 129 log = Logger.getLogger(RuntimeInitServlet.class); 130 long endTime = System.currentTimeMillis(); 131 log.info("Completed initialization in " + (endTime - startTime) / 1000 + " seconds"); 132 } catch (ConfigurationException ex) { 133 this.log("Error loading Expresso Configuration", ex); 134 throw new ServletException ("Error loading Expresso Configuration", ex); 135 } 136 } 137 138 141 public void destroy() { 142 if (log != null) { 143 log.info("Destroying Global Runtime Container"); 144 } 145 146 if (root != null) { 147 root.destroy(); 148 } 149 } 150 151 152 } | Popular Tags |