1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.portal.expire;
18
19
20 import java.io.IOException;
21
22
23 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
24 import org.apache.jetspeed.services.logging.JetspeedLogger;
25
26 /***
27 Handles expiration mechanisms that expire when the file changes.
28
29 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
30 @version $Id: FileWatchExpire.java,v 1.10 2004/02/23 03:24:40 jford Exp $
31 */
32 public class FileWatchExpire extends BaseExpire
33 {
34
35 /***
36 * Static initialization of the logger for this class
37 */
38 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(FileWatchExpire.class.getName());
39
40 FileWatcher fw = null;
41
42 /***
43 @see Expire#isExpired
44
45 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
46 @version $Id: FileWatchExpire.java,v 1.10 2004/02/23 03:24:40 jford Exp $
47 */
48 public boolean isExpired() {
49
50 if ( this.fw != null ) {
51 return this.fw.hasChanged();
52 } else {
53 return false;
54 }
55
56
57 }
58
59 /***
60 Set the url on which this depends. It is required that you call this
61 method before you use it.
62 */
63 public void setURL( String url ) {
64 try {
65 this.fw = new FileWatcher( url, this.getPortlet().getName() );
66 } catch ( IOException e ) {
67 logger.error("Exception", e);
68 }
69 }
70
71
72 }