no.feide.moria.servlet
Class FileMonitor

java.lang.Object
  extended by no.feide.moria.servlet.FileMonitor

public class FileMonitor
extends java.lang.Object

Based (in part) on ConfigurationManager#FileListenerTask

Version:
$Revision: 1.1 $
Author:
Eva Indal

Field Summary
private  long lastModified
          Modification time of the watched file.
private  java.io.File monitoredFile
          The monitored file
 
Constructor Summary
FileMonitor(java.lang.String fileURI)
          Constructor.
 
Method Summary
private static java.io.File fileForURI(java.lang.String fileURI)
          Resolves a fileURI to a File object.
 boolean hasChanged()
          Returns true if the monitored file has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monitoredFile

private final java.io.File monitoredFile
The monitored file


lastModified

private long lastModified
Modification time of the watched file.

Constructor Detail

FileMonitor

public FileMonitor(java.lang.String fileURI)
            throws java.io.FileNotFoundException
Constructor.

Parameters:
fileURI - The file to monitor
Throws:
java.io.FileNotFoundException
Method Detail

hasChanged

public boolean hasChanged()
Returns true if the monitored file has changed.

Returns:
true if file has changed

fileForURI

private static java.io.File fileForURI(java.lang.String fileURI)
                                throws java.io.FileNotFoundException
Resolves a fileURI to a File object.

Parameters:
fileURI - Reference to the file (full path or relative within the classpath).
Returns:
A File object referenced by the fileURI.
Throws:
java.io.FileNotFoundException - If the fileURI cannot be resolved to a readable file.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.