karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [6/6] git commit: [KARAF-2911] Small fixes to subsystem commands
Date Fri, 18 Apr 2014 21:35:56 GMT
[KARAF-2911] Small fixes to subsystem commands


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/486ad3ac
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/486ad3ac
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/486ad3ac

Branch: refs/heads/master
Commit: 486ad3aca57b364940f8d71d8f520b877ee614e2
Parents: 53ad48f
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Thu Apr 17 16:07:14 2014 +0200
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Fri Apr 18 23:33:51 2014 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/subsystem/commands/ListAction.java   | 10 ++++++++++
 .../apache/karaf/subsystem/commands/SubsystemSupport.java |  6 +++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/486ad3ac/subsystem/src/main/java/org/apache/karaf/subsystem/commands/ListAction.java
----------------------------------------------------------------------
diff --git a/subsystem/src/main/java/org/apache/karaf/subsystem/commands/ListAction.java b/subsystem/src/main/java/org/apache/karaf/subsystem/commands/ListAction.java
index 458ff5b..8b7ee12 100644
--- a/subsystem/src/main/java/org/apache/karaf/subsystem/commands/ListAction.java
+++ b/subsystem/src/main/java/org/apache/karaf/subsystem/commands/ListAction.java
@@ -36,6 +36,7 @@ public class ListAction extends SubsystemSupport implements Action {
         table.column("SymbolicName");
         table.column("Version");
         table.column("State");
+        table.column("Type");
         table.column("Parents");
         table.column("Children");
 
@@ -45,6 +46,7 @@ public class ListAction extends SubsystemSupport implements Action {
                     ss.getSymbolicName(),
                     ss.getVersion(),
                     ss.getState().toString(),
+                    getType(ss),
                     getSubsytemIds(ss.getParents()),
                     getSubsytemIds(ss.getChildren())
             );
@@ -53,4 +55,12 @@ public class ListAction extends SubsystemSupport implements Action {
         return null;
     }
 
+    private String getType(Subsystem subsystem) {
+        String type = subsystem.getType();
+        if (type.startsWith("osgi.subsystem.")) {
+            type = type.substring("osgi.subsystem.".length());
+        }
+        return type;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/486ad3ac/subsystem/src/main/java/org/apache/karaf/subsystem/commands/SubsystemSupport.java
----------------------------------------------------------------------
diff --git a/subsystem/src/main/java/org/apache/karaf/subsystem/commands/SubsystemSupport.java
b/subsystem/src/main/java/org/apache/karaf/subsystem/commands/SubsystemSupport.java
index e91461e..c19ebfe 100644
--- a/subsystem/src/main/java/org/apache/karaf/subsystem/commands/SubsystemSupport.java
+++ b/subsystem/src/main/java/org/apache/karaf/subsystem/commands/SubsystemSupport.java
@@ -104,8 +104,12 @@ public abstract class SubsystemSupport {
     protected List<Long> getSubsytemIds(Collection<Subsystem> subsystems) {
         List<Long> ids = new ArrayList<Long>();
         for (Subsystem ss : subsystems) {
-            ids.add(ss.getSubsystemId());
+            long id = ss.getSubsystemId();
+            if (!ids.contains(id)) {
+                ids.add(id);
+            }
         }
+        Collections.sort(ids);
         return ids;
     }
 


Mime
View raw message