From cvs-return-33949-apmail-cocoon-cvs-archive=cocoon.apache.org@cocoon.apache.org Sat Nov 29 17:20:41 2008 Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 66247 invoked from network); 29 Nov 2008 17:20:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Nov 2008 17:20:40 -0000 Received: (qmail 19010 invoked by uid 500); 29 Nov 2008 17:20:51 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 18943 invoked by uid 500); 29 Nov 2008 17:20:51 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 18934 invoked by uid 99); 29 Nov 2008 17:20:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Nov 2008 09:20:51 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Nov 2008 17:19:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 90408238893B; Sat, 29 Nov 2008 09:19:49 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r721693 - /cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java Date: Sat, 29 Nov 2008 17:19:49 -0000 To: cvs@cocoon.apache.org From: reinhard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081129171949.90408238893B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: reinhard Date: Sat Nov 29 09:19:44 2008 New Revision: 721693 URL: http://svn.apache.org/viewvc?rev=721693&view=rev Log: [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. 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(); - } }