Search in sources :

Example 1 with MetaTypeSummaryDTO

use of io.fabric8.api.jmx.MetaTypeSummaryDTO in project fabric8 by jboss-fuse.

the class ProfileMetadata method metaTypeSummary.

@Override
public MetaTypeSummaryDTO metaTypeSummary(String versionId, String profileId) throws Exception {
    final MetaTypeSummaryDTO answer = new MetaTypeSummaryDTO();
    MetadataHandler handler = new MetadataHandler() {

        @Override
        public void invoke(MetaData metadata, Properties resources) {
            addMetaData(answer, metadata, resources);
        }
    };
    findMetadataForProfile(versionId, profileId, handler);
    return answer;
}
Also used : MetaTypeSummaryDTO(io.fabric8.api.jmx.MetaTypeSummaryDTO) MetaData(org.apache.felix.metatype.MetaData) Properties(java.util.Properties)

Example 2 with MetaTypeSummaryDTO

use of io.fabric8.api.jmx.MetaTypeSummaryDTO in project fabric8 by jboss-fuse.

the class ProfileMetadata method addMetaData.

protected void addMetaData(MetaTypeSummaryDTO summary, MetaData metadata, Properties resources) {
    Map<String, Object> map = metadata.getDesignates();
    Map<String, Object> objects = metadata.getObjectClassDefinitions();
    Set<Map.Entry<String, Object>> entries = map.entrySet();
    for (Map.Entry<String, Object> entry : entries) {
        String pid = entry.getKey();
        Object value = objects.get(pid);
        if (value instanceof OCD) {
            OCD ocd = (OCD) value;
            MetaTypeObjectSummaryDTO object = summary.getOrCreateMetaTypeSummaryDTO(pid);
            object.setId(pid);
            object.setName(localize(resources, ocd.getName()));
            object.setDescription(localize(resources, ocd.getDescription()));
        }
    }
}
Also used : OCD(org.apache.felix.metatype.OCD) JarEntry(java.util.jar.JarEntry) MetaTypeObjectSummaryDTO(io.fabric8.api.jmx.MetaTypeObjectSummaryDTO) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with MetaTypeSummaryDTO

use of io.fabric8.api.jmx.MetaTypeSummaryDTO in project fabric8 by jboss-fuse.

the class MetaTypeFacade method metaTypeSummary.

@Override
public MetaTypeSummaryDTO metaTypeSummary() {
    MetaTypeSummaryDTO answer = new MetaTypeSummaryDTO();
    Bundle[] bundles = bundleContext.getBundles();
    for (Bundle bundle : bundles) {
        MetaTypeInformation info = getMetaTypeInformation(bundle);
        if (info != null) {
            answer.addTypeInformation(bundle, info);
        }
    }
    return answer;
}
Also used : MetaTypeSummaryDTO(io.fabric8.api.jmx.MetaTypeSummaryDTO) Bundle(org.osgi.framework.Bundle) MetaTypeInformation(org.osgi.service.metatype.MetaTypeInformation)

Aggregations

MetaTypeSummaryDTO (io.fabric8.api.jmx.MetaTypeSummaryDTO)2 MetaTypeObjectSummaryDTO (io.fabric8.api.jmx.MetaTypeObjectSummaryDTO)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 JarEntry (java.util.jar.JarEntry)1 MetaData (org.apache.felix.metatype.MetaData)1 OCD (org.apache.felix.metatype.OCD)1 Bundle (org.osgi.framework.Bundle)1 MetaTypeInformation (org.osgi.service.metatype.MetaTypeInformation)1