Author: vgritsenko
Date: Fri Mar 11 13:18:58 2005
New Revision: 157160
URL: http://svn.apache.org/viewcvs?view=rev&rev=157160
Log:
whitespaces / formatting
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java?view=diff&r1=157159&r2=157160
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
Fri Mar 11 13:18:58 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -46,10 +46,9 @@
* @since 2.1
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Melhem</a>
- * @version CVS $Id$
+ * @version $Id$
*/
-public abstract class AbstractCachingProcessingPipeline
- extends BaseCachingProcessingPipeline {
+public abstract class AbstractCachingProcessingPipeline extends
BaseCachingProcessingPipeline {
/** The role name of the generator */
protected String generatorRole;
@@ -64,28 +63,33 @@
protected String readerRole;
/** The cached response */
- protected CachedResponse cachedResponse;
+ protected CachedResponse cachedResponse;
/** The index indicating the first transformer getting input from the
cache */
protected int firstProcessedTransformerIndex;
+
/** Complete response is cached */
protected boolean completeResponseIsCached;
/** This key indicates the response that is fetched from the cache */
protected PipelineCacheKey fromCacheKey;
+
/** This key indicates the response that will get into the cache */
protected PipelineCacheKey toCacheKey;
+
/** The source validities used for caching */
protected SourceValidity[] toCacheSourceValidities;
/** The index indicating to the first transformer which is not cacheable */
protected int firstNotCacheableTransformerIndex;
+
/** Cache complete response */
protected boolean cacheCompleteResponse;
/** Smart caching ? */
protected boolean doSmartCaching;
+
/** Default setting for smart caching */
protected boolean configuredDoSmartCaching;
@@ -93,11 +97,15 @@
* Abstract methods defined in subclasses
*/
protected abstract void cacheResults(Environment environment,
- OutputStream os) throws Exception;
+ OutputStream os)
+ throws Exception;
+
protected abstract ComponentCacheKey newComponentCacheKey(int type,
- String role,Serializable key);
- protected abstract void connectCachingPipeline(Environment environment)
- throws ProcessingException;
+ String role,
+ Serializable
key);
+
+ protected abstract void connectCachingPipeline(Environment environment)
+ throws ProcessingException;
/**
* Parameterizable Interface - Configuration
@@ -105,8 +113,7 @@
public void parameterize(Parameters params)
throws ParameterException {
super.parameterize(params);
- this.configuredDoSmartCaching =
- params.getParameterAsBoolean("smart-caching", true);
+ this.configuredDoSmartCaching =
params.getParameterAsBoolean("smart-caching", true);
}
/**
@@ -115,14 +122,14 @@
public void setup(Parameters params) {
super.setup(params);
this.doSmartCaching = params.getParameterAsBoolean("smart-caching",
- this.configuredDoSmartCaching);
+
this.configuredDoSmartCaching);
}
/**
* Set the generator.
*/
public void setGenerator (String role, String source, Parameters param,
- Parameters hintParam)
+ Parameters hintParam)
throws ProcessingException {
super.setGenerator(role, source, param, hintParam);
this.generatorRole = role;
@@ -132,17 +139,18 @@
* Add a transformer.
*/
public void addTransformer (String role, String source, Parameters param,
- Parameters hintParam) throws ProcessingException {
+ Parameters hintParam)
+ throws ProcessingException {
super.addTransformer(role, source, param, hintParam);
this.transformerRoles.add(role);
}
-
/**
* Set the serializer.
*/
public void setSerializer (String role, String source, Parameters param,
- Parameters hintParam, String mimeType) throws ProcessingException {
+ Parameters hintParam, String mimeType)
+ throws ProcessingException {
super.setSerializer(role, source, param, hintParam, mimeType);
this.serializerRole = role;
}
@@ -151,7 +159,8 @@
* Set the Reader.
*/
public void setReader (String role, String source, Parameters param,
- String mimeType) throws ProcessingException {
+ String mimeType)
+ throws ProcessingException {
super.setReader(role, source, param, mimeType);
this.readerRole = role;
}
@@ -200,7 +209,6 @@
try {
OutputStream os = null;
-
if (this.cacheCompleteResponse && this.toCacheKey != null) {
os = new
CachingOutputStream(environment.getOutputStream(this.outputBufferSize));
}
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java?view=diff&r1=157159&r2=157160
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java
Fri Mar 11 13:18:58 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 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.
@@ -31,17 +31,17 @@
*
* @since 2.1
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: BaseCachingProcessingPipeline.java,v 1.3 2004/07/15
12:49:50 sylvain Exp $
+ * @version $Id$
*/
-public abstract class BaseCachingProcessingPipeline
- extends AbstractProcessingPipeline
- implements Disposable {
+public abstract class BaseCachingProcessingPipeline extends
AbstractProcessingPipeline
+ implements Disposable {
/** This is the Cache holding cached responses */
protected Cache cache;
/** The deserializer */
protected XMLDeserializer xmlDeserializer;
+
/** The serializer */
protected XMLSerializer xmlSerializer;
@@ -51,27 +51,27 @@
public void parameterize(Parameters params)
throws ParameterException {
super.parameterize(params);
-
+
String cacheRole = params.getParameter("cache-role", Cache.ROLE);
- if ( this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("Using cache " + cacheRole);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Using cache " + cacheRole);
}
-
+
try {
- this.cache = (Cache)this.manager.lookup(cacheRole);
+ this.cache = (Cache) this.manager.lookup(cacheRole);
} catch (ServiceException ce) {
throw new ParameterException("Unable to lookup cache: " +
cacheRole, ce);
}
}
-
+
/**
* Recyclable Interface
*/
public void recycle() {
- this.manager.release( this.xmlDeserializer );
+ this.manager.release(this.xmlDeserializer);
this.xmlDeserializer = null;
- this.manager.release( this.xmlSerializer );
+ this.manager.release(this.xmlSerializer);
this.xmlSerializer = null;
super.recycle();
@@ -81,7 +81,7 @@
* Disposable Interface
*/
public void dispose() {
- if ( null != this.manager ) {
+ if (null != this.manager) {
this.manager.release(this.cache);
}
this.cache = null;
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java?view=diff&r1=157159&r2=157160
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java
Fri Mar 11 13:18:58 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -37,10 +37,9 @@
*
* @since 2.1
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
*/
-public class CachingProcessingPipeline
- extends AbstractCachingProcessingPipeline {
+public class CachingProcessingPipeline extends
AbstractCachingProcessingPipeline {
/**
* Cache longest cacheable key
@@ -49,100 +48,101 @@
if (this.toCacheKey != null) {
// See if there is an expires object for this resource.
Long expiresObj = (Long)
environment.getObjectModel().get(ObjectModelHelper.EXPIRES_OBJECT);
- if ( this.cacheCompleteResponse ) {
- CachedResponse response = new
CachedResponse(this.toCacheSourceValidities,
-
((CachingOutputStream)os).getContent(),
- expiresObj);
+
+ CachedResponse response;
+ if (this.cacheCompleteResponse) {
+ response = new CachedResponse(this.toCacheSourceValidities,
+ ((CachingOutputStream)
os).getContent(),
+ expiresObj);
response.setContentType(environment.getContentType());
- this.cache.store(this.toCacheKey,
- response);
} else {
- CachedResponse response = new
CachedResponse(this.toCacheSourceValidities,
-
(byte[])this.xmlSerializer.getSAXFragment(),
- expiresObj);
- this.cache.store(this.toCacheKey,
- response);
+ response = new CachedResponse(this.toCacheSourceValidities,
+ (byte[])
this.xmlSerializer.getSAXFragment(),
+ expiresObj);
}
+
+ this.cache.store(this.toCacheKey, response);
}
}
/**
- * create a new cache key
+ * Create a new cache key
*/
protected ComponentCacheKey newComponentCacheKey(int type, String
role,Serializable key) {
return new ComponentCacheKey(type, role, key);
}
-
/**
* Connect the pipeline.
*/
protected void connectCachingPipeline(Environment environment)
throws ProcessingException {
- try {
- XMLSerializer localXMLSerializer = null;
- if (!this.cacheCompleteResponse) {
- this.xmlSerializer = (XMLSerializer)this.manager.lookup(
XMLSerializer.ROLE );
- localXMLSerializer = this.xmlSerializer;
- }
+ try {
+ XMLSerializer localXMLSerializer = null;
+ if (!this.cacheCompleteResponse) {
+ this.xmlSerializer = (XMLSerializer)
this.manager.lookup(XMLSerializer.ROLE);
+ localXMLSerializer = this.xmlSerializer;
+ }
- if (this.cachedResponse == null) {
- XMLProducer prev = super.generator;
- XMLConsumer next;
-
- int cacheableTransformerCount =
this.firstNotCacheableTransformerIndex;
-
- Iterator itt = this.transformers.iterator();
- while ( itt.hasNext() ) {
- next = (XMLConsumer) itt.next();
- if (localXMLSerializer != null) {
- if (cacheableTransformerCount == 0) {
- next = new XMLTeePipe(next,
localXMLSerializer);
- localXMLSerializer = null;
- } else {
- cacheableTransformerCount--;
- }
- }
- this.connect(environment, prev, next);
- prev = (XMLProducer) next;
- }
- next = super.lastConsumer;
+ if (this.cachedResponse == null) {
+ XMLProducer prev = super.generator;
+ XMLConsumer next;
+
+ int cacheableTransformerCount =
this.firstNotCacheableTransformerIndex;
+
+ Iterator itt = this.transformers.iterator();
+ while (itt.hasNext()) {
+ next = (XMLConsumer) itt.next();
if (localXMLSerializer != null) {
- next = new XMLTeePipe(next, localXMLSerializer);
- localXMLSerializer = null;
- }
- this.connect(environment, prev, next);
- } else {
- 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();
- if (cacheableTransformerCount >=
this.firstProcessedTransformerIndex) {
- if (localXMLSerializer != null
- && cacheableTransformerCount ==
this.firstNotCacheableTransformerIndex) {
- next = new XMLTeePipe(next,
localXMLSerializer);
- localXMLSerializer = null;
- }
- this.connect(environment, prev, next);
- prev = (XMLProducer)next;
+ if (cacheableTransformerCount == 0) {
+ next = new XMLTeePipe(next, localXMLSerializer);
+ localXMLSerializer = null;
+ } else {
+ cacheableTransformerCount--;
}
- cacheableTransformerCount++;
}
- next = super.lastConsumer;
- if (localXMLSerializer != null) {
- next = new XMLTeePipe(next, localXMLSerializer);
- localXMLSerializer = null;
+ connect(environment, prev, next);
+ prev = (XMLProducer) next;
+ }
+
+ next = super.lastConsumer;
+ if (localXMLSerializer != null) {
+ next = new XMLTeePipe(next, localXMLSerializer);
+ localXMLSerializer = null;
+ }
+ connect(environment, prev, next);
+ } else {
+ 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();
+ if (cacheableTransformerCount >=
this.firstProcessedTransformerIndex) {
+ if (localXMLSerializer != null
+ && cacheableTransformerCount ==
this.firstNotCacheableTransformerIndex) {
+ next = new XMLTeePipe(next, localXMLSerializer);
+ localXMLSerializer = null;
+ }
+ connect(environment, prev, next);
+ prev = (XMLProducer) next;
}
- this.connect(environment, prev, next);
+ cacheableTransformerCount++;
}
- } catch ( ServiceException e ) {
- throw new ProcessingException("Could not connect pipeline.",
e);
+ next = super.lastConsumer;
+ if (localXMLSerializer != null) {
+ next = new XMLTeePipe(next, localXMLSerializer);
+ localXMLSerializer = null;
+ }
+ connect(environment, prev, next);
}
- }
+ } catch (ServiceException e) {
+ throw new ProcessingException("Could not connect pipeline.", e);
+ }
+ }
}