Fixed FELIX-4996 : Dependency Finder should use Inventory instead of deprecated ConfigurationPrinter
https://issues.apache.org/jira/browse/FELIX-4996
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1694635 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/packageadmin/pom.xml b/webconsole-plugins/packageadmin/pom.xml
index f9089e0..38b7ace 100644
--- a/webconsole-plugins/packageadmin/pom.xml
+++ b/webconsole-plugins/packageadmin/pom.xml
@@ -148,6 +148,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.inventory</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20070829</version>
diff --git a/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/Activator.java b/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/Activator.java
index 0f2cd85..7dcb40a 100644
--- a/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/Activator.java
+++ b/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/Activator.java
@@ -21,9 +21,9 @@
import java.util.Dictionary;
import java.util.Hashtable;
-import org.apache.felix.webconsole.ConfigurationPrinter;
+import org.apache.felix.inventory.Format;
+import org.apache.felix.inventory.InventoryPrinter;
import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.apache.felix.webconsole.WebConsoleConstants;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -55,10 +55,12 @@
// register configuration printer
final Dictionary/*<String, Object>*/props = new Hashtable/*<String, Object>*/();
- props.put(WebConsoleConstants.CONFIG_PRINTER_MODES, new String[] {
- ConfigurationPrinter.MODE_ZIP, ConfigurationPrinter.MODE_TXT });
+ props.put(InventoryPrinter.NAME, "duplicate_exports"); //$NON-NLS-1$
+ props.put(InventoryPrinter.TITLE, "Duplicate Exports"); //$NON-NLS-1$
+ props.put(InventoryPrinter.FORMAT, new String[] { Format.TEXT.toString() });
+
printerReg = context.registerService(
- "org.apache.felix.webconsole.ConfigurationPrinter", //$NON-NLS-1$
+ InventoryPrinter.class.getName(),
new WebConsolePrinter(context, pkgAdminTracker), props);
}
diff --git a/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/WebConsolePrinter.java b/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/WebConsolePrinter.java
index aba1264..1365f02 100644
--- a/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/WebConsolePrinter.java
+++ b/webconsole-plugins/packageadmin/src/main/java/org/apache/felix/webconsole/plugins/packageadmin/internal/WebConsolePrinter.java
@@ -23,17 +23,18 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
-import org.apache.felix.webconsole.ConfigurationPrinter;
+import org.apache.felix.inventory.Format;
+import org.apache.felix.inventory.InventoryPrinter;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
-class WebConsolePrinter implements ConfigurationPrinter
+class WebConsolePrinter implements InventoryPrinter
{
private final ServiceTracker tracker;
@@ -46,9 +47,10 @@
}
/**
- * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
+ * @see org.apache.felix.inventory.InventoryPrinter#print(
+ * java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
*/
- public void printConfiguration(PrintWriter pw)
+ public void print(PrintWriter pw, Format format, boolean isZip)
{
final PackageAdmin pa = (PackageAdmin) tracker.getService();
if (pa == null)
@@ -160,7 +162,7 @@
}
/**
- * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
+ * @return
*/
public String getTitle()
{