geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r701800 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/command/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-commands/gshell-builtins/src/main/resources...
Date Sun, 05 Oct 2008 14:30:54 GMT
Author: jdillon
Date: Sun Oct  5 07:30:53 2008
New Revision: 701800

URL: http://svn.apache.org/viewvc?rev=701800&view=rev
Log:
Adding printf command

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/PrintfAction.java
  (with props)
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
    geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandAction.java?rev=701800&r1=701799&r2=701800&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandAction.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandAction.java
Sun Oct  5 07:30:53 2008
@@ -47,11 +47,11 @@
         /**
          * The command execution was successful.
          */
-        SUCCESS,
+        SUCCESS, // 0
 
         /**
          * The command exectuion failed.
          */
-        FAILURE
+        FAILURE // 1
     }
 }
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/PrintfAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/PrintfAction.java?rev=701800&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/PrintfAction.java
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/PrintfAction.java
Sun Oct  5 07:30:53 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.commands.builtins;
+
+import org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.clp.Argument;
+
+import java.util.Collection;
+
+/**
+ * Prints formatted output.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrintfAction
+    implements CommandAction
+{
+    @Argument(index=0, required=true)
+    private String format;
+
+    @Argument(index=1, multiValued=true, required=true)
+    private Collection<String> arguments = null;
+
+    public Object execute(final CommandContext context) throws Exception {
+        assert context != null;
+        IO io = context.getIo();
+
+        io.out.print(String.format(format, arguments.toArray()));
+        
+        return Result.SUCCESS;
+    }
+}
\ No newline at end of file

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

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

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

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml?rev=701800&r1=701799&r2=701800&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
Sun Oct  5 07:30:53 2008
@@ -60,6 +60,10 @@
 
             <gshell:link name="print" target="echo"/>
 
+            <gshell:command name="printf">
+                <gshell:action class="org.apache.geronimo.gshell.commands.builtins.PrintfAction"/>
+            </gshell:command>
+
             <gshell:command name="clear" type="stateless">
                 <gshell:action class="org.apache.geronimo.gshell.commands.builtins.ClearAction"/>
             </gshell:command>

Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties?rev=701800&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
Sun Oct  5 07:30:53 2008
@@ -0,0 +1,35 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev$ $Date$
+##
+
+command.name=printf
+
+command.description=Print formatted output
+
+command.argument.format=Output format
+command.argument.format.token=FORMAT
+
+command.argument.arguments=Format arguments
+command.argument.arguments.token=ARGUMENTS
+
+command.manual=\
+  TODO: printf manual
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/PrintfAction.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java?rev=701800&r1=701799&r2=701800&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/CommandLineProcessor.java
Sun Oct  5 07:30:53 2008
@@ -296,6 +296,10 @@
         if (!requireOverride) {
 	        for (Handler handler : optionHandlers) {
 	            if (handler.descriptor.isRequired() && !present.contains(handler)) {
+                    //
+                    // FIXME: This needs to be i18n aware
+                    //
+
 	                throw new ProcessingException(Messages.REQUIRED_OPTION_MISSING.format(handler.descriptor.toString()));
 	            }
 	        }
@@ -303,6 +307,10 @@
 	        // Ensure that all required argument handlers are present
 	        for (Handler handler : argumentHandlers) {
 	            if (handler.descriptor.isRequired() && !present.contains(handler)) {
+                    //
+                    // FIXME: This needs to be i18n aware
+                    //
+                    
 	                throw new ProcessingException(Messages.REQUIRED_ARGUMENT_MISSING.format(handler.descriptor.toString()));
 	            }
 	        }

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml?rev=701800&r1=701799&r2=701800&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
Sun Oct  5 07:30:53 2008
@@ -45,6 +45,7 @@
 
     <!--
     FIXME: This should really not be prototype scoped, or it should be accessible for a Shell
instance.
+           Should probably create a HistoryProvider component to deal with this shit.
     -->
     
     <bean id="history" class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl" scope="prototype"/>



Mime
View raw message