I have a component MyComponent that needs to access AConfiguration and BConfiguration:
my.MyComponent:
@Component(
configurationPid = "[my.AConfiguration,my.BConfiguration]"
)
public class MyComponent {
@Activate
@Modified
protected void activate(Map<String, Object> properties) {
_aConfiguration = ConfigurableUtil
.createConfigurable(AConfiguration.class, properties);
_bConfiguration = ConfigurableUtil
.createConfigurable(BConfiguration.class, properties);
}
public void hello() {
System.out.println("A:" + _sConfiguration.valueA());
System.out.println("B:" + _sConfiguration.valueB());
}
}
my.AConfiguration:
@Meta.OCD(
id = "my.AConfiguration"
)
public interface AConfiguration {
@Meta.AD(deflt = "6")
public long valueA();
}
my.BConfiguration:
@Meta.OCD(
id = "my.BConfiguration"
)
public interface BConfiguration {
@Meta.AD(deflt = "6")
public long valueB();
}
Problem: Configuring valueA and valueB to 7
using Liferay's configuration UI has no effect, MyComponent.hello()
still sees the default value 6
.
What am I doing wrong?
What is the correct way to make my component use configuration information from several configuration interfaces?
Use case: My component does some business processing and saves results to a remote server. There is one configuration interface containing the business processing settings, and one configuration interface containing the URL to the remote server.