geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r726178 - in /geronimo/gshell/trunk: gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/ gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/
Date Sat, 13 Dec 2008 07:14:51 GMT
Author: jdillon
Date: Fri Dec 12 23:14:51 2008
New Revision: 726178

URL: http://svn.apache.org/viewvc?rev=726178&view=rev
Log:
Use some consistent names for variables

Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/HistoryAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/HistoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/HistoryAction.java?rev=726178&r1=726177&r2=726178&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/HistoryAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/HistoryAction.java
Fri Dec 12 23:14:51 2008
@@ -45,7 +45,7 @@
         IO io = context.getIo();
 
         // HACK: Get at the shell's history from our variables
-        History history = (History) context.getVariables().get("SHELL.HISTORY");
+        History history = context.getVariables().get("gshell.internal.history", History.class);
         assert history != null;
 
         // noinspection unchecked

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java?rev=726178&r1=726177&r2=726178&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java
Fri Dec 12 23:14:51 2008
@@ -123,7 +123,7 @@
                     String name = iter.next();
 
                     // HACK: Hide some internal muck for now
-                    if (name.startsWith("SHELL")) {
+                    if (name.startsWith("gshell.internal")) {
                         continue;
                     }
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=726178&r1=726177&r2=726178&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
Fri Dec 12 23:14:51 2008
@@ -22,7 +22,6 @@
 import jline.Completor;
 import jline.History;
 import org.apache.geronimo.gshell.application.Application;
-import org.apache.geronimo.gshell.application.model.Branding;
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.console.Console;
@@ -65,8 +64,6 @@
 
     private ShellContext context;
 
-    private Branding branding;
-
     private Prompter prompter;
 
     private ErrorHandler errorHandler;
@@ -119,21 +116,14 @@
             }
         };
 
-        branding = application.getModel().getBranding();
-
-        // HACK: Add ourself to variables so commands can get to us.  Maybe need to add to
^^^ and expose in CommandContent
-        vars.set("SHELL", this, true);
-
-        // HACK: Add history for the 'history' command, since its not part of the Shell interf
it can't really access it easy, resolve with ^^^
-        vars.set("SHELL.HISTORY", getHistory(), true);
-
-        vars.set("gshell.prompt", branding.getPrompt());
-
+        vars.set("gshell.prompt", application.getModel().getBranding().getPrompt());
         vars.set(CommandResolver.GROUP, "/");
+        vars.set("gshell.username", application.getUserName());
+        vars.set("gshell.hostname", application.getLocalHost());
+
+        // HACK: Add history for the 'history' command, since its not part of the Shell intf
it can't really access it
+        vars.set("gshell.internal.history", getHistory(), true);
 
-        vars.set("USERNAME", application.getUserName());
-        vars.set("HOSTNAME", application.getLocalHost());
-        
         loadProfileScripts();
 
         opened = true;
@@ -203,8 +193,7 @@
 
         log.debug("Starting interactive console; args: {}", args);
 
-        assert branding != null;
-        loadUserScript(branding.getInteractiveScriptName());
+        loadUserScript(application.getModel().getBranding().getInteractiveScriptName());
 
         // Setup 2 final refs to allow our executor to pass stuff back to us
         final AtomicReference<ExitNotification> exitNotifHolder = new AtomicReference<ExitNotification>();
@@ -246,7 +235,7 @@
 
         // Unless the user wants us to shut up, then display a nice welcome banner
         if (!io.isQuiet()) {
-            String message = branding.getWelcomeMessage();
+            String message = application.getModel().getBranding().getWelcomeMessage();
             if (message != null) {
                 io.out.print(message);
                 io.out.println(repeat("-", io.getTerminal().getTerminalWidth() - 1));
@@ -304,13 +293,11 @@
     //
 
     private void loadProfileScripts() throws Exception {
-        assert branding != null;
-
         log.debug("Loading profile scripts");
         
         // Load profile scripts if they exist
-        loadSharedScript(branding.getProfileScriptName());
-        loadUserScript(branding.getProfileScriptName());
+        loadSharedScript(application.getModel().getBranding().getProfileScriptName());
+        loadUserScript(application.getModel().getBranding().getProfileScriptName());
     }
 
     private void loadScript(final File file) throws Exception {
@@ -333,7 +320,7 @@
     private void loadUserScript(final String fileName) throws Exception {
         assert fileName != null;
 
-        File file = new File(branding.getUserDirectory(), fileName);
+        File file = new File(application.getModel().getBranding().getUserDirectory(), fileName);
 
         if (file.exists()) {
             log.debug("Loading user-script: {}", file);
@@ -348,7 +335,7 @@
     private void loadSharedScript(final String fileName) throws Exception {
         assert fileName != null;
 
-        File file = new File(branding.getUserDirectory(), fileName);
+        File file = new File(application.getModel().getBranding().getUserDirectory(), fileName);
 
         if (file.exists()) {
             log.debug("Loading shared-script: {}", file);



Mime
View raw message