org.apache.commons.configuration2.reloading

## Class VFSFileHandlerReloadingDetector

- java.lang.Object
- - org.apache.commons.configuration2.reloading.FileHandlerReloadingDetector
  - - org.apache.commons.configuration2.reloading.VFSFileHandlerReloadingDetector

- All Implemented Interfaces:
    ReloadingDetector

      public class VFSFileHandlerReloadingDetector
      extends FileHandlerReloadingDetector

  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
  Version:
    $Id: VFSFileHandlerReloadingDetector.java 1624601 2014-09-12 18:04:36Z oheger $
  Author:
    Commons Configuration team

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VFSFileHandlerReloadingDetector()` Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with an empty `FileHandler` object.
    `VFSFileHandlerReloadingDetector(FileHandler handler)` Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with the given `FileHandler` object.
    `VFSFileHandlerReloadingDetector(FileHandler handler, long refreshDelay)` Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with the given `FileHandler` object and the given refresh delay.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.apache.commons.vfs2.FileObject` | `getFileObject()` Returns the file that is monitored by this strategy.
    `protected long` | `getLastModificationDate()` Returns the date of the last modification of the monitored file.
    `protected String` | `resolveFileURI()` Resolves the URI of the monitored file.

    - ### Methods inherited from class org.apache.commons.configuration2.reloading.FileHandlerReloadingDetector

      `getFile, getFileHandler, getRefreshDelay, isReloadingRequired, reloadingPerformed, updateLastModified`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VFSFileHandlerReloadingDetector

          public VFSFileHandlerReloadingDetector()

      Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with an empty `FileHandler` object.

    - #### VFSFileHandlerReloadingDetector

          public VFSFileHandlerReloadingDetector(FileHandler handler,
                                                 long refreshDelay)

      Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with the given `FileHandler` object and the given refresh delay.
      Parameters:
        `handler` - the `FileHandler`
        `refreshDelay` - the refresh delay

    - #### VFSFileHandlerReloadingDetector

          public VFSFileHandlerReloadingDetector(FileHandler handler)

      Creates a new instance of `VFSFileHandlerReloadingDetector` and initializes it with the given `FileHandler` object.
      Parameters:
        `handler` - the `FileHandler`

  - ### Method Detail

    - #### getLastModificationDate

          protected long getLastModificationDate()

      Returns 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 a `FileObject` and read the date of the last modification.
      Overrides:
        `getLastModificationDate` in class `FileHandlerReloadingDetector`
      Returns:
        the last modification date

    - #### getFileObject

          protected org.apache.commons.vfs2.FileObject getFileObject()

      Returns the file that is monitored by this strategy. Note that the return value can be null under some circumstances.
      Returns:
        the monitored file

    - #### resolveFileURI

          protected String resolveFileURI()

      Resolves the URI of the monitored file.
      Returns:
        the URI of the monitored file or null if it cannot be resolved

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.