Author: vgritsenko Date: Fri Mar 18 08:58:15 2005 New Revision: 158100 URL: http://svn.apache.org/viewcvs?view=rev&rev=158100 Log: Use SourceValidity constants
Modified: cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/DefaultCacheManager.java Modified: cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/DefaultCacheManager.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/DefaultCacheManager.java?view=diff&r1=158099&r2=158100 ============================================================================== --- cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/DefaultCacheManager.java (original) +++ cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/DefaultCacheManager.java Fri Mar 18 08:58:15 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - * + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,13 +32,13 @@ /** * Component implementing the [EMAIL PROTECTED] CacheManager} role. - * + * * @version $Id$ */ -public class DefaultCacheManager - extends AbstractLogEnabled +public class DefaultCacheManager + extends AbstractLogEnabled implements CacheManager, ThreadSafe, Serviceable, Disposable, Configurable { - + protected ServiceManager manager; protected Configuration configuration; protected FastHashMap cache = new FastHashMap(); @@ -60,29 +60,30 @@ // If source is not valid then remove object from cache and return null if (newValidity == null) { - cache.remove(key); + this.cache.remove(key); return null; } // If object is not in cache then return null - Object[] objectAndValidity = (Object[])cache.get(key); - if (objectAndValidity == null) + Object[] objectAndValidity = (Object[]) this.cache.get(key); + if (objectAndValidity == null) { return null; + } - // Check stored validity against current source validity - SourceValidity storedValidity = (SourceValidity)objectAndValidity[1]; + // Check stored validity against current source validity + SourceValidity storedValidity = (SourceValidity) objectAndValidity[1]; int valid = storedValidity.isValid(); boolean isValid; - if (valid == 0) { + if (valid == SourceValidity.UNKNOWN) { valid = storedValidity.isValid(newValidity); - isValid = (valid == 1); + isValid = (valid == SourceValidity.VALID); } else { - isValid = (valid == 1); + isValid = (valid == SourceValidity.VALID); } // If stored object is not valid then remove object from cache and return null if (!isValid) { - cache.remove(key); + this.cache.remove(key); return null; }