localXMLSerializer = this.xmlSerializer;
}
if ( this.cachedResponse == null ) {
XMLProducer prev = super.generator;
XMLConsumer next;
int cacheableTransformerCount = this.firstNotCacheableTransformerIndex;
int currentTransformerIndex = 0; //start with the first transformer
Iterator itt = this.transformers.iterator();
while ( itt.hasNext() ) {
next = (XMLConsumer) itt.next();
// if we have cacheable transformers,
// check the tranformers for cachepoints
if (cacheableTransformerCount > 0) {
if ( (this.isCachePoint.get(currentTransformerIndex) != null) &&
((Boolean)this.isCachePoint.get(currentTransformerIndex)).booleanValue()) {
cachePointXMLSerializer = ((XMLSerializer)
this.manager.lookup( XMLSerializer.ROLE ));
next = new XMLTeePipe(next, cachePointXMLSerializer);
this.xmlSerializerArray.add(cachePointXMLSerializer);
}
}
// Serializer is not cacheable,
// but we have the longest cacheable key. Do default longest key caching
if (localXMLSerializer != null) {
if (cacheableTransformerCount == 0) {
next = new XMLTeePipe(next, localXMLSerializer);
this.xmlSerializerArray.add(localXMLSerializer);
localXMLSerializer = null;
} else {
cacheableTransformerCount--;
}
}
this.connect(environment, prev, next);
prev = (XMLProducer) next;
currentTransformerIndex++;
}
next = super.lastConsumer;
// if the serializer is not cacheable, but all the transformers are:
// (this is default longest key caching)
if (localXMLSerializer != null) {
next = new XMLTeePipe(next, localXMLSerializer);
this.xmlSerializerArray.add(localXMLSerializer);
localXMLSerializer = null;
}
// else if the serializer is cacheable and has cocoon views
else if ((currentTransformerIndex == this.firstNotCacheableTransformerIndex) &&
this.nextIsCachePoint) {
cachePointXMLSerializer = ((XMLSerializer)this.manager.lookup( XMLSerializer.ROLE ));
next = new XMLTeePipe(next, cachePointXMLSerializer);
this.xmlSerializerArray.add(cachePointXMLSerializer);
}
this.connect(environment, prev, next);
} else {
// Here the first part of the pipeline has been retrived from cache
// we now check if any part of the rest of the pipeline can be cached
this.xmlDeserializer = (XMLDeserializer)this.manager.lookup(XMLDeserializer.ROLE);
// connect the pipeline:
XMLProducer prev = xmlDeserializer;
XMLConsumer next;
int cacheableTransformerCount = 0;
Iterator itt = this.transformers.iterator();
while ( itt.hasNext() ) {
next = (XMLConsumer) itt.next();