cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r522902 - in /cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main: java/org/apache/cocoon/caching/impl/ resources/META-INF/cocoon/avalon/ resources/META-INF/cocoon/spring/
Date Tue, 27 Mar 2007 13:30:33 GMT
Author: reinhard
Date: Tue Mar 27 06:30:32 2007
New Revision: 522902

URL: http://svn.apache.org/viewvc?view=rev&rev=522902
Log:
CacheImpl + EventCacheImpl: avalon->spring

Added:
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/
    cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
  (with props)
Modified:
    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/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf

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?view=diff&rev=522902&r1=522901&r2=522902
==============================================================================
--- 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 Mar 27 06:30:32 2007
@@ -20,8 +20,6 @@
 import java.util.Iterator;
 
 import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.CachedResponse;
 import org.apache.cocoon.caching.EventAware;
@@ -29,6 +27,8 @@
 import org.apache.cocoon.caching.validity.Event;
 import org.apache.cocoon.caching.validity.EventValidity;
 import org.apache.cocoon.components.source.impl.SitemapSource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.AbstractAggregatedValidity;
 
@@ -38,8 +38,9 @@
  * 
  * @version $Id$
  */
-public class EventAwareCacheImpl extends CacheImpl implements Initializable,
-                                                              EventAware {
+public class EventAwareCacheImpl extends CacheImpl implements Initializable, EventAware {
+
+    private Log logger = LogFactory.getLog(getClass());       
     
 	private EventRegistry eventRegistry;
 
@@ -71,23 +72,6 @@
         super.store(key, response);
 	}
 
-    /* (non-Javadoc)
-     * @see org.apache.cocoon.caching.Cache#store(java.io.Serializable, org.apache.cocoon.caching.CachedResponse)
-     
-    public void store(Serializable key, CachedResponse response)
-        throws ProcessingException {
-        // TODO Auto-generated method stub
-        super.store(key, response);
-    }*/
-
-    /**
-     * Look up the EventRegistry 
-     */
-	public void service(ServiceManager manager) throws ServiceException {
-        super.service(manager);
-        this.eventRegistry = (EventRegistry)this.manager.lookup(EventRegistry.ROLE);
-	}
-
 	/**
      * Un-register this key in the EventRegistry in addition to 
      * removing it from the Store
@@ -109,8 +93,8 @@
         if (keys == null) return;
         for (int i=0;i<keys.length; i++) {
             if (keys[i] != null) {
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Processing cache event, found Pipeline key: " + keys[i].toString());
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Processing cache event, found Pipeline key: " + keys[i].toString());
                 }
                 /* every pck associated with this event needs to be
                  * removed -- regardless of event mapping. and every 
@@ -149,25 +133,14 @@
         for (int i=0; i<keys.length; i++) {
             if (!this.containsKey(keys[i])) {
                 this.eventRegistry.removeKey(keys[i]);
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Cache key no longer valid: " + 
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Cache key no longer valid: " + 
                             keys[i]);
                 }
             }
         }
     }
 
-    /**
-     * Release resources
-     */
-	public void dispose() {
-        if ( this.manager != null ) {
-            this.manager.release(this.eventRegistry);
-            this.eventRegistry = null;
-        }
-		super.dispose();
-	}
-
     private void examineValidity(SourceValidity val, Serializable key) {
         if (val instanceof AbstractAggregatedValidity) {
             handleAggregatedValidity((AbstractAggregatedValidity)val, key);
@@ -191,10 +164,14 @@
     }
 
     private void handleEventValidity(EventValidity val, Serializable key) {
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("Found EventValidity: " + val.toString());
+        if (logger.isDebugEnabled()) {
+            logger.debug("Found EventValidity: " + val.toString());
         }
         this.eventRegistry.register(val.getEvent(),key); 
+    }
+    
+    public void setEventRegistry(EventRegistry eventRegistry) {
+        this.eventRegistry = eventRegistry;
     }
 
 }

Modified: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf?view=diff&rev=522902&r1=522901&r2=522902
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf
(original)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-eventcache.xconf
Tue Mar 27 06:30:32 2007
@@ -30,8 +30,6 @@
        -->
     </component>
     
-    <component role="org.apache.cocoon.caching.Cache/EventAware"
-               class="org.apache.cocoon.caching.impl.EventAwareCacheImpl"/>
     <!-- The event registry which maps Cache events to Pipeline keys -->
     <!--component role="org.apache.cocoon.caching.EventRegistry"
                   class="org.apache.cocoon.caching.impl.DefaultEventRegistryImpl"/-->

Added: 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?view=auto&rev=522902
==============================================================================
--- cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
(added)
+++ cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
Tue Mar 27 06:30:32 2007
@@ -0,0 +1,32 @@
+<?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.
+-->
+<!-- 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">
+
+  <!--+
+      | 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"/>
+  </bean>
+
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/blocks/cocoon-eventcache/cocoon-eventcache-impl/src/main/resources/META-INF/cocoon/spring/cocoon-eventcache.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message