incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shinich...@apache.org
Subject svn commit: r1302268 - in /incubator/lcf/trunk: ./ connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/ connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/ connecto...
Date Mon, 19 Mar 2012 03:52:26 GMT
Author: shinichiro
Date: Mon Mar 19 03:52:26 2012
New Revision: 1302268

URL: http://svn.apache.org/viewvc?rev=1302268&view=rev
Log:
Fix for CONNECTORS-424

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/FileConnector.java
    incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
    incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
    incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1302268&r1=1302267&r2=1302268&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Mon Mar 19 03:52:26 2012
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 0.5-dev =====================
 
+CONNECTORS-424: Add RepositoryDocument.getFileName for posting file
+name as metadata.
+(Shinichiro Abe)
+
 CONNECTORS-427: The default value for "include only host matching seeds"
 should be yes/checked
 (Erlend GarĂ¥sen)

Modified: incubator/lcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/FileConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/FileConnector.java?rev=1302268&r1=1302267&r2=1302268&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/FileConnector.java
(original)
+++ incubator/lcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/FileConnector.java
Mon Mar 19 03:52:26 2012
@@ -278,6 +278,7 @@ public class FileConnector extends org.a
                     long fileBytes = file.length();
                     RepositoryDocument data = new RepositoryDocument();
                     data.setBinary(is,fileBytes);
+                    data.setFileName(file.getName());
                     data.addField("uri",file.toString());
                     // MHL for other metadata
                     activities.ingestDocument(documentIdentifier,version,convertToURI(documentIdentifier),data);

Modified: incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1302268&r1=1302267&r2=1302268&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
(original)
+++ incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
Mon Mar 19 03:52:26 2012
@@ -771,6 +771,7 @@ public class SharedDriveConnector extend
                       {
                         RepositoryDocument rd = new RepositoryDocument();
                         rd.setBinary(inputStream, tempFile.length());
+                        rd.setFileName(file.getName());
                         int index = 0;
                         index = setDocumentSecurity(rd,version,index);
                         index = setPathMetadata(rd,version,index);
@@ -823,6 +824,7 @@ public class SharedDriveConnector extend
                   {
                     RepositoryDocument rd = new RepositoryDocument();
                     rd.setBinary(inputStream, fileLength(file));
+                    rd.setFileName(file.getName());
                     int index = 0;
                     index = setDocumentSecurity(rd,version,index);
                     index = setPathMetadata(rd,version,index);

Modified: incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java?rev=1302268&r1=1302267&r2=1302268&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
(original)
+++ incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
Mon Mar 19 03:52:26 2012
@@ -899,7 +899,7 @@ public class HttpPoster
     if (fileName != null)
       value += "; filename=\""+fileName+"\"";
     value += "\r\n";
-    byte[] tmp = value.getBytes("ASCII");
+    byte[] tmp = value.getBytes("UTF-8");
     rval += tmp.length;
     tmp = ("Content-Type: "+contentType+"\r\n\r\n").getBytes("ASCII");
     rval += tmp.length;
@@ -962,7 +962,7 @@ public class HttpPoster
     if (fileName != null)
       value += "; filename=\""+fileName+"\"";
     value += "\r\n";
-    byte[] tmp = value.getBytes("ASCII");
+    byte[] tmp = value.getBytes("UTF-8");
     out.write(tmp, 0, tmp.length);
     tmp = ("Content-Type: "+contentType+"\r\n\r\n").getBytes("ASCII");
     out.write(tmp, 0, tmp.length);
@@ -1147,7 +1147,7 @@ public class HttpPoster
                   totalLength += lengthField(COMMITWITHIN_METADATA,commitWithin);
                 // Count the binary data
                 totalLength += lengthPreamble();
-                totalLength += lengthBoundary("application/octet-stream","myfile","docname");
+                totalLength += lengthBoundary("application/octet-stream","myfile",document.getFileName());
                 totalLength += length;
                 // Count the postamble
                 totalLength += lengthPostamble();
@@ -1217,7 +1217,7 @@ public class HttpPoster
                 // Write the content
                 writePreamble(out);
 
-                writeBoundary(out,"application/octet-stream","myfile","docname");
+                writeBoundary(out,"application/octet-stream","myfile",document.getFileName());
 
                 // Stream the data
                 long total = 0;

Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java?rev=1302268&r1=1302267&r2=1302268&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java
(original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java
Mon Mar 19 03:52:26 2012
@@ -44,7 +44,8 @@ public class RepositoryDocument
   protected Security fileSecurity = new Security();
   protected Security shareSecurity = new Security();
   protected List<Security> directorySecurity = new ArrayList<Security>();
-
+  protected String fileName = "docname";
+  
   /** Constructor.
   */
   public RepositoryDocument()
@@ -158,6 +159,22 @@ public class RepositoryDocument
   {
     return binaryFieldData;
   }
+  
+  /** Set the file name.
+   *@param fileName is the file name.
+   */
+   public void setFileName(String fileName)
+   {
+     this.fileName = fileName;
+   }
+
+   /** Get the file Name.
+   *@return the string of file name.
+   */
+   public String getFileName()
+   {
+     return fileName;
+   }
 
   /** Get the binary length.
   *@return the length in bytes.



Mime
View raw message