geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r407907 - in /geronimo/sandbox/gshell/trunk: ./ gshell-cli/ gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/ gshell-core/ gshell-core/src/main/java/org/apache/geronimo/gshell/console/
Date Fri, 19 May 2006 20:37:40 GMT
Author: jdillon
Date: Fri May 19 13:37:40 2006
New Revision: 407907

URL: http://svn.apache.org/viewvc?rev=407907&view=rev
Log:
Added JLineConsole, which uses the awesome JLine library to provide a nice command-line interface
w/history etc.
To support JLineConsole, expose streams in IO, but have commands keep using readers/writers
by default
Default IDEA configuration to link modules
Set JDK to 1.5

Added:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
    geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/IO.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/SimpleConsole.java
    geronimo/sandbox/gshell/trunk/pom.xml

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml Fri May 19 13:37:40 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- $Id -->
+<!-- $Id$ -->
 
 <project
     xmlns="http://maven.apache.org/POM/4.0.0"

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Fri May 19 13:37:40 2006
@@ -29,6 +29,7 @@
 import org.apache.geronimo.gshell.console.IO;
 import org.apache.geronimo.gshell.console.InteractiveConsole;
 import org.apache.geronimo.gshell.console.SimpleConsole;
+import org.apache.geronimo.gshell.console.JLineConsole;
 
 import org.apache.geronimo.gshell.util.Version;
 import org.apache.geronimo.gshell.util.Banner;
@@ -187,7 +188,7 @@
         }
 
         if (interactive) {
-            InteractiveConsole console = new InteractiveConsole(new SimpleConsole(io), gshell);
+            InteractiveConsole console = new InteractiveConsole(new JLineConsole(io), gshell);
 
             // Check if there are args, and run them and then enter interactive
             if (_args.length != 0) {

Modified: geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/pom.xml?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/pom.xml Fri May 19 13:37:40 2006
@@ -48,6 +48,11 @@
             <type>jar</type>
             <scope>compile</scope>
         </dependency>
+
+        <dependency>
+            <groupId>jline</groupId>
+            <artifactId>jline</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/IO.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/IO.java?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/IO.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/IO.java
Fri May 19 13:37:40 2006
@@ -29,26 +29,26 @@
  */
 public class IO
 {
-    //
-    // TODO: Expose the binary versions, wrap for text readers/writers
-    //
-    
+    public final InputStream inputStream;
+    public final PrintStream outputStream;
+    public final PrintStream errorStream;
+
     public final Reader in;
     public final PrintWriter out;
     public final PrintWriter err;
     
-    public IO(final Reader in, final PrintWriter out, final PrintWriter err) {
+    public IO(final InputStream in, final PrintStream out, final PrintStream err) {
         assert in != null;
         assert out != null;
         assert err != null;
-        
-        this.in = in;
-        this.out = out;
-        this.err = err;
-    }
-    
-    public IO(final InputStream in, final PrintStream out, final PrintStream err) {
-        this(new InputStreamReader(in), new PrintWriter(out), new PrintWriter(err));
+
+        this.inputStream = in;
+        this.outputStream = out;
+        this.errorStream = err;
+
+        this.in = new InputStreamReader(in);
+        this.out = new PrintWriter(out);
+        this.err = new PrintWriter(err);
     }
     
     public IO() {

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java?rev=407907&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
(added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
Fri May 19 13:37:40 2006
@@ -0,0 +1,53 @@
+/*
+ * 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.console;
+
+import org.apache.geronimo.gshell.GShell;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import jline.ConsoleReader;
+
+/**
+ * A console backed up by <a href="http://jline.sf.net">JLine</a>.
+ *
+ * @version $Id: IO.java 399599 2006-05-04 08:13:57Z jdillon $
+ */
+public class JLineConsole
+    implements Console
+{
+    private static final Log log = LogFactory.getLog(SimpleConsole.class);
+
+    private IO io;
+    private ConsoleReader reader;
+
+    public JLineConsole(final IO io) throws IOException {
+        assert io != null;
+
+        this.io = io;
+        this.reader = new ConsoleReader(io.inputStream, io.out);
+    }
+
+    public String readLine(final String prompt) throws IOException {
+        assert prompt != null;
+
+        return reader.readLine(prompt);
+    }
+}

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/SimpleConsole.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/SimpleConsole.java?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/SimpleConsole.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/SimpleConsole.java
Fri May 19 13:37:40 2006
@@ -24,7 +24,7 @@
 import java.io.IOException;
 
 /**
- * ???
+ * A simple console implementation using a buffered reader.
  *
  * @version $Id: IO.java 399599 2006-05-04 08:13:57Z jdillon $
  */

Modified: geronimo/sandbox/gshell/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/pom.xml?rev=407907&r1=407906&r2=407907&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/pom.xml Fri May 19 13:37:40 2006
@@ -15,6 +15,38 @@
     <packaging>pom</packaging>
     <version>1.0.0-SNAPSHOT</version>
     
+    <repositories>
+        <repository>
+            <id>maven2-snapshots</id>
+            <name>Maven Snapshots Repository</name>
+            <url>http://snapshots.maven.codehaus.org/maven2</url>
+            <layout>default</layout>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>daily</updatePolicy>
+                <checksumPolicy>ignore</checksumPolicy>
+            </snapshots>
+        </repository>
+        
+        <repository>
+            <id>apache-cvs</id>
+            <name>Apache CVS Repository</name>
+            <url>http://cvs.apache.org/repository</url>
+            <layout>legacy</layout>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>daily</updatePolicy>
+                <checksumPolicy>ignore</checksumPolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+    
     <dependencyManagement>
         <dependencies>
             <dependency>
@@ -69,6 +101,13 @@
                 <version>1.1</version>
                 <scope>compile</scope>
             </dependency>
+            
+            <dependency>
+                <groupId>jline</groupId>
+                <artifactId>jline</artifactId>
+                <version>0.9.5</version>
+                <scope>compile</scope>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     
@@ -102,10 +141,19 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.4</source>
-                    <target>1.4</target>
+                    <source>1.5</source>
+                    <target>1.5</target>
                 </configuration>
              </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-idea-plugin</artifactId>
+                <configuration>
+                    <jdkName>1.5</jdkName>
+                    <linkModules>true</linkModules>
+                </configuration>
+            </plugin>
          </plugins>
     </build>
     



Mime
View raw message