cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r680697 - in /cocoon/trunk/blocks/cocoon-eventcache: cocoon-eventcache-impl/ cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/ cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/ cocoon-eventcache-impl/src/main...
Date Tue, 29 Jul 2008 13:54:15 GMT
Author: reinhard
Date: Tue Jul 29 06:54:14 2008
New Revision: 680697

URL: http://svn.apache.org/viewvc?rev=680697&view=rev
Log:
COCOON-2223

Apply Lukas' patch that 

. migrates eventcache from Avalon to Spring
. adds some pipeline for integration tests

Added:
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
  (with props)
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
  (with props)
Removed:
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf
Modified:
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/pom.xml
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/CacheEventAction.java
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/generation/EventCacheGenerator.java
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/samples/EventAwareGenerator.java
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample-blockServlet.xml
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample.xml

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/pom.xml?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/pom.xml Tue Jul 29 06:54:14
2008
@@ -39,18 +39,23 @@
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-core</artifactId>
     </dependency>
+    
+    <!-- 
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-jms-impl</artifactId>
     </dependency>
+     -->
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-template-impl</artifactId>
     </dependency>
+    <!-- 
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jms_1.1_spec</artifactId>
     </dependency>
+     -->
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/CacheEventAction.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/CacheEventAction.java?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/CacheEventAction.java
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/acting/CacheEventAction.java
Tue Jul 29 06:54:14 2008
@@ -20,7 +20,6 @@
 
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.thread.ThreadSafe;
-
 import org.apache.cocoon.caching.Cache;
 import org.apache.cocoon.caching.impl.EventAwareCacheImpl;
 import org.apache.cocoon.caching.validity.NamedEvent;
@@ -40,6 +39,11 @@
  */
 public class CacheEventAction extends ServiceableAction implements ThreadSafe {
 
+	/**
+	 * Cache implementation injected by Spring.
+	 */
+	private Cache cache = null;
+	
     /**
      * Lookup the cache and call its processEvent method. Returns an 
      * empty map to signal success.
@@ -50,24 +54,28 @@
                     String src,
                     Parameters par
     ) throws Exception {
-        final String cacheRole = par.getParameter("cache-role", Cache.ROLE + "/EventAware");
-        Cache cache = (Cache)this.manager.lookup(cacheRole);
-        try {
-            // FIXME - This cast might not work with every container!
-            if (cache instanceof EventAwareCacheImpl) {
-                String eventName = par.getParameter("event");
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Configured for cache event named: " + eventName);
-                }
-                if (eventName == null || "".equals(eventName)) {
-                    return null;
-                }
-                ((EventAwareCacheImpl)cache).processEvent(
-                                                    new NamedEvent(eventName));
+        // FIXME - This cast might not work with every container!
+        if (cache instanceof EventAwareCacheImpl) {
+            String eventName = par.getParameter("event");
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug(
+                        "Configured for cache event named: " + eventName);
+            }
+            if (eventName == null || "".equals(eventName)) {
+                return null;
             }
-        } finally {
-            this.manager.release(cache);
+            ((EventAwareCacheImpl) cache)
+                    .processEvent(new NamedEvent(eventName));
         }
         return EMPTY_MAP;
     }
-}
\ No newline at end of file
+
+	/**
+	 * Sets cache.
+     * @param cache
+     *            the cache to set
+     */
+	public final void setCache(Cache cache) {
+		this.cache = cache;
+	}
+}

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
Tue Jul 29 06:54:14 2008
@@ -38,7 +38,7 @@
  * 
  * @version $Id$
  */
-public class EventAwareCacheImpl extends CacheImpl implements Initializable, EventAware {
+public class EventAwareCacheImpl extends CacheImpl implements EventAware {
 
     private Log logger = LogFactory.getLog(getClass());       
     

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
Tue Jul 29 06:54:14 2008
@@ -18,51 +18,46 @@
 
 import java.io.IOException;
 
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
 import org.apache.excalibur.store.Store;
 
 /**
  * This implementation of <code>EventRegistry</code> stores its <code>EventRegistryDataWrapper</code>
- * in the default <code>Store</code> defined in cocoon.xconf.
+ * in the default <code>Store</code> injected by Spring.
  * 
  * @since 2.1
  * @version $Id$
  */
-public class StoreEventRegistryImpl extends AbstractDoubleMapEventRegistry 
-implements Serviceable {
+public class StoreEventRegistryImpl extends AbstractDoubleMapEventRegistry {
 
+    /**
+     * Event registry key.
+     */
     private static final String EVENTREGISTRYKEY = "EVENTREGWRAPPER";
-    private ServiceManager m_manager;
-    private Store m_store;
 
+    /**
+     * Store to use.
+     */
+    private Store store;
+
+    /**
+     * Wraps the registry and stores it.
+     * @param wrapper The EventRegistryDataWrapper to store.
+     */
     protected void persist(EventRegistryDataWrapper wrapper) {
         EventRegistryDataWrapper ecdw = wrapRegistry();
         try {
-            m_store.store(EVENTREGISTRYKEY, ecdw);
+            this.store.store(EVENTREGISTRYKEY, ecdw);
         } catch (IOException e) {
             getLogger().warn("Unable to persist Event Registry");
         }
-        this.m_manager.release(this.m_store);
-        m_manager = null;
-        m_store = null;
-    }
-
-    /**
-	 * Obtain a reference to the Store
-	 */
-    public void service(ServiceManager manager) throws ServiceException {
-        this.m_manager = manager;
-        this.m_store = (Store) manager.lookup(Store.ROLE);
     }
 
     /**
 	 * Recover the datawrapper from the Store.
 	 */
     protected boolean recover() {
-        Object o = m_store.get(EVENTREGISTRYKEY);
-        m_store.remove(EVENTREGISTRYKEY);
+        Object o = store.get(EVENTREGISTRYKEY);
+        this.store.remove(EVENTREGISTRYKEY);
         if (o != null && o instanceof EventRegistryDataWrapper) {
             if (getLogger().isInfoEnabled()) {
                 getLogger().info("Retrieving EventRegistry from Store.");
@@ -76,4 +71,11 @@
         }
     }
 
+	/**
+	 * Sets the Store.
+	 * @param store The Store to set.
+	 */
+	public void setStore(Store store) {
+		this.store = store;
+	}
 }

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/generation/EventCacheGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/generation/EventCacheGenerator.java?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/generation/EventCacheGenerator.java
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/generation/EventCacheGenerator.java
Tue Jul 29 06:54:14 2008
@@ -80,7 +80,7 @@
  * TODO: share common code with EventCacheTransformer
  */
 public class EventCacheGenerator extends ServiceableGenerator 
-implements Configurable, CacheableProcessingComponent {
+implements CacheableProcessingComponent {
 
 
     // ---------------------------------------------------- constants

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/samples/EventAwareGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/samples/EventAwareGenerator.java?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/samples/EventAwareGenerator.java
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/java/org/apache/cocoon/samples/EventAwareGenerator.java
Tue Jul 29 06:54:14 2008
@@ -18,14 +18,12 @@
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.validity.EventValidity;
 import org.apache.cocoon.caching.validity.NamedEvent;
-import org.apache.cocoon.el.objectmodel.ObjectModel;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.SourceResolver;

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
Tue Jul 29 06:54:14 2008
@@ -6,9 +6,9 @@
   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
-
+  
+  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.
@@ -17,16 +17,24 @@
 -->
 <!-- SVN $Id$ -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+  <!--+
+    | Event-cache implementation based on the default CacheImpl.
+    +-->
+  <bean name="org.apache.cocoon.caching.Cache/EventAware"
+    class="org.apache.cocoon.caching.impl.EventAwareCacheImpl" init-method="initialize">
+    <property name="store" ref="org.apache.excalibur.store.Store/TransientStore" />
+    <property name="eventRegistry" ref="org.apache.cocoon.caching.EventRegistry" />
+  </bean>
 
   <!--+
-      | Event-cache implementation based on the default CacheImpl.
-      +-->
-  <bean name="org.apache.cocoon.caching.Cache/EventAware" class="org.apache.cocoon.caching.impl.EventAwareCacheImpl"
-    init-method="initialize">
-    <property name="store" ref="org.apache.excalibur.store.Store"/>
-    <property name="eventRegistry" ref="org.apache.cocoon.caching.EventRegistry"/>
+    | Event-cache registry.
+    +-->
+  <bean name="org.apache.cocoon.caching.EventRegistry"
+    class="org.apache.cocoon.caching.impl.StoreEventRegistryImpl" init-method="initialize">
+    <property name="store" ref="org.apache.excalibur.store.Store/TransientStore" />
   </bean>
 
-</beans>
\ No newline at end of file
+</beans>

Added: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml?rev=680697&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
(added)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
Tue Jul 29 06:54:14 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<!-- $Id$ -->
+<eventcache>
+  <key>${cocoon.parameters.KEY}</key>
+  <date>${cocoon.parameters.DATE}</date>
+</eventcache>

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/it.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap?rev=680697&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
(added)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
Tue Jul 29 06:54:14 2008
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<!-- $Id$ -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components>
+    <!-- Pipes definition -->
+    <map:pipes default="caching">
+      <!-- A pipe must be defined configured to use the EventAware cache. -->
+      <map:pipe logger="core.sitemap" name="event-aware"
+        src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
+        <parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"
/>
+      </map:pipe>
+    </map:pipes>
+  </map:components>
+  <map:flow language="javascript">
+    <map:script src="../event.js" />
+  </map:flow>
+
+  <map:pipelines>
+    <map:pipeline>
+      <map:match pattern="it/**">
+        <map:mount src="it/" uri-prefix="it" />
+      </map:match>
+    </map:pipeline>
+    <!-- Our content must occur in a pipeline configured to use our Event Aware cache
-->
+    <map:pipeline type="event-aware">
+      <map:match pattern="action">
+        <map:act type="CacheEvent">
+          <map:parameter name="event" value="{request-param:event}" />
+        </map:act>
+        <map:redirect-to uri="demo?pageKey={request-param:pageKey}&amp;rand={random:x}"
/>
+      </map:match>
+
+      <map:match pattern="flow">
+        <map:call function="cacheEvent" />
+      </map:match>
+
+      <map:match pattern="*">
+        <map:generate src="it.xml" type="EventCacheSample">
+          <map:parameter name="DELAY_SECS" value="2" />
+          <map:parameter name="DATE" value="{date:date}" />
+          <map:parameter name="KEY" value="{request-param:pageKey}" />
+        </map:generate>
+        <map:serialize type="xml" />
+      </map:match>
+    </map:pipeline>
+  </map:pipelines>
+
+</map:sitemap>

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/it/sitemap.xmap
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/sitemap.xmap?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/COB-INF/sitemap.xmap
Tue Jul 29 06:54:14 2008
@@ -6,9 +6,9 @@
   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
-
+  
+  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.
@@ -17,29 +17,27 @@
 -->
 <!-- $Id$ -->
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
   <map:components>
-    <map:actions>
-      <map:action name="cacheevent" src="org.apache.cocoon.acting.CacheEventAction" />
-    </map:actions>
+    <!-- Pipes definition -->
     <map:pipes default="caching">
       <!-- A pipe must be defined configured to use the EventAware cache. -->
-      <map:pipe name="event-aware" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
+      <map:pipe logger="core.sitemap" name="event-aware"
+        src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
         <parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"
/>
       </map:pipe>
     </map:pipes>
   </map:components>
-
   <map:flow language="javascript">
     <map:script src="event.js" />
   </map:flow>
-
   <map:views>
     <map:view from-label="content" name="content">
       <map:serialize type="xml" />
     </map:view>
 
+    <!-- Make use of servlet services -->
     <map:view from-label="content" name="pretty-content">
-      <!-- Make use of servlet services -->
       <map:serialize type="servletService">
         <map:parameter name="service" value="servlet:style-default:/service/system/xml2html"
/>
       </map:serialize>
@@ -51,32 +49,37 @@
   </map:views>
 
   <map:pipelines>
+    <map:pipeline>
+      <map:match pattern="it/**">
+        <map:mount src="it/" uri-prefix="it" />
+      </map:match>
+    </map:pipeline>
     <!-- Our content must occur in a pipeline configured to use our Event Aware cache
-->
     <map:pipeline type="event-aware">
-
-      <map:match pattern="flow">
-        <map:call function="cacheEvent" />
-      </map:match>
-      
       <map:match pattern="action">
-        <map:act type="cacheevent">
+        <map:act type="CacheEvent">
           <map:parameter name="event" value="{request-param:event}" />
         </map:act>
         <map:redirect-to uri="demo?pageKey={request-param:pageKey}&amp;rand={random:x}"
/>
       </map:match>
-      
+
+      <map:match pattern="flow">
+        <map:call function="cacheEvent" />
+      </map:match>
+
       <map:match pattern="*">
-        <map:generate type="event-cache-sample" src="eventcache.xml">
+        <map:generate src="eventcache.xml" type="EventCacheSample">
           <map:parameter name="DELAY_SECS" value="2" />
           <map:parameter name="DATE" value="{date:date}" />
           <map:parameter name="KEY" value="{request-param:pageKey}" />
         </map:generate>
         <!-- Make use of servlet services -->
         <map:serialize type="servletService">
-          <map:parameter name="service" value="servlet:style-default:/service/blocks/dynamic-page2html"
/>
+          <map:parameter name="service"
+            value="servlet:style-default:/service/blocks/dynamic-page2html" />
         </map:serialize>
       </map:match>
-      
     </map:pipeline>
   </map:pipelines>
-</map:sitemap>
\ No newline at end of file
+
+</map:sitemap>

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample-blockServlet.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample-blockServlet.xml?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample-blockServlet.xml
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample-blockServlet.xml
Tue Jul 29 06:54:14 2008
@@ -6,9 +6,9 @@
   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
-
+  
+  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.
@@ -18,18 +18,21 @@
 
 <!--
   - $Id$
-  -->
+-->
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:servlet="http://cocoon.apache.org/schema/servlet"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:servlet="http://cocoon.apache.org/schema/servlet"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
 
-  <bean name="org.apache.cocoon.eventcache.sample.servlet" class="org.apache.cocoon.sitemap.SitemapServlet">
-    <servlet:context mount-path="/cocoon-eventcache-sample" context-path="blockcontext:/cocoon-eventcache-sample/">
+  <bean name="org.apache.cocoon.eventcache.sample.servlet"
+    class="org.apache.cocoon.sitemap.SitemapServlet">
+    <servlet:context mount-path="/cocoon-eventcache-sample"
+      context-path="blockcontext:/cocoon-eventcache-sample/">
       <servlet:connections>
-        <entry key="style-default" value-ref="org.apache.cocoon.samples.style.default.servlet"/>
+        <entry key="style-default" value-ref="org.apache.cocoon.samples.style.default.servlet"
/>
       </servlet:connections>
     </servlet:context>
   </bean>
+
 </beans>

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample.xml?rev=680697&r1=680696&r2=680697&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample.xml
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-sample/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache-sample.xml
Tue Jul 29 06:54:14 2008
@@ -6,9 +6,9 @@
   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.
@@ -16,14 +16,23 @@
   limitations under the License.
 -->
 <!-- $Id$ -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:configurator="http://cocoon.apache.org/schema/configurator"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
                            http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
 
-  <bean name="org.apache.cocoon.generation.Generator/event-cache-sample" class="org.apache.cocoon.samples.EventAwareGenerator"
-    scope="prototype" parent="org.apache.cocoon.generation.Generator/jx" />
+  <!-- Event aware generator bean inherits from the jx generator -->
+  <bean name="org.apache.cocoon.generation.Generator/EventCacheSample"
+    class="org.apache.cocoon.samples.EventAwareGenerator" scope="prototype"
+    parent="org.apache.cocoon.generation.Generator/jx" />
+
+  <!-- Cache event bean -->
+  <bean name="org.apache.cocoon.acting.Action/CacheEvent"
+    class="org.apache.cocoon.acting.CacheEventAction" scope="prototype">
+    <property name="cache" ref="org.apache.cocoon.caching.Cache/EventAware" />
+  </bean>
 
-</beans>
\ No newline at end of file
+</beans>



Mime
View raw message