You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/02/23 18:27:23 UTC

svn commit: r511027 - /lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java

Author: andreas
Date: Fri Feb 23 09:27:22 2007
New Revision: 511027

URL: http://svn.apache.org/viewvc?view=rev&rev=511027
Log:
Don't store shale node in RepoSourceValidity

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java?view=diff&rev=511027&r1=511026&r2=511027
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java Fri Feb 23 09:27:22 2007
@@ -18,7 +18,6 @@
 package org.apache.lenya.cms.cocoon.source;
 
 import org.apache.excalibur.source.SourceValidity;
-import org.apache.lenya.cms.repository.Node;
 import org.apache.lenya.cms.repository.RepositoryException;
 
 /**
@@ -27,18 +26,17 @@
 public class RepositorySourceValidity implements SourceValidity {
 
     private static final long serialVersionUID = 1L;
-    
-    private Node node;
-    
-    private long lastModified = -1;
-    
+
+    private String sourceUri;
+    private long lastModified;
+
     /**
      * @param source The source this validity is for.
      */
     public RepositorySourceValidity(RepositorySource source) {
-        this.node = source.getNode();
+        this.sourceUri = source.getNode().getSourceURI();
         try {
-            this.lastModified = this.node.getLastModified();
+            this.lastModified = source.getNode().getLastModified();
         } catch (RepositoryException e) {
             throw new RuntimeException(e);
         }
@@ -47,32 +45,30 @@
     public int isValid() {
         return SourceValidity.UNKNOWN;
     }
-    
-    protected Node getNode() {
-        return this.node;
-    }
 
     public int isValid(SourceValidity validity) {
         if (validity instanceof RepositorySourceValidity) {
             RepositorySourceValidity repoValidity = (RepositorySourceValidity) validity;
-            
-            if (!repoValidity.getNode().getSourceURI().equals(getNode().getSourceURI())) {
+
+            if (!repoValidity.getSourceURI().equals(this.sourceUri)) {
                 throw new RuntimeException("Wrong source URI!");
             }
-            
-            try {
-                if (getNode().getLastModified() >= repoValidity.getNode().getLastModified()) {
-                    return SourceValidity.VALID;
-                }
-                else {
-                    return SourceValidity.INVALID;
-                }
-            } catch (RepositoryException e) {
-                throw new RuntimeException(e);
+            if (this.lastModified >= repoValidity.getLastModified()) {
+                return SourceValidity.VALID;
+            } else {
+                return SourceValidity.INVALID;
             }
         } else {
             return SourceValidity.INVALID;
         }
+    }
+
+    protected long getLastModified() {
+        return this.lastModified;
+    }
+
+    protected String getSourceURI() {
+        return this.sourceUri;
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org