Author: kwright
Date: Wed Sep 17 01:09:24 2014
New Revision: 1625446
URL: http://svn.apache.org/r1625446
Log:
Pull up fix for CONNECTORS-1006 from dev_1x branch
Modified:
manifoldcf/branches/release-1.7-branch/ (props changed)
manifoldcf/branches/release-1.7-branch/CHANGES.txt
manifoldcf/branches/release-1.7-branch/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Propchange: manifoldcf/branches/release-1.7-branch/
------------------------------------------------------------------------------
Merged /manifoldcf/branches/dev_1x:r1620813
Merged /manifoldcf/trunk:r1620812
Modified: manifoldcf/branches/release-1.7-branch/CHANGES.txt
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/CHANGES.txt?rev=1625446&r1=1625445&r2=1625446&view=diff
==============================================================================
--- manifoldcf/branches/release-1.7-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-1.7-branch/CHANGES.txt Wed Sep 17 01:09:24 2014
@@ -8,6 +8,10 @@ CONNECTORS-1031: Fix Zookeeper synchroni
against short tick time settings.
(Karl Wright)
+CONNECTORS-1006: Extend GoogleDrive connector to capture
+Google native spreadsheets.
+(Shigeki Kabayashi)
+
CONNECTORS-1015: Add minimum file size to Allowed Documents
transformation filter.
(David Morana, Karl Wright)
Modified:
manifoldcf/branches/release-1.7-branch/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java?rev=1625446&r1=1625445&r2=1625446&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Wed Sep 17 01:09:24 2014
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Date;
import java.util.Set;
import java.util.Iterator;
+
import org.apache.manifoldcf.crawler.system.Logging;
import org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector;
import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
@@ -49,8 +50,11 @@ import org.apache.manifoldcf.crawler.int
import org.apache.manifoldcf.crawler.interfaces.IProcessActivity;
import org.apache.manifoldcf.crawler.interfaces.ISeedingActivity;
import org.apache.log4j.Logger;
+
import com.google.api.services.drive.model.File;
+import com.google.api.client.repackaged.com.google.common.base.Objects;
import com.google.api.client.util.DateTime;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
@@ -1067,11 +1071,16 @@ public class GoogleDriveRepositoryConnec
Logging.connectors.debug("GOOGLEDRIVE: its a file");
}
- // We always direct to the PDF
- String documentURI = getUrl(googleFile, "application/pdf");
+ // We always direct to the PDF except for Spreadsheets
+ String documentURI = null;
+ if
(!googleFile.getMimeType().equals("application/vnd.google-apps.spreadsheet")) {
+ documentURI = getUrl(googleFile, "application/pdf");
+ } else {
+ documentURI = getUrl(googleFile,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ }
// Get the file length
- Long fileLength = googleFile.getFileSize();
+ Long fileLength = Objects.firstNonNull(googleFile.getFileSize(),
0L);
if (fileLength != null) {
// Unpack the version string