Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Desktop Red Apps
- Plug-in Services
- Traditional OSGi Services
- ConfigService
- Using ConfigService and Configuring Properties
Using ConfigService and Configuring Properties
Before you begin, you need a plug-in project.
-
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
-
Either create a new configuration properties file with the .properties extension, or use the existing plugin.properties file in your plug-in. In the file, add the configuration properties that are specific to this plug-in.

-
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 |
String |
keyString=some string |
Boolean |
keyBoolean=true |
Long |
keyLong=1000000 |
Map <String, String> |
keyMap=map_key1,map_value1,map_key2,map_value2 |
-
On the Build tab, add your configuration properties file to the binary build.

-
Open the Extensions tab. Click Add, and then add the com.sabre.edge.platform.core.config.properties 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
-
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.
-
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();
-
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 your.bundle.symbolic.name with your bundle symbolic name.
-
You can find the bundle symbolic name in MANIFEST.MF
.
Example in MANIFEST.MF:
Bundle-SymbolicName: your.bundle.symbolic.name
Methods for Obtaining Configuration Properties in a Plug-in
Property Value Type |
Syntax Example |
String |
String s = config.getLocalProperty("keyString", "your.bundle.symbolic.name"); |
Boolean |
Boolean b = config.getLocalPropertyAsBoolean("keyBoolean", "your.bundle.symbolic.name"); |
Long |
Long l = config.getLocalPropertyAsLong("keyLong", "your.bundle.symbolic.name"); |
Map <String, String> |
Map <String, String> map = config.getLocalPropertyAsMap("keyMap", "your.bundle.symbolic.name"); |
Note
|
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.