You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/11/29 18:19:49 UTC
svn commit: r721693 -
/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java
Author: reinhard
Date: Sat Nov 29 09:19:44 2008
New Revision: 721693
URL: http://svn.apache.org/viewvc?rev=721693&view=rev
Log:
<action dev="steven" type="add">
[cocoon-pipeline] Support expires caching: CachingPipeline and AsyncCachingPipeline can be configured to
be valid for a particular period. This 'expires caching' doesn't check if any of the pipeline components
would produce a valid result or not and it isn't even necessary that the pipeline components are cacheable
by implementing the org.apache.cocoon.pipeline.component.CachingPipelineComponent interface.
</action>
Modified:
cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java
Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java?rev=721693&r1=721692&r2=721693&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java Sat Nov 29 09:19:44 2008
@@ -16,24 +16,29 @@
*/
package org.apache.cocoon.sample.generation;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import org.apache.cocoon.pipeline.ProcessingException;
-import org.apache.cocoon.pipeline.caching.CacheKey;
-import org.apache.cocoon.pipeline.caching.SimpleCacheKey;
-import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
import org.apache.cocoon.pipeline.component.sax.XMLConsumer;
import org.apache.cocoon.pipeline.util.ImmutableAttributesImpl;
import org.xml.sax.SAXException;
-public class TimestampGenerator extends AbstractGenerator implements CachingPipelineComponent {
+public class TimestampGenerator extends AbstractGenerator {
public void execute() {
XMLConsumer consumer = this.getXMLConsumer();
try {
- consumer.startDocument();
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ consumer.startDocument();
consumer.startElement("", "timestamp", "timestamp", new ImmutableAttributesImpl());
- String timestamp = Long.toString(System.currentTimeMillis());
+ String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date());
consumer.characters(timestamp.toCharArray(), 0, timestamp.length());
consumer.endElement("", "timestamp", "timestamp");
@@ -42,8 +47,4 @@
throw new ProcessingException(e);
}
}
-
- public CacheKey constructCacheKey() {
- return new SimpleCacheKey();
- }
}