Understanding configuration methods

The Configuration and Management components support several configuration methods.

  • public synchronized static Configuration getConfiguration()—Provides the caller with the sole instance of the Configuration singleton.
  • public ConfigContext createContext()—Obtains a context to access the Configuration and Management database. This context can then be used with other methods that are capable of context-based access to the Configuration and Management database.
  • public Node getNode(String canonicalName)—Retrieves a configuration node based on its canonical name, in a context-free manner.

    A canonical node name consists of the names of all the node's ancestors' names up to the root of the configuration tree, separated by the forward slash character (/). The root is designated by a forward-slash character.

    An example of a canonical node name is IBM/Party/Search.

  • public Node getNode(String canonicalName, ConfigContext context)—Retrieves a configuration node based on its canonical name, in a context-based manner.
  • public Item getConfigItem(String canonicalName)—Retrieves a configuration item based on its canonical name, in a context-free manner.

    A canonical item name consists of the names of all the node's ancestors' names up to the root of the configuration tree, separated by the forward slash character (/). The root is designated by a forward-slash character.

    An example of a canonical item name is /IBM/Party/Search/maxSearches

    Attention: Item getItem(String canonicalName) is deprecated
  • public Item getItem(String canonicalName, ConfigContext context)—Retrieves a configuration item based on its canonical name, in a context-based manner.
  • public synchronized void refresh()—Triggers a refresh of the configuration to ensure that the latest changes to the dynamic config settings made in the Configuration and Management database are visible to the application.

    The refresh operation only applies to context-free configuration. Context-based configuration access is unaffected and the application continues to see the same values for the configuration items as when the context was created.

    When the refresh operation is invoked, the configuration may reload immediately, but it is not guaranteed. The configuration is reloaded, at the latest, at the time of the first access after a refresh operation was invoked. That means that more changes can occur in the interval between when the refresh operation was invoked and the first configuration access.

    Applications should not rely on the timing of these operations to synchronize themselves with changes in the Configuration and Management database.

    Attention: getItem(String canonicalName, ConfigContext context) is deprecated.
  • public synchronized void refresh(Collection canonicalNodeNames)—Triggers a refresh of the configuration. This is similar to refresh(), except that it refreshes particular nodes that are passed as parameters to the call.

    The refresh applies to the nodes passed as parameters and all their configuration sub-trees.

  • public static String getApplicationName()—Returns the name of the application as recorded in the manifest of the application archive under the Application-Name attribute.
  • public static String getApplicationVersion()—Returns the version of the application as recorded in the manifest of the application archive under the Application-Version attribute.