geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r718272 - in /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry: AliasMetaMapper.java CommandResolverImpl.java
Date Mon, 17 Nov 2008 16:38:20 GMT
Author: jdillon
Date: Mon Nov 17 08:38:19 2008
New Revision: 718272

URL: http://svn.apache.org/viewvc?rev=718272&view=rev
Log:
Use virtul file system to root meta:/aliases for resolving aliases

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/AliasMetaMapper.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/CommandResolverImpl.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/AliasMetaMapper.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/AliasMetaMapper.java?rev=718272&r1=718271&r2=718272&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/AliasMetaMapper.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/AliasMetaMapper.java
Mon Nov 17 08:38:19 2008
@@ -97,6 +97,10 @@
         metaRegistry.registerData(fileName, data);
     }
 
+    //
+    // FIXME: This seems to have problems, when adding/removing alias, first alias value
keeps, probably due to the cached VFS FileObject
+    //
+    
     private void remove(final String name) throws Exception {
         assert name != null;
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/CommandResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/CommandResolverImpl.java?rev=718272&r1=718271&r2=718272&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/CommandResolverImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/registry/CommandResolverImpl.java
Mon Nov 17 08:38:19 2008
@@ -61,7 +61,7 @@
     
     private FileObject commandsDirectory;
 
-    private FileObject aliasesDirectory;
+    private FileObject aliasesRoot;
 
     private BeanContainer container;
 
@@ -117,6 +117,14 @@
         return command;
     }
 
+    private FileObject getAliasesRoot() throws FileSystemException {
+        if (aliasesRoot == null) {
+            aliasesRoot = fileSystemAccess.createVirtualFileSystem(ALIASES_ROOT);
+        }
+
+        return aliasesRoot;
+    }
+
     private AliasCommand resolveAliasCommand(final String name, final Variables variables)
{
         assert name != null;
         assert variables != null;
@@ -126,23 +134,12 @@
         AliasCommand command = null;
 
         try {
-            FileObject file = fileSystemAccess.resolveFile(getAliasesDirectory(), name);
+            FileObject root = getAliasesRoot();
+            FileObject file = root.resolveFile(name);
 
             if (file != null && file.exists()) {
                 log.trace("Resolved file: {}", file);
-
-                // Make sure whatever file we resolved is actually a meta file
-                if (!isMetaFile(file)) {
-                    log.debug("Command name '{}' did not resolve to a meta-file; found: {}",
name, file);
-                    return null;
-                }
-
-                // Make sure we found a file in the meta:/commands tree
-                if (!file.getName().getPath().startsWith("/aliases")) {
-                    log.debug("Command name '{}' did not resolve under " + ALIASES_ROOT +
"; found: {}", name, file);
-                    return null;
-                }
-
+                
                 command = createAliasCommand(file);
             }
         }
@@ -153,6 +150,14 @@
         return command;
     }
 
+    private FileObject getCommandsDirectory() throws FileSystemException {
+        if (commandsDirectory == null) {
+            commandsDirectory = fileSystemAccess.resolveFile(null, COMMANDS_ROOT);
+        }
+
+        return commandsDirectory;
+    }
+
     private FileObject resolveCommandFile(final String name, final Variables variables) throws
FileSystemException {
         assert name != null;
         assert variables != null;
@@ -289,22 +294,6 @@
         return MetaFileName.SCHEME.equals(file.getName().getScheme());
     }
 
-    private FileObject getCommandsDirectory() throws FileSystemException {
-        if (commandsDirectory == null) {
-            commandsDirectory = fileSystemAccess.resolveFile(null, COMMANDS_ROOT);
-        }
-
-        return commandsDirectory;
-    }
-
-    private FileObject getAliasesDirectory() throws FileSystemException {
-        if (aliasesDirectory == null) {
-            aliasesDirectory = fileSystemAccess.resolveFile(null, ALIASES_ROOT);
-        }
-
-        return aliasesDirectory;
-    }
-
     private Command createCommand(final FileObject file) throws FileSystemException, CommandException
{
         assert file != null;
 



Mime
View raw message