manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1452480 - /manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
Date Mon, 04 Mar 2013 20:18:32 GMT
Author: kwright
Date: Mon Mar  4 20:18:32 2013
New Revision: 1452480

URL: http://svn.apache.org/r1452480
Log:
Add modified date standard field value; part of CONNECTORS-657.

Modified:
    manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java

Modified: manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1452480&r1=1452479&r2=1452480&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
(original)
+++ manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
Mon Mar  4 20:18:32 2013
@@ -778,17 +778,8 @@ public class SharedDriveConnector extend
                       {
                         RepositoryDocument rd = new RepositoryDocument();
                         rd.setBinary(inputStream, tempFile.length());
-                        rd.setFileName(file.getName());
-                        String contentType = mapExtensionToMimeType(file.getName());
-                        if (contentType != null)
-                          rd.setMimeType(contentType);
-                        rd.addField("lastModified", new Date(file.lastModified()).toString());
-                        int index = 0;
-                        index = setDocumentSecurity(rd,version,index);
-                        index = setPathMetadata(rd,version,index);
-                        StringBuilder ingestURI = new StringBuilder();
-                        index = unpack(ingestURI,version,index,'+');
-                        activities.ingestDocument(documentIdentifier, version, ingestURI.toString(),
rd);
+                        
+                        indexDocument(activities,rd,file,documentIdentifier,version);
                       }
                       finally
                       {
@@ -835,17 +826,8 @@ public class SharedDriveConnector extend
                   {
                     RepositoryDocument rd = new RepositoryDocument();
                     rd.setBinary(inputStream, fileLength(file));
-                    rd.setFileName(file.getName());
-                    String contentType = mapExtensionToMimeType(file.getName());
-                    if (contentType != null)
-                      rd.setMimeType(contentType);
-                    rd.addField("lastModified", new Date(file.lastModified()).toString());
-                    int index = 0;
-                    index = setDocumentSecurity(rd,version,index);
-                    index = setPathMetadata(rd,version,index);
-                    StringBuilder ingestURI = new StringBuilder();
-                    index = unpack(ingestURI,version,index,'+');
-                    activities.ingestDocument(documentIdentifier, versions[i], ingestURI.toString(),
rd);
+                    
+                    indexDocument(activities,rd,file,documentIdentifier,version);
                   }
                   finally
                   {
@@ -983,6 +965,27 @@ public class SharedDriveConnector extend
 
   }
 
+  protected static void indexDocument(IProcessActivity activities, RepositoryDocument rd,
SmbFile file, String documentIdentifier, String version)
+    throws ManifoldCFException, ServiceInterruption, SmbException
+  {
+    String fileNameString = file.getName();
+    Date lastModifiedDate = new Date(file.lastModified());
+    String contentType = mapExtensionToMimeType(fileNameString);
+
+    rd.setFileName(fileNameString);
+    if (contentType != null)
+      rd.setMimeType(contentType);
+    rd.addField("lastModified", lastModifiedDate.toString());
+    rd.setModifiedDate(lastModifiedDate);
+
+    int index = 0;
+    index = setDocumentSecurity(rd,version,index);
+    index = setPathMetadata(rd,version,index);
+    StringBuilder ingestURI = new StringBuilder();
+    index = unpack(ingestURI,version,index,'+');
+    activities.ingestDocument(documentIdentifier, version, ingestURI.toString(), rd);
+  }
+
   /** Map an extension to a mime type */
   protected static String mapExtensionToMimeType(String fileName)
   {



Mime
View raw message