Author: ilgrosso
Date: Tue Nov 27 12:41:54 2012
New Revision: 1414157
URL: http://svn.apache.org/viewvc?rev=1414157&view=rev
Log:
White noise (reformatting + @Override), please ignore
Modified:
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AsyncCachePipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/PipelineException.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/ProcessingException.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/SetupException.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineComponentBuilder.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineConfigurationBuilder.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineSetupBuilder.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineStarterBuilder.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/PipelineBuilder.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCache.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheValue.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CacheRefreshManagerImpl.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheValue.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachingOutputStream.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompoundCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ExpiresCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheValue.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ParameterCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/SimpleCache.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/SimpleCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/TimestampCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/URLListCacheKey.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/AbstractPipelineComponent.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/util/StringRepresentation.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/util/URLConnectionUtils.java
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java Tue Nov 27 12:41:54 2012
@@ -22,7 +22,6 @@ import java.io.OutputStream;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map;
-
import org.apache.cocoon.pipeline.component.Consumer;
import org.apache.cocoon.pipeline.component.Finisher;
import org.apache.cocoon.pipeline.component.PipelineComponent;
@@ -33,17 +32,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Basic pipeline implementation that collects the {@link PipelineComponent}s
- * and connects them with each other.
+ * Basic pipeline implementation that collects the {@link PipelineComponent}s and connects them with each other.
*/
public abstract class AbstractPipeline<T extends PipelineComponent> implements Pipeline<T> {
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(AbstractPipeline.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractPipeline.class);
+
private final LinkedList<T> components = new LinkedList<T>();
private boolean setupDone;
@@ -53,15 +50,14 @@ public abstract class AbstractPipeline<T
*
* @see org.apache.cocoon.pipeline.Pipeline#addComponent(org.apache.cocoon.pipeline.component.PipelineComponent)
*/
- public void addComponent(T pipelineComponent) {
+ @Override
+ public void addComponent(final T pipelineComponent) {
if (this.setupDone) {
throw new SetupException(new IllegalStateException(
"Pass all pipeline components to the pipeline before calling this method."));
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Adding component " + pipelineComponent + " to pipeline [" + this + "].");
- }
+ LOG.debug("Adding component " + pipelineComponent + " to pipeline [" + this + "].");
this.components.add(pipelineComponent);
}
@@ -71,6 +67,7 @@ public abstract class AbstractPipeline<T
*
* @see org.apache.cocoon.pipeline.Pipeline#execute()
*/
+ @Override
public void execute() throws Exception {
if (!this.setupDone) {
throw new ProcessingException(new IllegalStateException(
@@ -85,10 +82,12 @@ public abstract class AbstractPipeline<T
*
* @see org.apache.cocoon.pipeline.Pipeline#getContentType()
*/
+ @Override
public String getContentType() {
return this.getFinisher().getContentType();
}
+ @Override
public long getLastModified() {
return -1;
}
@@ -98,6 +97,7 @@ public abstract class AbstractPipeline<T
*
* @see org.apache.cocoon.pipeline.Pipeline#setConfiguration(java.util.Map)
*/
+ @Override
public void setConfiguration(Map<String, ? extends Object> parameters) {
// do nothing
}
@@ -105,9 +105,9 @@ public abstract class AbstractPipeline<T
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.pipeline.Pipeline#setup(java.io.OutputStream,
- * java.util.Map)
+ * @see org.apache.cocoon.pipeline.Pipeline#setup(java.io.OutputStream, java.util.Map)
*/
+ @Override
public void setup(OutputStream outputStream) {
this.setup(outputStream, null);
}
@@ -115,10 +115,10 @@ public abstract class AbstractPipeline<T
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.pipeline.Pipeline#setup(java.io.OutputStream,
- * java.util.Map)
+ * @see org.apache.cocoon.pipeline.Pipeline#setup(java.io.OutputStream, java.util.Map)
*/
- public void setup(OutputStream outputStream, Map<String, Object> parameters) {
+ @Override
+ public void setup(final OutputStream outputStream, final Map<String, Object> parameters) {
if (outputStream == null) {
throw new SetupException("An output stream must be passed.");
}
@@ -141,12 +141,10 @@ public abstract class AbstractPipeline<T
}
protected void invokeStarter() {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Invoking first component of " + this);
- }
+ LOG.debug("Invoking first component of " + this);
try {
- Starter starter = (Starter) this.components.getFirst();
+ final Starter starter = (Starter) this.components.getFirst();
starter.execute();
} finally {
for (PipelineComponent pipelineComponent : this.getComponents()) {
@@ -155,20 +153,20 @@ public abstract class AbstractPipeline<T
}
}
- protected void setupComponents(OutputStream outputStream, Map<String, Object> parameters) {
- PipelineComponent first = this.components.getFirst();
+ protected void setupComponents(final OutputStream outputStream, final Map<String, Object> parameters) {
+ final PipelineComponent first = this.components.getFirst();
// first component must be a Starter
if (!(first instanceof Starter)) {
- String msg = "Cannot execute pipeline, first pipeline component is no starter";
+ final String msg = "Cannot execute pipeline, first pipeline component is no starter";
LOG.error(msg);
throw new SetupException(new IllegalStateException(msg));
}
// last component must be a Finisher
- PipelineComponent last = this.components.getLast();
+ final PipelineComponent last = this.components.getLast();
if (!(last instanceof Finisher)) {
- String msg = "Cannot execute pipeline, last pipeline component is no finisher";
+ final String msg = "Cannot execute pipeline, last pipeline component is no finisher";
LOG.error(msg);
throw new SetupException(new IllegalStateException(msg));
}
@@ -179,9 +177,9 @@ public abstract class AbstractPipeline<T
first.setup(parameters);
// next component to link is the second in the list
- for (ListIterator<T> i = this.components.listIterator(1); i.hasNext();) {
+ for (final ListIterator<T> itor = this.components.listIterator(1); itor.hasNext();) {
// link the current with the next component
- PipelineComponent nextComponent = i.next();
+ PipelineComponent nextComponent = itor.next();
this.linkComponents(currentComponent, nextComponent);
// now advance to the next component
@@ -193,20 +191,18 @@ public abstract class AbstractPipeline<T
((Finisher) last).setOutputStream(outputStream);
}
- private void linkComponents(PipelineComponent firstComponent, PipelineComponent secondComponent) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Going to link the component " + firstComponent + " with " + secondComponent + ".");
- }
+ private void linkComponents(final PipelineComponent firstComponent, final PipelineComponent secondComponent) {
+ LOG.debug("Going to link the component " + firstComponent + " with " + secondComponent + ".");
// first component must be a Producer
if (!(firstComponent instanceof Producer)) {
- String msg = "Cannot link components: First component (" + firstComponent + ") is no producer.";
+ final String msg = "Cannot link components: First component (" + firstComponent + ") is no producer.";
throw new SetupException(new IllegalStateException(msg));
}
// second component must be a Consumer
if (!(secondComponent instanceof Consumer)) {
- String msg = "Cannot link components: Second component (" + secondComponent + ") is no consumer.";
+ final String msg = "Cannot link components: Second component (" + secondComponent + ") is no consumer.";
throw new SetupException(new IllegalStateException(msg));
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AsyncCachePipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AsyncCachePipeline.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AsyncCachePipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AsyncCachePipeline.java Tue Nov 27 12:41:54 2012
@@ -19,7 +19,6 @@
package org.apache.cocoon.pipeline;
import java.io.ByteArrayOutputStream;
-
import org.apache.cocoon.pipeline.caching.CacheKey;
import org.apache.cocoon.pipeline.caching.CacheRefreshJob;
import org.apache.cocoon.pipeline.caching.CacheRefreshManager;
@@ -30,25 +29,23 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * <p>
- * This {@link Pipeline} basically works like the {@link CachingPipeline}. The only difference is that when the cached
- * result isn't valid anymore, the refresh is done in a separate thread. This means that the re-production of the result
- * doesn't block the initial request. The disadvantage of this approach is that until the result is being reproduced, an
- * out-dated result is returned. If this is out of question for a use case, the {@link CachingPipeline} has to be used.
- * </p>
+ * This {@link Pipeline} basically works like the {@link CachingPipeline}. <p>The only difference is that when the
+ * cached result isn't valid anymore, the refresh is done in a separate thread. This means that the re-production of the
+ * result doesn't block the initial request. The disadvantage of this approach is that until the result is being
+ * reproduced, an out-dated result is returned. If this is out of question for a use case, the {@link CachingPipeline}
+ * has to be used. </p>
*/
public class AsyncCachePipeline<T extends PipelineComponent> extends CachingPipeline<T> implements CacheRefreshJob {
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(AsyncCachePipeline.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AsyncCachePipeline.class);
/**
* The component that does the refresh in a separate thread.
*/
- private CacheRefreshManager cacheRefreshManager;
+ private CacheRefreshManager cacheRefMan;
/**
* {@inheritDoc}
@@ -57,28 +54,22 @@ public class AsyncCachePipeline<T extend
*/
@Override
public void execute() throws Exception {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Used cache: " + this.cache);
- }
+ LOG.debug("Used cache: " + this.cache);
// construct the current cache key
this.cacheKey = this.constructCacheKey();
// check for a cached value first
- CacheValue cachedValue = this.getCachedValue(this.cacheKey);
+ final CacheValue cachedValue = this.getCachedValue(this.cacheKey);
if (cachedValue != null) {
// cached value found -> write it
- if (LOG.isDebugEnabled()) {
- LOG.debug("Write cache value to output stream: " + cachedValue);
- }
+ LOG.debug("Write cache value to output stream: " + cachedValue);
cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
if (!this.isCacheKeyValid(cachedValue)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
- }
+ LOG.debug("Cached value is not up to date. Delegating to " + this.cacheRefMan);
// the cached value is not valid -> refresh the value
- this.cacheRefreshManager.refreshCacheValue(this.cacheKey, this);
+ this.cacheRefMan.refreshCacheValue(this.cacheKey, this);
}
// stop here
return;
@@ -87,12 +78,13 @@ public class AsyncCachePipeline<T extend
// no cached value (not even an invalid one) was present -> execute the pipeline
this.invokeStarter();
// cache the result
- CompleteCacheValue cacheValue = new CompleteCacheValue(this.cachingOutputStream.getContent(), this.cacheKey);
+ final CompleteCacheValue cacheValue = new CompleteCacheValue(this.cachingOutputStream.getContent(),
+ this.cacheKey);
this.setCachedValue(this.cacheKey, cacheValue);
}
public CacheRefreshManager getCacheRefreshManager() {
- return this.cacheRefreshManager;
+ return this.cacheRefMan;
}
/**
@@ -100,8 +92,9 @@ public class AsyncCachePipeline<T extend
*
* @see org.apache.cocoon.pipeline.caching.CacheRefreshJob#refresh(org.apache.cocoon.pipeline.caching.CacheKey)
*/
- public void refresh(CacheKey cacheKey) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ @Override
+ public void refresh(final CacheKey cacheKey) {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
this.getFinisher().setOutputStream(baos);
// execute the pipeline
@@ -110,7 +103,7 @@ public class AsyncCachePipeline<T extend
this.setCachedValue(cacheKey, new CompleteCacheValue(baos.toByteArray(), cacheKey));
}
- public void setCacheRefreshManager(CacheRefreshManager cacheRefreshManager) {
- this.cacheRefreshManager = cacheRefreshManager;
+ public void setCacheRefreshManager(final CacheRefreshManager cacheRefMan) {
+ this.cacheRefMan = cacheRefMan;
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java Tue Nov 27 12:41:54 2012
@@ -35,10 +35,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * <p>
- * A {@link Pipeline} implementation that returns a cached result if, and only
- * if all its components support caching. A {@link PipelineComponent} is
- * cacheable if it implements the interface {@link CachingPipelineComponent}.
+ * <p> A {@link Pipeline} implementation that returns a cached result if, and only if all its components support
+ * caching. A {@link PipelineComponent} is cacheable if it implements the interface {@link CachingPipelineComponent}.
* </p>
*/
public class CachingPipeline<T extends PipelineComponent> extends AbstractPipeline<T> {
@@ -46,42 +44,38 @@ public class CachingPipeline<T extends P
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(CachingPipeline.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(CachingPipeline.class);
+
protected Cache cache;
protected CacheKey cacheKey;
protected CachingOutputStream cachingOutputStream;
- /** Expires time in seconds */
+ /**
+ * Expires time in seconds
+ */
private String expires;
/**
- * Expires pipelines that have non-cacheable pipeline components require an
- * explicit cache key
+ * Expires pipelines that have non-cacheable pipeline components require an explicit cache key
*/
private Serializable expiresCacheKey;
private String jmxGroupName;
protected CacheKey constructCacheKey() {
- CompoundCacheKey result = new CompoundCacheKey();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Creating " + result + ": ");
- }
+ final CompoundCacheKey result = new CompoundCacheKey();
+ LOG.debug("Creating " + result + ": ");
for (PipelineComponent pipelineComponent : this.getComponents()) {
if (pipelineComponent instanceof CachingPipelineComponent) {
- CachingPipelineComponent cachablePipelineComponent = (CachingPipelineComponent) pipelineComponent;
+ final CachingPipelineComponent cachablePipelineComponent = (CachingPipelineComponent) pipelineComponent;
- CacheKey cacheKey = cachablePipelineComponent.constructCacheKey();
+ final CacheKey cacheKey = cachablePipelineComponent.constructCacheKey();
if (cacheKey != null) {
result.addCacheKey(cacheKey);
- if (LOG.isDebugEnabled()) {
- LOG.debug(" ~ adding " + cacheKey + " for component " + pipelineComponent);
- }
+ LOG.debug(" ~ adding " + cacheKey + " for component " + pipelineComponent);
continue;
}
@@ -89,54 +83,41 @@ public class CachingPipeline<T extends P
// support expires caching
if (this.expires != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" ~ adding " + ExpiresCacheKey.class.getSimpleName() + " for component: "
- + pipelineComponent + " (the component doesn't support caching "
- + "but expires caching is activated)");
- }
+ LOG.debug(" ~ adding " + ExpiresCacheKey.class.getSimpleName() + " for component: "
+ + pipelineComponent + " (the component doesn't support caching "
+ + "but expires caching is activated)");
return new ExpiresCacheKey(new InvalidCacheKey(this.expiresCacheKey), this.expires);
}
// component does not support caching
- if (LOG.isDebugEnabled()) {
- LOG.debug(" ~ no caching: " + pipelineComponent);
- LOG.debug("Aborting cache key construction");
- }
+ LOG.debug(" ~ no caching: " + pipelineComponent);
+ LOG.debug("Aborting cache key construction");
return null;
}
// support expires caching
if (this.expires != null) {
- CacheKey expiresCacheKey = new ExpiresCacheKey(result, this.expires);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Creating " + expiresCacheKey + " for pipeline " + this);
- }
+ final CacheKey expiresCacheKey = new ExpiresCacheKey(result, this.expires);
+ LOG.debug("Creating " + expiresCacheKey + " for pipeline " + this);
return expiresCacheKey;
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Creating " + result + " for pipeline " + this);
- }
+ LOG.debug("Creating " + result + " for pipeline " + this);
return result;
}
@Override
public void execute() throws Exception {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Used cache: " + this.cache);
- }
+ LOG.debug("Used cache: " + this.cache);
// checked for a cached value first
- CacheValue cachedValue = this.getCachedValue(this.cacheKey);
+ final CacheValue cachedValue = this.getCachedValue(this.cacheKey);
if (this.isCacheKeyValid(cachedValue)) {
// cached value found
- if (LOG.isDebugEnabled()) {
- LOG.debug("Write cache value to output stream: " + cachedValue);
- }
+ LOG.debug("Write cache value to output stream: " + cachedValue);
cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
return;
@@ -146,7 +127,8 @@ public class CachingPipeline<T extends P
this.invokeStarter();
// cache the result
- CompleteCacheValue cacheValue = new CompleteCacheValue(this.cachingOutputStream.getContent(), this.cacheKey);
+ final CompleteCacheValue cacheValue =
+ new CompleteCacheValue(this.cachingOutputStream.getContent(), this.cacheKey);
this.setCachedValue(this.cacheKey, cacheValue);
}
@@ -167,7 +149,7 @@ public class CachingPipeline<T extends P
return this.cacheKey.getLastModified();
}
- public void setCache(Cache cache) {
+ public void setCache(final Cache cache) {
this.cache = cache;
}
@@ -177,7 +159,7 @@ public class CachingPipeline<T extends P
* @see org.apache.cocoon.pipeline.AbstractPipeline#setConfiguration(java.util.Map)
*/
@Override
- public void setConfiguration(Map<String, ? extends Object> parameters) {
+ public void setConfiguration(final Map<String, ? extends Object> parameters) {
this.expires = (String) parameters.get("expires");
this.expiresCacheKey = (Serializable) parameters.get("expires-cache-key");
this.jmxGroupName = (String) parameters.get("jmx-group-name");
@@ -185,16 +167,16 @@ public class CachingPipeline<T extends P
super.setConfiguration(parameters);
}
- public void setExpires(String expires) {
+ public void setExpires(final String expires) {
this.expires = expires;
}
- public void setExpiresCacheKey(Serializable expiresCacheKey) {
+ public void setExpiresCacheKey(final Serializable expiresCacheKey) {
this.expiresCacheKey = expiresCacheKey;
}
@Override
- public void setup(OutputStream outputStream, Map<String, Object> parameters) {
+ public void setup(final OutputStream outputStream, final Map<String, Object> parameters) {
// create a caching output stream to intercept the result
this.cachingOutputStream = new CachingOutputStream(outputStream);
@@ -203,7 +185,7 @@ public class CachingPipeline<T extends P
this.cacheKey = this.constructCacheKey();
}
- protected CacheValue getCachedValue(CacheKey cacheKey) {
+ protected CacheValue getCachedValue(final CacheKey cacheKey) {
if (cacheKey == null) {
return null;
}
@@ -213,22 +195,20 @@ public class CachingPipeline<T extends P
return null;
}
- CacheValue cacheValue = this.cache.get(cacheKey, true);
- if (LOG.isDebugEnabled()) {
- if (cacheValue != null) {
- LOG.debug("Retrieved content from cache: " + cacheValue);
- } else {
- LOG.debug("No cache value available for " + cacheKey);
- }
+ final CacheValue cacheValue = this.cache.get(cacheKey, true);
+ if (cacheValue == null) {
+ LOG.debug("No cache value available for " + cacheKey);
+ } else {
+ LOG.debug("Retrieved content from cache: " + cacheValue);
}
return cacheValue;
}
- protected boolean isCacheKeyValid(CacheValue cachedValue) {
+ protected boolean isCacheKeyValid(final CacheValue cachedValue) {
return cachedValue != null && cachedValue.isValid(this.cacheKey);
}
- protected void setCachedValue(CacheKey cacheKey, CacheValue cacheValue) {
+ protected void setCachedValue(final CacheKey cacheKey, final CacheValue cacheValue) {
if (cacheKey == null) {
return;
}
@@ -238,9 +218,7 @@ public class CachingPipeline<T extends P
return;
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Putting result into pipeline cache: " + cacheValue + ")");
- }
+ LOG.debug("Putting result into pipeline cache: " + cacheValue + ")");
cacheKey.setJmxGroupName(this.jmxGroupName);
this.cache.put(cacheKey, cacheValue);
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java Tue Nov 27 12:41:54 2012
@@ -20,7 +20,6 @@ package org.apache.cocoon.pipeline;
import java.io.OutputStream;
import java.util.Map;
-
import org.apache.cocoon.pipeline.component.Consumer;
import org.apache.cocoon.pipeline.component.Finisher;
import org.apache.cocoon.pipeline.component.PipelineComponent;
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/PipelineException.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/PipelineException.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/PipelineException.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/PipelineException.java Tue Nov 27 12:41:54 2012
@@ -1,38 +1,40 @@
/*
- * 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
+ * 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.
+ * 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.pipeline;
public class PipelineException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -1776184186366191515L;
public PipelineException() {
super();
}
- public PipelineException(String message) {
+ public PipelineException(final String message) {
super(message);
}
- public PipelineException(Throwable cause) {
+ public PipelineException(final Throwable cause) {
super(cause);
}
- public PipelineException(String message, Throwable cause) {
+ public PipelineException(final String message, final Throwable cause) {
super(message, cause);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/ProcessingException.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/ProcessingException.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/ProcessingException.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/ProcessingException.java Tue Nov 27 12:41:54 2012
@@ -1,18 +1,20 @@
/*
- * 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
+ * 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.
+ * 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.pipeline;
@@ -21,21 +23,21 @@ package org.apache.cocoon.pipeline;
*/
public class ProcessingException extends PipelineException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3063183626136885800L;
public ProcessingException() {
super();
}
- public ProcessingException(String message, Throwable cause) {
+ public ProcessingException(final String message, final Throwable cause) {
super(message, cause);
}
- public ProcessingException(String message) {
+ public ProcessingException(final String message) {
super(message);
}
- public ProcessingException(Throwable cause) {
+ public ProcessingException(final Throwable cause) {
super(cause);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/SetupException.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/SetupException.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/SetupException.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/SetupException.java Tue Nov 27 12:41:54 2012
@@ -1,18 +1,20 @@
/*
- * 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
+ * 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.
+ * 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.pipeline;
@@ -21,21 +23,21 @@ package org.apache.cocoon.pipeline;
*/
public class SetupException extends PipelineException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3171467101256783514L;
public SetupException() {
super();
}
- public SetupException(String message, Throwable cause) {
+ public SetupException(final String message, final Throwable cause) {
super(message, cause);
}
- public SetupException(String message) {
+ public SetupException(final String message) {
super(message);
}
- public SetupException(Throwable cause) {
+ public SetupException(final Throwable cause) {
super(cause);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineComponentBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineComponentBuilder.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineComponentBuilder.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineComponentBuilder.java Tue Nov 27 12:41:54 2012
@@ -18,16 +18,9 @@ package org.apache.cocoon.pipeline.build
import org.apache.cocoon.pipeline.component.PipelineComponent;
-/**
- *
- *
- * @param <PC> the {@link PipelineComponent} type.
- * @version $Id$
- */
public interface LinkedPipelineComponentBuilder<PC extends PipelineComponent> {
LinkedPipelineComponentBuilder<PC> addComponent(PC pipelineComponent);
LinkedPipelineConfigurationBuilder<PC> setFinisher(PC finisher);
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineConfigurationBuilder.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineConfigurationBuilder.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineConfigurationBuilder.java Tue Nov 27 12:41:54 2012
@@ -17,19 +17,11 @@
package org.apache.cocoon.pipeline.builder;
import java.util.Map;
-
import org.apache.cocoon.pipeline.component.PipelineComponent;
-/**
- *
- *
- * @param <PC> the {@link PipelineComponent} type.
- * @version $Id$
- */
public interface LinkedPipelineConfigurationBuilder<PC extends PipelineComponent> {
LinkedPipelineSetupBuilder<PC> withEmptyConfiguration();
LinkedPipelineSetupBuilder<PC> setConfiguration(Map<String, ? extends Object> parameters);
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineSetupBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineSetupBuilder.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineSetupBuilder.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineSetupBuilder.java Tue Nov 27 12:41:54 2012
@@ -17,18 +17,10 @@
package org.apache.cocoon.pipeline.builder;
import java.io.OutputStream;
-
import org.apache.cocoon.pipeline.Pipeline;
import org.apache.cocoon.pipeline.component.PipelineComponent;
-/**
- *
- *
- * @param <PC> the {@link PipelineComponent} type.
- * @version $Id$
- */
public interface LinkedPipelineSetupBuilder<PC extends PipelineComponent> {
Pipeline<PC> setup(OutputStream outputStream);
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineStarterBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineStarterBuilder.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineStarterBuilder.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/LinkedPipelineStarterBuilder.java Tue Nov 27 12:41:54 2012
@@ -18,14 +18,7 @@ package org.apache.cocoon.pipeline.build
import org.apache.cocoon.pipeline.component.PipelineComponent;
-/**
- *
- *
- * @param <PC> the {@link PipelineComponent} type.
- * @version $Id$
- */
public interface LinkedPipelineStarterBuilder<PC extends PipelineComponent> {
LinkedPipelineComponentBuilder<PC> setStarter(PC starter);
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/PipelineBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/PipelineBuilder.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/PipelineBuilder.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/builder/PipelineBuilder.java Tue Nov 27 12:41:54 2012
@@ -19,7 +19,6 @@ package org.apache.cocoon.pipeline.build
import java.io.OutputStream;
import java.util.Collections;
import java.util.Map;
-
import org.apache.cocoon.pipeline.AsyncCachePipeline;
import org.apache.cocoon.pipeline.CachingPipeline;
import org.apache.cocoon.pipeline.NonCachingPipeline;
@@ -28,12 +27,6 @@ import org.apache.cocoon.pipeline.compon
import org.apache.cocoon.pipeline.component.PipelineComponent;
import org.apache.cocoon.pipeline.component.Starter;
-/**
- *
- *
- * @param <PC> the {@link PipelineComponent} type.
- * @version $Id$
- */
public final class PipelineBuilder {
/**
@@ -64,20 +57,25 @@ public final class PipelineBuilder {
return newPipeline(new NonCachingPipeline<PC>());
}
- private static <PC extends PipelineComponent> LinkedPipelineStarterBuilder<PC> newPipeline(final Pipeline<PC> pipeline) {
+ private static <PC extends PipelineComponent> LinkedPipelineStarterBuilder<PC> newPipeline(
+ final Pipeline<PC> pipeline) {
+
return new LinkedPipelineStarterBuilder<PC>() {
+ @Override
public LinkedPipelineComponentBuilder<PC> setStarter(final PC starter) {
if (starter == null) {
throw new IllegalArgumentException("Parameter 'starter' must be not null");
}
if (!(starter instanceof Starter)) {
- throw new IllegalArgumentException("Parameter 'starter' must be org.apache.cocoon.pipeline.component.Starter instance");
+ throw new IllegalArgumentException(
+ "Parameter 'starter' must be " + Starter.class.getName() + " instance");
}
pipeline.addComponent(starter);
return new LinkedPipelineComponentBuilder<PC>() {
+ @Override
public LinkedPipelineComponentBuilder<PC> addComponent(final PC pipelineComponent) {
if (pipelineComponent == null) {
throw new IllegalArgumentException("Parameter 'pipelineComponent' must be not null");
@@ -86,12 +84,14 @@ public final class PipelineBuilder {
return this;
}
+ @Override
public LinkedPipelineConfigurationBuilder<PC> setFinisher(final PC finisher) {
if (finisher == null) {
throw new IllegalArgumentException("Parameter 'finisher' must be not null");
}
if (!(finisher instanceof Finisher)) {
- throw new IllegalArgumentException("Parameter 'finisher' must be org.apache.cocoon.pipeline.component.Finisher instance");
+ throw new IllegalArgumentException(
+ "Parameter 'finisher' must be " + Finisher.class.getName() + " instance");
}
pipeline.addComponent(finisher);
@@ -102,7 +102,10 @@ public final class PipelineBuilder {
return this.setConfiguration(Collections.EMPTY_MAP);
}
- public LinkedPipelineSetupBuilder<PC> setConfiguration(final Map<String, ? extends Object> parameters) {
+ @Override
+ public LinkedPipelineSetupBuilder<PC> setConfiguration(
+ final Map<String, ? extends Object> parameters) {
+
if (parameters == null) {
throw new IllegalArgumentException("Parameter 'parameters' must be not null");
}
@@ -110,24 +113,21 @@ public final class PipelineBuilder {
return new LinkedPipelineSetupBuilder<PC>() {
+ @Override
public Pipeline<PC> setup(final OutputStream outputStream) {
if (outputStream == null) {
- throw new IllegalArgumentException("Parameter 'outputStream' must be not null");
+ throw new IllegalArgumentException(
+ "Parameter 'outputStream' must be not null");
}
pipeline.setup(outputStream);
return pipeline;
}
-
};
}
-
};
}
-
};
}
-
};
}
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCache.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCache.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCache.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCache.java Tue Nov 27 12:41:54 2012
@@ -21,44 +21,43 @@ package org.apache.cocoon.pipeline.cachi
import java.util.Set;
/**
- * An abstract implementation of the {@link Cache} interface.<br>
- * <br>
- * It handles the validity check for retrieving {@link CacheValue}s but relies on child classes for actually accessing the underlying
- * stores.
+ * An abstract implementation of the {@link Cache} interface.<br/><br/>It handles the validity check for retrieving
+ * {@link CacheValue}s but relies on child classes for actually accessing the underlying stores.
*/
public abstract class AbstractCache implements Cache {
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.caching.Cache#get(org.apache.cocoon.pipeline.caching.CacheKey)
*/
- public final CacheValue get(CacheKey cacheKey) {
+ @Override
+ public final CacheValue get(final CacheKey cacheKey) {
return this.get(cacheKey, false);
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.caching.Cache#get(org.apache.cocoon.pipeline.caching.CacheKey, boolean)
*/
- public final CacheValue get(CacheKey cacheKey, boolean includeInvalid) {
- CacheValue cacheValue = this.retrieve(cacheKey);
-
- if (includeInvalid || this.isValid(cacheKey, cacheValue)) {
- return cacheValue;
- }
-
- return null;
+ @Override
+ public final CacheValue get(final CacheKey cacheKey, final boolean includeInvalid) {
+ final CacheValue cacheValue = this.retrieve(cacheKey);
+
+ return includeInvalid || this.isValid(cacheKey, cacheValue)
+ ? cacheValue
+ : null;
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.caching.Cache#put(org.apache.cocoon.pipeline.caching.CacheKey,
- * org.apache.cocoon.pipeline.caching.CacheValue)
+ * org.apache.cocoon.pipeline.caching.CacheValue)
*/
- public final void put(CacheKey cacheKey, CacheValue cacheValue) {
+ @Override
+ public final void put(final CacheKey cacheKey, final CacheValue cacheValue) {
this.store(cacheKey, cacheValue);
}
@@ -67,6 +66,7 @@ public abstract class AbstractCache impl
*
* @see org.apache.cocoon.pipeline.caching.Cache#clear()
*/
+ @Override
public void clear() {
this.doClear();
}
@@ -76,7 +76,8 @@ public abstract class AbstractCache impl
*
* @see org.apache.cocoon.pipeline.caching.Cache#remove(org.apache.cocoon.pipeline.caching.CacheKey)
*/
- public boolean remove(CacheKey cacheKey) {
+ @Override
+ public boolean remove(final CacheKey cacheKey) {
return this.doRemove(cacheKey);
}
@@ -85,43 +86,47 @@ public abstract class AbstractCache impl
*
* @see org.apache.cocoon.pipeline.caching.Cache#keySet()
*/
+ @Override
public Set<CacheKey> keySet() {
return this.retrieveKeySet();
}
/**
- * Determines if the given <code>cacheValue</code> is valid according to the given <code>cacheKey</code>.<br>
- * <br>
- * This method returns <code>true</code> if and only if the given <code>cacheValue</code> is not <code>null</code> and calling
- * {@link CacheValue#isValid(CacheKey)} with the given <code>cacheKey</code> returns <code>true</code>.
+ * Determines if the given
+ * <code>cacheValue</code> is valid according to the given
+ * <code>cacheKey</code>.<br> <br> This method returns
+ * <code>true</code> if and only if the given
+ * <code>cacheValue</code> is not
+ * <code>null</code> and calling {@link CacheValue#isValid(CacheKey)} with the given
+ * <code>cacheKey</code> returns
+ * <code>true</code>.
*
* @param cacheKey The {@link CacheKey} to be used for checking the <code>cacheValue</code>'s validity.
* @param cacheValue The {@link CacheValue} to check for validity.
* @return <code>true</code> if the given <code>cacheValue</code> is not <code>null</code> and valid for the given
- * <code>cacheKey</code>.
+ * <code>cacheKey</code>.
*/
- protected boolean isValid(CacheKey cacheKey, CacheValue cacheValue) {
- if (cacheValue == null) {
- return false;
- }
-
- return cacheValue.isValid(cacheKey);
+ protected boolean isValid(final CacheKey cacheKey, final CacheValue cacheValue) {
+ return cacheValue == null
+ ? false
+ : cacheValue.isValid(cacheKey);
}
/**
- * Actually retrieves the {@link CacheValue} from the underlying storage.<br>
- * This method must return the previously stored value - even if it is not valid anymore.
- *
+ * Actually retrieves the {@link CacheValue} from the underlying storage.<br> This method must return the previously
+ * stored value - even if it is not valid anymore.
+ *
* @param cacheKey The {@link CacheKey} to be used for retrieval.
- * @return The previously stored {@link CacheValue} or <code>null</code> if no {@link CacheValue} is stored at the given
- * <code>cacheKey</code>.
+ * @return The previously stored {@link CacheValue} or <code>null</code> if no {@link CacheValue} is stored at the
+ * given <code>cacheKey</code>.
*/
protected abstract CacheValue retrieve(CacheKey cacheKey);
/**
- * Actually stores the given <code>cacheValue</code> at the given <code>cacheKey</code> in the underlying storage.<br>
- * <br>
- * This method is to replace any previously stored {@link CacheValue} (if any).
+ * Actually stores the given
+ * <code>cacheValue</code> at the given
+ * <code>cacheKey</code> in the underlying storage.<br> <br> This method is to replace any previously stored
+ * {@link CacheValue} (if any).
*
* @param cacheKey The {@link CacheKey} to be used for storing.
* @param cacheValue The {@link CacheValue} to be stored.
@@ -146,5 +151,4 @@ public abstract class AbstractCache impl
* @return The {@link Set} of {@link CacheKey} of containded data.
*/
protected abstract Set<CacheKey> retrieveKeySet();
-
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheKey.java Tue Nov 27 12:41:54 2012
@@ -18,20 +18,24 @@
*/
package org.apache.cocoon.pipeline.caching;
-@SuppressWarnings("serial")
public abstract class AbstractCacheKey implements CacheKey {
+ private static final long serialVersionUID = 6597451840279400946L;
+
private String jmxGroupName;
+ @Override
public String getJmxGroupName() {
return this.jmxGroupName;
}
+ @Override
public boolean hasJmxGroupName() {
return this.jmxGroupName != null && !this.jmxGroupName.equals("");
}
- public void setJmxGroupName(String jmxGroupName) {
+ @Override
+ public void setJmxGroupName(final String jmxGroupName) {
this.jmxGroupName = jmxGroupName;
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheValue.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheValue.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheValue.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/AbstractCacheValue.java Tue Nov 27 12:41:54 2012
@@ -20,11 +20,11 @@ package org.apache.cocoon.pipeline.cachi
public abstract class AbstractCacheValue implements CacheValue {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3328210769763633020L;
private final CacheKey cacheKey;
- protected AbstractCacheValue(CacheKey cacheKey) {
+ protected AbstractCacheValue(final CacheKey cacheKey) {
super();
this.cacheKey = cacheKey;
@@ -32,10 +32,11 @@ public abstract class AbstractCacheValue
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.caching.CacheValue#isValid(org.apache.cocoon.pipeline.caching.CacheKey)
*/
- public boolean isValid(CacheKey otherCacheKey) {
+ @Override
+ public boolean isValid(final CacheKey otherCacheKey) {
return this.cacheKey != null && this.cacheKey.isValid(otherCacheKey);
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CacheRefreshManagerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CacheRefreshManagerImpl.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CacheRefreshManagerImpl.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CacheRefreshManagerImpl.java Tue Nov 27 12:41:54 2012
@@ -23,7 +23,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-
import org.apache.cocoon.pipeline.util.StringRepresentation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,9 +32,8 @@ public class CacheRefreshManagerImpl imp
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(CacheRefreshManagerImpl.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(CacheRefreshManagerImpl.class);
+
private static final int threadPoolSize = 50;
private final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
@@ -44,16 +42,16 @@ public class CacheRefreshManagerImpl imp
/**
* {@inheritDoc}
- *
- * @see org.apache.cocoon.pipeline.caching.CacheRefreshManager#refreshCacheValue(org.apache.cocoon.pipeline.caching.CacheKey,
- * org.apache.cocoon.pipeline.caching.CacheRefreshJob)
+ *
+ * @see
+ * org.apache.cocoon.pipeline.caching.CacheRefreshManager#refreshCacheValue(org.apache.cocoon.pipeline.caching.CacheKey,
+ * org.apache.cocoon.pipeline.caching.CacheRefreshJob)
*/
- public void refreshCacheValue(CacheKey cacheKey, CacheRefreshJob cacheRefreshJob) {
+ @Override
+ public void refreshCacheValue(final CacheKey cacheKey, final CacheRefreshJob cacheRefreshJob) {
if (this.pendingCacheKeys.contains(cacheKey)) {
// the refresh of this cache key is already scheduled
- if (LOG.isDebugEnabled()) {
- LOG.debug("Refreshing of this cache key is already scheduled: " + cacheKey);
- }
+ LOG.debug("Refreshing of this cache key is already scheduled: {}", cacheKey);
return;
}
@@ -62,10 +60,8 @@ public class CacheRefreshManagerImpl imp
this.executorService.execute(new RefreshWorker(cacheKey, cacheRefreshJob));
}
- protected void executeCacheRefreshJob(CacheRefreshJob cacheRefreshJob, CacheKey cacheKey) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Execute cache refresh job for " + cacheRefreshJob);
- }
+ protected void executeCacheRefreshJob(final CacheRefreshJob cacheRefreshJob, final CacheKey cacheKey) {
+ LOG.debug("Execute cache refresh job for {}", cacheRefreshJob);
cacheRefreshJob.refresh(cacheKey);
this.pendingCacheKeys.remove(cacheKey);
@@ -74,13 +70,15 @@ public class CacheRefreshManagerImpl imp
private class RefreshWorker implements Runnable {
private final CacheKey cacheKey;
+
private final CacheRefreshJob cacheRefreshJob;
- public RefreshWorker(CacheKey cacheKey, CacheRefreshJob cacheRefreshJob) {
+ public RefreshWorker(final CacheKey cacheKey, final CacheRefreshJob cacheRefreshJob) {
this.cacheKey = cacheKey;
this.cacheRefreshJob = cacheRefreshJob;
}
+ @Override
public void run() {
CacheRefreshManagerImpl.this.executeCacheRefreshJob(this.cacheRefreshJob, this.cacheKey);
}
@@ -88,7 +86,7 @@ public class CacheRefreshManagerImpl imp
@Override
public String toString() {
- return StringRepresentation.buildString(this, "executerService=" + this.executorService, "threadPoolSize="
- + threadPoolSize);
+ return StringRepresentation.buildString(this, "executerService=" + this.executorService,
+ "threadPoolSize=" + threadPoolSize);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheKey.java Tue Nov 27 12:41:54 2012
@@ -54,12 +54,12 @@ public class CachedCacheKey extends Abst
private CacheKey cachedCacheKey;
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (!(obj instanceof CachedCacheKey)) {
return false;
}
- CachedCacheKey other = (CachedCacheKey) obj;
+ final CachedCacheKey other = (CachedCacheKey) obj;
return this.internalCacheKey.equals(other.internalCacheKey);
}
@@ -68,14 +68,14 @@ public class CachedCacheKey extends Abst
*
* @param key Simple {@link CacheKey} that can be easily generated for the component
*/
- public void setKey(String key) {
+ public void setKey(final String key) {
this.internalCacheKey = new ObjectCacheKey(key);
- if (CACHED_CACHE.get(internalCacheKey, true) != null) {
- this.cachedCacheKey = (URLListCacheKey) CACHED_CACHE.get(internalCacheKey, true).getValue();
- } else {
+ if (CACHED_CACHE.get(internalCacheKey, true) == null) {
// First time processed. Return invalid to update with real one.
this.cachedCacheKey = new InvalidCacheKey(getClass().getName());
LOG.debug("{} first time processed. Returning InvalidCacheKey.", key);
+ } else {
+ this.cachedCacheKey = (URLListCacheKey) CACHED_CACHE.get(internalCacheKey, true).getValue();
}
}
@@ -84,7 +84,7 @@ public class CachedCacheKey extends Abst
*
* @param value {@link CacheKey}
*/
- public void setValue(URLListCacheKey value) {
+ public void setValue(final URLListCacheKey value) {
this.cachedCacheKey = value;
CACHED_CACHE.put(this.internalCacheKey, new CachedCacheValue(this.cachedCacheKey));
}
@@ -94,19 +94,19 @@ public class CachedCacheKey extends Abst
*/
@Override
public int hashCode() {
- return cachedCacheKey != null ? cachedCacheKey.hashCode() : super.hashCode();
+ return cachedCacheKey == null ? super.hashCode() : cachedCacheKey.hashCode();
}
/**
* Delegates on cached key.
*/
@Override
- public boolean isValid(CacheKey cacheKey) {
+ public boolean isValid(final CacheKey cacheKey) {
if (cacheKey == null || !this.equals(cacheKey)) {
return false;
}
- CachedCacheKey otherCachedCacheKey = (CachedCacheKey) cacheKey;
+ final CachedCacheKey otherCachedCacheKey = (CachedCacheKey) cacheKey;
return cachedCacheKey != null && cachedCacheKey.isValid(otherCachedCacheKey.cachedCacheKey);
}
@@ -115,7 +115,7 @@ public class CachedCacheKey extends Abst
*/
@Override
public long getLastModified() {
- return cachedCacheKey != null ? cachedCacheKey.getLastModified() : -1;
+ return cachedCacheKey == null ? -1 : cachedCacheKey.getLastModified();
}
@Override
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheValue.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheValue.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheValue.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachedCacheValue.java Tue Nov 27 12:41:54 2012
@@ -35,12 +35,12 @@ public class CachedCacheValue extends Ab
*/
private static final Logger LOG = LoggerFactory.getLogger(CachedCacheValue.class);
- public CachedCacheValue(CacheKey cacheKey) {
+ public CachedCacheValue(final CacheKey cacheKey) {
super(cacheKey);
}
@Override
- public void writeTo(OutputStream outputStream) throws IOException {
+ public void writeTo(final OutputStream outputStream) throws IOException {
throw new UnsupportedOperationException("Cannot write the content of CachedCacheValue to OutputStream.");
}
@@ -50,15 +50,15 @@ public class CachedCacheValue extends Ab
}
@Override
- public void setValue(Object value) {
+ public void setValue(final Object value) {
throw new UnsupportedOperationException("Cannot set the content of CachedCacheValue to OutputStream.");
}
@Override
public double size() {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try {
- ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
+ final ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
objectOut.writeObject(getValue());
objectOut.flush();
objectOut.close();
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachingOutputStream.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachingOutputStream.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachingOutputStream.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CachingOutputStream.java Tue Nov 27 12:41:54 2012
@@ -24,10 +24,12 @@ import java.io.OutputStream;
public class CachingOutputStream extends OutputStream {
private byte[] buffer;
+
private int length;
+
private OutputStream outputStream;
- public CachingOutputStream(OutputStream outputStream) {
+ public CachingOutputStream(final OutputStream outputStream) {
super();
this.outputStream = outputStream;
@@ -46,7 +48,7 @@ public class CachingOutputStream extends
}
public byte[] getContent() {
- byte[] result = new byte[this.length];
+ final byte[] result = new byte[this.length];
System.arraycopy(this.buffer, 0, result, 0, this.length);
return result;
}
@@ -56,11 +58,11 @@ public class CachingOutputStream extends
}
@Override
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(final byte[] b, final int off, final int len) throws IOException {
this.outputStream.write(b, off, len);
if (this.length + len >= this.buffer.length) {
- byte[] nextBuffer = new byte[this.length + len + 1024];
+ final byte[] nextBuffer = new byte[this.length + len + 1024];
System.arraycopy(this.buffer, 0, nextBuffer, 0, this.buffer.length);
this.buffer = nextBuffer;
}
@@ -70,11 +72,11 @@ public class CachingOutputStream extends
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
this.outputStream.write(b);
if (this.length + 1 == this.buffer.length) {
- byte[] nextBuffer = new byte[this.buffer.length + 1024];
+ final byte[] nextBuffer = new byte[this.buffer.length + 1024];
System.arraycopy(this.buffer, 0, nextBuffer, 0, this.buffer.length);
this.buffer = nextBuffer;
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java Tue Nov 27 12:41:54 2012
@@ -33,8 +33,7 @@ public class CompleteCacheValue extends
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(CompleteCacheValue.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CompleteCacheValue.class);
private byte[] content;
@@ -49,6 +48,7 @@ public class CompleteCacheValue extends
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#getValue()
*/
+ @Override
public Object getValue() {
return this.content.clone();
}
@@ -58,6 +58,7 @@ public class CompleteCacheValue extends
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#setValue()
*/
+ @Override
public void setValue(final Object value) {
if (value instanceof String) {
this.content = ((String) value).getBytes();
@@ -92,6 +93,7 @@ public class CompleteCacheValue extends
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#size()
*/
+ @Override
public double size() {
return this.content.length;
}
@@ -99,9 +101,9 @@ public class CompleteCacheValue extends
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.pipeline.caching.CacheValue
- * #writeTo(java.io.OutputStream)
+ * @see org.apache.cocoon.pipeline.caching.CacheValue #writeTo(java.io.OutputStream)
*/
+ @Override
public void writeTo(final OutputStream outputStream) throws IOException {
outputStream.write(this.content);
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompoundCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompoundCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompoundCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompoundCacheKey.java Tue Nov 27 12:41:54 2012
@@ -29,13 +29,13 @@ import org.slf4j.LoggerFactory;
public class CompoundCacheKey extends AbstractCacheKey {
- private static final long serialVersionUID = 1L;
-
/**
* Logger.
*/
private static final Logger LOG = LoggerFactory.getLogger(CompoundCacheKey.class);
+ private static final long serialVersionUID = 6639830196195927237L;
+
private final List<CacheKey> cacheKeys = new LinkedList<CacheKey>();
public void addCacheKey(final CacheKey cacheKey) {
@@ -110,15 +110,11 @@ public class CompoundCacheKey extends Ab
final Iterator<CacheKey> otherIterator = other.cacheKeys.iterator();
while (myIterator.hasNext()) {
- CacheKey myCacheKey = myIterator.next();
- CacheKey otherCacheKey = otherIterator.next();
+ final CacheKey myCacheKey = myIterator.next();
+ final CacheKey otherCacheKey = otherIterator.next();
if (!myCacheKey.isValid(otherCacheKey)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Cache key is not valid: ");
- LOG.debug(" myCacheKey=" + myCacheKey);
- LOG.debug(" otherCacheKey=" + otherCacheKey);
- }
+ LOG.debug("Cache key is not valid:\nmyCacheKey={}\notherCacheKey={}\n", myCacheKey, otherCacheKey);
return false;
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ExpiresCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ExpiresCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ExpiresCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ExpiresCacheKey.java Tue Nov 27 12:41:54 2012
@@ -26,12 +26,15 @@ import org.apache.cocoon.util.murmurhash
*/
public final class ExpiresCacheKey extends AbstractCacheKey {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6336351832100762643L;
+
private final CacheKey cacheKey;
+
private final long timestamp;
+
private final long expirationTimestamp;
- public ExpiresCacheKey(CacheKey cacheKey, String expires) {
+ public ExpiresCacheKey(final CacheKey cacheKey, final String expires) {
this.cacheKey = cacheKey;
this.timestamp = System.currentTimeMillis();
this.expirationTimestamp = this.timestamp + Long.parseLong(expires) * 1000;
@@ -42,12 +45,13 @@ public final class ExpiresCacheKey exten
*
* @see org.apache.cocoon.pipeline.caching.CacheKey#isValid(org.apache.cocoon.pipeline.caching.CacheKey)
*/
- public boolean isValid(CacheKey cacheKey) {
+ @Override
+ public boolean isValid(final CacheKey cacheKey) {
if (!(cacheKey instanceof ExpiresCacheKey)) {
return false;
}
- ExpiresCacheKey other = (ExpiresCacheKey) cacheKey;
+ final ExpiresCacheKey other = (ExpiresCacheKey) cacheKey;
if (this.expirationTimestamp > other.timestamp) {
return true;
@@ -61,6 +65,7 @@ public final class ExpiresCacheKey exten
*
* @see org.apache.cocoon.pipeline.caching.CacheKey#getLastModified()
*/
+ @Override
public long getLastModified() {
return this.cacheKey.getLastModified();
}
@@ -75,12 +80,12 @@ public final class ExpiresCacheKey exten
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (!(obj instanceof ExpiresCacheKey)) {
return false;
}
- ExpiresCacheKey other = (ExpiresCacheKey) obj;
+ final ExpiresCacheKey other = (ExpiresCacheKey) obj;
return this.cacheKey.equals(other.cacheKey);
}
@@ -91,7 +96,7 @@ public final class ExpiresCacheKey exten
*/
@Override
public int hashCode() {
- return new MurmurHashCodeBuilder().append(this.getClass().getName()).append(this.cacheKey.hashCode())
- .toHashCode();
+ return new MurmurHashCodeBuilder().append(this.getClass().getName()).
+ append(this.cacheKey.hashCode()).toHashCode();
}
}
\ No newline at end of file
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java Tue Nov 27 12:41:54 2012
@@ -17,15 +17,15 @@
package org.apache.cocoon.pipeline.caching;
import java.io.Serializable;
-
import org.apache.cocoon.util.murmurhash.MurmurHashCodeBuilder;
public class InvalidCacheKey extends AbstractCacheKey {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3236728925974662802L;
+
private final Serializable expiresCacheKey;
- public InvalidCacheKey(Serializable expiresCacheKey) {
+ public InvalidCacheKey(final Serializable expiresCacheKey) {
if (expiresCacheKey == null) {
throw new IllegalArgumentException("An explicit cache key has to be provided.");
}
@@ -34,7 +34,7 @@ public class InvalidCacheKey extends Abs
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (!(obj instanceof InvalidCacheKey)) {
return false;
}
@@ -43,17 +43,19 @@ public class InvalidCacheKey extends Abs
return this.expiresCacheKey.equals(other.expiresCacheKey);
}
+ @Override
public long getLastModified() {
return -1;
}
@Override
public int hashCode() {
- return new MurmurHashCodeBuilder().append(this.getClass().getName()).append(this.expiresCacheKey.hashCode())
- .toHashCode();
+ return new MurmurHashCodeBuilder().append(this.getClass().getName()).
+ append(this.expiresCacheKey.hashCode()).toHashCode();
}
- public boolean isValid(CacheKey cacheKey) {
+ @Override
+ public boolean isValid(final CacheKey cacheKey) {
return false;
}
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheKey.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheKey.java Tue Nov 27 12:41:54 2012
@@ -21,16 +21,13 @@ package org.apache.cocoon.pipeline.cachi
import org.apache.cocoon.pipeline.util.StringRepresentation;
import org.apache.cocoon.util.murmurhash.MurmurHashCodeBuilder;
-/**
- * @version $Id$
- */
public class ObjectCacheKey extends AbstractCacheKey {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 7475542996963722056L;
private final Object obj;
- public ObjectCacheKey(Object obj) {
+ public ObjectCacheKey(final Object obj) {
this.obj = obj;
}
@@ -39,12 +36,12 @@ public class ObjectCacheKey extends Abst
}
@Override
- public boolean equals(Object other) {
+ public boolean equals(final Object other) {
if (!(other instanceof ObjectCacheKey)) {
return false;
}
- ObjectCacheKey otherCacheKey = (ObjectCacheKey) other;
+ final ObjectCacheKey otherCacheKey = (ObjectCacheKey) other;
return this.obj.equals(otherCacheKey.getObj());
}
@@ -69,7 +66,7 @@ public class ObjectCacheKey extends Abst
* @see org.apache.cocoon.pipeline.caching.CacheKey#isValid(org.apache.cocoon.pipeline.caching.CacheKey)
*/
@Override
- public boolean isValid(CacheKey other) {
+ public boolean isValid(final CacheKey other) {
return this.equals(other);
}
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheValue.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheValue.java?rev=1414157&r1=1414156&r2=1414157&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheValue.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/ObjectCacheValue.java Tue Nov 27 12:41:54 2012
@@ -22,7 +22,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,17 +30,16 @@ import org.slf4j.LoggerFactory;
*/
public class ObjectCacheValue extends AbstractCacheValue {
- private static final long serialVersionUID = 1L;
-
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(ObjectCacheValue.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(ObjectCacheValue.class);
+
+ private static final long serialVersionUID = -5740629911408166518L;
+
private final Object value;
- public ObjectCacheValue(Object value, CacheKey cacheKey) {
+ public ObjectCacheValue(final Object value, final CacheKey cacheKey) {
super(cacheKey);
this.value = value;
@@ -49,9 +47,10 @@ public class ObjectCacheValue extends Ab
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.pipeline.caching.CacheValue#getValue()
*/
+ @Override
public Object getValue() {
return this.value;
}
@@ -61,7 +60,8 @@ public class ObjectCacheValue extends Ab
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#setValue()
*/
- public void setValue(Object value) {
+ @Override
+ public void setValue(final Object value) {
throw new UnsupportedOperationException("Cannot set the content of ObjectCacheValue to OutputStream.");
}
@@ -70,10 +70,11 @@ public class ObjectCacheValue extends Ab
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#size()
*/
+ @Override
public double size() {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try {
- ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
+ final ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
objectOut.writeObject(this.value);
objectOut.flush();
objectOut.close();
@@ -89,7 +90,8 @@ public class ObjectCacheValue extends Ab
*
* @see org.apache.cocoon.pipeline.caching.CacheValue#writeTo(java.io.OutputStream)
*/
- public void writeTo(OutputStream outputStream) throws IOException {
+ @Override
+ public void writeTo(final OutputStream outputStream) throws IOException {
throw new UnsupportedOperationException("Cannot write the content of ObjectCacheValue to OutputStream.");
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.