You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by cz...@apache.org on 2002/06/04 10:42:13 UTC
cvs commit: jakarta-avalon-excalibur/xmlbundle/src/java/org/apache/avalon/excalibur/xml/xslt XSLTProcessorImpl.java
cziegeler 2002/06/04 01:42:13
Modified: sourceresolve/src/java/org/apache/excalibur/source
SourceValidity.java
sourceresolve/src/java/org/apache/excalibur/source/impl/validity
AggregatedValidity.java FileTimeStampValidity.java
NOPValidity.java TimeStampValidity.java
xmlbundle/src/java/org/apache/avalon/excalibur/xml/xslt
XSLTProcessorImpl.java
Log:
Changed return value of isValid from two states to three
Revision Changes Path
1.2 +9 -7 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java
Index: SourceValidity.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SourceValidity.java 19 Apr 2002 09:05:37 -0000 1.1
+++ SourceValidity.java 4 Jun 2002 08:42:13 -0000 1.2
@@ -14,14 +14,14 @@
* to check by itself how long it is valid (e.g. given an expires date).
* The other possibility needs another (newer) validity object to compare
* against (e.g. to test a last modification date).
- * To avoid testing, what the actual implementation of the validity object
- * supports, the invocation order is to first call isValid() and only if
- * this results in <code>false</code>, then to call isValid(SourceValidity).
- * But remember to call the second isValid(SourceValidity) when <code>false</code>
+ * To avoid testing, what the actual implementation of the validity
+ * object supports, the invocation order is to first call {@link isValid()} and only if
+ * this results in <code>0</code>, then to call {@link isValid(SourceValidity)}.
+ * But remember to call the second isValid(SourceValidity) when <code>0</code>
* is returned by the first invocation!
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/04/19 09:05:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/06/04 08:42:13 $
*/
public interface SourceValidity
extends java.io.Serializable
@@ -29,10 +29,12 @@
/**
* Check if the component is still valid.
- * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * If <code>0</code> is returned the isValid(SourceValidity) must be
* called afterwards!
+ * If -1 is returned, the component is not valid anymore and if +1
+ * is returnd, the component is valid.
*/
- boolean isValid();
+ int isValid();
/**
* Check if the component is still valid.
1.2 +13 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java
Index: AggregatedValidity.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AggregatedValidity.java 19 Apr 2002 09:05:37 -0000 1.1
+++ AggregatedValidity.java 4 Jun 2002 08:42:13 -0000 1.2
@@ -16,7 +16,7 @@
* A validation object using a List.
*
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/04/19 09:05:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/06/04 08:42:13 $
*/
public final class AggregatedValidity
implements SourceValidity
@@ -34,14 +34,21 @@
this.a.add( validity );
}
- public boolean isValid()
+ /**
+ * Check if the component is still valid.
+ * If <code>0</code> is returned the isValid(SourceValidity) must be
+ * called afterwards!
+ * If -1 is returned, the component is not valid anymore and if +1
+ * is returnd, the component is valid.
+ */
+ public int isValid()
{
for( Iterator i = a.iterator(); i.hasNext(); )
{
- if( !( (SourceValidity)i.next() ).isValid() )
- return false;
+ final int v = ((SourceValidity)i.next() ).isValid();
+ if (v < 1) return v;
}
- return true;
+ return 1;
}
public boolean isValid( SourceValidity validity )
@@ -55,7 +62,7 @@
{
final SourceValidity srcA = (SourceValidity)i.next();
final SourceValidity srcB = (SourceValidity)j.next();
- if( !srcA.isValid() && !srcA.isValid( srcB ) )
+ if( srcA.isValid() < 1 && !srcA.isValid( srcB ) )
return false;
}
return true;
1.2 +10 -8 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java
Index: FileTimeStampValidity.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileTimeStampValidity.java 3 Jun 2002 12:11:10 -0000 1.1
+++ FileTimeStampValidity.java 4 Jun 2002 08:42:13 -0000 1.2
@@ -14,8 +14,8 @@
/**
* A validation object for time-stamps.
*
- * @author: <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Revision: 1.1 $
+ * @author: <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
+ * @version CVS $Revision: 1.2 $
*/
public final class FileTimeStampValidity
implements SourceValidity
@@ -28,12 +28,12 @@
{
this(new File(filename));
}
-
+
public FileTimeStampValidity( File file )
{
this(file, file.lastModified());
}
-
+
public FileTimeStampValidity( File file, long timeStamp )
{
this.file = file;
@@ -42,12 +42,14 @@
/**
* Check if the component is still valid.
- * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * If <code>0</code> is returned the isValid(SourceValidity) must be
* called afterwards!
+ * If -1 is returned, the component is not valid anymore and if +1
+ * is returnd, the component is valid.
*/
- public boolean isValid()
+ public int isValid()
{
- return file.lastModified() == this.timeStamp;
+ return (file.lastModified() == this.timeStamp ? 1 : -1);
}
public boolean isValid( SourceValidity newValidity )
@@ -58,7 +60,7 @@
}
return false;
}
-
+
public File getFile()
{
return this.file;
1.2 +6 -4 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java
Index: NOPValidity.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NOPValidity.java 19 Apr 2002 09:05:37 -0000 1.1
+++ NOPValidity.java 4 Jun 2002 08:42:13 -0000 1.2
@@ -13,7 +13,7 @@
* A validation object which is always valid.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/04/19 09:05:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/06/04 08:42:13 $
*/
public final class NOPValidity
implements SourceValidity
@@ -23,12 +23,14 @@
/**
* Check if the component is still valid.
- * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * If <code>0</code> is returned the isValid(SourceValidity) must be
* called afterwards!
+ * If -1 is returned, the component is not valid anymore and if +1
+ * is returnd, the component is valid.
*/
- public boolean isValid()
+ public int isValid()
{
- return true;
+ return 1;
}
public boolean isValid( SourceValidity newValidity )
1.2 +6 -4 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java
Index: TimeStampValidity.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TimeStampValidity.java 19 Apr 2002 09:05:37 -0000 1.1
+++ TimeStampValidity.java 4 Jun 2002 08:42:13 -0000 1.2
@@ -13,7 +13,7 @@
* A validation object for time-stamps.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/04/19 09:05:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/06/04 08:42:13 $
*/
public final class TimeStampValidity
implements SourceValidity
@@ -28,12 +28,14 @@
/**
* Check if the component is still valid.
- * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * If <code>0</code> is returned the isValid(SourceValidity) must be
* called afterwards!
+ * If -1 is returned, the component is not valid anymore and if +1
+ * is returnd, the component is valid.
*/
- public boolean isValid()
+ public int isValid()
{
- return false;
+ return 0;
}
public boolean isValid( SourceValidity newValidity )
1.7 +6 -3 jakarta-avalon-excalibur/xmlbundle/src/java/org/apache/avalon/excalibur/xml/xslt/XSLTProcessorImpl.java
Index: XSLTProcessorImpl.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/xmlbundle/src/java/org/apache/avalon/excalibur/xml/xslt/XSLTProcessorImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSLTProcessorImpl.java 6 May 2002 09:03:10 -0000 1.6
+++ XSLTProcessorImpl.java 4 Jun 2002 08:42:13 -0000 1.7
@@ -59,7 +59,7 @@
*
* @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @author <a href="mailto:proyal@apache.org">Peter Royal</a>
- * @version CVS $Id: XSLTProcessorImpl.java,v 1.6 2002/05/06 09:03:10 cziegeler Exp $
+ * @version CVS $Id: XSLTProcessorImpl.java,v 1.7 2002/06/04 08:42:13 cziegeler Exp $
* @version 1.0
* @since July 11, 2001
*/
@@ -397,14 +397,17 @@
Object[] templateAndValidity = (Object[])store.get(id);
SourceValidity storedValidity = (SourceValidity)templateAndValidity[1];
- boolean isValid = storedValidity.isValid();
- if ( !isValid ) {
+ int valid = storedValidity.isValid();
+ boolean isValid = false;
+ if ( valid == 0 ) {
SourceValidity validity = stylesheet.getValidity();
if ( null != validity) {
isValid = storedValidity.isValid( validity );
}
+ } else {
+ isValid = (valid == 1);
}
if ( isValid ) {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>