manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1618568 - in /manifoldcf/branches/release-1.7-branch: ./ connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/ connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/
Date Mon, 18 Aug 2014 09:49:35 GMT
Author: kwright
Date: Mon Aug 18 09:49:35 2014
New Revision: 1618568

URL: http://svn.apache.org/r1618568
Log:
Pull up fix for CONNECTORS-1009 from trunk.

Modified:
    manifoldcf/branches/release-1.7-branch/   (props changed)
    manifoldcf/branches/release-1.7-branch/CHANGES.txt
    manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
    manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java

Propchange: manifoldcf/branches/release-1.7-branch/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1618364

Modified: manifoldcf/branches/release-1.7-branch/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/CHANGES.txt?rev=1618568&r1=1618567&r2=1618568&view=diff
==============================================================================
--- manifoldcf/branches/release-1.7-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-1.7-branch/CHANGES.txt Mon Aug 18 09:49:35 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= Release 1.7 =====================
 
+CONNECTORS-1009: Fix CMIS connector again, to handle typical case
+where a new version is a new node.
+(Karl Wright)
+
 CONNECTORS-1010: Use uri hash instead of full URI as lock key
 to prevent "file name too long" errors on windows.
 (Erlend Garåsen, Shigeki Kobayashi, Karl Wright)

Modified: manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1618568&r1=1618567&r2=1618568&view=diff
==============================================================================
--- manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
(original)
+++ manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Mon Aug 18 09:49:35 2014
@@ -1112,15 +1112,19 @@ public class CmisRepositoryConnector ext
           // content ingestion
 
           Document document = (Document) cmisObject;
+          long fileLength;
+          InputStream is;
           try {
-            document = document.getObjectOfLatestVersion(false);
+            fileLength = document.getContentStreamLength();
+            if (fileLength > 0)
+              is = document.getContentStream().getStream();
+            else
+              is = null;
           } catch (CmisObjectNotFoundException e) {
             // Document gone
             activities.deleteDocument(nodeId);
             continue;
           }
-          long fileLength = document.getContentStreamLength();
-          InputStream is = null;
           
           try {
             RepositoryDocument rd = new RepositoryDocument();
@@ -1133,8 +1137,7 @@ public class CmisRepositoryConnector ext
             rd.setModifiedDate(modifiedDate);
             
             //binary
-            if(fileLength>0 && document.getContentStream()!=null){
-              is = document.getContentStream().getStream();
+            if(is != null) {
               rd.setBinary(is, fileLength);
             } else {
               rd.setBinary(new NullInputStream(0),0);
@@ -1316,33 +1319,42 @@ public class CmisRepositoryConnector ext
 
     String[] rval = new String[documentIdentifiers.length];
     for (int i = 0; i < rval.length; i++) {
+      //System.out.println("Get document versions: "+documentIdentifiers[i]);
       CmisObject cmisObject;
       try {
         cmisObject = session.getObject(documentIdentifiers[i]);
       } catch (CmisObjectNotFoundException e) {
+        cmisObject = null;
+      }
+
+      if (cmisObject == null) {
+        //System.out.println(" doesn't exist");
         rval[i] = null;
         continue;
       }
-
+      
       if (cmisObject.getBaseType().getId().equals(CMIS_DOCUMENT_BASE_TYPE)) {
         Document document = (Document) cmisObject;
 
-        //we have to check if this CMIS repository support versioning
-        // or if the versioning is disabled for this content
+        // Since documents that are not current have different node id's, we can return a
constant version,
+        // EXCEPT when the document is not the current one (in which case we delete)
+        boolean isCurrentVersion;
         try {
-          document = document.getObjectOfLatestVersion(false);
+          Document d = document.getObjectOfLatestVersion(false);
+          isCurrentVersion = d.getId().equals(documentIdentifiers[i]);
         } catch (CmisObjectNotFoundException e) {
-          rval[i] = null;
-          continue;
+          isCurrentVersion = false;
         }
-        if(StringUtils.isNotEmpty(document.getVersionLabel())){
-          rval[i] = document.getVersionLabel() + ":" + cmisQuery;
+        if (isCurrentVersion) {
+          //System.out.println(" is latest version");
+          rval[i] = documentIdentifiers[i] + ":" + cmisQuery;
         } else {
-        //a CMIS document that doesn't contain versioning information will always be processed
-          rval[i] = StringUtils.EMPTY;
+          //System.out.println(" is NOT latest vrersion");
+          rval[i] = null;
         }
       } else {
         //a CMIS folder will always be processed
+        //System.out.println(" is folder");
         rval[i] = StringUtils.EMPTY;
       }
     }

Modified: manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java?rev=1618568&r1=1618567&r2=1618568&view=diff
==============================================================================
--- manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
(original)
+++ manifoldcf/branches/release-1.7-branch/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
Mon Aug 18 09:49:35 2014
@@ -417,7 +417,7 @@ public class APISanityDerbyIT extends Ba
       
       // We also need to make sure the new document was indexed.  Have to think about how
to do this though.
       // MHL
-      
+      //System.out.println("Starting delete...");
       // Delete a file, and recrawl
       removeDocument(cmisClientSession, "testdata2.txt");
       



Mime
View raw message