cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r326672 - in /cocoon/blocks/portal/trunk: ./ java/org/apache/cocoon/portal/coplet/ java/org/apache/cocoon/portal/coplet/adapter/impl/ java/org/apache/cocoon/portal/event/impl/
Date Wed, 19 Oct 2005 20:11:25 GMT
Author: cziegeler
Date: Wed Oct 19 13:11:10 2005
New Revision: 326672

URL: http://svn.apache.org/viewcvs?rev=326672&view=rev
Log:
Keep track of changed coplets

Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
    cocoon/blocks/portal/trunk/status.xml

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java?rev=326672&r1=326671&r2=326672&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceDataFeatures.java
Wed Oct 19 13:11:10 2005
@@ -15,8 +15,12 @@
  */
 package org.apache.cocoon.portal.coplet;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 
+import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.CopletInstanceEvent;
 import org.apache.cocoon.portal.event.coplet.CopletInstanceSizingEvent;
 import org.apache.cocoon.portal.event.impl.CopletJXPathEvent;
@@ -33,6 +37,8 @@
  */
 public final class CopletInstanceDataFeatures {
 
+    protected static final String CHANGED_COPLETS_ATTRIBUTE_NAME = CopletInstanceDataFeatures.class.getName()
+ "/ChangedCoplets";
+
     /**
      * Tests if this is a sizing event for a coplet instance.
      */
@@ -68,5 +74,25 @@
             }
         }
         return null;
-     }
+    }
+
+    public static List getChangedCopletInstanceDataObjects(PortalService service) {
+        List list = (List)service.getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
+        if ( list == null ) {
+            return Collections.EMPTY_LIST;
+        }
+        return list;
+    }
+
+    public static void addChangedCopletInstanceData(PortalService service,
+                                                    CopletInstanceData cid) {
+        List list = (List)service.getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
+        if ( list == null ) {
+            list = new ArrayList();
+        }
+        if ( !list.contains(cid) ) {
+            list.add(cid);
+        }
+        service.setTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME, list);
+    }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java?rev=326672&r1=326671&r2=326672&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/CachingURICopletAdapter.java
Wed Oct 19 13:11:10 2005
@@ -32,6 +32,7 @@
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.CopletInstanceDataFeatures;
 import org.apache.cocoon.portal.event.CopletInstanceEvent;
+import org.apache.cocoon.portal.event.Receiver;
 import org.apache.cocoon.util.NetUtils;
 import org.apache.excalibur.source.SourceValidity;
 import org.xml.sax.ContentHandler;
@@ -49,7 +50,8 @@
  * @version $Id$
  */
 public class CachingURICopletAdapter
-    extends URICopletAdapter {
+    extends URICopletAdapter
+    implements Receiver {
 
     /** The configuration name for enabling/disabling the cache. */
     public static final String CONFIGURATION_ENABLE_CACHING = "cache-enabled";
@@ -179,7 +181,6 @@
             this.getLogger().info("CopletInstanceEvent " + e + " caught by CachingURICopletAdapter");
         }
         this.handleCopletInstanceEvent(e);
-        super.inform(e, service);
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java?rev=326672&r1=326671&r2=326672&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
Wed Oct 19 13:11:10 2005
@@ -16,7 +16,6 @@
 package org.apache.cocoon.portal.coplet.adapter.impl;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -32,8 +31,7 @@
 import org.apache.cocoon.portal.Constants;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
-import org.apache.cocoon.portal.event.CopletInstanceEvent;
-import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.coplet.CopletInstanceDataFeatures;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.xml.sax.ContentHandler;
@@ -45,8 +43,7 @@
  * @version $Id$
  */
 public class URICopletAdapter 
-    extends AbstractCopletAdapter
-    implements Receiver {
+    extends AbstractCopletAdapter {
 
     /** The source resolver */
     protected SourceResolver resolver;
@@ -86,8 +83,8 @@
                 String sourceUri = uri;
 
                 if ( handlePars.booleanValue() ) {
-                    List list = (List) portalService.getTemporaryAttribute(URICopletAdapter.class.getName());
-                    if ( list != null && list.contains( coplet )) {
+                    List list = CopletInstanceDataFeatures.getChangedCopletInstanceDataObjects(this.portalService);
+                    if ( list.contains( coplet )) {
                         // add parameters
                         if ( uri.startsWith("cocoon:raw:") ) {
                             sourceUri = "cocoon:" + uri.substring(11); 
@@ -130,20 +127,6 @@
             this.resolver = null;
         }
         super.dispose();
-    }
-
-    /**
-     * @see Receiver
-     */
-    public void inform(CopletInstanceEvent event, PortalService service) {
-        List list = (List)service.getTemporaryAttribute(URICopletAdapter.class.getName());
-        if ( list == null ) {
-            list = new ArrayList();
-        }
-        if ( !list.contains(event.getTarget()) ) {
-            list.add(event.getTarget());
-        }
-        service.setTemporaryAttribute(URICopletAdapter.class.getName(), list);
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java?rev=326672&r1=326671&r2=326672&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
Wed Oct 19 13:11:10 2005
@@ -24,6 +24,7 @@
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.CopletInstanceDataFeatures;
 import org.apache.cocoon.portal.event.CopletDataEvent;
+import org.apache.cocoon.portal.event.CopletInstanceEvent;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.Receiver;
@@ -42,6 +43,13 @@
 
     public InternalEventReceiver() {
         // nothing to do 
+    }
+
+    /**
+     * @see Receiver
+     */
+    public void inform(CopletInstanceEvent event, PortalService service) {
+        CopletInstanceDataFeatures.addChangedCopletInstanceData(service, (CopletInstanceData)event.getTarget());
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/status.xml?rev=326672&r1=326671&r2=326672&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/status.xml (original)
+++ cocoon/blocks/portal/trunk/status.xml Wed Oct 19 13:11:10 2005
@@ -66,6 +66,10 @@
  <changes>
   <release version="@version@" date="@date@">
     <action dev="CZ" type="add">
+      Add CopletInstanceDataFeatures and CopletDataFeatures utility classes
+      to query optional features of coplets and to track changed coplets.
+    </action>
+    <action dev="CZ" type="add">
       Refactor url creation for events (NOT FINISHED YET).
     </action>
     <action dev="CZ" type="add">



Mime
View raw message