karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [3/5] git commit: Improve support for old commands annotations in namespace handler
Date Tue, 17 Dec 2013 16:50:13 GMT
Improve support for old commands annotations in namespace handler


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

Branch: refs/heads/master
Commit: c999ac9029b98a037c21b2a7f10b145205f6dfdd
Parents: 5c08402
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Tue Dec 17 09:24:54 2013 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Tue Dec 17 17:49:19 2013 +0100

----------------------------------------------------------------------
 .../shell/console/commands/NamespaceHandler.java  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/c999ac90/shell/console/src/main/java/org/apache/karaf/shell/console/commands/NamespaceHandler.java
----------------------------------------------------------------------
diff --git a/shell/console/src/main/java/org/apache/karaf/shell/console/commands/NamespaceHandler.java
b/shell/console/src/main/java/org/apache/karaf/shell/console/commands/NamespaceHandler.java
index d20bcfa..d1992f3 100644
--- a/shell/console/src/main/java/org/apache/karaf/shell/console/commands/NamespaceHandler.java
+++ b/shell/console/src/main/java/org/apache/karaf/shell/console/commands/NamespaceHandler.java
@@ -308,11 +308,25 @@ public class NamespaceHandler implements org.apache.aries.blueprint.NamespaceHan
 
     public static String getScope(Class<?> action) {
         Command command = action.getAnnotation(Command.class);
-        return command.scope();
+        if (command != null) {
+            return command.scope();
+        }
+        org.apache.felix.gogo.commands.Command command2 = action.getAnnotation(org.apache.felix.gogo.commands.Command.class);
+        if (command2 != null) {
+            return command2.scope();
+        }
+        return null;
     }
 
     public static String getName(Class<?> action) {
         Command command = action.getAnnotation(Command.class);
-        return command.name();
+        if (command != null) {
+            return command.name();
+        }
+        org.apache.felix.gogo.commands.Command command2 = action.getAnnotation(org.apache.felix.gogo.commands.Command.class);
+        if (command2 != null) {
+            return command2.name();
+        }
+        return null;
     }
 }


Mime
View raw message