You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/04/15 10:05:56 UTC
cvs commit: cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/acting ExpiresPipelineAction.java
cziegeler 2004/04/15 01:05:56
Modified: src/blocks/scratchpad/java/org/apache/cocoon/caching
SimpleCache.java
src/blocks/scratchpad/java/org/apache/cocoon/components/pipeline/impl
ExpiresCachingProcessingPipeline.java
src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl
CachingSource.java Refresher.java UpdateTarget.java
DelayRefresher.java
src/blocks/scratchpad/java/org/apache/cocoon/acting
ExpiresPipelineAction.java
Added: src/blocks/scratchpad/java/org/apache/cocoon/caching
IdentifierCacheKey.java
Removed: src/blocks/scratchpad/java/org/apache/cocoon/caching
SimpleCacheKey.java
Log:
Better class name
Revision Changes Path
1.4 +3 -3 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/caching/SimpleCache.java
Index: SimpleCache.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/caching/SimpleCache.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SimpleCache.java 15 Apr 2004 08:04:39 -0000 1.3
+++ SimpleCache.java 15 Apr 2004 08:05:55 -0000 1.4
@@ -70,8 +70,8 @@
String filename;
if ( key instanceof String ) {
filename = NetUtils.absolutize(this.baseDirectory, (String)key);
- } else if ( key instanceof SimpleCacheKey ) {
- filename = NetUtils.absolutize(this.baseDirectory, ((SimpleCacheKey)key).getKey());
+ } else if ( key instanceof IdentifierCacheKey ) {
+ filename = NetUtils.absolutize(this.baseDirectory, ((IdentifierCacheKey)key).getKey());
} else {
filename = NetUtils.absolutize(this.baseDirectory, key.toString());
}
1.1 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/caching/IdentifierCacheKey.java
Index: IdentifierCacheKey.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed 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.caching;
import java.io.Serializable;
/**
* This is a "simple" cache key that does not consider the components used in the
* pipeline. It simply consists of a key (unique identifier for the request) and
* a boolean value that defines if the key is for a complete pipeline call or
* for an internal pipeline call.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id: IdentifierCacheKey.java,v 1.1 2004/04/15 08:05:55 cziegeler Exp $
* @since 2.1.1
*/
public class IdentifierCacheKey
implements Serializable {
/** The key */
final protected String key;
/** Is this an external pipeline call? */
final protected boolean external;
/** cache key */
final protected String cacheKey;
/** cache toString() */
protected String toString;
/**
* Constructor
*/
public IdentifierCacheKey(String key, boolean external) {
this.key = key;
this.external = external;
final StringBuffer buf = new StringBuffer();
buf.append(this.external).append(':').append(this.key);
this.cacheKey = buf.toString();
}
/**
* Compare
*/
public boolean equals(Object object) {
if (object instanceof IdentifierCacheKey) {
IdentifierCacheKey pck = (IdentifierCacheKey)object;
return this.cacheKey.equals( pck.cacheKey );
}
return false;
}
/**
* Generate a hash code
*/
public int hashCode() {
return this.cacheKey.hashCode();
}
/**
* toString
* The FilesystemStore uses toString!
*/
public String toString() {
if (this.toString == null) {
StringBuffer buffer = new StringBuffer();
buffer.append("SCK:");
buffer.append(this.cacheKey);
this.toString = buffer.toString();
}
return toString;
}
/**
* The cache key
*/
public String getKey() {
return this.key;
}
}
1.5 +4 -4 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java
Index: ExpiresCachingProcessingPipeline.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ExpiresCachingProcessingPipeline.java 7 Mar 2004 18:44:14 -0000 1.4
+++ ExpiresCachingProcessingPipeline.java 15 Apr 2004 08:05:55 -0000 1.5
@@ -27,7 +27,7 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.CachedResponse;
import org.apache.cocoon.caching.CachingOutputStream;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.cocoon.components.sax.XMLDeserializer;
import org.apache.cocoon.components.sax.XMLSerializer;
import org.apache.cocoon.components.sax.XMLTeePipe;
@@ -63,7 +63,7 @@
protected SourceValidity cacheValidity;
/** The key used for caching */
- protected SimpleCacheKey cacheKey;
+ protected IdentifierCacheKey cacheKey;
/** The expires information */
protected long cacheExpires;
@@ -235,7 +235,7 @@
super.preparePipeline( environment );
// and now prepare the caching information
- this.cacheKey = new SimpleCacheKey(key,
+ this.cacheKey = new IdentifierCacheKey(key,
this.serializer == this.lastConsumer);
if ( this.cacheExpires > 0) {
this.cacheValidity = new ExpiresValidity(this.cacheExpires*1000);
1.11 +5 -5 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/CachingSource.java
Index: CachingSource.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/CachingSource.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CachingSource.java 24 Mar 2004 18:54:23 -0000 1.10
+++ CachingSource.java 15 Apr 2004 08:05:56 -0000 1.11
@@ -32,7 +32,7 @@
import org.apache.cocoon.CascadingIOException;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.Cache;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.cocoon.components.sax.XMLDeserializer;
import org.apache.cocoon.components.sax.XMLSerializer;
import org.apache.cocoon.xml.ContentHandlerWrapper;
@@ -104,7 +104,7 @@
final protected String protocol;
/** The key used in the store */
- final protected SimpleCacheKey cacheKey;
+ final protected IdentifierCacheKey cacheKey;
/** number of seconds before cached object becomes invalid */
final protected int expires;
@@ -136,7 +136,7 @@
if (cacheName != null) {
key += ":" + cacheName;
}
- this.cacheKey = new SimpleCacheKey(key, false);
+ this.cacheKey = new IdentifierCacheKey(key, false);
}
/**
@@ -489,7 +489,7 @@
/**
* Return the used key.
*/
- protected SimpleCacheKey getCacheKey() {
+ protected IdentifierCacheKey getCacheKey() {
return this.cacheKey;
}
1.5 +3 -3 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/Refresher.java
Index: Refresher.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/Refresher.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Refresher.java 22 Mar 2004 17:38:25 -0000 1.4
+++ Refresher.java 15 Apr 2004 08:05:56 -0000 1.5
@@ -16,7 +16,7 @@
package org.apache.cocoon.components.source.impl;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.excalibur.source.SourceException;
/**
@@ -42,7 +42,7 @@
* @param cacheRole The role of the cache component to store the content
* @param params Additional parameters such as a timout value
*/
- void refresh(SimpleCacheKey cacheKey,
+ void refresh(IdentifierCacheKey cacheKey,
String uri,
String cacheRole,
Parameters params)
1.6 +4 -4 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/UpdateTarget.java
Index: UpdateTarget.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/UpdateTarget.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UpdateTarget.java 24 Mar 2004 15:19:20 -0000 1.5
+++ UpdateTarget.java 15 Apr 2004 08:05:56 -0000 1.6
@@ -23,7 +23,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.cocoon.caching.Cache;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.cocoon.components.cron.ConfigurableCronJob;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
@@ -74,7 +74,7 @@
private boolean failSafe;
// the key under which to store the CachedResponse in the Cache
- private SimpleCacheKey cacheKey;
+ private IdentifierCacheKey cacheKey;
// ---------------------------------------------------- Lifecycle
@@ -98,7 +98,7 @@
this.cacheRole = pars.getParameter("cache-role", Cache.ROLE);
this.expires = pars.getParameterAsInteger("cache-expires", 60);
this.failSafe = pars.getParameterAsBoolean("fail-safe", true);
- this.cacheKey = (SimpleCacheKey) objects.get("cache-key");
+ this.cacheKey = (IdentifierCacheKey) objects.get("cache-key");
}
1.5 +6 -6 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/DelayRefresher.java
Index: DelayRefresher.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/source/impl/DelayRefresher.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DelayRefresher.java 2 Apr 2004 08:08:03 -0000 1.4
+++ DelayRefresher.java 15 Apr 2004 08:05:56 -0000 1.5
@@ -44,7 +44,7 @@
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.cocoon.components.cron.CronJob;
import org.apache.cocoon.components.cron.JobScheduler;
import org.apache.cocoon.components.source.SourceUtil;
@@ -162,7 +162,7 @@
/* (non-Javadoc)
* @see org.apache.cocoon.components.source.impl.Refresher#refresh(org.apache.cocoon.caching.SimpleCacheKey, java.lang.String, long, java.lang.String)
*/
- public void refresh(SimpleCacheKey cacheKey,
+ public void refresh(IdentifierCacheKey cacheKey,
String uri,
String cacheRole,
Parameters parameters)
@@ -273,7 +273,7 @@
final String cache = conf.getAttribute(ATTR_CACHE);
final int expires = conf.getAttributeAsInteger(ATTR_EXPIRES);
final String key = URLDecoder.decode(conf.getAttribute(ATTR_KEY));
- final SimpleCacheKey cacheKey = new SimpleCacheKey(key, false);
+ final IdentifierCacheKey cacheKey = new IdentifierCacheKey(key, false);
final Parameters parameters = Parameters.fromConfiguration(conf);
@@ -337,7 +337,7 @@
writer.write("\" "+ATTR_CACHE+"=\"");
writer.write(c.parameters.getParameter(PARAM_CACHE_ROLE, ""));
writer.write("\" "+ATTR_KEY+"=\"");
- writer.write(URLEncoder.encode(((SimpleCacheKey) c.map.get(CACHE_KEY)).getKey()));
+ writer.write(URLEncoder.encode(((IdentifierCacheKey) c.map.get(CACHE_KEY)).getKey()));
writer.write("\"/>\n");
}
@@ -349,7 +349,7 @@
final Map map;
Parameters parameters;
- TargetConfiguration(SimpleCacheKey cacheKey,
+ TargetConfiguration(IdentifierCacheKey cacheKey,
String uri,
String cacheRole,
Parameters parameters) {
1.4 +4 -4 cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/acting/ExpiresPipelineAction.java
Index: ExpiresPipelineAction.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/acting/ExpiresPipelineAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExpiresPipelineAction.java 5 Mar 2004 10:07:25 -0000 1.3
+++ ExpiresPipelineAction.java 15 Apr 2004 08:05:56 -0000 1.4
@@ -19,7 +19,7 @@
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.Cache;
-import org.apache.cocoon.caching.SimpleCacheKey;
+import org.apache.cocoon.caching.IdentifierCacheKey;
import org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
@@ -57,12 +57,12 @@
if ( cacheKey != null ) {
Cache cache = null;
- SimpleCacheKey key = new SimpleCacheKey(cacheKey, true);
+ IdentifierCacheKey key = new IdentifierCacheKey(cacheKey, true);
try {
cache = (Cache)this.manager.lookup(cacheRole);
cache.remove(key);
- key = new SimpleCacheKey(cacheKey, false);
+ key = new IdentifierCacheKey(cacheKey, false);
cache.remove(key);
} catch (Exception ex) {
if (this.getLogger().isDebugEnabled()) {