【发布时间】:2018-08-26 17:02:57
【问题描述】:
我正在尝试了解 Apache Felix 中 metatype 文件在我的 OSGi 应用程序中的用途。
示例 XML
<?xml version="1.0" encoding="UTF-8"?>
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0">
<OCD description="BundleMetaData" name="com.osgi.client" id="osgiclient">
<AD name="Bundle Name" id="osgiclient-feature" required="true" type="String" default="CUSTOM :: GREETER CLIENT :: BUNDLE"/>
</OCD>
<Designate pid="com.osgi.client">
<Object ocdref="com.osgi.client"/>
</Designate>
</metatype:MetaData>
我想以编程方式获取Bundle Name,但请参阅:
http://felix.apache.org/documentation/subprojects/apache-felix-metatype-service.html
需要某种 PID 来获取数据:
ObjectClassDefinition ocd = information.getObjectClassDefinition(pid, locale);
但是,我分析了 information 对象并没有看到任何 PID。如何从 XML 访问这些属性?
【问题讨论】:
标签: osgi apache-karaf apache-felix