portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r771541 - in /portals/applications/dbbrowser/trunk: dbbrowser-jar/ dbbrowser-war/ dbbrowser-war/src/main/java/ dbbrowser-war/src/main/webapp/WEB-INF/ dbbrowser-war/src/main/webapp/WEB-INF/classes/
Date Tue, 05 May 2009 03:32:01 GMT
Author: ate
Date: Tue May  5 03:32:00 2009
New Revision: 771541

URL: http://svn.apache.org/viewvc?rev=771541&view=rev
Log:
JS2-972: commons-logging unsuited for cross-context webapplication invocation usage - migrating
to slf4j
- adding a simple ServletContextListener for setting up relative log4j logging in the dbbrowser
war
- removing invalid (pluto specific) portlet.tld which wasn't used anyway
- removing jetspeed specific container servlet from web.xml (needs to be "infused" for each
container)
- cleaning up dependencies

Added:
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
  (with props)
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties
  (contents, props changed)
      - copied, changed from r771262, portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/log4j.properties
Removed:
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/log4j.properties
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/portlet.tld
Modified:
    portals/applications/dbbrowser/trunk/dbbrowser-jar/pom.xml
    portals/applications/dbbrowser/trunk/dbbrowser-war/pom.xml
    portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/web.xml

Modified: portals/applications/dbbrowser/trunk/dbbrowser-jar/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/dbbrowser/trunk/dbbrowser-jar/pom.xml?rev=771541&r1=771540&r2=771541&view=diff
==============================================================================
--- portals/applications/dbbrowser/trunk/dbbrowser-jar/pom.xml (original)
+++ portals/applications/dbbrowser/trunk/dbbrowser-jar/pom.xml Tue May  5 03:32:00 2009
@@ -38,6 +38,7 @@
 
   <properties>
     <portlet-api.version>2.0</portlet-api.version>
+    <org.apache.portals.bridges.common.version>1.0.4</org.apache.portals.bridges.common.version>
     <org.apache.portals.bridges.velocity.version>1.0.4</org.apache.portals.bridges.velocity.version>
     <slf4j.version>1.5.6</slf4j.version>
     <poi.version>3.0-FINAL</poi.version>
@@ -56,6 +57,18 @@
     </dependency>
     <dependency>
       <groupId>org.apache.portals.bridges</groupId>
+      <artifactId>portals-bridges-common</artifactId>
+      <version>${org.apache.portals.bridges.common.version}</version>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.portals.bridges</groupId>
       <artifactId>portals-bridges-velocity</artifactId>
       <version>${org.apache.portals.bridges.velocity.version}</version>
     </dependency>
@@ -63,6 +76,12 @@
       <groupId>org.apache.poi</groupId>
       <artifactId>poi</artifactId>
       <version>${poi.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>commons-dbcp</groupId>
@@ -80,17 +99,19 @@
       <artifactId>commons-digester</artifactId>
       <version>${commons-digester.version}</version>
       <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <version>${slf4j.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>${slf4j.version}</version>
-    </dependency>
+    <!-- needed as for instance digester uses commons-logging -->
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>

Modified: portals/applications/dbbrowser/trunk/dbbrowser-war/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/dbbrowser/trunk/dbbrowser-war/pom.xml?rev=771541&r1=771540&r2=771541&view=diff
==============================================================================
--- portals/applications/dbbrowser/trunk/dbbrowser-war/pom.xml (original)
+++ portals/applications/dbbrowser/trunk/dbbrowser-war/pom.xml Tue May  5 03:32:00 2009
@@ -34,45 +34,36 @@
   <name>Portals Database Browser application WAR</name>
 
   <properties>
-      <velocity.version>1.5</velocity.version>
-      <velocity-tools.version>1.3</velocity-tools.version>  
-      <slf4j.version>1.5.6</slf4j.version>
+    <javax.servlet.version>2.4</javax.servlet.version>
+    <org.apache.portals.bridges.common.version>1.0.4</org.apache.portals.bridges.common.version>
+    <slf4j.version>1.5.6</slf4j.version>
   </properties>
   <dependencies>
-    <!-- Runtime Dependencies -->
+  
     <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>apa-dbbrowser-jar</artifactId>
-      <version>${pom.version}</version>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>${javax.servlet.version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>${velocity.version}</version>
+      <groupId>org.apache.portals.bridges</groupId>
+      <artifactId>portals-bridges-common</artifactId>
+      <version>${org.apache.portals.bridges.common.version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>velocity-tools</groupId>
-      <artifactId>velocity-tools</artifactId>
-      <version>${velocity-tools.version}</version>
-      <scope>runtime</scope>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>apa-dbbrowser-jar</artifactId>
+      <version>${pom.version}</version>
     </dependency>
   <dependency>
     <groupId>org.slf4j</groupId>
-    <artifactId>slf4j-api</artifactId>
-    <version>${slf4j.version}</version>
-  </dependency>
-  <dependency>
-    <groupId>org.slf4j</groupId>
     <artifactId>slf4j-log4j12</artifactId>
     <version>${slf4j.version}</version>
   </dependency>
-  <dependency>
-    <groupId>org.slf4j</groupId>
-    <artifactId>jcl-over-slf4j</artifactId>
-    <version>${slf4j.version}</version>
-  </dependency>
   </dependencies>
   <build>
-        <finalName>apa-dbbrowser</finalName>
+     <finalName>apa-dbbrowser</finalName>
   </build>
 </project>
\ No newline at end of file

Added: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
URL: http://svn.apache.org/viewvc/portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java?rev=771541&view=auto
==============================================================================
--- portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
(added)
+++ portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
Tue May  5 03:32:00 2009
@@ -0,0 +1,57 @@
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Simple ServletContextListener which sets a system property to the current webapp root
folder.
+ * <p>
+ * The system property name to be used needs to be configured in web.xml with the <code>webAppRootKey</code>
init parameter.
+ * If not configured, it will use as default "webapp.root".
+ * <em>beware of using this default for multiple webapps at the same time: webcontainers
like Tomcat only use a single system
+ * properties space.
+ * </p>
+ * <p>
+ * The primary purpose of this listener is to allow using a webapp root folder relative path
for log4j logging.
+ * </p>
+ * @version $Id$
+ *
+ */
+public class WebAppRootListener implements ServletContextListener
+{
+    private static final String WEBAPP_ROOT_KEY = "webAppRootKey";
+    private static final String DEFAULT_WEBAPP_ROOT_PROPERTY_NAME = "webapp.root";
+    
+    public void contextInitialized(ServletContextEvent sce)
+    {
+        String webAppRootPropertyName = sce.getServletContext().getInitParameter(WEBAPP_ROOT_KEY);
+        if (webAppRootPropertyName == null)
+        {
+            webAppRootPropertyName = DEFAULT_WEBAPP_ROOT_PROPERTY_NAME; 
+        }
+        String webAppRoot = sce.getServletContext().getRealPath("/");
+        if (webAppRoot == null)
+        {
+            throw new IllegalStateException("Cannot use this WebAppRootListener in a non-expanded
webapplication");
+        }
+        System.setProperty(webAppRootPropertyName, webAppRoot);
+    }
+    
+    public void contextDestroyed(ServletContextEvent sce)
+    {
+    }
+}

Propchange: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/java/WebAppRootListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties
(from r771262, portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/log4j.properties)
URL: http://svn.apache.org/viewvc/portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties?p2=portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties&p1=portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/log4j.properties&r1=771262&r2=771541&rev=771541&view=diff
==============================================================================
--- portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/log4j.properties
(original)
+++ portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties
Tue May  5 03:32:00 2009
@@ -44,17 +44,17 @@
 #
 # pa.log
 #
-log4j.appender.pa = org.apache.log4j.FileAppender
-log4j.appender.pa.file = ${webApplicationRoot}/logs/pa.log
-log4j.appender.pa.layout = org.apache.log4j.PatternLayout
-log4j.appender.pa.layout.conversionPattern = %d [%t] %-5p %c - %m%n
-log4j.appender.pa.append = false
-
-#
-# velocity.log
-#
-log4j.appender.velocity = org.apache.log4j.FileAppender
-log4j.appender.velocity.file = ${webApplicationRoot}/logs/velocity.log
-log4j.appender.velocity.layout = org.apache.log4j.PatternLayout
-log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n
-log4j.appender.velocity.append = false
+log4j.appender.pa = org.apache.log4j.FileAppender
+log4j.appender.pa.file = ${org.apache.portals.applications.dbbrowser.webappRoot}/logs/pa.log
+log4j.appender.pa.layout = org.apache.log4j.PatternLayout
+log4j.appender.pa.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.pa.append = false
+
+#
+# velocity.log
+#
+log4j.appender.velocity = org.apache.log4j.FileAppender
+log4j.appender.velocity.file = ${org.apache.portals.applications.dbbrowser.webappRoot}/logs/velocity.log
+log4j.appender.velocity.layout = org.apache.log4j.PatternLayout
+log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.velocity.append = false

Propchange: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/classes/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/web.xml?rev=771541&r1=771540&r2=771541&view=diff
==============================================================================
--- portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/web.xml (original)
+++ portals/applications/dbbrowser/trunk/dbbrowser-war/src/main/webapp/WEB-INF/web.xml Tue
May  5 03:32:00 2009
@@ -13,24 +13,20 @@
   KIND, either express or implied. See the License for the specific language
   governing permissions and limitations under the License.
 -->
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-                         "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    
   <display-name>Portals Database Browser application</display-name>
   <description>Apache Portals Applications: db-browser portlet application</description>
 
-  <servlet>
-    <servlet-name>JetspeedContainer</servlet-name>
-    <display-name>Jetspeed Container</display-name>
-    <description>MVC Servlet for Jetspeed Portlet Applications</description>
-    <servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
-    <init-param>
-      <param-name>contextName</param-name>
-      <param-value>apa-dbbrowser</param-value>
-    </init-param>
-    <load-on-startup>100</load-on-startup>
-  </servlet>
-
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>org.apache.portals.applications.dbbrowser.webappRoot</param-value>
+    </context-param>
+    <listener>
+        <listener-class>WebAppRootListener</listener-class>
+    </listener>
+    
   <!-- Define Velocity Servlet -->
   <servlet>
     <servlet-name>velocity</servlet-name>
@@ -51,9 +47,5 @@
     <servlet-name>velocity</servlet-name>
     <url-pattern>*.vm</url-pattern>
   </servlet-mapping>
-
-  <servlet-mapping>
-    <servlet-name>JetspeedContainer</servlet-name>
-    <url-pattern>/container/*</url-pattern>
-  </servlet-mapping>
+  
 </web-app>



Mime
View raw message