geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r707108 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/notification/ gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ gshell-wisdom/gshell-wisdom-core/src/main/java/org/apac...
Date Wed, 22 Oct 2008 15:58:07 GMT
Author: jdillon
Date: Wed Oct 22 08:58:07 2008
New Revision: 707108

URL: http://svn.apache.org/viewvc?rev=707108&view=rev
Log:
Nuke {Success|Failure}Notification, just use ResultNotification to keep the API simple

Removed:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/notification/FailureNotification.java
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/notification/SuccessNotification.java
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandSupport.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java?rev=707108&r1=707107&r2=707108&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
Wed Oct 22 08:58:07 2008
@@ -23,9 +23,9 @@
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.geronimo.gshell.command.CommandAction;
 import org.apache.geronimo.gshell.command.CommandContext;
-import org.apache.geronimo.gshell.notification.FailureNotification;
 import org.apache.geronimo.gshell.vfs.FileObjects;
 import org.apache.geronimo.gshell.vfs.FileSystemAccess;
+import org.apache.geronimo.gshell.notification.ResultNotification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Required;
@@ -84,7 +84,7 @@
 
         if (!file.exists()) {
             FileObjects.close(file);
-            throw new FailureNotification("File not found: " + file.getName());
+            throw new ResultNotification("File not found: " + file.getName(), Result.FAILURE);
         }
     }
 
@@ -93,7 +93,7 @@
 
         if (!file.getType().hasContent()) {
             FileObjects.close(file);
-            throw new FailureNotification("File has no content: " + file.getName());
+            throw new ResultNotification("File has no content: " + file.getName(), Result.FAILURE);
         }
     }
 
@@ -102,7 +102,7 @@
 
         if (!file.getType().hasChildren()) {
             FileObjects.close(file);
-            throw new FailureNotification("File has no children: " + file.getName());
+            throw new ResultNotification("File has no children: " + file.getName(), Result.FAILURE);
         }
     }
 
@@ -111,7 +111,7 @@
 
         if (!file.getType().hasChildren()) {
             FileObjects.close(file);
-            throw new FailureNotification("File is not readable: " + file.getName());
+            throw new ResultNotification("File is not readable: " + file.getName(), Result.FAILURE);
         }
     }
 
@@ -120,7 +120,7 @@
 
         if (!file.getType().hasChildren()) {
             FileObjects.close(file);
-            throw new FailureNotification("File is not writable: " + file.getName());
+            throw new ResultNotification("File is not writable: " + file.getName(), Result.FAILURE);
         }
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandSupport.java?rev=707108&r1=707107&r2=707108&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandSupport.java
Wed Oct 22 08:58:07 2008
@@ -32,10 +32,8 @@
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.i18n.MessageSource;
 import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.notification.FailureNotification;
 import org.apache.geronimo.gshell.notification.Notification;
 import org.apache.geronimo.gshell.notification.ResultNotification;
-import org.apache.geronimo.gshell.notification.SuccessNotification;
 import org.apache.geronimo.gshell.shell.ShellContext;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
@@ -311,23 +309,16 @@
 
             result = new CommandResult.ValueResult(value);
         }
-        catch (final FailureNotification n) {
-            log.trace("Command notified FAILURE result: " + n, n);
-
-            io.error(n.getMessage());
-
-            result = new CommandResult.ValueResult(n.getResult());
-        }
-        catch (final SuccessNotification n) {
-            log.trace("Command notified SUCCESS result: " + n, n);
-
-            io.verbose(n.getMessage());
-
-            result = new CommandResult.ValueResult(n.getResult());
-        }
         catch (final ResultNotification n) {
             log.trace("Command notified result: " + n, n);
 
+            if (n.getResult() == CommandAction.Result.FAILURE) {
+                io.error(n.getMessage());
+            }
+            else {
+                io.verbose(n.getMessage());
+            }
+
             result = new CommandResult.ValueResult(n.getResult());
         }
         catch (final Notification n) {

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java?rev=707108&r1=707107&r2=707108&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
Wed Oct 22 08:58:07 2008
@@ -71,7 +71,10 @@
     }
 
     //
-    // FIXME: This does not properly complete when in a command group :-(
+    // FIXME: This does not properly complete when in a command group :-(  So, when we complete,
resolve the current group,
+    //        and look for an attribute on the file, which is the completer.  If it does
not exist, then build a new one
+    //        and attach it, else use what we found.  Pending how to deal with dynamic add/remove
muck.  May need to add
+    //        events to the MetaRegistry?
     //
 
     // @PostConstruct



Mime
View raw message