cziegeler 02/05/29 03:24:19
Modified: src/documentation cocoon.xconf sitemap.xmap
src/java/org/apache/cocoon/caching
CacheValidityToSourceValidity.java
src/java/org/apache/cocoon/components/pipeline/impl
CachingProcessingPipeline.java
Log:
Fixed some NPEs
Corrected documentation build
Revision Changes Path
1.15 +2 -2 xml-cocoon2/src/documentation/cocoon.xconf
Index: cocoon.xconf
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/documentation/cocoon.xconf,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- cocoon.xconf 29 May 2002 08:20:25 -0000 1.14
+++ cocoon.xconf 29 May 2002 10:24:18 -0000 1.15
@@ -29,8 +29,8 @@
<!-- Memory Storing -->
<transient-store logger="core.store.transient">
- <parameter name="maxobjects" value="100"/>
- <parameter name="use-persistent-cache" value="true"/>
+ <parameter name="maxobjects" value="10000"/>
+ <parameter name="use-persistent-cache" value="false"/>
</transient-store>
<!-- Store Janitor -->
1.13 +2 -2 xml-cocoon2/src/documentation/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/documentation/sitemap.xmap,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sitemap.xmap 29 May 2002 08:20:25 -0000 1.12
+++ sitemap.xmap 29 May 2002 10:24:18 -0000 1.13
@@ -39,8 +39,8 @@
<map:matcher name="wildcard"
src="org.apache.cocoon.matching.WildcardURIMatcher"/>
</map:matchers>
- <map:pipelines default="noncaching">
- <map:pipeline name="noncaching"
src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline"
+ <map:pipelines default="caching">
+ <map:pipeline name="caching"
src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"
logger="core.processing-pipeline" pool-max="32" pool-min="8"
pool-grow="4"/>
</map:pipelines>
1.4 +12 -2
xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidityToSourceValidity.java
Index: CacheValidityToSourceValidity.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidityToSourceValidity.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CacheValidityToSourceValidity.java 28 May 2002 10:57:42 -0000 1.3
+++ CacheValidityToSourceValidity.java 29 May 2002 10:24:18 -0000 1.4
@@ -58,7 +58,7 @@
*
* @since @next-version@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: CacheValidityToSourceValidity.java,v 1.3 2002/05/28 10:57:42
cziegeler Exp $
+ * @version CVS $Id: CacheValidityToSourceValidity.java,v 1.4 2002/05/29 10:24:18
cziegeler Exp $
*/
public final class CacheValidityToSourceValidity
implements SourceValidity {
@@ -66,9 +66,19 @@
protected CacheValidity cacheValidity;
/**
+ * Create a new instance
+ */
+ public static CacheValidityToSourceValidity createValidity(CacheValidity
validity) {
+ if ( null != validity) {
+ return new CacheValidityToSourceValidity(validity);
+ }
+ return null;
+ }
+
+ /**
* Constructor
*/
- public CacheValidityToSourceValidity(CacheValidity validity) {
+ protected CacheValidityToSourceValidity(CacheValidity validity) {
this.cacheValidity = validity;
}
1.21 +75 -56
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java
Index: CachingProcessingPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- CachingProcessingPipeline.java 29 May 2002 08:20:26 -0000 1.20
+++ CachingProcessingPipeline.java 29 May 2002 10:24:18 -0000 1.21
@@ -92,7 +92,7 @@
*
* @since @next-version@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: CachingProcessingPipeline.java,v 1.20 2002/05/29 08:20:26
cziegeler Exp $
+ * @version CVS $Id: CachingProcessingPipeline.java,v 1.21 2002/05/29 10:24:18
cziegeler Exp $
*/
public class CachingProcessingPipeline
extends AbstractProcessingPipeline
@@ -251,18 +251,20 @@
this.generator.generate();
}
}
- if ( this.cacheCompleteResponse ) {
- CachedResponse response = new
CachedResponse(this.pipelineValidityObjects,
- ((CachingOutputStream)os).getContent());
- this.cache.store(environment.getObjectModel(),
- this.pipelineCacheKey,
- response);
- } else {
- CachedResponse response = new
CachedResponse(this.pipelineValidityObjects,
- (byte[])this.xmlSerializer.getSAXFragment());
- this.cache.store(environment.getObjectModel(),
- this.pipelineCacheKey,
- response);
+ if (this.pipelineCacheKey != null) {
+ if ( this.cacheCompleteResponse ) {
+ CachedResponse response = new
CachedResponse(this.pipelineValidityObjects,
+ ((CachingOutputStream)os).getContent());
+ this.cache.store(environment.getObjectModel(),
+ this.pipelineCacheKey,
+ response);
+ } else {
+ CachedResponse response = new
CachedResponse(this.pipelineValidityObjects,
+
(byte[])this.xmlSerializer.getSAXFragment());
+ this.cache.store(environment.getObjectModel(),
+ this.pipelineCacheKey,
+ response);
+ }
}
} catch ( SocketException se ) {
if (se.getMessage().indexOf("reset") > 0
@@ -394,48 +396,44 @@
SourceValidity[] validities = response.getValidityObjects();
int i = 0;
while (responseIsValid && i < validities.length) {
- boolean isValid = false;
- // FIXME (CZ) WORKAROUND validities[i] should never be null
- if (validities[i] != null) {
- isValid = validities[i].isValid();
- if ( !isValid ) {
- final SourceValidity validity;
- if (i == 0) {
- // test generator
- if (generatorIsCacheableProcessingComponent) {
- validity =
((CacheableProcessingComponent)super.generator).generateValidity();
- } else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)super.generator).generateValidity());
- }
- } else if (i <= this.firstProcessedTransformerIndex) {
- // test transformer
- final Transformer trans =
- (Transformer)super.transformers.get(i-1);
- if (transformerIsCacheableProcessingComponent[i-1])
{
- validity =
((CacheableProcessingComponent)trans).generateValidity();
- } else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)trans).generateValidity());
- }
+ boolean isValid = validities[i].isValid();
+ if ( !isValid ) {
+ final SourceValidity validity;
+ if (i == 0) {
+ // test generator
+ if (generatorIsCacheableProcessingComponent) {
+ validity =
((CacheableProcessingComponent)super.generator).generateValidity();
} else {
- // test serializer
- if (serializerIsCacheableProcessingComponent) {
- validity =
((CacheableProcessingComponent)super.serializer).generateValidity();
- } else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)super.serializer).generateValidity());
- }
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)super.generator).generateValidity());
}
- if (validity != null) {
- isValid = validities[i].isValid( validity );
+ } else if (i <= this.firstProcessedTransformerIndex) {
+ // test transformer
+ final Transformer trans =
+ (Transformer)super.transformers.get(i-1);
+ if (transformerIsCacheableProcessingComponent[i-1]) {
+ validity =
((CacheableProcessingComponent)trans).generateValidity();
+ } else {
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)trans).generateValidity());
}
- if ( !isValid ) {
- responseIsValid = false;
- // update validity
- validities[i] = validity;
- if (validity == null) responseIsUsable = false;
+ } else {
+ // test serializer
+ if (serializerIsCacheableProcessingComponent) {
+ validity =
((CacheableProcessingComponent)super.serializer).generateValidity();
+ } else {
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)super.serializer).generateValidity());
}
}
- if ( isValid ) i++;
+ if (validity != null) {
+ isValid = validities[i].isValid( validity );
+ }
+ if ( !isValid ) {
+ responseIsValid = false;
+ // update validity
+ validities[i] = validity;
+ if (validity == null) responseIsUsable = false;
+ }
}
+ if ( isValid ) i++;
}
if ( responseIsValid ) {
// we are valid, ok that's it
@@ -510,14 +508,16 @@
this.pipelineValidityObjects[i] = cachedValidityObjects[i];
}
}
- for(int i=start; i < this.pipelineValidityObjects.length; i++) {
+ int len = this.pipelineValidityObjects.length;
+ int i = start;
+ while (i < len) {
final SourceValidity validity;
if (i == 0) {
// test generator
if (generatorIsCacheableProcessingComponent) {
validity =
((CacheableProcessingComponent)super.generator).generateValidity();
} else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)super.generator).generateValidity());
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)super.generator).generateValidity());
}
} else if (i <= firstNotCacheableTransformerIndex) {
// test transformer
@@ -526,17 +526,36 @@
if (transformerIsCacheableProcessingComponent[i-1]) {
validity =
((CacheableProcessingComponent)trans).generateValidity();
} else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)trans).generateValidity());
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)trans).generateValidity());
}
} else {
// test serializer
if (serializerIsCacheableProcessingComponent) {
validity =
((CacheableProcessingComponent)super.serializer).generateValidity();
} else {
- validity = new
CacheValidityToSourceValidity(((Cacheable)super.serializer).generateValidity());
+ validity =
CacheValidityToSourceValidity.createValidity(((Cacheable)super.serializer).generateValidity());
+ }
+ }
+ if (validity == null) {
+ if (i > 0 && i > cachedPipelineKey.size()) {
+ // shorten key
+ for(int m=i; m < this.pipelineValidityObjects.length;
m++) {
+ this.pipelineCacheKey.removeLastKey();
+ }
+ SourceValidity[] copy = new SourceValidity[i];
+ System.arraycopy(this.pipelineValidityObjects, 0,
+ copy, 0, copy.length);
+ this.pipelineValidityObjects = copy;
+ len = this.pipelineValidityObjects.length;
+ } else {
+ this.pipelineCacheKey = null;
+ this.pipelineValidityObjects = null;
+ len = 0;
}
+ } else {
+ this.pipelineValidityObjects[i] = validity;
}
- this.pipelineValidityObjects[i] = validity;
+ i++;
}
}
}
@@ -663,7 +682,7 @@
} else {
CacheValidity cv =
((Cacheable)super.reader).generateValidity();
if ( cv != null ) {
- readerValidity = new CacheValidityToSourceValidity(
cv );
+ readerValidity =
CacheValidityToSourceValidity.createValidity( cv );
}
}
if (readerValidity != null) {
@@ -703,7 +722,7 @@
} else {
CacheValidity cv =
((Cacheable)super.reader).generateValidity();
if ( cv != null ) {
- readerValidity = new CacheValidityToSourceValidity(
cv );
+ readerValidity =
CacheValidityToSourceValidity.createValidity( cv );
}
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]