changeset 3478:763789a9acca

Rename FeatureServletContextListener and move it out of the features package flys-client/trunk@5173 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Wed, 08 Aug 2012 13:04:07 +0000
parents 2c63994ceffb
children 40d02fbf414d
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/BaseServletContextListener.java flys-client/src/main/java/de/intevation/flys/client/server/features/FeatureServletContextListener.java flys-client/src/main/webapp/WEB-INF/web.xml
diffstat 4 files changed, 69 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Aug 08 12:56:25 2012 +0000
+++ b/flys-client/ChangeLog	Wed Aug 08 13:04:07 2012 +0000
@@ -1,3 +1,9 @@
+2012-08-08	Björn Ricks <bjoern.ricks@intevation.de>
+	  * src/main/java/de/intevation/flys/client/server/features/FeatureServletContextListener.java,
+	    src/main/java/de/intevation/flys/client/server/BaseServletContextListener.java,
+	    src/main/webapp/WEB-INF/web.xml:
+	    Rename and move FeatureServletContextListener.
+
 2012-08-08	Björn Ricks <bjoern.ricks@intevation.de>
 	  * src/main/java/de/intevation/flys/client/server/features/FeatureServletContextListener.java,
 	   src/main/webapp/WEB-INF/web.xml:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/BaseServletContextListener.java	Wed Aug 08 13:04:07 2012 +0000
@@ -0,0 +1,62 @@
+package de.intevation.flys.client.server;
+
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.client.server.LoggingConfigurator;
+import de.intevation.flys.client.server.features.Features;
+import de.intevation.flys.client.server.features.XMLFileFeatures;
+
+/**
+ * ServletContextListenter to initalize the Features globally for
+ * all Servlets
+ */
+public class BaseServletContextListener implements ServletContextListener {
+
+    public static final String LOG4J_PROPERTIES = "FLYS_CLIENT_LOG4J_PROPERIES";
+
+    public static final Logger logger = Logger.getLogger(BaseServletContextListener.class);
+
+    @Override
+    public void  contextInitialized(ServletContextEvent sce) {
+        ServletContext sc = sce.getServletContext();
+
+        this.initLogging(sc);
+
+        String filename = sc.getInitParameter("features-file");
+
+        logger.debug("Initializing ServletContext");
+        try {
+            XMLFileFeatures features = new XMLFileFeatures(sc.getRealPath(filename));
+            sc.setAttribute(Features.CONTEXT_ATTRIBUTE, features);
+        } catch(IOException e) {
+            logger.error(e);
+        }
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+        //DO NOTHING
+    }
+
+
+    private void initLogging(ServletContext sc) {
+        String log4jProperties = System.getenv(LOG4J_PROPERTIES);
+
+        if (log4jProperties == null || log4jProperties.length() == 0) {
+            String file = sc.getInitParameter("log4j-properties");
+
+            if (file != null && file.length() > 0) {
+                log4jProperties = sc.getRealPath(file);
+            }
+        }
+        System.out.println(log4jProperties);
+
+        LoggingConfigurator.init(log4jProperties);
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/server/features/FeatureServletContextListener.java	Wed Aug 08 12:56:25 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-package de.intevation.flys.client.server.features;
-
-import java.io.IOException;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.apache.log4j.Logger;
-
-import de.intevation.flys.client.server.LoggingConfigurator;
-
-/**
- * ServletContextListenter to initalize the Features globally for
- * all Servlets
- */
-public class FeatureServletContextListener implements ServletContextListener {
-
-    public static final String LOG4J_PROPERTIES = "FLYS_CLIENT_LOG4J_PROPERIES";
-
-    public static final Logger logger = Logger.getLogger(FeatureServletContextListener.class);
-
-    @Override
-    public void  contextInitialized(ServletContextEvent sce) {
-        ServletContext sc = sce.getServletContext();
-
-        this.initLogging(sc);
-
-        String filename = sc.getInitParameter("features-file");
-
-        logger.debug("Initializing ServletContext");
-        try {
-            XMLFileFeatures features = new XMLFileFeatures(sc.getRealPath(filename));
-            sc.setAttribute(Features.CONTEXT_ATTRIBUTE, features);
-        } catch(IOException e) {
-            logger.error(e);
-        }
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent sce) {
-        //DO NOTHING
-    }
-
-
-    private void initLogging(ServletContext sc) {
-        String log4jProperties = System.getenv(LOG4J_PROPERTIES);
-
-        if (log4jProperties == null || log4jProperties.length() == 0) {
-            String file = sc.getInitParameter("log4j-properties");
-
-            if (file != null && file.length() > 0) {
-                log4jProperties = sc.getRealPath(file);
-            }
-        }
-        System.out.println(log4jProperties);
-
-        LoggingConfigurator.init(log4jProperties);
-    }
-}
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Wed Aug 08 12:56:25 2012 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Wed Aug 08 13:04:07 2012 +0000
@@ -26,7 +26,7 @@
     </context-param>
 
     <listener>
-        <listener-class>de.intevation.flys.client.server.features.FeatureServletContextListener</listener-class>
+        <listener-class>de.intevation.flys.client.server.BaseServletContextListener</listener-class>
     </listener>
 
 

http://dive4elements.wald.intevation.org