use of org.osgi.service.component.runtime.dto.ComponentConfigurationDTO in project felix by apache.
the class ScrServiceImpl method getComponents.
/**
* @see org.apache.felix.scr.ScrService#getComponents(org.osgi.framework.Bundle)
*/
public Component[] getComponents(final Bundle bundle) {
List<Component> result = new ArrayList<Component>();
final Collection<ComponentDescriptionDTO> descriptions = (bundle == null ? this.runtime.getComponentDescriptionDTOs() : this.runtime.getComponentDescriptionDTOs(bundle));
for (final ComponentDescriptionDTO descDTO : descriptions) {
final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO);
ComponentConfigurationDTO configDTO = null;
if (!configs.isEmpty()) {
configDTO = configs.iterator().next();
}
result.add(new ComponentWrapper(this.context, this.runtime, descDTO, configDTO));
}
return result.isEmpty() ? null : result.toArray(new Component[result.size()]);
}
use of org.osgi.service.component.runtime.dto.ComponentConfigurationDTO in project felix by apache.
the class WebConsolePlugin method renderResult.
private void renderResult(final PrintWriter pw, RequestInfo info, final ComponentConfigurationDTO component) throws IOException {
final JSONWriter jw = new JSONWriter(pw);
jw.object();
// $NON-NLS-1$
jw.key("status");
jw.value(info.configurations.size());
if (!info.configurations.isEmpty()) {
// render components
// $NON-NLS-1$
jw.key("data");
jw.array();
if (component != null) {
if (component.state == -1) {
component(jw, component.description, null, true);
} else {
component(jw, component.description, component, true);
}
} else {
for (final ComponentDescriptionDTO cd : info.disabled) {
component(jw, cd, null, false);
}
for (final ComponentConfigurationDTO cfg : info.configurations) {
component(jw, cfg.description, cfg, false);
}
}
jw.endArray();
}
jw.endObject();
}
Aggregations