遍历 OSGi 配置中的属性
Iterate Through Properties in OSGi Configuration
我正在使用 OSGi ConfigurationAdmin return 配置列表:
Configuration[] configurations = configAdmin.listConfigurations(null);
然后我可以遍历该列表以获取永久 ID(配置属性组):
for (Configuration configuration : configurations) {
System.out.println(configuration.getPid());
}
我现在如何遍历每个 PID/Configuration 中的属性?
在这里找到答案:Iterate Dictionary in Java。请参阅说明的答案:
If you have to use a dictionary (for example osgi felix framework
ManagedService) then the following works...
我最终使用了一个迭代器,正如那里所描述的那样。有趣的是,这个答案与 OSGi 对 Dictionary 的使用有关,这也是我提出问题的原因。
我正在使用 OSGi ConfigurationAdmin return 配置列表:
Configuration[] configurations = configAdmin.listConfigurations(null);
然后我可以遍历该列表以获取永久 ID(配置属性组):
for (Configuration configuration : configurations) {
System.out.println(configuration.getPid());
}
我现在如何遍历每个 PID/Configuration 中的属性?
在这里找到答案:Iterate Dictionary in Java。请参阅说明的答案:
If you have to use a dictionary (for example osgi felix framework ManagedService) then the following works...
我最终使用了一个迭代器,正如那里所描述的那样。有趣的是,这个答案与 OSGi 对 Dictionary 的使用有关,这也是我提出问题的原因。