diff --git a/.classpath b/.classpath
index e2d9d4a17..e9f1fd119 100644
--- a/.classpath
+++ b/.classpath
@@ -8,7 +8,7 @@
-
+
@@ -70,20 +70,21 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/freebase/module/MOD-INF/libsrc/google-api-client-1.13.2-beta-sources.jar b/extensions/freebase/module/MOD-INF/libsrc/google-api-client-1.13.2-beta-sources.jar
deleted file mode 100644
index c82833329..000000000
Binary files a/extensions/freebase/module/MOD-INF/libsrc/google-api-client-1.13.2-beta-sources.jar and /dev/null differ
diff --git a/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java b/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java
index a805e9210..e7124a056 100644
--- a/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java
+++ b/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java
@@ -75,7 +75,7 @@ import com.google.api.client.http.HttpHeaders;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
-import com.google.api.client.json.jackson.JacksonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.freebase.Freebase;
import com.google.api.services.freebase.FreebaseRequestInitializer;
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-api-client-1.13.2-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-api-client-1.13.2-beta-sources.jar
deleted file mode 100644
index c82833329..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-api-client-1.13.2-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-api-services-fusiontables-v1-rev17-1.13.2-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-api-services-fusiontables-v1-rev17-1.13.2-beta-sources.jar
deleted file mode 100644
index b5a54736c..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-api-services-fusiontables-v1-rev17-1.13.2-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-http-client-1.13.1-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-http-client-1.13.1-beta-sources.jar
deleted file mode 100644
index 6377cbf92..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-http-client-1.13.1-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-http-client-jackson-1.13.1-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-http-client-jackson-1.13.1-beta-sources.jar
deleted file mode 100644
index a06710c27..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-http-client-jackson-1.13.1-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-1.13.1-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-1.13.1-beta-sources.jar
deleted file mode 100644
index f14e3a43f..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-1.13.1-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-servlet-1.13.1-beta-sources.jar b/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-servlet-1.13.1-beta-sources.jar
deleted file mode 100644
index 0af6258ba..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib-src/google-oauth-client-servlet-1.13.1-beta-sources.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/commons-logging-1.1.1.jar b/extensions/gdata/module/MOD-INF/lib/commons-logging-1.1.1.jar
new file mode 100644
index 000000000..1deef144c
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/commons-logging-1.1.1.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-client-1.13.2-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-api-client-1.13.2-beta.jar
deleted file mode 100644
index 2086bdcf3..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-api-client-1.13.2-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-client-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-api-client-1.20.0.jar
new file mode 100644
index 000000000..778aa0192
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-api-client-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-client-servlet-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-api-client-servlet-1.20.0.jar
new file mode 100644
index 000000000..d3389c132
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-api-client-servlet-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-services-drive-v2-rev168-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-api-services-drive-v2-rev168-1.20.0.jar
new file mode 100644
index 000000000..79ff52bb3
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-api-services-drive-v2-rev168-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v1-rev17-1.13.2-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v1-rev17-1.13.2-beta.jar
deleted file mode 100644
index 803f758c0..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v1-rev17-1.13.2-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v2-rev3-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v2-rev3-1.20.0.jar
new file mode 100644
index 000000000..5ef00235d
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-api-services-fusiontables-v2-rev3-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-http-client-1.13.1-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-http-client-1.13.1-beta.jar
deleted file mode 100644
index a36330873..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-http-client-1.13.1-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-http-client-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-http-client-1.20.0.jar
new file mode 100644
index 000000000..82887fb3e
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-http-client-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson-1.13.1-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson-1.13.1-beta.jar
deleted file mode 100644
index 8d38f7710..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson-1.13.1-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson2-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson2-1.20.0.jar
new file mode 100644
index 000000000..674aea920
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-http-client-jackson2-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.13.1-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.13.1-beta.jar
deleted file mode 100644
index 9faf0614c..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.13.1-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.20.0.jar
new file mode 100644
index 000000000..417dc5152
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.13.1-beta.jar b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.13.1-beta.jar
deleted file mode 100644
index 9970472a2..000000000
Binary files a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.13.1-beta.jar and /dev/null differ
diff --git a/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.20.0.jar b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.20.0.jar
new file mode 100644
index 000000000..d444049ca
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/google-oauth-client-servlet-1.20.0.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/httpclient-4.0.1.jar b/extensions/gdata/module/MOD-INF/lib/httpclient-4.0.1.jar
new file mode 100644
index 000000000..ad32285ab
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/httpclient-4.0.1.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/httpcore-4.0.1.jar b/extensions/gdata/module/MOD-INF/lib/httpcore-4.0.1.jar
new file mode 100644
index 000000000..4aef35e2f
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/httpcore-4.0.1.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/jackson-core-2.1.3.jar b/extensions/gdata/module/MOD-INF/lib/jackson-core-2.1.3.jar
new file mode 100644
index 000000000..f47619f41
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/jackson-core-2.1.3.jar differ
diff --git a/extensions/gdata/module/MOD-INF/lib/transaction-api-1.1.jar b/extensions/gdata/module/MOD-INF/lib/transaction-api-1.1.jar
new file mode 100644
index 000000000..7736ec9f0
Binary files /dev/null and b/extensions/gdata/module/MOD-INF/lib/transaction-api-1.1.jar differ
diff --git a/extensions/gdata/src/com/google/refine/extension/gdata/GDataExtension.java b/extensions/gdata/src/com/google/refine/extension/gdata/GDataExtension.java
index 3a5dcafdf..62aa91d32 100644
--- a/extensions/gdata/src/com/google/refine/extension/gdata/GDataExtension.java
+++ b/extensions/gdata/src/com/google/refine/extension/gdata/GDataExtension.java
@@ -38,11 +38,13 @@ import javax.servlet.http.HttpServletRequest;
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
+import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
-import com.google.api.client.json.jackson.JacksonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.services.drive.Drive;
import com.google.gdata.client.docs.DocsService;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
@@ -75,7 +77,7 @@ abstract public class GDataExtension {
CLIENT_ID,
authorizedUrl, // execution continues at authorized on redirect
Arrays.asList("https://www.googleapis.com/auth/fusiontables",
- "https://docs.google.com/feeds", // create new spreadsheets
+ "https://www.googleapis.com/auth/drive", // create new spreadsheets
"https://spreadsheets.google.com/feeds"));
return url.toString();
@@ -140,6 +142,12 @@ abstract public class GDataExtension {
return service;
}
+ static public Drive getDriveService(String token) {
+ GoogleCredential credential = new GoogleCredential().setAccessToken(token);
+ return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
+ .setApplicationName(SERVICE_APP_NAME).build();
+ }
+
static boolean isSpreadsheetURL(String url) {
// e.g. http://spreadsheets.google.com/ccc?key=tI36b9Fxk1lFBS83iR_3XQA&hl=en
// TODO: The following should work, but the GData implementation is too limited
diff --git a/extensions/gdata/src/com/google/refine/extension/gdata/UploadCommand.java b/extensions/gdata/src/com/google/refine/extension/gdata/UploadCommand.java
index 808c1af04..e81def7ea 100644
--- a/extensions/gdata/src/com/google/refine/extension/gdata/UploadCommand.java
+++ b/extensions/gdata/src/com/google/refine/extension/gdata/UploadCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010,2011 Thomas F. Morris
+ * Copyright (c) 2010,2011,2015 Thomas F. Morris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,8 @@ import org.json.JSONWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gdata.client.docs.DocsService;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.model.File;
import com.google.gdata.client.spreadsheet.CellQuery;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.Link;
@@ -54,10 +55,11 @@ import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.batch.BatchOperationType;
import com.google.gdata.data.batch.BatchStatus;
import com.google.gdata.data.batch.BatchUtils;
-import com.google.gdata.data.docs.SpreadsheetEntry;
import com.google.gdata.data.spreadsheet.Cell;
import com.google.gdata.data.spreadsheet.CellEntry;
import com.google.gdata.data.spreadsheet.CellFeed;
+import com.google.gdata.data.spreadsheet.SpreadsheetEntry;
+import com.google.gdata.data.spreadsheet.SpreadsheetFeed;
import com.google.gdata.data.spreadsheet.WorksheetEntry;
import com.google.gdata.util.ServiceException;
@@ -72,6 +74,7 @@ import com.google.refine.model.Project;
public class UploadCommand extends Command {
static final Logger logger = LoggerFactory.getLogger("gdata_upload");
+ private static final String SPREADSHEET_FEED = "https://spreadsheets.google.com/feeds/spreadsheets/private/full";
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
@@ -145,16 +148,34 @@ public class UploadCommand extends Command {
final Project project, final Engine engine, final Properties params,
String token, String name, List exceptions) {
- DocsService docsService = GDataExtension.getDocsService(token);
+ Drive driveService = GDataExtension.getDriveService(token);
final SpreadsheetService spreadsheetService = GDataExtension.getSpreadsheetService(token);
try {
- SpreadsheetEntry spreadsheetEntry = new SpreadsheetEntry();
- spreadsheetEntry.setTitle(new PlainTextConstruct(name));
-
- final SpreadsheetEntry spreadsheetEntry2 = docsService.insert(
- new URL("https://docs.google.com/feeds/default/private/full/"), spreadsheetEntry);
+ File body = new File();
+ body.setTitle(name);
+ body.setDescription("Spreadsheet uploaded from OpenRefine project: " + name);
+ body.setMimeType("application/vnd.google-apps.spreadsheet");
+
+ File file = driveService.files().insert(body).execute();
+ String fileID = file.getId();
+
+ // Iterate through all spreadsheets to find one with our ID
+ SpreadsheetEntry spreadsheetEntry2 = null;
+ SpreadsheetFeed feed = spreadsheetService.getFeed(new URL(SPREADSHEET_FEED), SpreadsheetFeed.class);
+ List spreadsheets = feed.getEntries();
+ for (com.google.gdata.data.spreadsheet.SpreadsheetEntry spreadsheet : spreadsheets) {
+ if (spreadsheet.getId().endsWith(fileID)) {
+ spreadsheetEntry2 = spreadsheet;
+ }
+ }
+ // Bail if we didn't find our spreadsheet (shouldn't happen)
+ if (spreadsheetEntry2 == null) {
+ logger.error("Failed to find match for ID: " + fileID);
+ return null;
+ }
+
int[] size = CustomizableTabularExporterUtilities.countColumnsRows(
project, engine, params);
@@ -167,15 +188,16 @@ public class UploadCommand extends Command {
spreadsheetEntry2.getDefaultWorksheet().delete();
+ final SpreadsheetEntry spreadsheetEntry3 = spreadsheetEntry2;
new Thread() {
@Override
public void run() {
- spreadsheetService.setProtocolVersion(SpreadsheetService.Versions.V1);
+ spreadsheetService.setProtocolVersion(SpreadsheetService.Versions.V3);
try {
uploadToCellFeed(
project, engine, params,
spreadsheetService,
- spreadsheetEntry2,
+ spreadsheetEntry3,
worksheetEntry2);
} catch (Exception e) {
logger.error("Error uploading data to Google Spreadsheets", e);
@@ -183,12 +205,8 @@ public class UploadCommand extends Command {
}
}.start();
- return spreadsheetEntry2.getDocumentLink().getHref();
- } catch (MalformedURLException e) {
- exceptions.add(e);
- } catch (IOException e) {
- exceptions.add(e);
- } catch (ServiceException e) {
+ return spreadsheetEntry2.getSpreadsheetLink().getHref();
+ } catch (IOException | ServiceException e) {
exceptions.add(e);
}
return null;