01: /* Loader.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Jun 3 09:13:02 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.util.resource;
20:
21: /**
22: * A loader that could load a resource to another format.
23: * It is mainly designed to work with {@link ResourceCache}.
24: *
25: * @author tomyeh
26: */
27: public interface Loader {
28: /** Returns whether to call {@link #getLastModified}.
29: * If false, it assumes the current cached content is up-to-date.
30: *
31: * @param expiredMillis how many milli-seconds are expired after the last
32: * check. In most cases, just return true if expiredMillis > 0
33: */
34: public boolean shallCheck(Object src, long expiredMillis);
35:
36: /** Returns the last modified time, or -1 if reload is required or not exists.
37: */
38: public long getLastModified(Object src);
39:
40: /** Loads the resource.
41: * @return null if not found
42: * @exception Exception you might throw any exception which will be
43: * passed back to the caller of {@link ResourceCache#get}
44: */
45: public Object load(Object src) throws Exception;
46: }
|