Search in sources :

Example 1 with AD

use of org.apache.felix.metatype.AD in project fabric8 by jboss-fuse.

the class ProfileMetadata method createMetaTypeObjectDTO.

protected static MetaTypeObjectDTO createMetaTypeObjectDTO(Properties resources, OCD ocd) {
    MetaTypeObjectDTO answer = new MetaTypeObjectDTO();
    answer.setId(ocd.getID());
    answer.setName(localize(resources, ocd.getName()));
    answer.setDescription(localize(resources, ocd.getDescription()));
    List<MetaTypeAttributeDTO> attributeList = new ArrayList<>();
    Map<String, Object> attributes = ocd.getAttributeDefinitions();
    if (attributes != null) {
        Set<Map.Entry<String, Object>> entries = attributes.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            String name = entry.getKey();
            Object value = entry.getValue();
            if (value instanceof AD) {
                AD ad = (AD) value;
                MetaTypeAttributeDTO attributeDTO = createMetaTypeAttributeDTO(resources, ocd, name, ad);
                if (attributeDTO != null) {
                    attributeList.add(attributeDTO);
                }
            }
        }
    }
    answer.setAttributes(attributeList);
    return answer;
}
Also used : JarEntry(java.util.jar.JarEntry) AD(org.apache.felix.metatype.AD) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) MetaTypeObjectDTO(io.fabric8.api.jmx.MetaTypeObjectDTO) MetaTypeAttributeDTO(io.fabric8.api.jmx.MetaTypeAttributeDTO)

Aggregations

MetaTypeAttributeDTO (io.fabric8.api.jmx.MetaTypeAttributeDTO)1 MetaTypeObjectDTO (io.fabric8.api.jmx.MetaTypeObjectDTO)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JarEntry (java.util.jar.JarEntry)1 AD (org.apache.felix.metatype.AD)1