01: // CacheValidator.java
02: // $Id: CacheValidator.java,v 1.5 2000/08/16 21:38:03 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.www.protocol.http.cache;
07:
08: import org.w3c.www.protocol.http.Request;
09: import org.w3c.www.protocol.http.Reply;
10:
11: public abstract class CacheValidator {
12: /**
13: * The CacheFilter we are working for
14: */
15: CacheFilter filter = null;
16:
17: /**
18: * Check if the request is stale or not
19: * @return a boolean, true if the resource is still valid
20: * false it if needs a revalidation.
21: */
22: public abstract boolean checkStaleness(CachedResource cr);
23:
24: /**
25: * Is the currently cached version usable to answer the given request ?
26: * @return A boolean, <strong>true</strong> if we are able to generate
27: * a valid answer to this request by the <code>perform</code> method,
28: * <strong>false</strong> otherwise (the resource needs to be refreshed).
29: */
30: public abstract boolean isValid(CachedResource cr, Request request);
31:
32: /**
33: * Update the expiration information on a cached resource, even if it was
34: * not used.
35: * @param cr, the CachedResource we are upgrading.
36: * @param request, the Request
37: * @param reply, the Reply
38: */
39: public abstract void updateExpirationInfo(CachedResource cr,
40: Request request, Reply reply);
41:
42: /**
43: * reset all the ages after a revalidation
44: * @param cr, the CachedResource we are upgrading.
45: * @param request, the Request
46: * @param reply, the Reply
47: */
48: public abstract void revalidateResource(CachedResource cr,
49: Request request, Reply reply);
50:
51: /**
52: * initialize this validator
53: */
54: public void initialize(CacheFilter filter) {
55: this.filter = filter;
56: }
57: }
|