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 2017/02/13 18:16:32 UTC

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

Author: cziegeler
Date: Mon Feb 13 18:16:31 2017
New Revision: 1782824

URL: http://svn.apache.org/viewvc?rev=1782824&view=rev
Log:
Switch to json writer from utils project

Removed:
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/JSONWriter.java
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/WebConsolePlugin.java

Modified: felix/trunk/webconsole-plugins/ds/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/pom.xml?rev=1782824&r1=1782823&r2=1782824&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/pom.xml (original)
+++ felix/trunk/webconsole-plugins/ds/pom.xml Mon Feb 13 18:16:31 2017
@@ -77,6 +77,9 @@
                              org.osgi.service.metatype;version="[1.1,2)",
                              *
                         </Import-Package>
+                        <Embed-Dependency>
+                             org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
+                        </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
@@ -111,7 +114,13 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.inventory</artifactId>
-		    <version>1.0.4</version>
+            <version>1.0.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <version>1.9.0</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=1782824&r1=1782823&r2=1782824&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 Mon Feb 13 18:16:31 2017
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.webconsole.plugins.ds.internal;
 
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -31,6 +32,7 @@ import java.util.TreeSet;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
+import org.apache.felix.utils.json.JSONWriter;
 import org.apache.felix.webconsole.WebConsoleUtil;
 import org.osgi.framework.Constants;
 import org.osgi.framework.dto.ServiceReferenceDTO;
@@ -90,7 +92,13 @@ class ComponentConfigurationPrinter impl
         if (Format.JSON.equals(format))
         {
             disabled.addAll(noConfig);
-            printComponentsJson(pw, disabled, configurations, isZip);
+            try
+            {
+                printComponentsJson(pw, disabled, configurations, isZip);
+            } catch (IOException ignore)
+            {
+                // ignore
+            }
         }
         else
         {
@@ -101,7 +109,7 @@ class ComponentConfigurationPrinter impl
     private final void printComponentsJson(final PrintWriter pw,
             final List<ComponentDescriptionDTO> disabled,
             final List<ComponentConfigurationDTO> configurations,
-            final boolean details)
+            final boolean details) throws IOException
     {
         final JSONWriter jw = new JSONWriter(pw);
         jw.object();

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=1782824&r1=1782823&r2=1782824&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 Mon Feb 13 18:16:31 2017
@@ -32,6 +32,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.felix.utils.json.JSONWriter;
 import org.apache.felix.webconsole.DefaultVariableResolver;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
 import org.apache.felix.webconsole.WebConsoleUtil;
@@ -254,7 +255,7 @@ class WebConsolePlugin extends SimpleWeb
         jw.endObject();
     }
 
-    void writePid(final JSONWriter jw, final ComponentDescriptionDTO desc)
+    void writePid(final JSONWriter jw, final ComponentDescriptionDTO desc) throws IOException
     {
         final String configurationPid = desc.configurationPid[0];
         final String pid;
@@ -276,7 +277,7 @@ class WebConsolePlugin extends SimpleWeb
 
     void component(JSONWriter jw,
             final ComponentDescriptionDTO desc,
-            final ComponentConfigurationDTO config, boolean details)
+            final ComponentConfigurationDTO config, boolean details) throws IOException
     {
         String id = config == null ? "" : String.valueOf(config.id);
         String name = desc.name;
@@ -324,7 +325,7 @@ class WebConsolePlugin extends SimpleWeb
 
     private void gatherComponentDetails(JSONWriter jw,
             ComponentDescriptionDTO desc,
-            ComponentConfigurationDTO component)
+            ComponentConfigurationDTO component) throws IOException
     {
         final Bundle bundle = this.getBundleContext().getBundle(0).getBundleContext().getBundle(desc.bundle.id);
 
@@ -355,7 +356,7 @@ class WebConsolePlugin extends SimpleWeb
         jw.endArray();
     }
 
-    private void listServices(JSONWriter jw, ComponentDescriptionDTO desc)
+    private void listServices(JSONWriter jw, ComponentDescriptionDTO desc) throws IOException
     {
         String[] services = desc.serviceInterfaces;
         if (services == null)
@@ -391,7 +392,7 @@ class WebConsolePlugin extends SimpleWeb
         return null;
     }
 
-    private void listReferences(JSONWriter jw, ComponentDescriptionDTO desc, ComponentConfigurationDTO config)
+    private void listReferences(JSONWriter jw, ComponentDescriptionDTO desc, ComponentConfigurationDTO config) throws IOException
     {
         for(final ReferenceDTO dto : desc.references)
         {
@@ -457,7 +458,7 @@ class WebConsolePlugin extends SimpleWeb
         }
     }
 
-    private void listProperties(JSONWriter jw, ComponentDescriptionDTO desc, ComponentConfigurationDTO component)
+    private void listProperties(JSONWriter jw, ComponentDescriptionDTO desc, ComponentConfigurationDTO component) throws IOException
     {
         Map<String, Object> props = component != null ? component.properties : desc.properties;
         if (props != null)
@@ -485,7 +486,7 @@ class WebConsolePlugin extends SimpleWeb
 
     }
 
-    private void keyVal(JSONWriter jw, String key, Object value)
+    private void keyVal(JSONWriter jw, String key, Object value) throws IOException
     {
         if (key != null && value != null)
         {