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/30 08:09:57 UTC

svn commit: r700355 - in /geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main: java/org/apache/geronimo/gshell/commands/optional/ resources/META-INF/spring/ resources/org/apache/geronimo/gshell/commands/optional/

Author: jdillon
Date: Mon Sep 29 23:09:56 2008
New Revision: 700355

URL: http://svn.apache.org/viewvc?rev=700355&view=rev
Log:
Added 'hostname' command

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java   (contents, props changed)
      - copied, changed from r700354, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/DateAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/HostnameAction.properties
      - copied, changed from r700354, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/DateAction.properties
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/META-INF/spring/components.xml

Copied: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java (from r700354, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/DateAction.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java?p2=geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java&p1=geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/DateAction.java&r1=700354&r2=700355&rev=700355&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/DateAction.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java Mon Sep 29 23:09:56 2008
@@ -23,23 +23,24 @@
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.io.IO;
 
-import java.text.DateFormat;
-import java.util.Date;
+import java.net.InetAddress;
 
 /**
- * Displays the current time and date.
+ * Displays the name of the current host.
  *
  * @version $Rev$ $Date$
  */
-public class DateAction
+public class HostnameAction
     implements CommandAction
 {
     public Object execute(final CommandContext context) throws Exception {
         assert context != null;
         IO io = context.getIo();
 
-        io.info(DateFormat.getInstance().format(new Date()));
+        InetAddress localhost = InetAddress.getLocalHost();
+        io.info(localhost.getHostName());
+        io.verbose(localhost.getHostAddress());
 
         return Result.SUCCESS;
     }
-}
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/HostnameAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/META-INF/spring/components.xml?rev=700355&r1=700354&r2=700355&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/META-INF/spring/components.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/META-INF/spring/components.xml Mon Sep 29 23:09:56 2008
@@ -44,6 +44,10 @@
             <gshell:command name="date">
                 <gshell:action class="org.apache.geronimo.gshell.commands.optional.DateAction"/>
             </gshell:command>
+
+            <gshell:command name="hostname">
+                <gshell:action class="org.apache.geronimo.gshell.commands.optional.HostnameAction"/>
+            </gshell:command>
         </gshell:command-bundle>
     </gshell:plugin>
 

Copied: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/HostnameAction.properties (from r700354, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/DateAction.properties)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/HostnameAction.properties?p2=geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/HostnameAction.properties&p1=geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/DateAction.properties&r1=700354&r2=700355&rev=700355&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/DateAction.properties (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/org/apache/geronimo/gshell/commands/optional/HostnameAction.properties Mon Sep 29 23:09:56 2008
@@ -21,9 +21,9 @@
 ## $Rev$ $Date$
 ##
 
-command.name=date
+command.name=hostname
 
-command.description=Displays the current time and date.
+command.description=Displays the name of the current host.
 
 command.manual=\
-  TODO: date manual
\ No newline at end of file
+  TODO: hostname manual
\ No newline at end of file