Skip to content
Browse files

Changed project nam into cascading.json (ah, and also fixed a NPE by …

…the way ;-)
  • Loading branch information...
1 parent b7c258b commit 5213106842627b772e9b1fff44de81d1c770b0c1 @gmarabout committed May 3, 2009
View
10 build.xml
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
-<project name="cascading.utils" default="build" basedir=".">
+<project name="cascading.jsonf" default="build" basedir=".">
<property file="${basedir}/build.properties"/>
<property file="${basedir}/version.properties"/>
<property environment="env"/>
<property name="jars.dir" value="${basedir}/jars"/>
- <property name="cascading.utils.release.version" value="x.y.z"/>
+ <property name="cascading.json.release.version" value="x.y.z"/>
<!-- HADOOP -->
<property name="hadoop.home" location="${env.HADOOP_HOME}"/>
@@ -60,19 +60,19 @@
</target>
<target name="build" depends="init">
- <echo message="building cascading.utils JAR..."/>
+ <echo message="building cascading.json JAR..."/>
<javac srcdir="${src.java}" destdir="${build.classes}" verbose="off" debug="${javac.debug}">
<classpath refid="project.class.path"/>
</javac>
- <jar jarfile="${jars.dir}/${ant.project.name}-${cascading.utils.release.version}.jar">
+ <jar jarfile="${jars.dir}/${ant.project.name}-${cascading.json.release.version}.jar">
<fileset dir="${build.classes}"/>
</jar>
</target>
<target name="clean">
<echo message="cleaning..."/>
- <delete file="${jars.dir}/${ant.project.name}-${cascading.utils.release.version}.jar" />
+ <delete file="${jars.dir}/${ant.project.name}-${cascading.jsoncascading.json.release.version}.jar" />
<delete dir="${build.classes}"/>
<delete dir="${build.classes}"/>
</target>
View
3 data/input1.json
@@ -1,4 +1,5 @@
{"name" : "Greg", "age" : 33, "address" : {"city": "Paris", "zipcode": "4321"}, "phones": [{"number": "123345", "type": "landline"}, {"number": "123346", "type": "mobile"}]}
{"name" : "John", "age" : 45, "address" : {"city": "New-York", "zipcode": "1234"}, "phones": [{"number": "342326", "type": "mobile"}]}
{"name" : "Bill", "age" : 23, "address" : {"city": "New-York", "zipcode": "abcd"}, "phones": [] }
-{"name" : "Mike", "age" : 45, "address" : {"city": "London", "zipcode": "4321"}, "phones": [{"number": "56446", "type": "landline"}, {"number": "41634273", "type": "landline"}, {"number": "6674472", "type": "mobile"}]}
+{"name" : "Mike", "age" : 45, "address" : {"city": "London", "zipcode": "4321"}, "phones": [{"number": "56446", "type": "landline"}, {"number": "41634273", "type": "landline"}, {"number": "6674472", "type": "mobile"}]}
+{"name" : "Max", "age" : 24, "address" : {"city": "New-York", "zipcode": "abcd"} }
View
2 .../java/cascading/utils/json/JSONUtils.java → src/main/java/cascading/json/JSONUtils.java
@@ -1,7 +1,7 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json;
+package cascading.json;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
View
2 ...va/cascading/utils/json/JSONWritable.java → ...ain/java/cascading/json/JSONWritable.java
@@ -1,7 +1,7 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json;
+package cascading.json;
import java.io.DataInput;
import java.io.DataOutput;
View
7 ...ding/utils/json/operation/JSONFilter.java → .../cascading/json/operation/JSONFilter.java
@@ -1,7 +1,7 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json.operation;
+package cascading.json.operation;
import net.sf.json.JSONObject;
import cascading.flow.FlowProcess;
@@ -14,7 +14,7 @@
* respect the configuration specified.
*
* @author <a href="mailto:gmarabout@gmail.com">Grégoire Marabout</a>
- * @see cascading.utils.json.operation.JSONFilterConfig
+ * @see cascading.json.operation.JSONFilterConfig
*/
public class JSONFilter extends JSONOperation implements Filter {
@@ -56,7 +56,6 @@ public static JSONFilter mustEqual(String path, Object value){
return new JSONFilter( new JSONFilterConfig.MustEqual( new String[]{ path }, new Object[]{ value } ) );
}
-
/**
* Factory method to create a filter that will exclude tuples
* <i>not</i> matching the specified specification.
@@ -85,7 +84,7 @@ public boolean isRemove(FlowProcess flowProcess, FilterCall filterCall){
else if(input instanceof JSONObject) {
jsonObj = (JSONObject) input;
} else {
- throw new RuntimeException("UNexpected object type: "+input.getClass());
+ throw new RuntimeException("Unexpected object type: "+input.getClass());
}
return isRemove( jsonObj );
}
View
2 ...tils/json/operation/JSONFilterConfig.java → ...ding/json/operation/JSONFilterConfig.java
@@ -1,4 +1,4 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
import net.sf.json.JSONObject;
View
6 ...ing/utils/json/operation/JSONFlatten.java → ...cascading/json/operation/JSONFlatten.java
@@ -1,17 +1,17 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
import java.util.Iterator;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import cascading.flow.FlowProcess;
+import cascading.json.JSONUtils;
+import cascading.json.JSONWritable;
import cascading.operation.Function;
import cascading.operation.FunctionCall;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
-import cascading.utils.json.JSONUtils;
-import cascading.utils.json.JSONWritable;
public class JSONFlatten extends JSONOperation implements Function {
View
4 ...g/utils/json/operation/JSONOperation.java → ...scading/json/operation/JSONOperation.java
@@ -1,14 +1,14 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json.operation;
+package cascading.json.operation;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
+import cascading.json.JSONWritable;
import cascading.operation.BaseOperation;
import cascading.tuple.Fields;
-import cascading.utils.json.JSONWritable;
/**
* @author <a href="mailto:gmarabout@gmail.com">Grégoire Marabout</a>
View
6 ...ding/utils/json/operation/JSONParser.java → .../cascading/json/operation/JSONParser.java
@@ -1,17 +1,17 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json.operation;
+package cascading.json.operation;
import net.sf.json.JSON;
import cascading.flow.FlowProcess;
+import cascading.json.JSONUtils;
+import cascading.json.JSONWritable;
import cascading.operation.BaseOperation;
import cascading.operation.Function;
import cascading.operation.FunctionCall;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
-import cascading.utils.json.JSONUtils;
-import cascading.utils.json.JSONWritable;
/**
* A class to parse a JSON string and outputs a JSON object.
View
2 ...tils/json/operation/JSONPathResolver.java → ...ding/json/operation/JSONPathResolver.java
@@ -1,7 +1,7 @@
/*
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json.operation;
+package cascading.json.operation;
import java.io.Serializable;
View
11 ...ng/utils/json/operation/JSONSplitter.java → ...ascading/json/operation/JSONSplitter.java
@@ -2,16 +2,17 @@
* Copyright 2009, Grégoire Marabout. All rights reserved.
*/
-package cascading.utils.json.operation;
+package cascading.json.operation;
import net.sf.json.JSON;
+import net.sf.json.JSONNull;
import cascading.flow.FlowProcess;
+import cascading.json.JSONUtils;
+import cascading.json.JSONWritable;
import cascading.operation.Function;
import cascading.operation.FunctionCall;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
-import cascading.utils.json.JSONUtils;
-import cascading.utils.json.JSONWritable;
/**
* @author <a href="mailto:gmarabout@gmail.com">Grégoire Marabout</a>
@@ -35,7 +36,11 @@ public void operate(FlowProcess flowProcess, FunctionCall functionCall){
if (value instanceof JSON) {
value = new JSONWritable((JSON) value);
}
+ else if (value == null) {
+ value = new JSONWritable(JSONNull.getInstance());
+ }
output.add( value );
+
}
functionCall.getOutputCollector().add( output );
}
View
4 ...ls/json/operation/JSONFilterTestCase.java → ...ng/json/operation/JSONFilterTestCase.java
@@ -1,6 +1,6 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
-import cascading.utils.json.operation.JSONFilter;
+import cascading.json.operation.JSONFilter;
import junit.framework.TestCase;
import net.sf.json.JSONObject;
View
4 ...s/json/operation/JSONFlattenTestCase.java → ...g/json/operation/JSONFlattenTestCase.java
@@ -1,8 +1,10 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
import junit.framework.TestCase;
import cascading.flow.Flow;
import cascading.flow.FlowConnector;
+import cascading.json.operation.JSONFlatten;
+import cascading.json.operation.JSONSplitter;
import cascading.operation.AssertionLevel;
import cascading.operation.assertion.AssertNotNull;
import cascading.pipe.Each;
View
6 ...json/operation/JSONOperationTestCase.java → ...json/operation/JSONOperationTestCase.java
@@ -1,7 +1,7 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
-import cascading.utils.json.operation.JSONOperation;
-import cascading.utils.json.operation.JSONPathResolver;
+import cascading.json.operation.JSONOperation;
+import cascading.json.operation.JSONPathResolver;
import junit.framework.TestCase;
import net.sf.json.JSONObject;
View
6 ...ls/json/operation/JSONParserTestCase.java → ...ng/json/operation/JSONParserTestCase.java
@@ -1,10 +1,9 @@
-package cascading.utils.json.operation;
+package cascading.json.operation;
import junit.framework.TestCase;
import cascading.flow.Flow;
import cascading.flow.FlowConnector;
import cascading.operation.AssertionLevel;
-import cascading.operation.Identity;
import cascading.operation.assertion.AssertNotNull;
import cascading.operation.assertion.AssertSizeEquals;
import cascading.pipe.CoGroup;
@@ -15,9 +14,6 @@
import cascading.tap.Hfs;
import cascading.tap.Tap;
import cascading.tuple.Fields;
-import cascading.tuple.TupleEntry;
-import cascading.utils.json.operation.JSONParser;
-import cascading.utils.json.operation.JSONSplitter;
public class JSONParserTestCase extends TestCase {
public void testJSONParsing() {
View
2 version.properties
@@ -1 +1 @@
-cascading.utils.release.version=0.0.2
+cascading.json.release.version=0.0.2

0 comments on commit 5213106

Please sign in to comment.
Something went wrong with that request. Please try again.