org.apache.tamaya.resource

## Class AbstractPathPropertySourceProvider

- java.lang.Object
- - org.apache.tamaya.resource.AbstractPathPropertySourceProvider

- All Implemented Interfaces:
    PropertySourceProvider

      public abstract class AbstractPathPropertySourceProvider
      extends Object
      implements PropertySourceProvider

  Abstract base class that uses a descriptive resource path to define the locations of configuration files to be included into the configuration. This is especially useful, when the current configuration policy in place does not define the exact file names, but the file locations, where configuration can be provided.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractPathPropertySourceProvider(String... resourcePaths)` Creates a new instance using the given resource paths.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PropertySource` | `createPropertiesPropertySource(URL url)` Utility method that reads a .properties file from the given url and creates a corresponding `PropertySource`.
    `Collection<PropertySource>` | `getPropertySources()`
    `protected abstract Collection<PropertySource>` | `getPropertySources(URL url)` Factory method that creates a `PropertySource` based on the URL found by the resource locator.

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

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

- - ### Constructor Detail

    - #### AbstractPathPropertySourceProvider

          public AbstractPathPropertySourceProvider(String... resourcePaths)

      Creates a new instance using the given resource paths.
      Parameters:
        `resourcePaths` - the resource paths, not null, not empty.

  - ### Method Detail

    - #### getPropertySources

          public Collection<PropertySource> getPropertySources()

      Specified by:
        `getPropertySources` in interface `PropertySourceProvider`

    - #### getPropertySources

          protected abstract Collection<PropertySource> getPropertySources(URL url)

      Factory method that creates a `PropertySource` based on the URL found by the resource locator.
      Parameters:
        `url` - the URL, not null.
      Returns:
        the `PropertySource`s to be included into the current provider's sources list. It is safe to return `null` here, in case the content of the URL has shown to be not relevant as configuration input. In case the input is not valid or accessible an exception can be thrown or logged.

    - #### createPropertiesPropertySource

          public static PropertySource createPropertiesPropertySource(URL url)

      Utility method that reads a .properties file from the given url and creates a corresponding `PropertySource`.
      Parameters:
        `url` - the url to read, not null.
      Returns:
        the corresponding PropertySource, or null.

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