org.apache.tamaya.format

## Class BaseFormatPropertySourceProvider

- java.lang.Object
- - org.apache.tamaya.format.BaseFormatPropertySourceProvider

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

      public abstract class BaseFormatPropertySourceProvider
      extends Object
      implements org.apache.tamaya.spi.PropertySourceProvider

  Implementation of a `PropertySourceProvider` that reads configuration from some given resource paths and using the given formats. The resource path are resolved as classpath resources. This can be changed by overriding `getPropertySources()`. For each resource found the configuration formats passed get a chance to read the resource, if they succeed the result is taken as the providers PropertySources to be exposed.

- - ### Field Summary

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

      `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats, ClassLoader classLoader, String... paths)` Creates a new instance.
    `BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats, String... paths)` Creates a new instance, hereby using the current thread context classloader, or if not available the classloader that loaded this class.
    `BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats, URL... paths)` Creates a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<org.apache.tamaya.spi.PropertySource>` | `getPropertySources()` This method does dynamically resolve the paths using the current ClassLoader set.
    `protected abstract Collection<org.apache.tamaya.spi.PropertySource>` | `getPropertySources(ConfigurationData data)` Method to create a `PropertySource` based on the given entries read.

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

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

- - ### Constructor Detail

    - #### BaseFormatPropertySourceProvider

          public BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats,
                                          URL... paths)

      Creates a new instance.
      Parameters:
        `formats` - the formats to be used, not null, not empty.
        `paths` - the paths to be resolved, not null, not empty.

    - #### BaseFormatPropertySourceProvider

          public BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats,
                                          String... paths)

      Creates a new instance, hereby using the current thread context classloader, or if not available the classloader that loaded this class.
      Parameters:
        `formats` - the formats to be used, not null, not empty.
        `paths` - the paths to be resolved, not null, not empty.

    - #### BaseFormatPropertySourceProvider

          public BaseFormatPropertySourceProvider(List<ConfigurationFormat> formats,
                                          ClassLoader classLoader,
                                          String... paths)

      Creates a new instance.
      Parameters:
        `classLoader` - the ClassLoader to be used, not null, not empty.
        `formats` - the formats to be used, not null, not empty.
        `paths` - the paths to be resolved, not null, not empty.

  - ### Method Detail

    - #### getPropertySources

          protected abstract Collection<org.apache.tamaya.spi.PropertySource> getPropertySources(ConfigurationData data)

      Method to create a `PropertySource` based on the given entries read.
      Parameters:
        `data` - the configuration data, not null.
      Returns:
        the `PropertySource` instance ready to be registered.

    - #### getPropertySources

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

      This method does dynamically resolve the paths using the current ClassLoader set. If no ClassLoader was explcitly set during creation the current Thread context ClassLoader is used. If none of the supported formats is able to parse a resource a WARNING log is written.
      Specified by:
        `getPropertySources` in interface `org.apache.tamaya.spi.PropertySourceProvider`
      Returns:
        the PropertySources successfully read

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