org.appng.core.service

## Class PropertySupport

- java.lang.Object
- - org.appng.core.service.PropertySupport

-     public class PropertySupport
      extends Object

  A service offering methods for initializing and retrieving the configuration `Properties` of the platform, a `Site` or an `Application`.
  Author:
    Matthias Müller
  See Also:
    `Properties`, `PropertyHolder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PREFIX_PLATFORM`
    `static String` | `PROP_PATTERN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertySupport(PropertyHolder propertyHolder)` Creates a new `PropertySupport` using the given `PropertyHolder`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getNodePrefix(String nodeId)` Returns the dot-separated property-prefix for a node-property.
    `static Properties` | `getProperties(Properties platFormConfig, Site site, Application application, boolean addPlatformScope)` Aggregates the `Properties` of the platform, the given `Site` and given `Application` to a single `Properties` object, using a prefix for determining the origin of a certain property.The prefix for a site-property is `site.`, for a platform-property it's "platform.".
    `static String` | `getPropertyName(Site site, Application application, String name)` Returns the dot-separated full name for a given property, depending on whether a `Site` and/or an `Application` are given.
    `static String` | `getPropertyPrefix(Site site, Application application)` Returns the dot-separated property-prefix, depending on whether a `Site` and/or an `Application` are given.
    `static String` | `getSitePrefix(Site site)` Returns the dot-separated property-prefix for a site-property.
    `void` | `initNodeConfig(boolean finalize)` Initializes the node configuration with the default values.
    `void` | `initPlatformConfig(String rootPath, Boolean devMode)`
    `void` | `initPlatformConfig(String rootPath, Boolean devMode, Properties immutableOverrides, boolean finalize)` Initializes the platform configuration with the default values.
    `void` | `initSiteProperties(SiteImpl site, Properties platformConfig)` Initializes the `Site` configuration with the default values.

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

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

- - ### Field Detail

    - #### PREFIX_PLATFORM

          public static final String PREFIX_PLATFORM

      See Also:
        Constant Field Values

    - #### PROP_PATTERN

          public static final String PROP_PATTERN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PropertySupport

          public PropertySupport(PropertyHolder propertyHolder)

      Creates a new `PropertySupport` using the given `PropertyHolder`.
      Parameters:
        `propertyHolder` - the `PropertyHolder` to use

  - ### Method Detail

    - #### getProperties

          public static Properties getProperties(Properties platFormConfig,
                                                 Site site,
                                                 Application application,
                                                 boolean addPlatformScope)

      Aggregates the `Properties` of the platform, the given `Site` and given `Application` to a single `Properties` object, using a prefix for determining the origin of a certain property.The prefix for a site-property is `site.`, for a platform-property it's "platform.". For an `Application` property no prefix is used.
      Parameters:
        `platFormConfig` - the platform configuration, only needed if `addPlatformScope` is `true`.
        `site` - the `Site` to retrieve `Properties` from (may be null)
        `application` - the `Application` to retrieve `Properties` from (may be null)
        `addPlatformScope` - set to `true` to add the platform properties
      Returns:
        the aggregated `Properties` with prefixed entries
      See Also:
        `Properties.getPlainProperties()`

    - #### getPropertyName

          public static String getPropertyName(Site site,
                                               Application application,
                                               String name)

      Returns the dot-separated full name for a given property, depending on whether a `Site` and/or an `Application` are given.
      Parameters:
        `site` - the `Site`, may be `null`
        `application` - the `Application`, may be `null`
        `name` - the raw name of the property, without dot-notation
      Returns:
        the full name of the property.

    - #### getPropertyPrefix

          public static String getPropertyPrefix(Site site,
                                                 Application application)

      Returns the dot-separated property-prefix, depending on whether a `Site` and/or an `Application` are given.
      Parameters:
        `site` - the `Site`, may be `null`
        `application` - the `Application`, may be `null`

    - #### getSitePrefix

          public static String getSitePrefix(Site site)

      Returns the dot-separated property-prefix for a site-property.
      Parameters:
        `site` - the `Site`
      Returns:
        the dot-separated property-prefix

    - #### initSiteProperties

          public void initSiteProperties(SiteImpl site,
                                         Properties platformConfig)

      Initializes the `Site` configuration with the default values. The properties are added to the `PropertyHolder` this `PropertySupport` was created with.
      Parameters:
        `site` - the `Site` to initialize the `Properties` for
        `platformConfig` - the platform configuration
      See Also:
        `PropertySupport(PropertyHolder)`, `SiteProperties`

    - #### initPlatformConfig

          public void initPlatformConfig(String rootPath,
                                         Boolean devMode)

    - #### initPlatformConfig

          public void initPlatformConfig(String rootPath,
                                         Boolean devMode,
                                         Properties immutableOverrides,
                                         boolean finalize)

      Initializes the platform configuration with the default values. The properties are added to the `PropertyHolder` this `PropertySupport` was created with.
      Parameters:
        `rootPath` - the root path of the platform (see `Platform.Property.PLATFORM_ROOT_PATH`)
        `devMode` - value for the `Platform.Property.DEV_MODE` property to set
        `immutableOverrides` - some `Properties` used to override the default values
        `finalize` - whether or not to call `PropertyHolder.setFinal()`
      See Also:
        `PropertySupport(PropertyHolder)`, `Platform.Property`

    - #### getNodePrefix

          public static String getNodePrefix(String nodeId)

      Returns the dot-separated property-prefix for a node-property.
      Parameters:
        `nodeId` - the node id as returned by `Messaging.getNodeId(org.appng.api.Environment)`
      Returns:
        the dot-separated property-prefix

    - #### initNodeConfig

          public void initNodeConfig(boolean finalize)

      Initializes the node configuration with the default values. The properties are added to the `PropertyHolder` this `PropertySupport` was created with.
      Parameters:
        `finalize` - whether or not to call `PropertyHolder.setFinal()`
      See Also:
        `PropertySupport(PropertyHolder)`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.