org.apache.tamaya.management

## Class ManagedConfig

- java.lang.Object
- - org.apache.tamaya.management.ManagedConfig

- All Implemented Interfaces:
    ManagedConfigMBean

      public class ManagedConfig
      extends Object
      implements ManagedConfigMBean

  Default implementation of the `ManagedConfigMBean` interface. Each bean binds to the current Configuration instance on creation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ManagedConfig()` Constructor, which binds this instance to the current TCCL.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,String>` | `getConfiguration()` Accesses a configuration current a given type as Map.
    `protected org.apache.tamaya.Configuration` | `getConfigurationInternal()` Evaluate the current configuration.
    `String` | `getJsonConfigurationInfo()` Get a general description of the configuration (context) in place, in JSON format: Configuration: { "class": "org.apache.tamaya.core.internal.DefaultConfiguration", "timestamp": 1440426409388, "data": { "ALLUSERSPROFILE": "C:\ProgramData", "APPDATA": "C:\Users\Anatole\AppData\Roaming", "COMPUTERNAME": "DEVBOX-WIN", "ComSpec": "C:\Windows\system32\cmd.exe", "CommonProgramFiles": "C:\Program Files\Common Files", "CommonProgramFiles(x86)": "C:\Program Files (x86)\Common Files", "CommonProgramW6432": "C:\Program Files\Common Files", "FP_NO_HOST_CHECK": "NO", "HOMEDRIVE": "C:", // ... } }
    `Map<String,String>` | `getSection(String area, boolean recursive)` Accesses a configuration values for current a given config section as Map.
    `Set<String>` | `getSections()` Access the defined sections for a given configuration.
    `Set<String>` | `getTransitiveSections()` Access the transitive sections for the current configuration.
    `String` | `getXmlConfigurationInfo()` Get a general description of the configuration (context) in place, in JSON format: ConfigurationContext[gqContextClassName] { version = 2345-34334-2333-3434, config { key = "value", key2 = "value2" ... }, filters = [...], converters{...}, property-sources{...} }
    `boolean` | `isAreaEmpty(String area)` Allows to determine if an section is empty.
    `boolean` | `isAreaExisting(String area)` Allows to determine if an section is existing.

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

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

- - ### Constructor Detail

    - #### ManagedConfig

          public ManagedConfig()

      Constructor, which binds this instance to the current TCCL. In the rare cases where the TCCL is null, this class's classloader is used.

  - ### Method Detail

    - #### getJsonConfigurationInfo

          public String getJsonConfigurationInfo()

      Description copied from interface: `ManagedConfigMBean`
      Get a general description of the configuration (context) in place, in JSON format:

           Configuration: {
             "class": "org.apache.tamaya.core.internal.DefaultConfiguration",
             "timestamp": 1440426409388,
             "data": {
               "ALLUSERSPROFILE": "C:\ProgramData",
               "APPDATA": "C:\Users\Anatole\AppData\Roaming",
               "COMPUTERNAME": "DEVBOX-WIN",
               "ComSpec": "C:\Windows\system32\cmd.exe",
               "CommonProgramFiles": "C:\Program Files\Common Files",
               "CommonProgramFiles(x86)": "C:\Program Files (x86)\Common Files",
               "CommonProgramW6432": "C:\Program Files\Common Files",
               "FP_NO_HOST_CHECK": "NO",
               "HOMEDRIVE": "C:",
               // ...
             }
           }

      Specified by:
        `getJsonConfigurationInfo` in interface `ManagedConfigMBean`
      Returns:
        a JSON formatted meta-information.

    - #### getXmlConfigurationInfo

          public String getXmlConfigurationInfo()

      Description copied from interface: `ManagedConfigMBean`
      Get a general description of the configuration (context) in place, in JSON format:

               ConfigurationContext[gqContextClassName] {
                   version = 2345-34334-2333-3434,
                   config {
                       key = "value",
                       key2 = "value2"
                       ...
                   },
                   filters = [...],
                   converters{...},
                   property-sources{...}
               }

      Specified by:
        `getXmlConfigurationInfo` in interface `ManagedConfigMBean`
      Returns:
        a JSON formatted meta-information.

    - #### getConfiguration

          public Map<String,String> getConfiguration()

      Description copied from interface: `ManagedConfigMBean`
      Accesses a configuration current a given type as Map.
      Specified by:
        `getConfiguration` in interface `ManagedConfigMBean`
      Returns:
        the current configuration map.

    - #### getSection

          public Map<String,String> getSection(String area,
                                      boolean recursive)

      Description copied from interface: `ManagedConfigMBean`
      Accesses a configuration values for current a given config section as Map.
      Specified by:
        `getSection` in interface `ManagedConfigMBean`
      Parameters:
        `area` - the target section key, not null.
        `recursive` - if set to false only direct child keys of the given section are returned.
      Returns:
        the key/values found, including the recursive child values.

    - #### getSections

          public Set<String> getSections()

      Description copied from interface: `ManagedConfigMBean`
      Access the defined sections for a given configuration.
      Specified by:
        `getSections` in interface `ManagedConfigMBean`
      Returns:
        the sections defined (only returning the sections that contain properties).

    - #### getTransitiveSections

          public Set<String> getTransitiveSections()

      Description copied from interface: `ManagedConfigMBean`
      Access the transitive sections for the current configuration.
      Specified by:
        `getTransitiveSections` in interface `ManagedConfigMBean`
      Returns:
        the transitive sections defined.

    - #### isAreaExisting

          public boolean isAreaExisting(String area)

      Description copied from interface: `ManagedConfigMBean`
      Allows to determine if an section is existing.
      Specified by:
        `isAreaExisting` in interface `ManagedConfigMBean`
      Parameters:
        `area` - the target section key, not null.
      Returns:
        true, if such an section exists (the section may be empty).

    - #### isAreaEmpty

          public boolean isAreaEmpty(String area)

      Description copied from interface: `ManagedConfigMBean`
      Allows to determine if an section is empty.
      Specified by:
        `isAreaEmpty` in interface `ManagedConfigMBean`
      Parameters:
        `area` - the target section key, not null.
      Returns:
        true, if such an section exists and is not empty.

    - #### getConfigurationInternal

          protected org.apache.tamaya.Configuration getConfigurationInternal()

      Evaluate the current configuration. By default this class is temporarely setting the TCCL to the instance active on bean creation and then calls `ConfigurationProvider.getConfiguration()`.
      Returns:
        the configuration instance to be used.

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