nicolaken 2002/12/18 17:17:03 Added: src/deprecated/java/org/apache/cocoon/caching AggregatedCacheValidity.java Cacheable.java CachedEventObject.java CachedStreamObject.java CacheValidity.java CompositeCacheValidity.java DeltaTimeCacheValidity.java IncludeCacheValidity.java NOPCacheValidity.java ParametersCacheValidity.java TimeStampCacheValidity.java Log: <action dev="NKB" type="update"> Created .src/deprecated directory to contain all deprecated classes. This will help in maintaining Cocoon free from deprecated classes. Started by moving some deprecated caching stuff. </action> Revision Changes Path 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/AggregatedCacheValidity.java Index: AggregatedCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * A validation object aggregating several validity objects. This is similar to the * {@link CompositeCacheValidity} with the difference that the amount of * aggregated objects is not limited. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a> * @version CVS $Id: AggregatedCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class AggregatedCacheValidity implements CacheValidity { private List a; /** * Constructor */ public AggregatedCacheValidity() { this.a = new ArrayList(); } /** * Add another validity object */ public void add(CacheValidity validity) { this.a.add(validity); } public boolean isValid(CacheValidity validity) { if (validity instanceof AggregatedCacheValidity) { List b = ((AggregatedCacheValidity)validity).a; if(a.size() != b.size()) return false; for(Iterator i = a.iterator(), j = b.iterator(); i.hasNext();) { if(!((CacheValidity)i.next()).isValid((CacheValidity)j.next())) return false; } return true; } return false; } public String toString() { StringBuffer b = new StringBuffer("Aggregated Validity["); for(Iterator i = a.iterator(); i.hasNext();) { b.append(i.next()); if(i.hasNext()) b.append(':'); } b.append(']'); return b.toString(); } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/Cacheable.java Index: Cacheable.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; /** * This marker interface declares a (sitemap) component as cacheable. * * @deprecated by the {@link CacheableProcessingComponent} interface * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: Cacheable.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public interface Cacheable { /** * Generate the unique key. * This key must be unique inside the space of this component. * This method must be invoked before the generateValidity() method. * * @return The generated key or <code>0</code> if the component * is currently not cacheable. */ long generateKey(); /** * Generate the validity object. * Before this method can be invoked the generateKey() method * must be invoked. * * @return The generated validity object or <code>null</code> if the * component is currently not cacheable. */ CacheValidity generateValidity(); } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/CachedEventObject.java Index: CachedEventObject.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import java.util.Map; /** * This is a cached object as it is stored in the <code>EventCache</code> * * @deprecated by the {@link CachedResponse} * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: CachedEventObject.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class CachedEventObject implements java.io.Serializable { private Map validityObjects; private Object saxFragment; /** * Create a new entry for the cache. * * @param validityObjects The CacheValidity objects hashed by their * <code>ComponentCacheKey</code> * @param saxFragment The cached sax stream */ public CachedEventObject(Map validityObjects, Object saxFragment) { this.validityObjects = validityObjects; this.saxFragment = saxFragment; } /** * Checks if the CacheValidity object is still valid. */ public boolean isValid(ComponentCacheKey componentKey, CacheValidity componentValidity) { CacheValidity ownValidity = (CacheValidity)this.validityObjects.get(componentKey); if (ownValidity != null && ownValidity.isValid(componentValidity)) { return true; } return false; } /** * Get the validity object * @return The <CODE>CacheValidity</CODE> object or <CODE>null</CODE>. */ public CacheValidity getCacheValidity(ComponentCacheKey componentKey) { return (CacheValidity)this.validityObjects.get(componentKey); } /** * Get the cached sax stream. * * @return The sax stream */ public Object getSAXFragment() { return this.saxFragment; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/CachedStreamObject.java Index: CachedStreamObject.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import java.util.Map; /** * This is an cached object as it is stored in the <code>StreamCache</code> * * @deprecated by the {@link CachedResponse} * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: CachedStreamObject.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class CachedStreamObject implements java.io.Serializable { private Map validityObjects; private byte[] response; /** * Create a new entry for the cache. * * @param validityObjects The CacheValidity objects hashed by their * <code>ComponentCacheKey</code> * @param response The cached response */ public CachedStreamObject(Map validityObjects, byte[] response) { this.validityObjects = validityObjects; this.response = response; } /** * Checks if the CacheValidity object is still valid. */ public boolean isValid(ComponentCacheKey componentKey, CacheValidity componentValidity) { CacheValidity ownValidity = (CacheValidity)this.validityObjects.get(componentKey); if (ownValidity != null && ownValidity.isValid(componentValidity)) { return true; } return false; } /** * Get the validity object * @return The <CODE>CacheValidity</CODE> object or <CODE>null</CODE>. */ public CacheValidity getCacheValidity(ComponentCacheKey componentKey) { return (CacheValidity)this.validityObjects.get(componentKey); } /** * Get the cached response. * * @return The response */ public byte[] getResponse() { return this.response; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/CacheValidity.java Index: CacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import java.io.Serializable; /** * A CacheValidity object contains all information for one pipeline component * to check if it is still valid.<br> * For example, the FileGenerator stores only the timestamp for the read * xml file in this container. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: CacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public interface CacheValidity extends Serializable { /** * Check if the component is still valid. * This is only true, if the incoming CacheValidity is of the same * type and has the same values. */ boolean isValid(CacheValidity validity); /** * Creates text represenation of the validity object. * This is used to create fake 'lastModificationDate' for cocoon: sources. * <p>Due to changes in source API, this method is no longer needed, * starting with Cocoon 2.1. */ String toString(); } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/CompositeCacheValidity.java Index: CompositeCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; /** * A validation object aggregating two validity objects. This is similar to the * {@link AggregatedCacheValidity} with the difference that the amount of * aggregated objects is limited. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a> * @version CVS $Id: CompositeCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class CompositeCacheValidity implements CacheValidity { private CacheValidity v1; private CacheValidity v2; /** * Constructor */ public CompositeCacheValidity(CacheValidity v1, CacheValidity v2) { this.v1 = v1; this.v2 = v2; } public boolean isValid(CacheValidity validity) { if (validity instanceof CompositeCacheValidity) { return (v1.isValid(((CompositeCacheValidity)validity).getValidity1()) && v2.isValid(((CompositeCacheValidity)validity).getValidity2())); } return false; } public CacheValidity getValidity1() { return this.v1; } public CacheValidity getValidity2() { return this.v2; } public String toString() { return "Composite Validity[" + v1 + ':' + v2 + ']'; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/DeltaTimeCacheValidity.java Index: DeltaTimeCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; /** * A validation object that remains valid for a specified amount of time. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Michael Homeijer</a> * @version CVS $Id: DeltaTimeCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class DeltaTimeCacheValidity implements CacheValidity { private long cachedDateTime; // Holds the store-time in miliseconds private long timeInCache; // maximum time allowed in cache in minutes /** * Creates validity object with timeout in minutes. */ public DeltaTimeCacheValidity(long minutes) { this.cachedDateTime = System.currentTimeMillis(); this.timeInCache = minutes * 60000; } /** * Creates validity object with timeout in minutes, seconds. */ public DeltaTimeCacheValidity(long minutes, long seconds) { this.cachedDateTime = System.currentTimeMillis(); this.timeInCache = minutes * 60000 + seconds * 1000; } /** * Creates validity object with timeout in minutes, seconds and milliseconds. */ public DeltaTimeCacheValidity(long minutes, long seconds, long milliseconds) { this.cachedDateTime = System.currentTimeMillis(); this.timeInCache = minutes * 60000 + seconds * 1000 + milliseconds; } public boolean isValid(CacheValidity validity) { if (validity instanceof DeltaTimeCacheValidity) { return Math.abs((((DeltaTimeCacheValidity)validity).getCachedDateTime() - this.cachedDateTime)) < this.timeInCache; } return false; } public long getCachedDateTime() { return this.cachedDateTime; } public String toString() { return "Delta Validity[" + this.cachedDateTime + '+' + this.timeInCache + "ms]"; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/IncludeCacheValidity.java Index: IncludeCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import org.apache.excalibur.source.Source; import org.apache.cocoon.environment.SourceResolver; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * A validation object used in CachingCIncludeTransformer * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Maciek Kaminski</a> * @version CVS $Id: IncludeCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class IncludeCacheValidity implements CacheValidity { private List sources; private List timeStamps; private boolean isNew; private SourceResolver resolver; public IncludeCacheValidity(SourceResolver resolver) { this.resolver = resolver; sources = new ArrayList(); timeStamps = new ArrayList(); isNew = true; } public boolean isNew() { return isNew; } public void setIsNew2False() { isNew = false; resolver = null; } public void add(String source, long timeStamp) { this.sources.add(source); this.timeStamps.add(new Long(timeStamp)); } public boolean isValid(CacheValidity validity) { if (validity instanceof IncludeCacheValidity) { SourceResolver otherResolver = ((IncludeCacheValidity) validity).resolver; for(Iterator i = sources.iterator(), j = timeStamps.iterator(); i.hasNext();) { String src = ((String)i.next()); long timeStamp = ((Long)j.next()).longValue(); Source otherSource = null; try { otherSource = otherResolver.resolveURI(src); if(otherSource.getLastModified() != timeStamp || timeStamp == 0) return false; } catch (Exception e) { return false; } finally { otherResolver.release(otherSource); } } return true; } return false; } public String toString() { StringBuffer b = new StringBuffer("Include Validity["); for(Iterator i = sources.iterator(), j = timeStamps.iterator(); i.hasNext();) { b.append('{'); b.append(i.next()); b.append(':'); b.append(j.next()); b.append('}'); if(i.hasNext()) b.append(':'); } b.append(']'); return b.toString(); } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/NOPCacheValidity.java Index: NOPCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; /** * A validation object which is always valid. * This might be the most used CacheValidity object for serializers. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: NOPCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class NOPCacheValidity implements CacheValidity { public static final CacheValidity CACHE_VALIDITY = new NOPCacheValidity(); public boolean isValid(CacheValidity validity) { return validity instanceof NOPCacheValidity; } public String toString() { return "NOP Validity"; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/ParametersCacheValidity.java Index: ParametersCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; import java.util.Map; /** * A validation object using a set of key/value pairs contained in a <code>Map</code>. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a> * @version CVS $Id: ParametersCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class ParametersCacheValidity implements CacheValidity { private Map map; /** * Constructor */ public ParametersCacheValidity(Map map) { this.map = map; } public boolean isValid(CacheValidity validity) { if (validity instanceof ParametersCacheValidity) { return this.map.toString().equals(((ParametersCacheValidity)validity).getParameters().toString()); } return false; } public Map getParameters() { return this.map; } public String toString() { return "Parameters Validity[" + this.map + ']'; } } 1.1 xml-cocoon2/src/deprecated/java/org/apache/cocoon/caching/TimeStampCacheValidity.java Index: TimeStampCacheValidity.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.caching; /** * A validation object for time-stamps. * This is might be the most used CacheValidity object. * * @deprecated Use the Avalon Excalibur SourceValidity implementations instead * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version CVS $Id: TimeStampCacheValidity.java,v 1.1 2002/12/19 01:17:03 nicolaken Exp $ */ public final class TimeStampCacheValidity implements CacheValidity { private long timeStamp; public TimeStampCacheValidity(long timeStamp) { this.timeStamp = timeStamp; } public boolean isValid(CacheValidity validity) { if (validity instanceof TimeStampCacheValidity) { return this.timeStamp == ((TimeStampCacheValidity)validity).getTimeStamp(); } return false; } public long getTimeStamp() { return this.timeStamp; } public String toString() { return "TimeStamp Validity[" + this.timeStamp + ']'; } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]