cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r158107 - cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java
Date Fri, 18 Mar 2005 17:13:46 GMT
Author: tim
Date: Fri Mar 18 09:13:44 2005
New Revision: 158107

URL: http://svn.apache.org/viewcvs?view=rev&rev=158107
Log:
Use SourceValidity constants

Modified:
    cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java

Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java?view=diff&r1=158106&r2=158107
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/DefaultCacheManager.java Fri Mar
18 09:13:44 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 {@link 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;
         }
 



Mime
View raw message