FELIX-1127: Add a name for a repository
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@803526 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/assembly/src/main/filtered-resources/features.xml b/karaf/assembly/src/main/filtered-resources/features.xml
index 70e9fe5..f18ba6a 100644
--- a/karaf/assembly/src/main/filtered-resources/features.xml
+++ b/karaf/assembly/src/main/filtered-resources/features.xml
@@ -16,7 +16,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<features name="default}">
+<features name="default">
<feature name="spring" version="${spring.version}">
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance.version}</bundle>
<bundle>mvn:org.springframework/spring-core/${spring.version}</bundle>
diff --git a/karaf/features/command/src/main/java/org/apache/felix/karaf/features/command/ListFeaturesCommand.java b/karaf/features/command/src/main/java/org/apache/felix/karaf/features/command/ListFeaturesCommand.java
index 3c5041d..63efe72 100644
--- a/karaf/features/command/src/main/java/org/apache/felix/karaf/features/command/ListFeaturesCommand.java
+++ b/karaf/features/command/src/main/java/org/apache/felix/karaf/features/command/ListFeaturesCommand.java
@@ -46,14 +46,14 @@
// Get the feature data to print.
List<Feature> features = new ArrayList<Feature>();
- Map<Feature, String> repositoryNames = new HashMap<Feature, String>();
+ List<Repository> repositories = new ArrayList<Repository>();
for (Repository r : Arrays.asList(admin.listRepositories())) {
for (Feature f : r.getFeatures()) {
if (installed && !admin.isInstalled(f)) {
continue;
}
features.add(f);
- repositoryNames.put(f, r.getName());
+ repositories.add(r);
}
}
if (features.size() == 0) {
@@ -88,6 +88,7 @@
System.out.println(sb.toString());
// Print the feature data.
+ boolean needsLegend = false;
for (Feature f : features) {
sb.setLength(0);
@@ -113,11 +114,20 @@
}
sb.append(" ");
- sb.append(repositoryNames.get(f));
+ String name = repositories.get(0).getName();
+ sb.append(name);
+ repositories.remove(0);
System.out.println(sb.toString());
+ if (name.charAt(name.length() - 1) == '*') {
+ needsLegend = true;
+ }
}
+ if (needsLegend) {
+ System.out.println("* Installed via deploy directory");
+ }
+
}
}
diff --git a/karaf/webconsole/features/src/main/resources/res/ui/features.js b/karaf/webconsole/features/src/main/resources/res/ui/features.js
index 7fcf4a8..3bfc2e4 100644
--- a/karaf/webconsole/features/src/main/resources/res/ui/features.js
+++ b/karaf/webconsole/features/src/main/resources/res/ui/features.js
@@ -25,10 +25,10 @@
function renderView() {
renderStatusLine();
renderTable( "Feature Repositories", "repository_table", ["Name", "URL", "Actions"] );
- var txt = "<form method='post'><div class='table'><table class='tablelayout'><tbody><tr>" +
- "<input type='hidden' name='action' value='addRepository'/>" +
- "<td><input id='url' type='text' name='url' style='width:100%'/></td>" +
- "<td class='col_Actions'><input type='button' value='Add URL' onclick='addRepositoryUrl()' colspan='2'/></td>" +
+ var txt = "<form method='post'><div class='table'><table id='repository_table_footer' class='tablelayout'><tbody>" +
+ "<tr><input type='hidden' name='action' value='addRepository'/>" +
+ "<td><input id='url' type='text' name='url' style='width:100%' colspan='2'/></td>" +
+ "<td class='col_Actions'><input type='button' value='Add URL' onclick='addRepositoryUrl()'/></td>" +
"</tr></tbody></table></div></form><br/>";
$("#plugin_content").append( txt );
renderTable( "Features", "feature_table", ["Name", "Version", "Repository", "Status", "Actions"] );
@@ -81,18 +81,30 @@
function renderRepositoryTableData( /* array of Objects */ repositories ) {
var trElement;
var input;
+ var needsLegend = false;
$("#repository_table > tbody > tr").remove();
for ( var idx in repositories ) {
- trElement = tr( null, { id: "repository-" + repositories[idx].name } );
+ var name = repositories[idx].name;
+ trElement = tr( null, { id: "repository-" + name } );
renderRepositoryData( trElement, repositories[idx] );
- $("#repository_table > tbody").append( trElement );
+ $("#repository_table > tbody").append( trElement );
+ if ( name[ name.length - 1 ] == "*" ) {
+ needsLegend = true;
+ }
}
$("#repository_table").trigger( "update" );
+ if ( needsLegend ) {
+ trElement = tr( null, null ) ;
+ trElement.appendChild( td( null, { colspan: 3 },
+ [ text( "* Installed via deploy directory" ) ] ) );
+ $("#repository_table_footer > tbody").prepend( trElement );
+ }
+ $("#repository_table_footer").trigger( "update" );
}
function renderRepositoryData( /* Element */ parent, /* Object */ repository ) {
- parent.appendChild( td( null, null, [text( repository.name )] ) );
- parent.appendChild( td( null, null, [text( repository.url )] ) );
+ parent.appendChild( td( null, null, [ text( repository.name ) ] ) );
+ parent.appendChild( td( null, null, [ text( repository.url ) ] ) );
var actionsTd = td( null, null );
var div = createElement( "div", null, {