servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r652309 - /servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
Date Wed, 30 Apr 2008 07:06:03 GMT
Author: gnodet
Date: Wed Apr 30 00:06:03 2008
New Revision: 652309

URL: http://svn.apache.org/viewvc?rev=652309&view=rev
Log:
SMX4KNL-31: Aliases do not work in subshell

Modified:
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java?rev=652309&r1=652308&r2=652309&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
(original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
Wed Apr 30 00:06:03 2008
@@ -160,10 +160,9 @@
         if (node instanceof GroupNode) {
             if (s.startsWith(ALIAS_PREFIX)) {
                 s = s.substring(ALIAS_PREFIX.length());
-                for (Node n : ((GroupNode) node).nodes()) {
-                    if (n instanceof CommandNode && ((CommandNode) n).getId().equals(s))
{
-                        return n;
-                    }
+                Node n = recursiveFind((GroupNode) node, s);
+                if (n != null) {
+                    return n;
                 }
                 throw new NotFoundException(s);
             }
@@ -180,6 +179,20 @@
         }
     }
 
+    private Node recursiveFind(GroupNode groupNode, String s) {
+        for (Node n : groupNode.nodes()) {
+            if (n instanceof CommandNode && ((CommandNode) n).getId().equals(s))
{
+                return n;
+            } else if (n instanceof GroupNode) {
+                Node n2 = recursiveFind((GroupNode) n, s);
+                if (n2 != null) {
+                    return n2;
+                }
+            }
+        }
+        return null;
+    }
+
     public Node findNode(String path, String searchPath) throws NotFoundException {
         return findNode(path);
     }



Mime
View raw message