manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1489010 - in /manifoldcf/trunk: CHANGES.txt connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Date Mon, 03 Jun 2013 14:45:48 GMT
Author: kwright
Date: Mon Jun  3 14:45:47 2013
New Revision: 1489010

URL: http://svn.apache.org/r1489010
Log:
Fix for CONNECTORS-698.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1489010&r1=1489009&r2=1489010&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Jun  3 14:45:47 2013
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-698: Add various required metadata values to the
+GoogleDrive connector.
+(Karl Wright)
+
 CONNECTORS-693: Support for gzip and deflate encoding for web
 connector.
 (Maciej Li¿ewski, Karl Wright)

Modified: manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java?rev=1489010&r1=1489009&r2=1489010&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Mon Jun  3 14:45:47 2013
@@ -29,6 +29,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Date;
 import org.apache.manifoldcf.crawler.system.Logging;
 import org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
@@ -45,13 +46,13 @@ import org.apache.manifoldcf.crawler.int
 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.util.DateTime;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.util.Map.Entry;
 import java.security.GeneralSecurityException;
-
 /**
  *
  * @author andrew
@@ -977,6 +978,25 @@ public class GoogleDriveRepositoryConnec
           //otherwise process
           RepositoryDocument rd = new RepositoryDocument();
 
+          String mimeType = googleFile.getMimeType();
+          DateTime createdDate = googleFile.getCreatedDate();
+          DateTime modifiedDate = googleFile.getModifiedDate();
+          String extension = googleFile.getFileExtension();
+          String title = googleFile.getTitle();
+          
+          if (mimeType != null)
+            rd.setMimeType(mimeType);
+          if (createdDate != null)
+            rd.setCreatedDate(new Date(createdDate.getValue()));
+          if (modifiedDate != null)
+            rd.setModifiedDate(new Date(modifiedDate.getValue()));
+          if (extension != null)
+          {
+            if (title == null)
+              title = "";
+            rd.setFileName(title + "." + extension);
+          }
+
           for (Entry<String, Object> entry : googleFile.entrySet()) {
             rd.addField(entry.getKey(), entry.getValue().toString());
           }



Mime
View raw message