org.apache.tamaya.format

## Class BaseFormatPropertySourceProvider

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

- All Implemented Interfaces:
    PropertySourceProvider

      public abstract class BaseFormatPropertySourceProvider
      extends Object
      implements PropertySourceProvider

  Implementation of a `PropertySourceProvider` that reads configuration from some given resource paths and using the given formats. The resource path are resolved using the current `ResourceResolver` active. 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.

- - ### 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

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<PropertySource>` | `getPropertySources()` This method does dynamically resolve the paths using the current ClassLoader set.
    `protected abstract Collection<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<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<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 `PropertySourceProvider`
      Returns:
        the PropertySources successfully read

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