org.apache.myfaces.trinidad.config

## Class ConfigPropertyService

- java.lang.Object
- - org.apache.myfaces.trinidad.config.ConfigPropertyService

-     public abstract class ConfigPropertyService
      extends Object

  This class allows access to configuration properties supplied by a plugable property value provider. Using a plugable property value provider separates access to property values from where the values are stored, allowing different property storage and configuration schemes to be used without impacting code that uses the property values.

  See `PropertyValueProvider` for information on configuring a property value provider.

  Implementation os this class are required to be thread safe allowing multiple threads to invoke methods on an instance concurrently.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `CONFIG_PROPERTY_SERVICE_KEY` Key used to store the application's ConfigPropertyService instance in the applicationScope map.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigPropertyService()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addPropertyChangeListener(PropertyChangeListener listener)` Register a listener to be informed if/when a property value is changed.
    `static ConfigPropertyService` | `getInstance(javax.faces.context.ExternalContext externalContext)` Obtain a reference to the service.
    `abstract String` | `getProperty(javax.faces.context.ExternalContext externalContext, String name)`
    `protected abstract TestPropertyValueProvider` | `getTestProvider()` Get the test value provider.
    `protected abstract void` | `notifyValueChange(javax.faces.context.ExternalContext externalContext, String name, String oldValue)` Notify value change listeners of a config property value change.
    `abstract void` | `removePropertyChangeListener(PropertyChangeListener listener)` Unregister a property change listener.

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

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

- - ### Field Detail

    - #### CONFIG_PROPERTY_SERVICE_KEY

          protected static final String CONFIG_PROPERTY_SERVICE_KEY

      Key used to store the application's ConfigPropertyService instance in the applicationScope map.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ConfigPropertyService

          public ConfigPropertyService()

  - ### Method Detail

    - #### getInstance

          public static ConfigPropertyService getInstance(javax.faces.context.ExternalContext externalContext)

      Obtain a reference to the service.
      Parameters:
        `externalContext` - container context object.
      Returns:
        service object for obtaining property values.

    - #### getProperty

          public abstract String getProperty(javax.faces.context.ExternalContext externalContext,
                           String name)

      Parameters:
        `externalContext` - container context object.
        `name` - name of the requested property.
      Returns:
        the value of the property or `null` if the property was not found.
      Throws:
        `NullPointerException` - is the specified name is null.

    - #### addPropertyChangeListener

          public abstract void addPropertyChangeListener(PropertyChangeListener listener)

      Register a listener to be informed if/when a property value is changed.

      The `ConfigPropertyService` will be specified as the 'source' attribute of any change events the listener receives.

      Parameters:
        `listener` - the listener to be notified of property value changes.

    - #### removePropertyChangeListener

          public abstract void removePropertyChangeListener(PropertyChangeListener listener)

      Unregister a property change listener.
      Parameters:
        `listener` - the listener to unregister.

    - #### getTestProvider

          protected abstract TestPropertyValueProvider getTestProvider()

      Get the test value provider. If one is not currently in the collection of value providers a new instance will be created and added to the collection. An implementation of this class should not allow more than one instance of in its collection of value providers.
      Returns:
        a test value provider.

    - #### notifyValueChange

          protected abstract void notifyValueChange(javax.faces.context.ExternalContext externalContext,
                               String name,
                               String oldValue)

      Notify value change listeners of a config property value change.
      Parameters:
        `name` - the name of the property who's value changed.
        `oldValue` - the previous value of the property.
        `newValue` - the new value of the property.

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.