我有一个组件声明为:
<ipojo>
<component classname="HelloClass" name="helloCom" immediate="true">
<requires field="delayService" id="id1">
</requires>
</component>
<instance component="helloCom" name="hello">
<property name="requires.from">
<property name="id1" value="A"/>
</property>
</instance>
</ipojo>
该组件的jar文件:helloComponent.jar
现在,我想将 (value="A") 更新为 (value="AA")。因此,我使用 ConfigurationAdmin 实现了一个组件来更新此属性
public class ControllerReconfiguration {
private ConfigurationAdmin m_configAdmin;
@SuppressWarnings({ "rawtypes", "unchecked" })
public void reconfigure() throws IOException {
Configuration configuration = m_configAdmin.getConfiguration("hello","file:./helloComponent.jar");
configuration.setBundleLocation("file:./helloComponent.jar");
Properties props = new Properties();
//Dictionary props = new Hashtable();
props.put("id1", "AA");
configuration.update(props);
System.out.println("Update");
}
}
但是,此 ControllerReconfiguration 组件无法更新 'hello' 实例中的值 'A'(由 'AA')。
请问如何修改这个 ControllerReconfiguration 组件?
谢谢你的帮助。