knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject knox git commit: [KNOX-677] - Upgrade to latest Groovy. (via Colm O hEigeartaigh)
Date Wed, 02 Mar 2016 20:10:24 GMT
Repository: knox
Updated Branches:
  refs/heads/master 0b527aca1 -> 05fd6fefc


[KNOX-677] - Upgrade to latest Groovy. (via Colm O hEigeartaigh)


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/05fd6fef
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/05fd6fef
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/05fd6fef

Branch: refs/heads/master
Commit: 05fd6fefceb779a2d748068232afe023dd49d1b2
Parents: 0b527ac
Author: Kevin Minder <kminder@apache.org>
Authored: Wed Mar 2 15:10:13 2016 -0500
Committer: Kevin Minder <kminder@apache.org>
Committed: Wed Mar 2 15:10:13 2016 -0500

----------------------------------------------------------------------
 CHANGES                                         |  1 +
 gateway-shell/pom.xml                           | 14 +++++++-
 .../org/apache/hadoop/gateway/shell/Shell.java  | 34 ++++++++++++--------
 pom.xml                                         | 20 ++++++++++--
 4 files changed, 52 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/05fd6fef/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bccc54e..0179aea 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ Release Notes - Apache Knox - Version 0.9.0
     * [KNOX-670] - Knox should be able to sost simple web apps
     * [KNOX-674] - Expose Jetty's SSL cipher suite configuration via gateway-site.xml
 ** Improvement
+    * [KNOX-677] - Upgrade to latest Groovy
 ** Bug
 
 ------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/knox/blob/05fd6fef/gateway-shell/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-shell/pom.xml b/gateway-shell/pom.xml
index 719e275..9ac3bf5 100644
--- a/gateway-shell/pom.xml
+++ b/gateway-shell/pom.xml
@@ -41,6 +41,18 @@
             <artifactId>groovy</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-groovysh</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-xml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-json</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.fusesource.jansi</groupId>
             <artifactId>jansi</artifactId>
         </dependency>
@@ -73,4 +85,4 @@
 
     </dependencies>
 
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/knox/blob/05fd6fef/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Shell.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Shell.java b/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Shell.java
index 23227ab..38cbfe8 100644
--- a/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Shell.java
+++ b/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Shell.java
@@ -18,6 +18,11 @@
 package org.apache.hadoop.gateway.shell;
 
 import groovy.ui.GroovyMain;
+import org.apache.hadoop.gateway.shell.hbase.HBase;
+import org.apache.hadoop.gateway.shell.hdfs.Hdfs;
+import org.apache.hadoop.gateway.shell.job.Job;
+import org.apache.hadoop.gateway.shell.workflow.Workflow;
+import org.apache.hadoop.gateway.shell.yarn.Yarn;
 import org.apache.log4j.PropertyConfigurator;
 import org.codehaus.groovy.tools.shell.AnsiDetector;
 import org.codehaus.groovy.tools.shell.Groovysh;
@@ -25,11 +30,20 @@ import org.fusesource.jansi.Ansi;
 import org.fusesource.jansi.AnsiConsole;
 
 import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
+import java.util.concurrent.TimeUnit;
 
 public class Shell {
 
+  private static String[] IMPORTS = new String[] {
+      Hadoop.class.getName(),
+      HBase.class.getName(),
+      Hdfs.class.getName(),
+      Job.class.getName(),
+      Workflow.class.getName(),
+      Yarn.class.getName(),
+      TimeUnit.class.getName()
+  };
+
   static {
     AnsiConsole.systemInstall();
     Ansi.setDetector( new AnsiDetector() );
@@ -41,19 +55,11 @@ public class Shell {
     if( args.length > 0 ) {
       GroovyMain.main( args );
     } else {
-      StringWriter buffer = new StringWriter();
-      PrintWriter setup = new PrintWriter( buffer );
-      setup.println( "import org.apache.hadoop.gateway.shell.Hadoop;" );
-      setup.println( "import org.apache.hadoop.gateway.shell.hdfs.Hdfs;" );
-      setup.println( "import org.apache.hadoop.gateway.shell.job.Job;" );
-      setup.println( "import org.apache.hadoop.gateway.shell.workflow.Workflow;" );
-      setup.println( "import org.apache.hadoop.gateway.shell.yarn.Yarn;" );
-      setup.println( "import java.util.concurrent.TimeUnit;" );
-      //setup.println( "set verbosity QUIET;" );
-      //setup.println( "set show-last-result false;" );
       Groovysh shell = new Groovysh();
-      shell.execute( buffer.toString() );
-      shell.run();
+      for( String name : IMPORTS ) {
+        shell.execute( "import " + name );
+      }
+      shell.run( null );
     }
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/05fd6fef/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 67c20bd..508c2d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,6 +98,7 @@
         <gateway-artifact>knox</gateway-artifact>
         <gateway-version>0.9.0-SNAPSHOT</gateway-version>
         <gateway-group>org.apache.knox</gateway-group>
+        <groovy-version>2.4.6</groovy-version>
         <hadoop-version>2.2.0</hadoop-version>
         <jetty-version>8.1.18.v20150929</jetty-version>
         <surefire-version>2.16</surefire-version>
@@ -716,7 +717,22 @@
             <dependency>
                 <groupId>org.codehaus.groovy</groupId>
                 <artifactId>groovy</artifactId>
-                <version>1.8.3</version>
+                <version>${groovy-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-groovysh</artifactId>
+                <version>${groovy-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-xml</artifactId>
+                <version>${groovy-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-json</artifactId>
+                <version>${groovy-version}</version>
             </dependency>
             <dependency>
                 <groupId>org.fusesource.jansi</groupId>
@@ -726,7 +742,7 @@
             <dependency>
                 <groupId>jline</groupId>
                 <artifactId>jline</artifactId>
-                <version>1.0</version>
+                <version>2.13</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.httpcomponents</groupId>


Mime
View raw message