cziegeler 01/12/17 05:20:58
Modified: src/scratchpad/org/apache/avalon/excalibur/source
SourceValidity.java
src/scratchpad/org/apache/avalon/excalibur/source/validity
NOPValidity.java TimeStampValidity.java
Log:
Extended Validity functionality
Revision Changes Path
1.2 +17 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceValidity.java
Index: SourceValidity.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SourceValidity.java 2001/12/17 10:02:21 1.1
+++ SourceValidity.java 2001/12/17 13:20:57 1.2
@@ -10,12 +10,28 @@
/**
* A Validity object contains all information to check if a Source object is
* still valid.
+ * There are two possibilities: The validity object has all information
+ * 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
+ * agains (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>
+ * is returned by the first invocation!
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/12/17 10:02:21 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/12/17 13:20:57 $
*/
public interface SourceValidity
extends java.io.Serializable {
+
+ /**
+ * Check if the component is still valid.
+ * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * called afterwards!
+ */
+ boolean isValid();
/**
* Check if the component is still valid.
1.2 +12 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/validity/NOPValidity.java
Index: NOPValidity.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/validity/NOPValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NOPValidity.java 2001/12/17 10:02:21 1.1
+++ NOPValidity.java 2001/12/17 13:20:57 1.2
@@ -13,10 +13,21 @@
* A validation object which is always valid.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/12/17 10:02:21 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/12/17 13:20:57 $
*/
public final class NOPValidity
implements SourceValidity {
+
+ public static final SourceValidity SHARED_INSTANCE = new NOPValidity();
+
+ /**
+ * Check if the component is still valid.
+ * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * called afterwards!
+ */
+ public boolean isValid() {
+ return true;
+ }
public boolean isValid(SourceValidity newValidity) {
return newValidity instanceof NOPValidity;
1.2 +10 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/validity/TimeStampValidity.java
Index: TimeStampValidity.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/validity/TimeStampValidity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TimeStampValidity.java 2001/12/17 10:02:21 1.1
+++ TimeStampValidity.java 2001/12/17 13:20:57 1.2
@@ -13,7 +13,7 @@
* A validation object for time-stamps.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/12/17 10:02:21 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/12/17 13:20:57 $
*/
public final class TimeStampValidity
implements SourceValidity {
@@ -22,6 +22,15 @@
public TimeStampValidity(long timeStamp) {
this.timeStamp = timeStamp;
+ }
+
+ /**
+ * Check if the component is still valid.
+ * If <code>false</code> is returned the isValid(SourceValidity) must be
+ * called afterwards!
+ */
+ public boolean isValid() {
+ return false;
}
public boolean isValid(SourceValidity newValidity) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>