2017-11-25

Tamaya SPI Support

Tamaya SPI Support is a core module only depending on the API. It implements lots of API and SPI related artifacts in a portable way. Tamaya’s core module reuses this functionality to build up a fully fledged Tamaya API implementatation.

What functionality this module provide?

Tamaya SPI Support provides a few helpful base classes that can be used to implement aspects of Tamaya:

  • BasePropertySource provides an abstract base class for implementation of your own PropertySources.

  • DefaultConfiguration provides you with a simple implementation of the Configuration interface based on a ConfigurationContext provided. This is also very useful for mocking configuration during test execution, but not only constraint to that use case.

  • DefaultConfigurationContext provides you with a working implementation of the ConfigurationContext.

  • Numerous converters, including an EnumConverter,that is a converter implementation that can automatically select the currect enumeration values based on a configured entry.

  • MapPropertySource implements a property source based on java.util.Map.

  • PriorityServiceComparator compares arbitrary services based on their @Priority annotations (also handling the case, where no such annotation is present).

  • PropertiesResourcePropertySource is an implementation of a PropertySource based on a Properties instance, loadable from any URL. + PropertyConverterManager is a useful service class, when implementing instances of ConfigurationContext. It manages registered instances of PropertyConverter and provides easy to use type conversion logic. + PropertyFiltering provides another helpful class that manages PropertyFilter instances and provides an easy to use high level API. + PropertySourceComparator provides an implementation that compares PropertySources based on their getOrdinal() values and their class names. + The default configuration implementation also allows to replace the raw value evaluation logic using a ConfigValueEvaluator, similar to Tamaya’s core implementation.

Note
It is highly recommended that you also read the documentation of Tamaya’s core implementation, since this describes the abstrations in use in more detail. This module allows to reuse Tamaya’s implementation artifacts but still allows alternate implementations of the core API to be used.

Compatibility

The module is based on Java 8, so it will run on Java 8 and beyond.

Installation

To use Tamaya’s spisupport you only have to add the corresponding dependency to your module:

<dependency>
  <groupId>org.apache.tamaya</groupId>
  <artifactId>tamaya-spisupport</artifactId>
  <version>{tamaya_version}</version>
</dependency>

The component will not register any components but only provides portable base classes for some common SPI implementation tasks. It only depends on the API, so it should be safely reusable also with other implementations of the Tamaya API as well.