Skip Navigation

Using ConfigService and Configuring Properties

Before you begin, you need a plug-in project.

  1. Open the Dependencies tab in your plug-in project, and add the following plug-in dependencies:

    • com.sabre.edge.platform.core.common

    • org.eclipse.ui

    • org.eclipse.core.runtime

Putting the Specific Properties of a Plug-in into ConfigService

  1. Either create a new configuration properties file with the .properties extension, or use the existing file in your plug-in. In the file, add the configuration properties that are specific to this plug-in.

  1. Type the properties in the form of key=value pairs to retrieve and wrap the values as the following types. (See the next table.)

Value Types of Configuration Properties for ConfigService

Value Type Syntax Example


keyString=some string
Example of an entry in the file:
This entry replaces keyString=string value.
Rule for adding a suffix:
Supported suffixes
Example that uses a suffix:
Include the following keys in your properties file:
When you try to retrieve a key 'url', ConfigService returns when the CERT environment is used, and the service returns for the PROD environment.





Map <String, String>


  1. On the Build tab, add your configuration properties file to the binary build.



  1. Open the Extensions tab. Click Add, and then add the extension point. (See the next figure.) Right-click the extension point, and choose New > contributor.


  Only the file property is required for this extension point. In the file field, you are required to point to your configuration properties file.

Getting Specific Properties in a Plug-in from ConfigService

  1. Add or update the Activator class in your plug-in. To add or update this class, extend com.sabre.edge.platform.core.common.plugin.base.AbstractEdgeBasePlugin.

  2. Obtain a reference to the ConfigService service.

        Inside the Activator class, add the following code:

IBaseConfigService config = getConfigService();

        Outside of the Activator class, add the following code:

IBaseConfigService config = Activator.getDefault().getConfigService();

  1. The next table shows the methods that obtain the configuration properties in a plug-in. Use the method that corresponds to your property value type.

    • In the syntax example, replace key* with your key name.

    • Replace with your bundle symbolic name.

You can find the bundle symbolic name in MANIFEST.MF.

        Example in MANIFEST.MF:


Methods for Obtaining Configuration Properties in a Plug-in

Property Value Type Syntax Example


String s = config.getLocalProperty("keyString", "");


Boolean b = config.getLocalPropertyAsBoolean("keyBoolean", "");


Long l = config.getLocalPropertyAsLong("keyLong", "");

Map <String, String>

Map <String, String> map = config.getLocalPropertyAsMap("keyMap", "");

When you use return-object type methods, as in getLocalPropertyAs (String, String)* , be careful to match the type of the property value with the type of the object that the method returns. If you do not match these types correctly, an exception will be returned at runtime.

Note that getLocalProperty(String, String) ignores the property value type and returns a string value.