Tamaya Management (JMX Support) (Extension Module)

Overview

The Tamaya management module provides support for registering a JMX management bean for accessing configuration.

Compatibility

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

Installation

To benefit from configuration builder support you only must add the corresponding dependency to your module:

<dependency>
  <groupId>org.apache.tamaya.ext</groupId>
  <artifactId>tamaya-management</artifactId>
  <version>{tamayaVersion}</version>
</dependency>

The ManagedConfigMBean bean

The management model defines the MBean of type ManagedConfigMBean as follows:

public interface ManagedConfigMBean {
    String getJsonConfigurationInfo();
    String getXmlConfigurationInfo();
    Map<String, String> getConfiguration();
    Map<String, String> getSection(String area, boolean recursive);
    Set<String> getSections();
    Set<String> getTransitiveSections();
    boolean isSectionExisting(String area);
    default boolean isSectionEmpty(String area);
}
  • getJsonConfigurationInfo,getXmlConfigurationInfo return a JSON or XML representation of the current configuration.

  • getConfiguration access the current configuration properties.

  • getSection allows to extract all entries below a certain subkey. With recursive the query will not only return direct children, but also recursively walk down all subsection of the given section key.

  • getSections returns all current known section names.

  • getTransitiveSections return all sections, but also adds all transitive subsection as single entries to the set as well.

  • isSectionExisting and isSectionEmpty allow for quering if entries are present under the given section keys.

Registering the ManagedConfigMBean

For registering the current ManagedConfigMBean instance to the current MBean platform server, the following static methods are available:

public final class ConfigManagementSupport{

    private JMXSupport(){}

    public static ObjectName registerMBean();
    public static ObjectName registerMBean(String context);
    public static ObjectName unregisterMBean();
    public static ObjectName unregisterMBean(String context);
}
  • registerMBean creates a new ManagedConfigMBean instance using the ServiceContextManager and registers it. Optionally an additional context parameter can be passed, which allows to register the management bean for different classloaders, e.g. for different ears.

  • unregisterMBean does the oppsite than registering obviously.

Note The instance of ManagedConfigMBean to be created and registered is evaluated by use og the ServiceContextManager. So you can replace the bean implementation by registering your overriding implementation using the current ServiceContext (by default using java.util.ServiceLoader and @Priority annotation.
Last updated 2016-07-13 23:26:00 +02:00

Back to top

Version: 0.3-incubating-SNAPSHOT. Last Published: 2016-07-13.

Reflow Maven skin by Andrius Velykis.