2017-11-25

Tamaya Features Check (Extension Module)

Tamaya Features is an extension module. Refer to the extensions documentation for further details.

What functionality this module provides ?

Tamaya Features provides a simple Features singleton that allows to check which Tamaya Extensions are currently on the classpath.

Compatibility

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

Installation

To use Tamaya Features you only must add the corresponding dependency to your module:

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

The Functionality Provided

Main artifact is the Features singleton, which provides various static methods to check, which Tamaya extensions are currently loaded.

public final class Features {

    private Features(){}

    public static boolean eventsAvailable();
    public static boolean formatsAvailable();
    public static boolean tamayaCoreAvailable();
    public static boolean injectionAvailable();
    public static boolean injectionCDIAvailable();
    public static boolean mutableConfigAvailable();
    public static boolean optionalAvailable();
    public static boolean resolverAvailable();
    public static boolean resourcesAvailable();
    public static boolean spiSupportAvailable();
    public static boolean filterSupportAvailable();
    public static boolean springAvailable();
    public static boolean jndiAvailable();

    public static boolean extSpringCoreAvailable();
    public static boolean extJndiAvailable();
    public static boolean extOSGIAvailable();

    public static boolean checkClassIsLoadable(String classname);
}
  • eventsAvailable(); checks for the tamaya_events module.

  • formatsAvailable(); checks for the tamaya_formats module.

  • tamayaCoreAvailable(); checks if the Tamaya core implementation is loaded.

  • injectionAvailable(); checks for the tamaya_injection SE module.

  • injectionCDIAvailable(); checks for the tamaya CDI modules.

  • mutableConfigAvailable(); checks for the tamaya_mutableconfig module.

  • optionalAvailable(); checks for the tamaya_optional module.

  • resolverAvailable(); checks for the tamaya_resolver module.

  • resourcesAvailable(); checks for the tamaya_resources module.

  • spiSupportAvailable(); checks for the tamaya_spisupport module.

  • filterSupportAvailable(); checks for the tamaya_filter module.

  • springAvailable(); checks for the tamaya_spring module.

  • jndiAvailable(); checks for the tamaya_jndi module.

  • extJndiAvailable(); checks if creation of a new InitialContext is successful.

  • extSpringCoreAvailable(); checks if Spring Core is on the classpath.

  • extOSGIAvailable(); checks the OSGI framework is on the classpath.

  • Finally checkClassIsLoaded(String) tries to load a class. If it fails, false is returned.