cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r525734 - in /cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader: ./ src/ src/changes/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cocoon/ src/main/java/org/apache/cocoon/tools/ src/m...
Date Thu, 05 Apr 2007 07:16:16 GMT
Author: reinhard
Date: Thu Apr  5 00:16:13 2007
New Revision: 525734

URL: http://svn.apache.org/viewvc?view=rev&rev=525734
Log:
   This module provides a single class "SpringReloader" that is used by the 
   ReloadingSpringFilter to reload a Spring web application context. 
   In order not to run into NoClassDefFoundErrors, is is important that this 
   class is loaded through the reloading classloader.

Added:
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/   (with props)
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml   (with props)
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml   (with
props)
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
  (with props)

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr  5 00:16:13 2007
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml?view=auto&rev=525734
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml (added)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml Thu Apr  5 00:16:13 2007
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!--+
+    | @version $Id$
+    +-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>jar</packaging>
+
+  <parent>
+    <artifactId>cocoon-tools-modules</artifactId>
+    <groupId>org.apache.cocoon</groupId>
+    <version>4-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>    
+  </parent>
+  <artifactId>cocoon-rcl-spring-reloader</artifactId>
+  <version>1.0.0-M1-SNAPSHOT</version>
+  <name>Cocoon Reloading ClassLoader - Spring reloader</name>
+  <description>
+   This module provides a single class "SpringReloader" that is used by the 
+   ReloadingSpringFilter to reload a Spring web application context. 
+   In order not to run into NoClassDefFoundErrors, is is important that this 
+   class is loaded through the reloading classloader.
+  </description>
+
+  <!--+
+      | Be careful with any dependency that you add here. If its scope is NOT set
+      | to provided or test, it will be added to the Classloader of each application
+      | that is generated by the Cocoon Reloading Classloader Maven 2 plugin.
+      +-->
+  <dependencies>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>logkit</artifactId>
+          <groupId>logkit</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>avalon-framework</artifactId>
+          <groupId>avalon-framework</groupId>
+        </exclusion>
+      </exclusions>
+      <scope>provided</scope>      
+    </dependency>     
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>    
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>2.0.3</version>
+      <scope>provided</scope>
+    </dependency>   
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>2.0.3</version>
+      <scope>provided</scope>
+    </dependency>    
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>2.0.3</version>
+      <scope>provided</scope>
+    </dependency>   
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aop</artifactId>
+      <version>2.0.3</version>
+      <scope>provided</scope>
+    </dependency>      
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+      <version>2.0.3</version>
+      <scope>provided</scope>
+    </dependency>             
+    <!--  test dependencies  -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies> 
+  
+  
+</project>

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml?view=auto&rev=525734
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml (added)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml Thu Apr
 5 00:16:13 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!--+
+    | Find usage details at http://maven.apache.org/plugins/maven-changes-plugin/usage.html
+    |
+    | @version $Id$
+    +-->
+    <document>
+      <body>
+        <release version="1.0.0-M1" date="2007-??-??" description="unreleased">   

+          <action dev="reinhard" type="add">
+            Initial creation.
+          </action>      
+        </release>
+      </body>
+    </document>
+    
\ No newline at end of file

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java?view=auto&rev=525734
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
(added)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
Thu Apr  5 00:16:13 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.tools.rcl.springreloader;
+
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.ServletContextFactoryBean;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+/**
+ * <p>
+ * This class is used by the ReloadingSpringFilter to reload a Spring
+ * web application context. In order not to run into {@link NoClassDefFoundError}s,
+ * is is important that this class is loaded through the reloading classloader.
+ * </p>
+ * 
+ * @version $Id$
+ */
+public class SpringReloader {
+    
+    private final Log log = LogFactory.getLog(SpringReloader.class);      
+
+    public synchronized void reload(ServletContext servletContext) {
+        ContextLoader springContextLoader = new ContextLoader();
+
+        // close old Spring application context
+        XmlWebApplicationContext oldAc = (XmlWebApplicationContext) 
+                WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+        if(log.isDebugEnabled()) {                     
+            this.log.debug("Removing old application context: " + oldAc);
+        }
+        oldAc.close();        
+        servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+
+        // create the new Spring application context
+        ServletContextFactoryBean b = new ServletContextFactoryBean();
+        b.setServletContext(servletContext);
+        XmlWebApplicationContext xac = (XmlWebApplicationContext) springContextLoader.
+                initWebApplicationContext(servletContext);
+        if(log.isDebugEnabled()) {
+            log.debug("Reloading Spring application context: " + xac);
+        }
+    }
+    
+}

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-spring-reloader/src/main/java/org/apache/cocoon/tools/rcl/springreloader/SpringReloader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message