Class VFSFileHandlerReloadingDetector
java.lang.Object
org.apache.commons.configuration2.reloading.FileHandlerReloadingDetector
org.apache.commons.configuration2.reloading.VFSFileHandlerReloadingDetector
- All Implemented Interfaces:
ReloadingDetector
A file-based reloading strategy that uses Commons VFS to determine when a file was changed.
This reloading strategy is very similar to FileHandlerReloadingDetector, except for the fact that it uses VFS
and thus can deal with a variety of different configuration sources.
This strategy only works with FileConfiguration instances.
- Since:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with an emptyFileHandlerobject.Creates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with the givenFileHandlerobject.VFSFileHandlerReloadingDetector(FileHandler handler, long refreshDelay) Creates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with the givenFileHandlerobject and the given refresh delay. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.commons.vfs2.FileObjectGets the file that is monitored by this strategy.protected longGets the date of the last modification of the monitored file.protected StringResolves the URI of the monitored file.Methods inherited from class org.apache.commons.configuration2.reloading.FileHandlerReloadingDetector
getFile, getFileHandler, getRefreshDelay, isReloadingRequired, refresh, reloadingPerformed, updateLastModified
-
Constructor Details
-
VFSFileHandlerReloadingDetector
public VFSFileHandlerReloadingDetector()Creates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with an emptyFileHandlerobject. -
VFSFileHandlerReloadingDetector
Creates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with the givenFileHandlerobject.- Parameters:
handler- theFileHandler
-
VFSFileHandlerReloadingDetector
Creates a new instance ofVFSFileHandlerReloadingDetectorand initializes it with the givenFileHandlerobject and the given refresh delay.- Parameters:
handler- theFileHandlerrefreshDelay- the refresh delay
-
-
Method Details
-
getFileObject
Gets the file that is monitored by this strategy. Note that the return value can be null under some circumstances.- Returns:
- the monitored file
-
getLastModificationDate
Gets the date of the last modification of the monitored file. A return value of 0 indicates, that the monitored file does not exist. This implementation uses Commons VFS to obtain aFileObjectand read the date of the last modification.- Overrides:
getLastModificationDatein classFileHandlerReloadingDetector- Returns:
- the last modification date in milliseconds.
-
resolveFileURI
Resolves the URI of the monitored file.- Returns:
- the URI of the monitored file or null if it cannot be resolved
-