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 2018/04/27 06:58:01 UTC

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

Author: cziegeler
Date: Fri Apr 27 06:58:01 2018
New Revision: 1830298

URL: http://svn.apache.org/viewvc?rev=1830298&view=rev
Log:
FELIX-5841 : Update webconsole plugin to DS 1.4 (R7)

Modified:
    felix/trunk/webconsole-plugins/ds/changelog.txt
    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/WebConsolePlugin.java

Modified: felix/trunk/webconsole-plugins/ds/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/changelog.txt?rev=1830298&r1=1830297&r2=1830298&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/changelog.txt (original)
+++ felix/trunk/webconsole-plugins/ds/changelog.txt Fri Apr 27 06:58:01 2018
@@ -1,3 +1,9 @@
+Changes in 2.1.0
+----------------
+** Improvement
+    * [FELIX-5841] : Update webconsole plugin to DS 1.4 (R7)
+
+
 Changes from 2.0.6 to 2.0.8
 ---------------------------
 ** Improvement

Modified: felix/trunk/webconsole-plugins/ds/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/pom.xml?rev=1830298&r1=1830297&r2=1830298&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/pom.xml (original)
+++ felix/trunk/webconsole-plugins/ds/pom.xml Fri Apr 27 06:58:01 2018
@@ -14,7 +14,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>felix-parent</artifactId>
-        <version>4</version>
+        <version>5</version>
         <relativePath>../../../pom/pom.xml</relativePath>
     </parent>
 
@@ -33,10 +33,6 @@
         <url>http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds</url>
     </scm>
 
-    <properties>
-        <felix.java.version>5</felix.java.version>
-    </properties>
-
     <build>
         <plugins>
             <!-- translate UTF-8 encoded properties files to ISO-8859-1 -->
@@ -59,7 +55,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>3.2.0</version>
+                <version>3.5.0</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
@@ -73,12 +69,12 @@
                             {maven-resources},OSGI-INF=target/classes/OSGI-INF
                         </Include-Resource>
                         <Import-Package>
-                            org.osgi.service.cm;version="[1.2,2)";resolution:=optional,
+                            org.osgi.service.cm;version="[1.6,2)";resolution:=optional,
                             org.osgi.service.metatype;version="[1.2,2)";resolution:=optional,
                             *
                         </Import-Package>
                         <DynamicImport-Package>
-                            org.osgi.service.cm;version="[1.2,2)",
+                            org.osgi.service.cm;version="[1.6,2)",
                             org.osgi.service.metatype;version="[1.2,2)"
                         </DynamicImport-Package>
                         <Embed-Dependency>
@@ -105,8 +101,26 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <version>6.0.0</version>
+            <artifactId>org.osgi.service.component</artifactId>
+            <version>1.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.cm</artifactId>
+            <version>1.6.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.metatype</artifactId>
+            <version>1.3.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.util.promise</artifactId>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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=1830298&r1=1830297&r2=1830298&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 Fri Apr 27 06:58:01 2018
@@ -197,12 +197,19 @@ class ComponentConfigurationPrinter impl
         pw.println("  Bundle=" + cfg.description.bundle.symbolicName + " ("
                 + cfg.description.bundle.id + ")");
         pw.println("  State=" + toStateString(cfg.state));
+        if ( cfg.state == ComponentConfigurationDTO.FAILED_ACTIVATION && cfg.failure != null ) {
+            pw.println("  Failure=" + cfg.failure);
+        }
         pw.println("  DefaultState="
                 + (cfg.description.defaultEnabled ? "enabled" : "disabled"));
         pw.println("  Activation=" + (cfg.description.immediate ? "immediate" : "delayed"));
         pw.println("  ConfigurationPolicy=" + cfg.description.configurationPolicy);
 
         listServices(pw, cfg.description);
+        if ( cfg.service != null ) {
+            pw.println("  ServiceId=" + String.valueOf(cfg.service.id));
+        }
+
         listReferences(pw, cfg.description, cfg);
         listProperties(pw, cfg.description, cfg);
 
@@ -347,6 +354,21 @@ class ComponentConfigurationPrinter impl
                 pw.println("    " + key + "=" + value);
             }
         }
+        if ( cfg == null && description.factoryProperties != null ) {
+            pw.println("  FactoryProperties=");
+            TreeSet<String> keys = new TreeSet<String>(description.factoryProperties.keySet());
+            for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
+            {
+                String key = ki.next();
+                Object value = props.get(key);
+                value = WebConsoleUtil.toString(value);
+                if (value.getClass().isArray())
+                {
+                    value = Arrays.asList((Object[]) value);
+                }
+                pw.println("    " + key + "=" + value);
+            }
+        }
     }
 
     static final String toStateString(int state)
@@ -361,6 +383,8 @@ class ComponentConfigurationPrinter impl
             return "unsatisfied (configuration)";
         case ComponentConfigurationDTO.UNSATISFIED_REFERENCE:
             return "unsatisfied (reference)";
+        case ComponentConfigurationDTO.FAILED_ACTIVATION:
+            return "failed activation";
         default:
             return String.valueOf(state);
         }

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=1830298&r1=1830297&r2=1830298&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 Fri Apr 27 06:58:01 2018
@@ -354,6 +354,12 @@ class WebConsolePlugin extends SimpleWeb
 
         keyVal(jw, "Configuration Policy", desc.configurationPolicy);
 
+        if ( component != null && component.state == ComponentConfigurationDTO.FAILED_ACTIVATION && component.failure != null ) {
+            keyVal(jw, "failure", component.failure);
+        }
+        if ( component != null && component.service != null ) {
+            keyVal(jw, "serviceId", component.service.id);
+        }
         listServices(jw, desc);
         if (desc.configurationPid.length == 1) {
             keyVal(jw, "PID", desc.configurationPid[0]);
@@ -493,7 +499,27 @@ class WebConsolePlugin extends SimpleWeb
             jw.endArray();
             jw.endObject();
         }
+        if ( component == null && desc.factoryProperties != null ) {
+            jw.object();
+            jw.key("key");
+            jw.value("FactoryProperties");
+            jw.key("value");
+            jw.array();
+            TreeSet<String> keys = new TreeSet<String>(desc.factoryProperties.keySet());
+            for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
+            {
+                final String key = ki.next();
+                final StringBuilder b = new StringBuilder();
+                b.append(key).append(" = ");
 
+                Object prop = props.get(key);
+                prop = WebConsoleUtil.toString(prop);
+                b.append(prop);
+                jw.value(b.toString());
+            }
+            jw.endArray();
+            jw.endObject();
+        }
     }
 
     private void keyVal(JSONWriter jw, String key, Object value) throws IOException