You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/02/03 22:52:15 UTC

svn commit: r1656929 - in /felix/trunk/webconsole-plugins/ds: ./ src/main/java/org/apache/felix/webconsole/plugins/ds/internal/

Author: cziegeler
Date: Tue Feb  3 21:52:14 2015
New Revision: 1656929

URL: http://svn.apache.org/r1656929
Log:
FELIX-4786 : Update to latest DS implementation

Modified:
    felix/trunk/webconsole-plugins/ds/pom.xml
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java

Modified: felix/trunk/webconsole-plugins/ds/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/pom.xml?rev=1656929&r1=1656928&r2=1656929&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/pom.xml (original)
+++ felix/trunk/webconsole-plugins/ds/pom.xml Tue Feb  3 21:52:14 2015
@@ -71,6 +71,15 @@
                     </instructions>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                        <source>1.6</source>
+                        <target>1.6</target>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
@@ -84,13 +93,13 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
-            <version>4.0.0</version>
+            <version>6.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.compendium</artifactId>
-            <version>4.1.0</version>
+            <version>5.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -115,7 +124,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr</artifactId>
-            <version>1.6.0</version>
+            <version>1.8.3-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java?rev=1656929&r1=1656928&r2=1656929&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java Tue Feb  3 21:52:14 2015
@@ -19,102 +19,120 @@
 package org.apache.felix.webconsole.plugins.ds.internal;
 
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Dictionary;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
-import org.apache.felix.scr.ScrService;
 import org.apache.felix.webconsole.WebConsoleUtil;
 import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
+import org.osgi.framework.dto.ServiceReferenceDTO;
 import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+import org.osgi.service.component.runtime.dto.ReferenceDTO;
+import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
 
 /**
- * ComponentConfigurationPrinter prints the available SCR services. 
+ * ComponentConfigurationPrinter prints the available SCR services.
  */
 class ComponentConfigurationPrinter implements InventoryPrinter
 {
 
-    private final ScrService scrService;
+    private final ServiceComponentRuntime scrService;
 
     ComponentConfigurationPrinter(Object scrService)
     {
-        this.scrService = (ScrService)scrService;
+        this.scrService = (ServiceComponentRuntime)scrService;
     }
 
     /**
      * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
      */
+    @Override
     public void print(PrintWriter pw, Format format, boolean isZip)
     {
-        printComponents(pw, scrService.getComponents());
+        final List<ComponentDescriptionDTO> descriptions = new ArrayList<ComponentDescriptionDTO>();
+        final List<ComponentConfigurationDTO> configurations = new ArrayList<ComponentConfigurationDTO>();
+
+        final Collection<ComponentDescriptionDTO> descs = scrService.getComponentDescriptionDTOs();
+        for(final ComponentDescriptionDTO d : descs)
+        {
+            for(final ComponentConfigurationDTO cfg : scrService.getComponentConfigurationDTOs(d))
+            {
+                configurations.add(cfg);
+            }
+            descriptions.add(d);
+        }
+        Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
+
+        printComponents(pw, configurations);
     }
-    
-    
+
+
     private static final void printComponents(final PrintWriter pw,
-        final Component[] components)
+            final List<ComponentConfigurationDTO> configurations)
     {
-        if (components == null || components.length == 0)
+        if (configurations.size() == 0)
         {
             pw.println("Status: No Components Registered");
         }
         else
         {
             // order components by id
-            TreeMap componentMap = new TreeMap();
-            for (int i = 0; i < components.length; i++)
+            TreeMap<Long, ComponentConfigurationDTO> componentMap = new TreeMap<Long, ComponentConfigurationDTO>();
+            for(final ComponentConfigurationDTO cfg : configurations)
             {
-                Component component = components[i];
-                componentMap.put(new Long(component.getId()), component);
+                componentMap.put(new Long(cfg.id), cfg);
             }
 
             // render components
-            for (Iterator ci = componentMap.values().iterator(); ci.hasNext();)
+            for (final ComponentConfigurationDTO cfg : componentMap.values())
             {
-                Component component = (Component) ci.next();
-                component(pw, component);
+                component(pw, cfg);
             }
         }
     }
 
-    private static final void component(PrintWriter pw, Component component)
+    private static final void component(PrintWriter pw, final ComponentConfigurationDTO cfg)
     {
 
-        pw.print(component.getId());
+        pw.print(cfg.id);
         pw.print("=[");
-        pw.print(component.getName());
+        pw.print(cfg.description.name);
         pw.println("]");
 
-        pw.println("  Bundle" + component.getBundle().getSymbolicName() + " ("
-            + component.getBundle().getBundleId() + ")");
-        pw.println("  State=" + toStateString(component.getState()));
+        pw.println("  Bundle" + cfg.description.bundle.symbolicName + " ("
+            + cfg.description.bundle.id + ")");
+        pw.println("  State=" + toStateString(cfg.state));
         pw.println("  DefaultState="
-            + (component.isDefaultEnabled() ? "enabled" : "disabled"));
-        pw.println("  Activation=" + (component.isImmediate() ? "immediate" : "delayed"));
+            + (cfg.description.defaultEnabled ? "enabled" : "disabled"));
+        pw.println("  Activation=" + (cfg.description.immediate ? "immediate" : "delayed"));
 
-        listServices(pw, component);
-        listReferences(pw, component);
-        listProperties(pw, component);
+        listServices(pw, cfg);
+        listReferences(pw, cfg);
+        listProperties(pw, cfg);
 
         pw.println();
     }
 
-    private static void listServices(PrintWriter pw, Component component)
+    private static void listServices(PrintWriter pw, final ComponentConfigurationDTO cfg)
     {
-        String[] services = component.getServices();
+        String[] services = cfg.description.serviceInterfaces;
         if (services == null)
         {
             return;
         }
 
-        pw.println("  ServiceType="
-            + (component.isServiceFactory() ? "service factory" : "service"));
+        pw.println("  ServiceType=" + cfg.description.scope);
 
         StringBuffer buf = new StringBuffer();
         for (int i = 0; i < services.length; i++)
@@ -129,76 +147,82 @@ class ComponentConfigurationPrinter impl
         pw.println("  Services=" + buf);
     }
 
-    private static final void listReferences(PrintWriter pw, Component component)
+    private static SatisfiedReferenceDTO findReference(final ComponentConfigurationDTO component, final String name)
     {
-        Reference[] refs = component.getReferences();
-        if (refs != null)
+        for(final SatisfiedReferenceDTO dto : component.satisfiedReferences)
         {
-            for (int i = 0; i < refs.length; i++)
+            if ( dto.name.equals(name))
             {
+                return dto;
+            }
+        }
+        return null;
+    }
+
+    private static final void listReferences(PrintWriter pw, final ComponentConfigurationDTO cfg)
+    {
+        for(final ReferenceDTO dto : cfg.description.references)
+        {
+            final SatisfiedReferenceDTO satisfiedRef = findReference(cfg, dto.name);
 
-                pw.println("  Reference=" + refs[i].getName() + ", "
-                    + (refs[i].isSatisfied() ? "Satisfied" : "Unsatisfied"));
+            pw.println("  Reference=" + dto.name + ", "
+                + (satisfiedRef != null ? "Satisfied" : "Unsatisfied"));
 
-                pw.println("    Service Name: " + refs[i].getServiceName());
+            pw.println("    Service Name: " + dto.interfaceName);
 
-                if (refs[i].getTarget() != null)
-                {
-                    pw.println("  Target Filter: " + refs[i].getTarget());
-                }
+            if (dto.target != null)
+            {
+                pw.println("  Target Filter: " + dto.target);
+            }
 
-                pw.println("    Multiple: "
-                    + (refs[i].isMultiple() ? "multiple" : "single"));
-                pw.println("    Optional: "
-                    + (refs[i].isOptional() ? "optional" : "mandatory"));
-                pw.println("    Policy: " + (refs[i].isStatic() ? "static" : "dynamic"));
-
-                // list bound services
-                ServiceReference[] boundRefs = refs[i].getServiceReferences();
-                if (boundRefs != null && boundRefs.length > 0)
+            pw.println("    Cardinality: " + dto.cardinality);
+            pw.println("    Policy: " + dto.policy);
+            pw.println("    Policy Option: " + dto.policyOption);
+
+            // list bound services
+            if ( satisfiedRef != null )
+            {
+                for(final ServiceReferenceDTO sref : satisfiedRef.boundServices )
                 {
-                    for (int j = 0; j < boundRefs.length; j++)
-                    {
-                        pw.print("    Bound Service: ID ");
-                        pw.print(boundRefs[j].getProperty(Constants.SERVICE_ID));
+                    pw.print("    Bound Service: ID ");
+                    pw.print(sref.properties.get(Constants.SERVICE_ID));
 
-                        String name = (String) boundRefs[j].getProperty(ComponentConstants.COMPONENT_NAME);
+                    String name = (String) sref.properties.get(ComponentConstants.COMPONENT_NAME);
+                    if (name == null)
+                    {
+                        name = (String) sref.properties.get(Constants.SERVICE_PID);
                         if (name == null)
                         {
-                            name = (String) boundRefs[j].getProperty(Constants.SERVICE_PID);
-                            if (name == null)
-                            {
-                                name = (String) boundRefs[j].getProperty(Constants.SERVICE_DESCRIPTION);
-                            }
-                        }
-                        if (name != null)
-                        {
-                            pw.print(" (");
-                            pw.print(name);
-                            pw.print(")");
+                            name = (String) sref.properties.get(Constants.SERVICE_DESCRIPTION);
                         }
-                        pw.println();
                     }
-                }
-                else
-                {
-                    pw.println("    No Services bound");
+                    if (name != null)
+                    {
+                        pw.print(" (");
+                        pw.print(name);
+                        pw.print(")");
+                    }
+                    pw.println();
                 }
             }
+            else
+            {
+                pw.println("    No Services bound");
+            }
         }
     }
 
-    private static final void listProperties(PrintWriter pw, Component component)
+    private static final void listProperties(PrintWriter pw, final ComponentConfigurationDTO cfg)
     {
-        Dictionary props = component.getProperties();
+        Map<String, Object> props = cfg.properties;
         if (props != null)
         {
 
             pw.println("  Properties=");
-            TreeSet keys = new TreeSet(Util.list(props.keys()));
-            for (Iterator ki = keys.iterator(); ki.hasNext();)
+            TreeSet<String> keys = new TreeSet<String>(props.keySet());
+            for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
             {
-                String key = (String) ki.next();
+                String key = ki.next();
                 Object value = props.get(key);
                 value = WebConsoleUtil.toString(value);
                 if (value.getClass().isArray())
@@ -214,34 +238,16 @@ class ComponentConfigurationPrinter impl
     {
         switch (state)
         {
-            case Component.STATE_DISABLED:
-                return "disabled";
-            case Component.STATE_ENABLING:
-                return "enabling";
-            case Component.STATE_ENABLED:
-                return "enabled";
-            case Component.STATE_UNSATISFIED:
-                return "unsatisfied";
-            case Component.STATE_ACTIVATING:
-                return "activating";
-            case Component.STATE_ACTIVE:
+            case ComponentConfigurationDTO.ACTIVE:
                 return "active";
-            case Component.STATE_REGISTERED:
-                return "registered";
-            case Component.STATE_FACTORY:
-                return "factory";
-            case Component.STATE_DEACTIVATING:
-                return "deactivating";
-            case Component.STATE_DISABLING:
-                return "disabling";
-            case Component.STATE_DISPOSING:
-                return "disposing";
-            case Component.STATE_DESTROYED:
-                return "destroyed/disposed";
+            case ComponentConfigurationDTO.SATISFIED:
+                return "satisfied";
+            case ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION:
+                return "unsatisfied (configuration)";
+            case ComponentConfigurationDTO.UNSATISFIED_REFERENCE:
+                return "unsatisfied (reference)";
             default:
                 return String.valueOf(state);
         }
     }
-
-
 }

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java?rev=1656929&r1=1656928&r2=1656929&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java Tue Feb  3 21:52:14 2015
@@ -19,11 +19,13 @@
 package org.apache.felix.webconsole.plugins.ds.internal;
 
 import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.ScrService;
 import org.apache.felix.webconsole.bundleinfo.BundleInfo;
 import org.apache.felix.webconsole.bundleinfo.BundleInfoProvider;
 import org.apache.felix.webconsole.bundleinfo.BundleInfoType;
@@ -31,23 +33,27 @@ import org.apache.felix.webconsole.i18n.
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
 
 class InfoProvider implements BundleInfoProvider
 {
 
     private final LocalizationHelper localization;
 
-    private final ScrService scrService;
+    private final ServiceComponentRuntime scrService;
 
     InfoProvider(Bundle bundle, Object scrService)
     {
-        this.scrService = (ScrService) scrService;
+        this.scrService = (ServiceComponentRuntime) scrService;
         localization = new LocalizationHelper(bundle);
     }
 
     /**
      * @see org.apache.felix.webconsole.bundleinfo.BundleInfoProvider#getName(java.util.Locale)
      */
+    @Override
     public String getName(Locale locale)
     {
         return localization.getResourceBundle(locale).getString("info.name"); //$NON-NLS-1$;;
@@ -57,36 +63,51 @@ class InfoProvider implements BundleInfo
     * @see org.apache.felix.webconsole.bundleinfo.BundleInfoProvider#getBundleInfo(org.osgi.framework.Bundle,
     *      java.lang.String, java.util.Locale)
     */
+    @Override
     public BundleInfo[] getBundleInfo(Bundle bundle, String webConsoleRoot, Locale locale)
     {
+        final List<ComponentDescriptionDTO> descriptions = new ArrayList<ComponentDescriptionDTO>();
+        final List<ComponentConfigurationDTO> configurations = new ArrayList<ComponentConfigurationDTO>();
 
-        final Component[] components = scrService.getComponents(bundle);
-        if (null == components || components.length == 0)
+        final Collection<ComponentDescriptionDTO> descs = scrService.getComponentDescriptionDTOs();
+        for(final ComponentDescriptionDTO d : descs)
+        {
+            for(final ComponentConfigurationDTO cfg : scrService.getComponentConfigurationDTOs(d))
+            {
+                configurations.add(cfg);
+            }
+            descriptions.add(d);
+        }
+        Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
+
+        if (configurations.size() == 0)
         {
             return NO_INFO;
         }
 
-        BundleInfo[] ret = new BundleInfo[components.length];
-        for (int i = 0; i < components.length; i++)
+        BundleInfo[] ret = new BundleInfo[configurations.size()];
+        int i=0;
+        for (final ComponentConfigurationDTO cfg : configurations)
         {
-            ret[i] = toInfo(components[i], webConsoleRoot, locale);
+            ret[i] = toInfo(cfg, webConsoleRoot, locale);
+            i++;
         }
         return ret;
     }
 
-    private BundleInfo toInfo(Component component, String webConsoleRoot, Locale locale)
+    private BundleInfo toInfo(final ComponentConfigurationDTO cfg, String webConsoleRoot, Locale locale)
     {
         final ResourceBundle bundle = localization.getResourceBundle(locale);
-        final String state = ComponentConfigurationPrinter.toStateString(component.getState());
-        final String name = component.getName();
+        final String state = ComponentConfigurationPrinter.toStateString(cfg.state);
+        final String name = cfg.description.name;
         final String descr = bundle.getString("info.descr"); //$NON-NLS-1$;
         String key = bundle.getString("info.key"); //$NON-NLS-1$;
         // Component #{0} {1}, state {2}
-        key = MessageFormat.format(key, new Object[] { String.valueOf(component.getId()), //
+        key = MessageFormat.format(key, new Object[] { String.valueOf(cfg.id), //
                 name != null ? name : "", //$NON-NLS-1$
                 state, //
         });
-        return new BundleInfo(key, webConsoleRoot + "/components/" + component.getId(), //$NON-NLS-1$
+        return new BundleInfo(key, webConsoleRoot + "/components/" + cfg.id, //$NON-NLS-1$
             BundleInfoType.LINK, descr);
     }
 

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java?rev=1656929&r1=1656928&r2=1656929&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java Tue Feb  3 21:52:14 2015
@@ -20,23 +20,22 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Enumeration;
 
-import org.apache.felix.scr.Component;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
 
 class Util
 {
 
-    static final Comparator COMPONENT_COMPARATOR = new Comparator()
+    static final Comparator<ComponentConfigurationDTO> COMPONENT_COMPARATOR = new Comparator<ComponentConfigurationDTO>()
     {
-        public int compare(Object o0, Object o1)
+        @Override
+        public int compare(ComponentConfigurationDTO c0, ComponentConfigurationDTO c1)
         {
-            final Component c0 = (Component) o0;
-            final Component c1 = (Component) o1;
-            final int nameCmp = c0.getName().compareTo(c1.getName());
+            final int nameCmp = c0.description.name.compareTo(c1.description.name);
             if (nameCmp != 0)
             {
                 return nameCmp;
             }
-            return (c0.getId() < c1.getId()) ? -1 : ((c0.getId() > c1.getId()) ? 1 : 0);
+            return (c0.id < c1.id) ? -1 : ((c0.id > c1.id) ? 1 : 0);
         }
     };
 

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java?rev=1656929&r1=1656928&r2=1656929&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java Tue Feb  3 21:52:14 2015
@@ -19,18 +19,18 @@ package org.apache.felix.webconsole.plug
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Dictionary;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.TreeSet;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
-import org.apache.felix.scr.ScrService;
 import org.apache.felix.webconsole.DefaultVariableResolver;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
 import org.apache.felix.webconsole.WebConsoleUtil;
@@ -40,10 +40,14 @@ import org.json.JSONWriter;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+import org.osgi.service.component.runtime.dto.ReferenceDTO;
+import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
 import org.osgi.service.metatype.MetaTypeInformation;
 import org.osgi.service.metatype.MetaTypeService;
 
@@ -68,7 +72,7 @@ class WebConsolePlugin extends SimpleWeb
     //private static final String OPERATION_CONFIGURE = "configure";
 
     // needed services
-    static final String SCR_SERVICE = "org.apache.felix.scr.ScrService"; //$NON-NLS-1$
+    static final String SCR_SERVICE = ServiceComponentRuntime.class.getName(); //$NON-NLS-1$
     private static final String META_TYPE_NAME = "org.osgi.service.metatype.MetaTypeService"; //$NON-NLS-1$
     private static final String CONFIGURATION_ADMIN_NAME = "org.osgi.service.cm.ConfigurationAdmin"; //$NON-NLS-1$
 
@@ -84,6 +88,7 @@ class WebConsolePlugin extends SimpleWeb
         TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$
     }
 
+    @Override
     public String getCategory()
     {
         return CATEGORY;
@@ -92,6 +97,7 @@ class WebConsolePlugin extends SimpleWeb
     /**
      * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
+    @Override
     protected void doPost(HttpServletRequest request, HttpServletResponse response)
         throws IOException
     {
@@ -109,22 +115,23 @@ class WebConsolePlugin extends SimpleWeb
         String op = request.getParameter(OPERATION);
         if (OPERATION_ENABLE.equals(op))
         {
-            reqInfo.component.enable();
+            getScrService().enableComponent(reqInfo.component.description);
         }
         else if (OPERATION_DISABLE.equals(op))
         {
-            reqInfo.component.disable();
+            getScrService().disableComponent(reqInfo.component.description);
         }
 
         final PrintWriter pw = response.getWriter();
         response.setContentType("application/json"); //$NON-NLS-1$
         response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
-        renderResult(pw, null);
+        renderResult(pw, reqInfo, null);
     }
 
     /**
      * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
+    @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
     {
@@ -143,7 +150,7 @@ class WebConsolePlugin extends SimpleWeb
                 response.setContentType("application/json"); //$NON-NLS-1$
                 response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
 
-                this.renderResult(response.getWriter(), reqInfo.component);
+                this.renderResult(response.getWriter(), reqInfo, reqInfo.component);
 
                 // nothing more to do
                 return;
@@ -155,6 +162,7 @@ class WebConsolePlugin extends SimpleWeb
     /**
      * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
+    @Override
     protected void renderContent(HttpServletRequest request, HttpServletResponse response)
         throws IOException
     {
@@ -163,7 +171,7 @@ class WebConsolePlugin extends SimpleWeb
 
         StringWriter w = new StringWriter();
         PrintWriter w2 = new PrintWriter(w);
-        renderResult(w2, reqInfo.component);
+        renderResult(w2, reqInfo, reqInfo.component);
 
         // prepare variables
         DefaultVariableResolver vars = ((DefaultVariableResolver) WebConsoleUtil.getVariableResolver(request));
@@ -174,7 +182,7 @@ class WebConsolePlugin extends SimpleWeb
 
     }
 
-    private void renderResult(final PrintWriter pw, final Component component)
+    private void renderResult(final PrintWriter pw, RequestInfo info, final ComponentConfigurationDTO component)
         throws IOException
     {
         final JSONWriter jw = new JSONWriter(pw);
@@ -182,7 +190,7 @@ class WebConsolePlugin extends SimpleWeb
         {
             jw.object();
 
-            final ScrService scrService = getScrService();
+            final ServiceComponentRuntime scrService = getScrService();
             if (scrService == null)
             {
                 jw.key("status"); //$NON-NLS-1$
@@ -190,28 +198,23 @@ class WebConsolePlugin extends SimpleWeb
             }
             else
             {
-                final Component[] components = scrService.getComponents();
-
-                if (components == null || components.length == 0)
+                if (info.configurations.size() == 0)
                 {
                     jw.key("status"); //$NON-NLS-1$
                     jw.value(0);
                 }
                 else
                 {
-                    // order components by name
-                    sortComponents(components);
-
                     final StringBuffer buffer = new StringBuffer();
-                    buffer.append(components.length);
+                    buffer.append(info.configurations.size());
                     buffer.append(" component"); //$NON-NLS-1$
-                    if (components.length != 1)
+                    if (info.configurations.size() != 1)
                     {
                         buffer.append('s');
                     }
                     buffer.append(" installed."); //$NON-NLS-1$
                     jw.key("status"); //$NON-NLS-1$
-                    jw.value(components.length);
+                    jw.value(info.configurations.size());
 
                     // render components
                     jw.key("data"); //$NON-NLS-1$
@@ -222,9 +225,9 @@ class WebConsolePlugin extends SimpleWeb
                     }
                     else
                     {
-                        for (int i = 0; i < components.length; i++)
+                        for (final ComponentConfigurationDTO cfg : info.configurations)
                         {
-                            component(jw, components[i], false);
+                            component(jw, cfg, false);
                         }
                     }
                     jw.endArray();
@@ -239,17 +242,12 @@ class WebConsolePlugin extends SimpleWeb
         }
     }
 
-    private void sortComponents(Component[] components)
-    {
-        Arrays.sort(components, Util.COMPONENT_COMPARATOR);
-    }
-
-    private void component(JSONWriter jw, Component component, boolean details)
+    private void component(JSONWriter jw, ComponentConfigurationDTO component, boolean details)
         throws JSONException
     {
-        String id = String.valueOf(component.getId());
-        String name = component.getName();
-        int state = component.getState();
+        String id = String.valueOf(component.id);
+        String name = component.description.name;
+        int state = component.state;
 
         jw.object();
 
@@ -263,7 +261,7 @@ class WebConsolePlugin extends SimpleWeb
         jw.key("stateRaw"); //$NON-NLS-1$
         jw.value(state);
 
-        final Dictionary props = component.getProperties();
+        final Map<String, Object> props = component.properties;
 
         final String pid = (String) (props != null ? props.get(Constants.SERVICE_PID)
             : null);
@@ -271,7 +269,7 @@ class WebConsolePlugin extends SimpleWeb
         {
             jw.key("pid"); //$NON-NLS-1$
             jw.value(pid);
-            if (isConfigurable(component.getBundle(), pid))
+            if (isConfigurable(this.getBundleContext().getBundle(0).getBundleContext().getBundle(component.description.bundle.id), pid))
             {
                 jw.key("configurable"); //$NON-NLS-1$
                 jw.value(pid);
@@ -287,25 +285,27 @@ class WebConsolePlugin extends SimpleWeb
         jw.endObject();
     }
 
-    private void gatherComponentDetails(JSONWriter jw, Component component)
+    private void gatherComponentDetails(JSONWriter jw, ComponentConfigurationDTO component)
         throws JSONException
     {
+        final Bundle bundle = this.getBundleContext().getBundle(0).getBundleContext().getBundle(component.description.bundle.id);
+
         jw.key("props"); //$NON-NLS-1$
         jw.array();
 
-        keyVal(jw, "Bundle", component.getBundle().getSymbolicName() + " ("
-            + component.getBundle().getBundleId() + ")");
-        keyVal(jw, "Implementation Class", component.getClassName());
-        if (component.getFactory() != null)
+        keyVal(jw, "Bundle", bundle.getSymbolicName() + " ("
+            + bundle.getBundleId() + ")");
+        keyVal(jw, "Implementation Class", component.description.implementationClass);
+        if (component.description.factory != null)
         {
-            keyVal(jw, "Component Factory Name", component.getFactory());
+            keyVal(jw, "Component Factory Name", component.description.factory);
         }
-        keyVal(jw, "Default State", component.isDefaultEnabled() ? "enabled" : "disabled");
-        keyVal(jw, "Activation", component.isImmediate() ? "immediate" : "delayed");
+        keyVal(jw, "Default State", component.description.defaultEnabled ? "enabled" : "disabled");
+        keyVal(jw, "Activation", component.description.immediate ? "immediate" : "delayed");
 
         try
         {
-            keyVal(jw, "Configuration Policy", component.getConfigurationPolicy());
+            keyVal(jw, "Configuration Policy", component.description.configurationPolicy);
         }
         catch (Throwable t)
         {
@@ -320,16 +320,15 @@ class WebConsolePlugin extends SimpleWeb
         jw.endArray();
     }
 
-    private void listServices(JSONWriter jw, Component component)
+    private void listServices(JSONWriter jw, ComponentConfigurationDTO component)
     {
-        String[] services = component.getServices();
+        String[] services = component.description.serviceInterfaces;
         if (services == null)
         {
             return;
         }
 
-        keyVal(jw, "Service Type", component.isServiceFactory() ? "service factory"
-            : "service");
+        keyVal(jw, "Service Type", component.description.scope);
 
         JSONArray buf = new JSONArray();
         for (int i = 0; i < services.length; i++)
@@ -340,73 +339,82 @@ class WebConsolePlugin extends SimpleWeb
         keyVal(jw, "Services", buf);
     }
 
-    private void listReferences(JSONWriter jw, Component component)
+    private SatisfiedReferenceDTO findReference(final ComponentConfigurationDTO component, final String name)
     {
-        Reference[] refs = component.getReferences();
-        if (refs != null)
+        for(final SatisfiedReferenceDTO dto : component.satisfiedReferences)
         {
-            for (int i = 0; i < refs.length; i++)
+            if ( dto.name.equals(name))
             {
-                JSONArray buf = new JSONArray();
-                buf.put(refs[i].isSatisfied() ? "Satisfied" : "Unsatisfied");
-                buf.put("Service Name: " + refs[i].getServiceName());
-                if (refs[i].getTarget() != null)
-                {
-                    buf.put("Target Filter: " + refs[i].getTarget());
-                }
-                buf.put("Multiple: " + (refs[i].isMultiple() ? "multiple" : "single"));
-                buf.put("Optional: " + (refs[i].isOptional() ? "optional" : "mandatory"));
-                buf.put("Policy: " + (refs[i].isStatic() ? "static" : "dynamic"));
+                return dto;
+            }
+        }
+        return null;
+    }
+
+    private void listReferences(JSONWriter jw, ComponentConfigurationDTO component)
+    {
+        for(final ReferenceDTO dto : component.description.references)
+        {
+            JSONArray buf = new JSONArray();
+            final SatisfiedReferenceDTO satisfiedRef = findReference(component, dto.name);
 
-                // list bound services
-                ServiceReference[] boundRefs = refs[i].getServiceReferences();
-                if (boundRefs != null && boundRefs.length > 0)
+            buf.put(satisfiedRef != null ? "Satisfied" : "Unsatisfied");
+            buf.put("Service Name: " + dto.interfaceName);
+            if (dto.target != null)
+            {
+                buf.put("Target Filter: " + dto.target);
+            }
+            buf.put("Cardinality: " + dto.cardinality);
+            buf.put("Policy: " + dto.policy);
+            buf.put("Policy Option: " + dto.policyOption);
+
+            // list bound services
+            if ( satisfiedRef != null )
+            {
+                for (int j = 0; j < satisfiedRef.boundServices.length; j++)
                 {
-                    for (int j = 0; j < boundRefs.length; j++)
-                    {
-                        final StringBuffer b = new StringBuffer();
-                        b.append("Bound Service ID ");
-                        b.append(boundRefs[j].getProperty(Constants.SERVICE_ID));
+                    final StringBuffer b = new StringBuffer();
+                    b.append("Bound Service ID ");
+                    b.append(satisfiedRef.boundServices[j].id);
 
-                        String name = (String) boundRefs[j].getProperty(ComponentConstants.COMPONENT_NAME);
+                    String name = (String) satisfiedRef.boundServices[j].properties.get(ComponentConstants.COMPONENT_NAME);
+                    if (name == null)
+                    {
+                        name = (String) satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_PID);
                         if (name == null)
                         {
-                            name = (String) boundRefs[j].getProperty(Constants.SERVICE_PID);
-                            if (name == null)
-                            {
-                                name = (String) boundRefs[j].getProperty(Constants.SERVICE_DESCRIPTION);
-                            }
-                        }
-                        if (name != null)
-                        {
-                            b.append(" (");
-                            b.append(name);
-                            b.append(")");
+                            name = (String) satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_DESCRIPTION);
                         }
-                        buf.put(b.toString());
                     }
+                    if (name != null)
+                    {
+                        b.append(" (");
+                        b.append(name);
+                        b.append(")");
+                    }
+                    buf.put(b.toString());
                 }
-                else
-                {
-                    buf.put("No Services bound");
-                }
-
-                keyVal(jw, "Reference " + refs[i].getName(), buf.toString());
             }
+            else
+            {
+                buf.put("No Services bound");
+            }
+
+            keyVal(jw, "Reference " + dto.name, buf.toString());
         }
     }
 
-    private void listProperties(JSONWriter jw, Component component)
+    private void listProperties(JSONWriter jw, ComponentConfigurationDTO component)
     {
-        Dictionary props = component.getProperties();
+        Map<String, Object> props = component.properties;
         if (props != null)
         {
             JSONArray buf = new JSONArray();
-            TreeSet keys = new TreeSet(Util.list(props.keys()));
-            for (Iterator ki = keys.iterator(); ki.hasNext();)
+            TreeSet<String> keys = new TreeSet<String>(props.keySet());
+            for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
             {
-                final String key = (String) ki.next();
-                final StringBuffer b = new StringBuffer();
+                final String key = ki.next();
+                final StringBuilder b = new StringBuilder();
                 b.append(key).append(" = ");
 
                 Object prop = props.get(key);
@@ -492,9 +500,9 @@ class WebConsolePlugin extends SimpleWeb
         return (ConfigurationAdmin) getService(CONFIGURATION_ADMIN_NAME);
     }
 
-    final ScrService getScrService()
+    final ServiceComponentRuntime getScrService()
     {
-        return (ScrService) getService(SCR_SERVICE);
+        return (ServiceComponentRuntime) getService(SCR_SERVICE);
     }
 
     private final MetaTypeService getMetaTypeService()
@@ -505,11 +513,29 @@ class WebConsolePlugin extends SimpleWeb
     private final class RequestInfo
     {
         public final String extension;
-        public final Component component;
+        public final ComponentConfigurationDTO component;
         public final boolean componentRequested;
+        public final ServiceComponentRuntime scrService;
+        public final List<ComponentDescriptionDTO> descriptions = new ArrayList<ComponentDescriptionDTO>();
+        public final List<ComponentConfigurationDTO> configurations = new ArrayList<ComponentConfigurationDTO>();
 
         protected RequestInfo(final HttpServletRequest request)
         {
+            this.scrService = getScrService();
+            if ( scrService != null )
+            {
+                final Collection<ComponentDescriptionDTO> descs = scrService.getComponentDescriptionDTOs();
+                for(final ComponentDescriptionDTO d : descs)
+                {
+                    for(final ComponentConfigurationDTO cfg : scrService.getComponentConfigurationDTOs(d))
+                    {
+                        configurations.add(cfg);
+                    }
+                    descriptions.add(d);
+                }
+                Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
+            }
+
             String info = request.getPathInfo();
             // remove label and starting slash
             info = info.substring(getLabel().length() + 1);
@@ -529,7 +555,7 @@ class WebConsolePlugin extends SimpleWeb
             {
                 this.componentRequested = true;
                 info = info.substring(1);
-                Component component = getComponentId(info);
+                ComponentConfigurationDTO component = getComponentId(info);
                 if (component == null)
                 {
                     component = getComponentByName(info);
@@ -545,76 +571,80 @@ class WebConsolePlugin extends SimpleWeb
             request.setAttribute(WebConsolePlugin.this.getClass().getName(), this);
         }
 
-        protected Component getComponentId(final String componentIdPar)
+        protected ComponentConfigurationDTO getComponentId(final String componentIdPar)
         {
-            final ScrService scrService = getScrService();
-            if (scrService != null)
+            try
             {
-                try
-                {
-                    final long componentId = Long.parseLong(componentIdPar);
-                    return scrService.getComponent(componentId);
-                }
-                catch (NumberFormatException nfe)
+                final long componentId = Long.parseLong(componentIdPar);
+                for(final ComponentConfigurationDTO cfg : this.configurations)
                 {
-                    // don't care
+                    if ( cfg.id == componentId )
+                    {
+                        return cfg;
+                    }
                 }
             }
+            catch (NumberFormatException nfe)
+            {
+                // don't care
+            }
 
             return null;
         }
 
-        protected Component getComponentByName(final String names)
+        protected ComponentConfigurationDTO getComponentByName(final String names)
         {
             if (names.length() > 0)
             {
-                final ScrService scrService = getScrService();
-                if (scrService != null)
+                final int slash = names.lastIndexOf('/');
+                final String componentName;
+                final String pid;
+                if (slash > 0)
                 {
+                    componentName = names.substring(0, slash);
+                    pid = names.substring(slash + 1);
+                }
+                else
+                {
+                    componentName = names;
+                    pid = null;
+                }
 
-                    final int slash = names.lastIndexOf('/');
-                    final String componentName;
-                    final String pid;
-                    if (slash > 0)
-                    {
-                        componentName = names.substring(0, slash);
-                        pid = names.substring(slash + 1);
-                    }
-                    else
-                    {
-                        componentName = names;
-                        pid = null;
-                    }
-
-                    Component[] components;
-                    try
-                    {
-                        components = scrService.getComponents(componentName);
-                    }
-                    catch (Throwable t)
+                Collection<ComponentConfigurationDTO> components = null;
+                try
+                {
+                    for(final ComponentDescriptionDTO d : this.descriptions)
                     {
-                        // not implemented in the used API version
-                        components = null;
+                        if ( d.name.equals(componentName) )
+                        {
+                            components = scrService.getComponentConfigurationDTOs(d);
+                        }
                     }
+                }
+                catch (Throwable t)
+                {
+                    // not implemented in the used API version
+                    components = null;
+                }
 
-                    if (components != null)
+                if (components != null)
+                {
+                    if (pid != null)
                     {
-                        if (pid != null)
+                        final Iterator<ComponentConfigurationDTO> i = components.iterator();
+                        while ( i.hasNext() )
                         {
-                            for (int i = 0; i < components.length; i++)
+                            ComponentConfigurationDTO c = i.next();
+                            if (pid.equals(c.properties.get(Constants.SERVICE_PID)))
                             {
-                                Component component = components[i];
-                                if (pid.equals(component.getProperties().get(
-                                    Constants.SERVICE_PID)))
-                                {
-                                    return component;
-                                }
+                                return c;
                             }
+
                         }
-                        else if (components.length > 0)
-                        {
-                            return components[0];
-                        }
+                    }
+                    else if (components.size() > 0)
+                    {
+                        return components.iterator().next();
                     }
                 }
             }