Skip Navigation

About ConfigService

ConfigService is a logical component that retrieves local configurations either as String, Boolean, Long, or Map classes. Local configurations are configurations in a bundle. ConfigService stores properties that other plug-ins use. Typical properties include host names, port numbers, and web addresses.

The properties are configurable values that are stored as key-value pairs in a text file in the specific plug-in in which they are used. Storing the properties in a separate file lets you quickly update the properties. When you need to change properties, you update the properties in the text file, and you contribute new properties to ConfigService by using an extension to an extension point.

This service is a separate plug-in. It does not contribute to the UI.

Use of Suffixes for Environments

Suffix mechanism allows to choose a value for the variable, depending on execution environment. Use it if you want a Red App to be aware of the environment and to consume different values of the variable during development and on production. The rule is: KEY.SUFFIX=VALUE.

Currently supported suffixes (environments):

  • prod

  • cert

Keep in mind, that when using suffixes ConfigService will return default value (key without suffix) on environment for which corresponding suffix is missing. It is good practice to always define default value when using suffixes.

Example of a URL Property as a Key-Value Pair

Suppose that you have a plug-in with an HTML browser. A specific URL is embedded in the plug-in. You store the URL of the page as a key-value property in a configuration properties file. In this example, you are storing your configuration properties in the plugin.properties file. The key-value entry in the file follows:

url=http://www.somepage.com

        Where:

key = url

When you need to update the URL, update the value of url in the properties file. Sabre Red 360 loads the new page inside a browser.

If url is the key in a properties file, you can append a suffix if you want to use different values for different environments.

url=https://www.somepage.com
url.cert=https://www.someotherpage.com
url.prod=https://www.somepage.com

Dependencies, Extension Points, and Classes

When you are adding ConfigService to your plug-in, both Eclipse and Sabre Red 360 have defined some dependencies, extension points, and classes that are required to add ConfigService . They are listed below.

Minimal Required Dependencies

com.sabre.edge.platform.core.common

org.eclipse.ui

org.eclispe.core.runtime

Required Extension Point

com.sabre.edge.platform.core.config.properties

Required Class

The plug-in is required to have an Activator class. Create or update the Activator by extending com.sabre.edge.platform.core.common.plugin.base.AbstractEdgeBasePlugin .