On our project we are developing classes that are configurable via the Apache Felix Maven SCR Plugin and Felix Configuration Console. I understand the concept of the scr.property tag and am able to view and edit these properties within the Console Configuration screen. However, I am having trouble with property values that appear to persist when a bundle is updated, but in actuality are not persisted to that property.
For example, I have these two properties in my LDAPManager that is in my Authentication bundle:
/** @scr.property label="Security Principle Password" description="Security principle password" */
private static String SECURITY_CREDENTIALS = "security.credentials";
/** @scr.property label="Authorization Type" description="LDAP Authorization Type" value="Simple"*/
private static String SECURITY_AUTH_TYPE = "security.authorization.type";
When I upload the bundle to Felix and go the configurations tab, I see both of these configurable form fields and auth type is defaulted to "Simple." If I fill out the password form field to "my_password" and hit 'save,' through log files, I am able to see the password field being updated in my code. However, if I go back to my bundles tab and update that bundle (browse to that bundle in the file system, select "install or update", select "refresh packages"), my issue occurs. I notice that if I go to my configurations tab, "my_password" is still filled out/populated in to the password form field but when I check my logs, the property value in the code is set to null. I'm worried that people may assume that the property has been filled out and correct in the code since the form field displays the value but in actuality, the property is still null and won't be set until I hit the save button.
I am populating these fields via the following code:
@SuppressWarnings("unchecked")
protected void activate(ComponentContext context)
{
this.setup(context.getProperties());
}
void setup(Dictionary<String, Object> configuration)
{
Object parameter = configuration.get("password");
userPassword = parameter.toString();
}
Thanks