You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/09/25 10:25:14 UTC

svn commit: r698861 - in /geronimo/gshell/trunk/gshell-remote: gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/ gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/ gshell-remote-server/src/main/...

Author: jdillon
Date: Thu Sep 25 01:25:12 2008
New Revision: 698861

URL: http://svn.apache.org/viewvc?rev=698861&view=rev
Log:
Externalize more messages for i18n

Modified:
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/RshCommand.properties
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/resources/org/apache/geronimo/gshell/remote/server/RshServerCommand.properties

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java?rev=698861&r1=698860&r2=698861&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java Thu Sep 25 01:25:12 2008
@@ -29,6 +29,7 @@
 import org.apache.geronimo.gshell.remote.client.proxy.RemoteShellProxy;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.i18n.MessageSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -59,7 +60,7 @@
     private URI remote;
 
     @Argument(index=1, multiValued=true)
-    private List<String> command = new ArrayList<String>();
+    private List<String> command = null;
 
     private BeanContainer container;
 
@@ -71,8 +72,9 @@
     public Object execute(final CommandContext context) throws Exception {
         assert context != null;
         IO io = context.getIo();
+        MessageSource messages = context.getCommand().getMessages();
 
-        io.info("Connecting to: {}", remote);
+        io.info(messages.format("info.connecting", remote));
 
         RshClient client = container.getBean(RshClient.class);
 
@@ -80,18 +82,18 @@
         
         client.connect(remote, local);
 
-        io.info("Connected");
+        io.info(messages.getMessage("info.connected"));
 
         // If the username/password was not configured via cli, then prompt the user for the values
         if (username == null || password == null) {
             PromptReader prompter = new PromptReader(io);
 
             if (username == null) {
-                username = prompter.readLine("Username: ");
+                username = prompter.readLine(messages.getMessage("prompt.username") + ": ");
             }
 
             if (password == null) {
-                password = prompter.readPassword("Password: ");
+                password = prompter.readPassword(messages.getMessage("prompt.password") + ": ");
             }
 
             //
@@ -109,6 +111,10 @@
         Object result = Result.SUCCESS;
 
         try {
+            if (command == null) {
+                command = new ArrayList<String>();
+            }
+            
             shell.run(command.toArray());
         }
         catch (ExitNotification n) {
@@ -118,11 +124,11 @@
 
         shell.close();
         
-        io.verbose("Disconnecting");
+        io.verbose(messages.getMessage("verbose.disconnecting"));
 
         client.close();
 
-        io.verbose("Disconnected");
+        io.verbose(messages.getMessage("verbose.disconnected"));
 
         return result;
     }

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/RshCommand.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/RshCommand.properties?rev=698861&r1=698860&r2=698861&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/RshCommand.properties (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/resources/org/apache/geronimo/gshell/remote/client/RshCommand.properties Thu Sep 25 01:25:12 2008
@@ -41,4 +41,13 @@
 command.argument.command.token=COMMAND
 
 command.manual=\
-  TODO: rsh manual
\ No newline at end of file
+  TODO: rsh manual
+
+info.connecting=Connecting to: {0}
+info.connected=Connected
+
+prompt.username=Username
+prompt.password=Password
+
+verbose.disconnecting=Disconnecting
+verbose.disconnected=Disconnected
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java?rev=698861&r1=698860&r2=698861&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java Thu Sep 25 01:25:12 2008
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.i18n.MessageSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,6 +58,8 @@
 
     public Object execute(final CommandContext context) throws Exception {
         assert context != null;
+        IO io = context.getIo();
+        MessageSource messages = context.getCommand().getMessages();
 
         RshServer server = container.getBean(RshServer.class);
 
@@ -64,9 +67,7 @@
 
         server.bind(location);
 
-        IO io = context.getIo();
-
-        io.info("Listening on: {}", location);
+        io.info(messages.format("info.listening", location));
 
         if (!background) {
             synchronized (this) {

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/resources/org/apache/geronimo/gshell/remote/server/RshServerCommand.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/resources/org/apache/geronimo/gshell/remote/server/RshServerCommand.properties?rev=698861&r1=698860&r2=698861&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/resources/org/apache/geronimo/gshell/remote/server/RshServerCommand.properties (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/resources/org/apache/geronimo/gshell/remote/server/RshServerCommand.properties Thu Sep 25 01:25:12 2008
@@ -31,4 +31,6 @@
 command.argument.location.token=URI
 
 command.manual=\
-  TODO: rsh-server manual
\ No newline at end of file
+  TODO: rsh-server manual
+
+info.listening=Listening on: {0}
\ No newline at end of file