You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafu.apache.org by mh...@apache.org on 2018/01/18 23:33:23 UTC

incubator-datafu git commit: DATAFU-133 Remove json dependency.

Repository: incubator-datafu
Updated Branches:
  refs/heads/1.3.3 b52b1fe78 -> 7d4fb64b1


DATAFU-133 Remove json dependency.

This removes the dependency on the json library and replaces it with a dependency on the json-simple library, which is Apache 2.0.

I've also updated the year in the NOTICE file and other places.


Project: http://git-wip-us.apache.org/repos/asf/incubator-datafu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-datafu/commit/7d4fb64b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-datafu/tree/7d4fb64b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-datafu/diff/7d4fb64b

Branch: refs/heads/1.3.3
Commit: 7d4fb64b1b1379020b340d2e045315ed5a8bac23
Parents: b52b1fe
Author: Matthew Hayes <mh...@apache.org>
Authored: Thu Jan 18 15:32:46 2018 -0800
Committer: Matthew Hayes <mh...@apache.org>
Committed: Thu Jan 18 15:32:46 2018 -0800

----------------------------------------------------------------------
 LICENSE                                         | 16 ---------
 NOTICE                                          |  2 +-
 datafu-hourglass/build.gradle                   |  6 ++--
 .../hourglass/avro/AvroMultipleInputsUtil.java  | 34 +++++++++-----------
 .../src/main/resources/META-INF/NOTICE          |  2 +-
 datafu-pig/src/main/resources/META-INF/NOTICE   |  2 +-
 gradle/dependency-versions.gradle               |  2 +-
 site/source/layouts/_footer.erb                 |  2 +-
 8 files changed, 23 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index 38e6fe1..da23a8e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -248,22 +248,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 
 -----------------------------------------------------------------------
- The JSON License
------------------------------------------------------------------------
-
-The Apache DataFu project bundles the following under the JSON License:
-
-- json v20090211 (http://json.org/) - Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
------------------------------------------------------------------------
  Public Domain
 -----------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index ac686e7..0f490af 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache DataFu
-Copyright 2010-2017 The Apache Software Foundation
+Copyright 2010-2018 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/datafu-hourglass/build.gradle
----------------------------------------------------------------------
diff --git a/datafu-hourglass/build.gradle b/datafu-hourglass/build.gradle
index 027d8f4..d3819ce 100644
--- a/datafu-hourglass/build.gradle
+++ b/datafu-hourglass/build.gradle
@@ -102,7 +102,7 @@ task copyDemoDependencies(type: Copy, dependsOn: replace_demo_dependencies_dir)
 dependencies {
   // core dependencies, listed as dependencies in pom
   core "log4j:log4j:$log4jVersion"
-  core "org.json:json:$jsonVersion"
+  core "com.googlecode.json-simple:json-simple:$jsonVersion"
   core "org.apache.avro:avro:$avroVersion"
   core "org.apache.avro:avro-compiler:$avroVersion"
   core "org.apache.commons:commons-math:$commonsMathVersion"
@@ -159,8 +159,8 @@ modifyPom {
         version "$log4jVersion"
       }
       dependency {
-        groupId 'org.json'
-        artifactId 'json'
+        groupId 'com.googlecode.json-simple'
+        artifactId 'json-simple'
         version "$jsonVersion"
       }
       dependency {

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/datafu-hourglass/src/main/java/datafu/hourglass/avro/AvroMultipleInputsUtil.java
----------------------------------------------------------------------
diff --git a/datafu-hourglass/src/main/java/datafu/hourglass/avro/AvroMultipleInputsUtil.java b/datafu-hourglass/src/main/java/datafu/hourglass/avro/AvroMultipleInputsUtil.java
index bf6071e..32a1e95 100644
--- a/datafu-hourglass/src/main/java/datafu/hourglass/avro/AvroMultipleInputsUtil.java
+++ b/datafu-hourglass/src/main/java/datafu/hourglass/avro/AvroMultipleInputsUtil.java
@@ -25,8 +25,9 @@ import org.apache.hadoop.mapreduce.InputSplit;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.input.FileSplit;
 import org.apache.log4j.Logger;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
 
 /**
  * Helper methods for dealing with multiple Avro input schemas.  A mapping is stored in the configuration
@@ -48,7 +49,7 @@ public class AvroMultipleInputsUtil
    * @return schema
    */
   public static Schema getInputKeySchemaForSplit(Configuration conf, InputSplit split) 
-  {
+  {    
     String path = ((FileSplit)split).getPath().toString();
     _log.info("Determining schema for input path " + path);
     JSONObject schemas;
@@ -56,28 +57,22 @@ public class AvroMultipleInputsUtil
     {
       schemas = getInputSchemas(conf);
     }
-    catch (JSONException e1)
+    catch (ParseException e1)
     {
       throw new RuntimeException(e1);
     }
     Schema schema = null;
     if (schemas != null)
     {
-      for (String key : JSONObject.getNames(schemas))
+      for (Object keyObj : schemas.keySet())
       {
+        String key = (String)keyObj;
         _log.info("Checking against " + key);
         if (path.startsWith(key))
         {
-          try
-          {
-            schema = new Schema.Parser().parse(schemas.getString(key));
-            _log.info("Input schema found: " + schema.toString(true));
-            break;
-          }
-          catch (JSONException e)
-          {
-            throw new RuntimeException(e);
-          }
+          schema = new Schema.Parser().parse((String)schemas.get(key));
+          _log.info("Input schema found: " + schema.toString(true));
+          break;
         }
       }
     }
@@ -95,6 +90,7 @@ public class AvroMultipleInputsUtil
    * @param schema The input key schema.
    * @param path the path to set the schema for
    */
+  @SuppressWarnings("unchecked")
   public static void setInputKeySchemaForPath(Job job, Schema schema, String path) 
   { 
     JSONObject schemas;    
@@ -103,7 +99,7 @@ public class AvroMultipleInputsUtil
       schemas = getInputSchemas(job.getConfiguration());
       schemas.put(path, schema.toString());
     }
-    catch (JSONException e)
+    catch (ParseException e)
     {
       throw new RuntimeException(e);
     }         
@@ -115,9 +111,9 @@ public class AvroMultipleInputsUtil
    * 
    * @param conf
    * @return mapping from path to input schem
-   * @throws JSONException
+   * @throws ParseException 
    */
-  private static JSONObject getInputSchemas(Configuration conf) throws JSONException
+  private static JSONObject getInputSchemas(Configuration conf) throws ParseException
   {
     JSONObject schemas;
     
@@ -129,7 +125,7 @@ public class AvroMultipleInputsUtil
     }
     else
     {
-      schemas = new JSONObject(schemasJson);
+      schemas = (JSONObject)new JSONParser().parse(schemasJson);
     }   
     
     return schemas;

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/datafu-hourglass/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/datafu-hourglass/src/main/resources/META-INF/NOTICE b/datafu-hourglass/src/main/resources/META-INF/NOTICE
index ac686e7..0f490af 100644
--- a/datafu-hourglass/src/main/resources/META-INF/NOTICE
+++ b/datafu-hourglass/src/main/resources/META-INF/NOTICE
@@ -1,5 +1,5 @@
 Apache DataFu
-Copyright 2010-2017 The Apache Software Foundation
+Copyright 2010-2018 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/datafu-pig/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/datafu-pig/src/main/resources/META-INF/NOTICE b/datafu-pig/src/main/resources/META-INF/NOTICE
index 18fba06..f2deef2 100644
--- a/datafu-pig/src/main/resources/META-INF/NOTICE
+++ b/datafu-pig/src/main/resources/META-INF/NOTICE
@@ -1,5 +1,5 @@
 Apache DataFu
-Copyright 2010-2017 The Apache Software Foundation
+Copyright 2010-2018 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/gradle/dependency-versions.gradle
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.gradle b/gradle/dependency-versions.gradle
index 9053bf2..5500df2 100644
--- a/gradle/dependency-versions.gradle
+++ b/gradle/dependency-versions.gradle
@@ -36,7 +36,7 @@ ext {
   wagonHttpVersion="1.0-beta-2"
   openNlpVersion="1.5.3"
   openNlpMaxEntVersion="3.0.3"
-  jsonVersion="20090211"
+  jsonVersion="1.1.1"
   jsr311Version="1.1.1"
   slf4jVersion="1.6.4"
 }

http://git-wip-us.apache.org/repos/asf/incubator-datafu/blob/7d4fb64b/site/source/layouts/_footer.erb
----------------------------------------------------------------------
diff --git a/site/source/layouts/_footer.erb b/site/source/layouts/_footer.erb
index fcf0235..36710c3 100644
--- a/site/source/layouts/_footer.erb
+++ b/site/source/layouts/_footer.erb
@@ -24,7 +24,7 @@
 </div>
 
 <div class="copyright">
-  Copyright &copy; 2011-2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br>
+  Copyright &copy; 2011-2018 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br>
   Apache DataFu, DataFu, Apache Pig, Apache Hadoop, Hadoop, Apache, and the Apache feather logo are either registered trademarks or trademarks of the <a href="http://www.apache.org/">Apache Software Foundation</a> in the United States and other countries.
 </div>
 </div>
\ No newline at end of file