Skip to content

Commit

Permalink
Repackage gson to a private package name.
Browse files Browse the repository at this point in the history
Avoids namespace collision in MapR 3.x.
  • Loading branch information
tomkraljevic committed Sep 15, 2014
1 parent fd472f7 commit 4ee7aad
Show file tree
Hide file tree
Showing 62 changed files with 112 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cookbook.groupedaverage;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.Key;
import water.Request2;
import water.UKV;
Expand Down
12 changes: 6 additions & 6 deletions h2o-samples/src/main/java/samples/expert/WebAPI.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package samples.expert;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonWriter;
import dontweave.gson.Gson;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;
import dontweave.gson.JsonParser;
import dontweave.gson.internal.Streams;
import dontweave.gson.stream.JsonWriter;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
Expand Down
24 changes: 24 additions & 0 deletions lib/gson/README_H2O.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

We embed gson 2.3 into h2o and change the package name to avoid colliding with other software.
In particular, MapR 3.x has an ancient version of gson it includes in the classpath.


Steps:

Get gson sources into a fresh directory.
mkdir Gson23
cd Gson23
mkdir -p src/main/java
jar .../gson-2.3-sources.jar
mv com src/main/java
Import from sources into IDEA.
Use IDEA refactor 'move' step to move com.google.gson to dontweave.gson.
Project settings --> add Artifact jar file.
Build jar (make sure target is 1.6 language level).

cp -p out/artifacts/main_jar/gson-2.3.jar ~/0xdata/ws/h2o/lib/gson
cd to h2o directory
sed -i.sedbak 's/com.google.gson/dontweave.gson/g' `cat list_of_files`
rm `find . -name '*sedbak'`
make

Binary file modified lib/gson/gson-2.3.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/main/java/hex/ConfusionMatrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static water.api.DocGen.FieldDoc;
import static water.util.Utils.printConfusionMatrix;
import com.google.gson.JsonArray;
import com.google.gson.JsonPrimitive;
import dontweave.gson.JsonArray;
import dontweave.gson.JsonPrimitive;
import water.Iced;
import water.api.Request.API;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hex/glm/GLM2.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hex.glm;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import hex.FrameTask.DataInfo;
import hex.GridSearch.GridSearchProgress;
import hex.glm.GLMModel.GLMXValidationTask;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hex/glm/LSMSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import water.Key;
import water.MemoryManager;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;


/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hex/singlenoderf/SpeeDRFModel.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hex.singlenoderf;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import dontweave.gson.JsonArray;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;
import dontweave.gson.JsonPrimitive;
import hex.ConfusionMatrix;
import hex.VarImp;
import hex.gbm.DTree;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/External.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import water.util.Log;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

/**
* Expose internal H2O API calls to the External World
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/ExternalInterface.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import java.io.InputStream;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/InternalInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import water.api.Cloud;
import water.util.Log;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class InternalInterface implements water.ExternalInterface {
@Override public Key makeKey( String key_name ) { return Key.make(key_name); }
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import water.util.*;
import water.util.Utils.ExpectedExceptionForDebug;

import com.google.gson.*;
import dontweave.gson.*;

public abstract class Job extends Func {
static final int API_WEAVER = 1; // This file has auto-gen'd doc & json fields
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/water/ModelMetrics.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package water;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import dontweave.gson.JsonObject;
import dontweave.gson.JsonParser;
import water.Model.ModelCategory;
import water.api.AUCData;
import water.api.ConfusionMatrix;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/water/Request2.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package water;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;
import dontweave.gson.JsonParser;
import hex.GridSearch;
import water.api.DocGen;
import water.api.Request;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/water/UniqueFrameId.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package water;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import dontweave.gson.JsonObject;
import dontweave.gson.JsonParser;
import org.apache.commons.codec.binary.Hex;

import water.api.DocGen;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/UniqueId.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.api.DocGen;
import water.api.Request.API;
import water.api.Request.Default;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Cancel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import water.Key;
import water.util.RString;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class Cancel extends Request {
// TODO use ExistingJobKey (check other places)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Cloud.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.*;
import dontweave.gson.*;
import water.*;
import water.util.Log;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/ExportHdfs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import water.persist.PersistHdfs;
import water.util.Log;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class ExportHdfs extends Request {
protected final H2OExistingKey _source = new H2OExistingKey(SOURCE_KEY);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Frames.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.*;
import dontweave.gson.*;
import org.apache.commons.math3.util.Pair;
import water.*;
import water.api.Models.ModelSummary;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Get.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import java.util.Properties;
import water.*;
import water.util.Log;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/HTMLOnlyRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import water.NanoHTTPD;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

/** Request that only supports browser (html, query, help, wiki) request types.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/IOStatus.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.*;
import dontweave.gson.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/water/api/ImportHdfs.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import water.persist.PersistHdfs;
import water.util.Log;

import com.google.gson.*;
import com.google.gson.internal.Streams;
import dontweave.gson.*;
import dontweave.gson.internal.Streams;

public class ImportHdfs extends Request {
public class PathArg extends TypeaheadInputText<String> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/ImportS3.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.google.gson.*;
import dontweave.gson.*;
import water.util.Log;

public class ImportS3 extends Request {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/JSONOnlyRequest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import java.util.Properties;
import water.NanoHTTPD;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/water/api/Jobs.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package water.api;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import dontweave.gson.JsonArray;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;
import water.DKV;
import water.Job;
import water.Job.JobState;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/LogAndEcho.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.util.Log;

public class LogAndEcho extends Request {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/water/api/LogView.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import water.util.*;
import water.util.Log.LogStr;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import dontweave.gson.JsonArray;
import dontweave.gson.JsonObject;

public class LogView extends Request {
@Override protected Response serve() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/ModelMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.*;

import com.google.gson.*;
import dontweave.gson.*;

import water.DKV;
import water.Key;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/water/api/Models.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package water.api;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import dontweave.gson.Gson;
import dontweave.gson.GsonBuilder;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;
import hex.VarImp;
import hex.deeplearning.DeepLearning;
import hex.drf.DRF;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Parse.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/PutValue.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.Key;
import water.UKV;
import water.Value;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Remove.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import water.UKV;
import water.Value;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class Remove extends Request {
@Override public RequestServer.API_VERSION[] supportedVersions() { return SUPPORTS_V1_V2; }
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/RemoveAck.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import water.Value;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class RemoveAck extends Request {
protected final H2OExistingKey _key = new H2OExistingKey(KEY);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/RemoveAll.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.Job;
import water.util.Log;
import water.util.RemoveAllKeysTask;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import water.util.*;

import com.google.common.io.ByteStreams;
import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public abstract class Request extends RequestBuilders {
@Retention(RetentionPolicy.RUNTIME)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/RequestArguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;
import water.*;
import water.Request2.TypeaheadKey;
import water.api.Request.Filter;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/RequestBuilders.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package water.api;

import com.google.gson.*;
import dontweave.gson.*;
import water.AutoBuffer;
import water.H2O;
import water.Iced;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/water/api/RequestStatics.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import water.util.Log;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import dontweave.gson.JsonElement;
import dontweave.gson.JsonObject;

/** All statics for the Request api.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/Shutdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import water.H2O;
import water.UDPRebooted;

import com.google.gson.JsonObject;
import dontweave.gson.JsonObject;

public class Shutdown extends Request {

Expand Down
Loading

0 comments on commit 4ee7aad

Please sign in to comment.