geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r406783 - in /geronimo/sandbox/gshell/trunk: gshell-cli/src/main/assembly/ gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ gshell-core/ gshell-core/src/main/java/org/apache/geronimo/gshell/ gshe...
Date Tue, 16 May 2006 00:11:05 GMT
Author: jdillon
Date: Mon May 15 17:11:04 2006
New Revision: 406783

URL: http://svn.apache.org/viewcvs?rev=406783&view=rev
Log:
Added Arguments utils (shift)
Implemented property based version

Added:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-cli/src/main/assembly/bin.xml
    geronimo/sandbox/gshell/trunk/gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
    geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellImpl.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Version.java

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/assembly/bin.xml?rev=406783&r1=406782&r2=406783&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/assembly/bin.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/assembly/bin.xml Mon May 15 17:11:04
2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- $Id -->
+<!-- $Id$ -->
 
 <assembly>
     <id>bin</id>
@@ -57,14 +57,14 @@
     </fileSets>
     
     <dependencySets>
-    		<dependencySet>
+        <dependencySet>
             <outputDirectory>lib</outputDirectory>
             <excludes>
                 <exclude>classworlds:classworlds</exclude>
             </excludes>
         </dependencySet>
         
-    		<dependencySet>
+        <dependencySet>
             <outputDirectory>lib/boot</outputDirectory>
             <includes>
                 <include>classworlds:classworlds</include>

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java?rev=406783&r1=406782&r2=406783&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
Mon May 15 17:11:04 2006
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.command.Command;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.console.IO;
+import org.apache.geronimo.gshell.util.Arguments;
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
@@ -107,7 +108,7 @@
             throw new Exception("Missing classname");
         }
 
-        run(args[0], shift(args));
+        run(args[0], Arguments.shift(args));
     }
 
     private void run(final String classname, final String[] args) throws Exception {
@@ -124,21 +125,5 @@
         Object result = method.invoke(null, new Object[] { args });
 
         log.info("Result: " + result);
-    }
-
-    //
-    // Misc
-    //
-
-    public static String[] shift(final String[] args) {
-        return shift(args, 1);
-    }
-
-    public static String[] shift(final String[] args, int pos) {
-        assert args.length >= pos;
-
-        String[] _args = new String[args.length - pos];
-        System.arraycopy(args, pos, _args, 0, _args.length);
-        return _args;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-core/pom.xml?rev=406783&r1=406782&r2=406783&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/pom.xml Mon May 15 17:11:04 2006
@@ -49,5 +49,23 @@
             <scope>compile</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${pom.basedir}/src/main/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>${pom.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>org/apache/geronimo/gshell/util/version.properties</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
     
 </project>

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellImpl.java?rev=406783&r1=406782&r2=406783&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellImpl.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellImpl.java
Mon May 15 17:11:04 2006
@@ -24,6 +24,7 @@
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.command.VariablesMap;
 import org.apache.geronimo.gshell.console.IO;
+import org.apache.geronimo.gshell.util.Arguments;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -95,23 +96,7 @@
         
         log.info("Executing (String[]): " + java.util.Arrays.asList(args));
         
-        return execute(args[0], shift(args));
-    }
-    
-    //
-    // Misc
-    //
-    
-    public static String[] shift(final String[] args) {
-        return shift(args, 1);
-    }
-    
-    public static String[] shift(final String[] args, int pos) {
-        assert args.length >= pos;
-        
-        String[] _args = new String[args.length - pos];
-        System.arraycopy(args, pos, _args, 0, _args.length);
-        return _args;
+        return execute(args[0], Arguments.shift(args));
     }
     
     //

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Arguments.java?rev=406783&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
(added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
Mon May 15 17:11:04 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+/**
+ * ???
+ *
+ * @version $Id: GShellImpl.java 405303 2006-05-09 04:55:39Z jdillon $
+ */
+public class Arguments
+{
+    public static String[] shift(final String[] args) {
+        return shift(args, 1);
+    }
+
+    public static String[] shift(final String[] args, int pos) {
+        assert args.length >= pos;
+
+        String[] _args = new String[args.length - pos];
+        System.arraycopy(args, pos, _args, 0, _args.length);
+        return _args;
+    }
+}

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Version.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Version.java?rev=406783&r1=406782&r2=406783&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Version.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/util/Version.java
Mon May 15 17:11:04 2006
@@ -16,8 +16,14 @@
 
 package org.apache.geronimo.gshell.util;
 
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Properties;
+
 /**
- * ???
+ * Provides externalization of the GShell version details.
+ *
+ * <p>This facilitates syncing up version details with the build system.
  *
  * @version $Id$
  */
@@ -29,20 +35,26 @@
         if (instance == null) {
             instance = new Version();
         }
-        
+
         return instance;
     }
-    
+
+    private Properties props = new Properties();
+
     public Version() {
-        //
-        // TODO: Load version.properties
-        //
+        InputStream input = getClass().getResourceAsStream("version.properties");
+        assert input != null;
+
+        try {
+            props.load(input);
+            input.close();
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Failed to load version.properties", e);
+        }
     }
-    
+
     public String toString() {
-        //
-        // HACK: Read from properties
-        //
-        return "1.0.0-SNAPSHOT";
+        return props.getProperty("version");
     }
 }



Mime
View raw message