01: package com.technoetic.xplanner.actions;
02:
03: import com.technoetic.xplanner.db.hibernate.HibernateHelper;
04: import org.apache.log4j.Logger;
05: import org.apache.struts.action.ActionServlet;
06: import org.apache.struts.action.PlugIn;
07: import org.apache.struts.config.ModuleConfig;
08:
09: import javax.servlet.ServletException;
10:
11: public class XPlannerInitializationPlugin implements PlugIn {
12: private static Logger log = Logger
13: .getLogger(XPlannerInitializationPlugin.class);
14: private static boolean isInitialized = false;
15:
16: public void init(ActionServlet actionservlet,
17: ModuleConfig moduleConfig) throws ServletException {
18: if (!isInitialized) {
19: log.info("initialization started");
20: try {
21: HibernateHelper.initializeHibernate();
22: } catch (Throwable e) {
23: throw new ServletException(e);
24: }
25: log.info("initialization completed");
26: isInitialized = true;
27: }
28: }
29:
30: public void destroy() {
31: }
32: }
|