Search in sources :

Example 1 with DefaultMetaTypeProvider

use of org.apache.felix.metatype.DefaultMetaTypeProvider in project felix by apache.

the class MetaTypeInformationImpl method addMetaData.

// ---------- setters to fill the values -----------------------------------
protected void addMetaData(MetaData md) {
    if (md.getDesignates() != null) {
        // meta type provide to register by PID
        DefaultMetaTypeProvider dmtp = new DefaultMetaTypeProvider(this.bundle, md);
        Iterator designates = md.getDesignates().iterator();
        while (designates.hasNext()) {
            Designate designate = (Designate) designates.next();
            // get the OCD reference, ignore the designate if none
            DesignateObject object = designate.getObject();
            String ocdRef = (object == null) ? null : object.getOcdRef();
            if (ocdRef == null) {
                continue;
            }
            // get ocd for the reference, ignore designate if none
            final Map map = md.getObjectClassDefinitions();
            OCD ocd = (OCD) (map == null ? null : map.get(ocdRef));
            if (ocd == null) {
                continue;
            }
            // gather pids and factory pids and register provider
            if (designate.getFactoryPid() != null) {
                this.factoryPids.add(designate.getFactoryPid());
                this.addMetaTypeProvider(designate.getFactoryPid(), dmtp);
            } else {
                this.pids.add(designate.getPid());
                this.addMetaTypeProvider(designate.getPid(), dmtp);
            }
        }
    }
}
Also used : OCD(org.apache.felix.metatype.OCD) DesignateObject(org.apache.felix.metatype.DesignateObject) Iterator(java.util.Iterator) Designate(org.apache.felix.metatype.Designate) DefaultMetaTypeProvider(org.apache.felix.metatype.DefaultMetaTypeProvider) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 DefaultMetaTypeProvider (org.apache.felix.metatype.DefaultMetaTypeProvider)1 Designate (org.apache.felix.metatype.Designate)1 DesignateObject (org.apache.felix.metatype.DesignateObject)1 OCD (org.apache.felix.metatype.OCD)1