FELIX-4430 Provide bundles using exported packages along with the version at which the exports are imported

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1570134 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle.properties
index 91c4163..d555ac5 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ b/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -36,6 +36,7 @@
 header.exporting.bundle=Exported by
 header.maven.deps=Maven Dependency
 no.exporters.found=No exporting bundle(s) found
+no.uses.found=No importing bundle(s) found
 no.maven.found=No maven information available
 status.initial=Please enter a list of package or class names and click the find button
 status.find={0} result(s) found
diff --git a/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties b/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
index b81e554..4532c73 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
+++ b/webconsole-plugins/packageadmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
@@ -1,4 +1,4 @@
-#Licensed to the Apache Software Foundation (ASF) under one or more

+#Licensed to the Apache Software Foundation (ASF) under one or more

 # contributor license agreements.  See the NOTICE file distributed with

 # this work for additional information regarding copyright ownership.

 # The ASF licenses this file to You under the Apache License, Version 2.0

@@ -34,9 +34,10 @@
 header.package.name=Pakete

 header.package.ver=Version

 header.exporting.bundle=Exportiert von

-header.maven.deps=Maven Abhängigkeit

+header.maven.deps=Maven Abhängigkeit

 no.exporters.found=Keine exportierenden Bundle(s) gefunden

-no.maven.found=Keine Maven-Informationen verfügbar

+no.uses.found=Keine importierenden Bundle(s) gefunden

+no.maven.found=Keine Maven-Informationen verfügbar

 status.initial=Bitte geben Sie eine Liste von Paket- oder Klassen-Namen und klicken Sie auf die Suche-Taste.

 status.find={0} Ergebnis(se) gefunden

 

diff --git a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
index d4fbae3..918c6f1 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
+++ b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
@@ -28,6 +28,7 @@
 			<th>${header.package.name}</th>
 			<th>${header.package.ver}</th>
 			<th>${header.exporting.bundle}</th>
+			<th>${header.importing.bundle}</th>
 			<th>${header.maven.deps}</th>
 		</tr>
 	</thead>
@@ -36,6 +37,7 @@
 			<td class="pkg">&nbsp;</td>
 			<td class="ver">-</td>
 			<td class="bnd">${no.exporters.found}</td>
+			<td class="use">${no.uses.found}</td>
 			<td class="mvn">${no.maven.found}</td>
 		</tr>
 	</tbody>
diff --git a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
index 8468103..43589ee 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
+++ b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
@@ -25,7 +25,26 @@
 var dupsTableTemplate = false;

 var statline = false;

 

-function linkBundle(bnd) { return '<a href="{0}/bundles/{1}">{2} ({3})</a>'.msgFormat(appRoot, bnd.bid, bnd.bsn, bnd.bid) }

+function linkBundle(bnd) { return '<a href="{0}/bundles/{1}">{2} ({3})</a>'.msgFormat(appRoot, bnd.bid, bnd.bsn, bnd.bid) }
+function uses(uses) {

+    var result = ""; 

+    if (uses) {

+        resul = "<table>";

+        for(var i in uses) {

+            result += "<tr><td>";

+            result += linkBundle(uses[i]);

+            result += "</td><td>";

+            if (uses[i].ver) {

+                result += uses[i].ver;

+            } else {

+                result += "&mdash;";

+            }

+            result += "</td></tr>";

+        }

+        result += "</table>";

+    }

+    return result;

+}

 

 $(function() {

 	findField = $('#findField');

@@ -63,7 +82,8 @@
 						var tr = findTableTemplate.clone()

 							.find('td.pkg').text(pkg.name).end()

 							.find('td.ver').text(exp.version).end()

-							.find('td.bnd').html(linkBundle(exp)).end()

+							.find('td.bnd').html(linkBundle(exp)).end()
+							.find('td.use').html(uses(exp.importers)).end()

 							.appendTo(findTableBody);

 						if (response.maven && response.maven[exp.bid]) {

 							var mvn = response.maven[exp.bid];

@@ -100,8 +120,7 @@
 						.find('td.ver').text(exp.version).end()

 						.find('td.exp').html(linkBundle(exp)).end();

 					if (exp.importers) {

-						var txt = ''; for(var j in exp.importers) txt += linkBundle(exp.importers[j]) + '<br/>';

-						td.find('td.imp').html( txt );

+						td.find('td.imp').html(uses(exp.importers));

 					}

 					if (i==0) {

 						td.find('td.pkg').attr('rowspan', pkg.entries.length);