Search in sources :

Example 36 with ComponentDescriptionDTO

use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO 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();
}
Also used : JSONWriter(org.apache.felix.utils.json.JSONWriter) ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO) ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)

Aggregations

ComponentDescriptionDTO (org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)36 ComponentConfigurationDTO (org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)18 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)6 Bundle (org.osgi.framework.Bundle)3 ServiceComponentRuntime (org.osgi.service.component.runtime.ServiceComponentRuntime)3 ReferenceDTO (org.osgi.service.component.runtime.dto.ReferenceDTO)3 UnsatisfiedReferenceDTO (org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO)3 Iterator (java.util.Iterator)2 TreeMap (java.util.TreeMap)2 Component (org.apache.felix.scr.Component)2 Descriptor (org.apache.felix.service.command.Descriptor)2 JSONWriter (org.apache.felix.utils.json.JSONWriter)2 ServiceReferenceDTO (org.osgi.framework.dto.ServiceReferenceDTO)2 SatisfiedReferenceDTO (org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Pattern (java.util.regex.Pattern)1