use of io.fabric8.api.jmx.MetaTypeObjectDTO 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;
}
use of io.fabric8.api.jmx.MetaTypeObjectDTO in project fabric8 by jboss-fuse.
the class ProfileMetadata method getPidMetaTypeObject.
@Override
public MetaTypeObjectDTO getPidMetaTypeObject(String versionId, String profileId, final String pid) throws Exception {
final AtomicReference<MetaTypeObjectDTO> answer = new AtomicReference<>(null);
MetadataHandler handler = new MetadataHandler() {
@Override
public void invoke(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 aPid = entry.getKey();
Object value = objects.get(aPid);
if (Objects.equal(pid, aPid) && value instanceof OCD) {
OCD ocd = (OCD) value;
answer.set(createMetaTypeObjectDTO(resources, ocd));
}
}
}
};
findMetadataForProfile(versionId, profileId, handler);
return answer.get();
}
use of io.fabric8.api.jmx.MetaTypeObjectDTO in project fabric8 by jboss-fuse.
the class MetaTypeFacade method getPidMetaTypeObject.
@Override
public MetaTypeObjectDTO getPidMetaTypeObject(String pid, String locale) {
Bundle[] bundles = bundleContext.getBundles();
MetaTypeObjectDTO answer = null;
for (Bundle bundle : bundles) {
MetaTypeInformation info = getMetaTypeInformation(bundle);
if (info != null) {
ObjectClassDefinition object = MetaTypeSummaryDTO.tryGetObjectClassDefinition(info, pid, locale);
if (object != null) {
if (answer == null) {
answer = new MetaTypeObjectDTO(object);
} else {
answer.appendObjectDefinition(object);
}
}
}
}
return answer;
}
Aggregations