org.apache.tamaya.events.folderobserver

## Class ObservingPropertySourceProvider

- java.lang.Object
- - org.apache.tamaya.events.folderobserver.ObservingPropertySourceProvider

- All Implemented Interfaces:
    org.apache.tamaya.spi.PropertySourceProvider

      public class ObservingPropertySourceProvider
      extends Object
      implements org.apache.tamaya.spi.PropertySourceProvider

  This implementation runs in a folder taking up all files compatible with the given ConfigurationFormats. When a file is added, deleted or modified the PropertySourceProvider will adapt the changes automatically and trigger according `PropertySourceChange` events. The default folder is META-INF/config, but you can change it via an absolute path in the "-Dtamaya.configdir" parameter.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.tamaya.spi.PropertySourceProvider

      `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObservingPropertySourceProvider(Path directory)` Constructorm using an explicit directory, ignoring all kind of configuration, if set.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `directoryChanged(Path directory)` Called when a file has been modified.
    `Collection<org.apache.tamaya.spi.PropertySource>` | `getPropertySources()`
    `protected Collection<org.apache.tamaya.spi.PropertySource>` | `getPropertySources(Path file)` Read property sources from the given file.
    `protected static Map<String,String>` | `readProperties(Path file)` Load a single file.

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

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

- - ### Constructor Detail

    - #### ObservingPropertySourceProvider

          public ObservingPropertySourceProvider(Path directory)

      Constructorm using an explicit directory, ignoring all kind of configuration, if set.
      Parameters:
        `directory` - the target directory. If null, the default configuration and system property are used.

  - ### Method Detail

    - #### getPropertySources

          protected Collection<org.apache.tamaya.spi.PropertySource> getPropertySources(Path file)

      Read property sources from the given file.
      Parameters:
        `file` - source of the property sources.
      Returns:
        property sources from the given file.

    - #### readProperties

          protected static Map<String,String> readProperties(Path file)

      Load a single file.
      Parameters:
        `file` - the file, not null.
      Returns:
        properties as read from the given file.

    - #### directoryChanged

          public void directoryChanged(Path directory)

      Called when a file has been modified.
      Parameters:
        `directory` - the file path, not null.

    - #### getPropertySources

          public Collection<org.apache.tamaya.spi.PropertySource> getPropertySources()

      Specified by:
        `getPropertySources` in interface `org.apache.tamaya.spi.PropertySourceProvider`

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.