01: /*
02: * Helma License Notice
03: *
04: * The contents of this file are subject to the Helma License
05: * Version 2.0 (the "License"). You may not use this file except in
06: * compliance with the License. A copy of the License is available at
07: * http://adele.helma.org/download/helma/license.txt
08: *
09: * Copyright 1998-2003 Helma Software. All Rights Reserved.
10: *
11: * $RCSfile$
12: * $Author: root $
13: * $Revision: 8604 $
14: * $Date: 2007-09-28 15:16:38 +0200 (Fre, 28 Sep 2007) $
15: */
16:
17: package helma.framework.repository;
18:
19: import java.io.IOException;
20:
21: /**
22: * A utility class that allows Resource consumers to track changes
23: * on resources.
24: */
25: public class ResourceTracker {
26:
27: Resource resource;
28: long lastModified;
29:
30: public ResourceTracker(Resource resource) {
31: this .resource = resource;
32: markClean();
33: }
34:
35: public boolean hasChanged() throws IOException {
36: return lastModified != resource.lastModified();
37: }
38:
39: public void markClean() {
40: lastModified = resource.lastModified();
41: }
42:
43: public Resource getResource() {
44: return resource;
45: }
46: }
|