To make a component's properties configurable through the Configuration Admin, write a metatype XML resource to export them as metadata as defined in the OSGi Metatype Service Specification, linking the defined metatype with the component name. Then, create the component configuration in the Configuration Admin using the component name as the configuration PID.
The example that follows is an XML document providing the metadata of a component's properties. Their IDs must be same as their names declared in the component description:
Providing a component's configuration data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OCD name="Hello Component Config" id="ocd1">
<AD name="Property One" id="Prop1" type="String" default="init value"/>
<AD name="Property Two" id="Prop2" type="Integer" default="0"/>
</OCD>
<Designate pid="HelloServiceComponent">
<Object ocdref="ocd1"/>
</Designate>
</metatype:MetaData>
If you want to produce and preconfigure multiple component instances, set the factory attribute of the Designate element to true to indicate that this metatype will be for a Managed Service Factory.