cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r490332 - in /cocoon/trunk/core: cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
Date Tue, 26 Dec 2006 17:09:16 GMT
Author: cziegeler
Date: Tue Dec 26 09:09:15 2006
New Revision: 490332

URL: http://svn.apache.org/viewvc?view=rev&rev=490332
Log:
Add new interface for clean up of sitemap components (this allows to use Spring's factory
mechanisms to create pipeline components)

Added:
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
  (with props)
Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java?view=diff&rev=490332&r1=490331&r2=490332
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
Tue Dec 26 09:09:15 2006
@@ -41,6 +41,7 @@
 import org.apache.cocoon.generation.Generator;
 import org.apache.cocoon.reading.Reader;
 import org.apache.cocoon.serialization.Serializer;
+import org.apache.cocoon.sitemap.DisposableSitemapComponent;
 import org.apache.cocoon.sitemap.SitemapErrorHandler;
 import org.apache.cocoon.sitemap.SitemapModelComponent;
 import org.apache.cocoon.transformation.Transformer;
@@ -126,13 +127,13 @@
     /** The current SourceResolver */
     protected SourceResolver sourceResolver;
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
-    public void service (ServiceManager manager)
+    public void service (ServiceManager aManager)
     throws ServiceException {
-        this.manager = manager;
-        this.newManager = manager;
+        this.manager = aManager;
+        this.newManager = aManager;
     }
 
     /**
@@ -659,18 +660,27 @@
         return true;
     }
 
+    /**
+     * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
+     */
     public void recycle() {
         this.prepared = false;
 
         // Release reader.
         if (this.reader != null) {
+            if ( this.reader instanceof DisposableSitemapComponent ) {
+                ((DisposableSitemapComponent)this.reader).dispose();
+            }
             this.newManager.release(this.reader);
             this.reader = null;
             this.readerParam = null;
         }
 
+        // Release generator.
         if (this.generator != null) {
-            // Release generator.
+            if ( this.generator instanceof DisposableSitemapComponent ) {
+                ((DisposableSitemapComponent)this.generator).dispose();
+            }
             this.newManager.release(this.generator);
             this.generator = null;
             this.generatorParam = null;
@@ -679,6 +689,9 @@
         // Release transformers
         int size = this.transformers.size();
         for (int i = 0; i < size; i++) {
+            if ( this.transformers.get(i) instanceof DisposableSitemapComponent ) {
+                ((DisposableSitemapComponent)this.transformers.get(i)).dispose();
+            }
             this.newManager.release(this.transformers.get(i));
         }
         this.transformers.clear();
@@ -687,6 +700,9 @@
 
         // Release serializer
         if (this.serializer != null) {
+            if ( this.serializer instanceof DisposableSitemapComponent ) {
+                ((DisposableSitemapComponent)this.serializer).dispose();
+            }
             this.newManager.release(this.serializer);
             this.serializerParam = null;
         }

Added: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java?view=auto&rev=490332
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
(added)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
Tue Dec 26 09:09:15 2006
@@ -0,0 +1,37 @@
+/*
+ * 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.sitemap;
+
+
+/**
+ * If a sitemap component needs to be cleaned up after it is used, it should
+ * implement this additional interface. The pipeline implementation calls
+ * the dispose method after the pipeline has been processed or when an error
+ * during processing occured.
+ *
+ * Please note that you should only implement this interface for Spring managed
+ * beans. In the case of Avalon components, use the Recyclable interface instead!
+ *
+ * @version $Id$
+ */
+public interface DisposableSitemapComponent {
+
+    /**
+     * Clean up the component.
+     */
+    void dispose();
+}

Propchange: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-api/src/main/java/org/apache/cocoon/sitemap/DisposableSitemapComponent.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message