Pierre,
As you had guessed, there are no API's to access those custom properties
and you need to parse those yourself or extend the MetaType service to
do so.
Ali
On 2/10/2010 5:00 PM, Pierre De Rop wrote:
Hello everyone;
For now, we are using our own GUI for configuring our bundles (we use Config
Admin). So, the GUI loads property meta informations (labels, default
values) from a proprietary configuration file which is embedded in the
bundle (META-INF).
But now, we would like to be able to expose our metadata properties using
MetaType (OSGI-INF/metadata/metadata.xml).
So, most of our metadata properties matches the available MetaType xml
attributes. For instance, in the MetaType xml schema, we can define property
attribute types; default values; cardinality, etc ....
But the point is that we do have some specific property meta informations
which don't fit into the MetaType xml schema. For instance, some of our
property meta data have a specific "Level" parameter, which can take either
the "Basic", or "Advanced" value: when set to "Advanced", then the property
is displayed and configurable in the GUI, only if the GUI has been logged in
SuperUser mode.
My question is: where can I store such specific "Level" meta information in
the MetaType xml file ?
I am not sure, but it seems that specific informations have to be stored in
the<Attribute> elements of the<Designate><Object> xml element ?
For instance:
<?xml version="1.0" encoding="UTF-8"?>
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"
localization="OSGI-INF/metatype/metatype">
<OCD id="foo.bar.MyComponent" name="MyComponent bundle"
description="Configuration for MyComponent bundle">
<AD id="log.level" type="String" default="WARN" name="Log Level"
description="This property defines the MyComponent log level">
<Option value="WARN" label="WARN label"/>
<Option value="INFO" label="INFO label"/>
<Option value="DEBUG" label="DEBUG label"/>
</AD>
</OCD>
<Designate pid="foo.bar.MyComponent">
<Object ocdref="foo.bar.MyComponent">
*<Attribute adref="log.level">
<Value>Level:Advanced</Value>
</Attribute>*
</Object>
</Designate>
</metatype:MetaData>
Am I correct ?
If yes, then it appears that the MetaType Service does not expose an API
which let me parse the specific Attribute<Value> elements. Does anyone know
why ? So, will I have to parse myself the metatype.xml file (for parsing the
specific<Value> attribute) ?
Thanks in advance;
/pierre
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]