manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1611521 - in /manifoldcf/trunk: CHANGES.txt connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Date Fri, 18 Jul 2014 00:49:50 GMT
Author: kwright
Date: Fri Jul 18 00:49:50 2014
New Revision: 1611521

URL: http://svn.apache.org/r1611521
Log:
Fix for CONNECTORS-994.

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

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1611521&r1=1611520&r2=1611521&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Fri Jul 18 00:49:50 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.7-dev =====================
 
+CONNECTORS-994: Make Alfresco connector pay attention to the
+scanOnly flag.
+(Prasad Perera, Karl Wright)
+
 CONNECTORS-997: Get CMIS connector working again.
 (Karl Wright)
 

Modified: manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1611521&r1=1611520&r2=1611521&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Fri Jul 18 00:49:50 2014
@@ -898,81 +898,82 @@ public class AlfrescoRepositoryConnector
       
       //a generic node in Alfresco could also have binaries content
       if (isDocument) {
-        // this is a content to ingest
-        InputStream is = null;
-        long fileLength = 0;
-        try {
-          //properties ingestion
-          RepositoryDocument rd = new RepositoryDocument();      
-          List<NamedValue> contentProperties = PropertiesUtils.getContentProperties(properties);
-          PropertiesUtils.ingestProperties(rd, properties, contentProperties);
+        if (!scanOnly[i]) {
+          // this is a content to ingest
+          InputStream is = null;
+          long fileLength = 0;
+          try {
+            //properties ingestion
+            RepositoryDocument rd = new RepositoryDocument();      
+            List<NamedValue> contentProperties = PropertiesUtils.getContentProperties(properties);
+            PropertiesUtils.ingestProperties(rd, properties, contentProperties);
 
-          // binaries ingestion - in Alfresco we could have more than one binary for each
node (custom content models)
-          for (NamedValue contentProperty : contentProperties) {
-            //we are ingesting all the binaries defined as d:content property in the Alfresco
content model
-            Content binary = ContentReader.read(endpoint, username, password, socketTimeout,
session, predicate, contentProperty.getName());
-            fileLength = binary.getLength();
-            is = ContentReader.getBinary(endpoint, binary, username, password, socketTimeout,
session);
-            rd.setBinary(is, fileLength);
-            
-            //id is the node reference only if the node has an unique content stream
-            //For a node with a single d:content property: id = node reference
-            String id = PropertiesUtils.getNodeReference(properties);
-            
-            //For a node with multiple d:content properties: id = node reference;QName
-            //The QName of a property of type d:content will be appended to the node reference
-            if(contentProperties.size()>1){
-              id = id + INGESTION_SEPARATOR_FOR_MULTI_BINARY + contentProperty.getName();
+            // binaries ingestion - in Alfresco we could have more than one binary for each
node (custom content models)
+            for (NamedValue contentProperty : contentProperties) {
+              //we are ingesting all the binaries defined as d:content property in the Alfresco
content model
+              Content binary = ContentReader.read(endpoint, username, password, socketTimeout,
session, predicate, contentProperty.getName());
+              fileLength = binary.getLength();
+              is = ContentReader.getBinary(endpoint, binary, username, password, socketTimeout,
session);
+              rd.setBinary(is, fileLength);
+              
+              //id is the node reference only if the node has an unique content stream
+              //For a node with a single d:content property: id = node reference
+              String id = PropertiesUtils.getNodeReference(properties);
+              
+              //For a node with multiple d:content properties: id = node reference;QName
+              //The QName of a property of type d:content will be appended to the node reference
+              if(contentProperties.size()>1){
+                id = id + INGESTION_SEPARATOR_FOR_MULTI_BINARY + contentProperty.getName();
+              }
+              
+              //version label
+              String version = PropertiesUtils.getVersionLabel(properties);
+              
+              //the document uri is related to the specific d:content property available
in the node
+              //we want to ingest each content stream that are nested in a single node
+              String documentURI = binary.getUrl();
+              activities.ingestDocumentWithException(id, version, documentURI, rd);
             }
             
-            //version label
-            String version = PropertiesUtils.getVersionLabel(properties);
+            AuthenticationUtils.endSession();
             
-            //the document uri is related to the specific d:content property available in
the node
-            //we want to ingest each content stream that are nested in a single node
-            String documentURI = binary.getUrl();
-            activities.ingestDocumentWithException(id, version, documentURI, rd);
-          }
-          
-          AuthenticationUtils.endSession();
-          
-        } catch (ParseException e) {
-          errorCode = "IO ERROR";
-          errorDesc = e.getMessage();
-          Logging.connectors.warn(
-              "Alfresco: Error during the reading process of dates: "
-                  + e.getMessage(), e);
-          handleParseException(e);
-        } catch (IOException e) {
-          Logging.connectors.warn(
-              "Alfresco: IOException: "
-                  + e.getMessage(), e);
-          handleIOException(e);
-        } finally {
-          try {
-            if(is!=null){
-              is.close();
-            }
-          } catch (InterruptedIOException e) {
-            errorCode = "Interrupted error";
-            errorDesc = e.getMessage();
-            throw new ManifoldCFException(e.getMessage(), e,
-                ManifoldCFException.INTERRUPTED);
-          } catch (IOException e) {
+          } catch (ParseException e) {
             errorCode = "IO ERROR";
             errorDesc = e.getMessage();
             Logging.connectors.warn(
-                "Alfresco: IOException closing file input stream: "
+                "Alfresco: Error during the reading process of dates: "
+                    + e.getMessage(), e);
+            handleParseException(e);
+          } catch (IOException e) {
+            Logging.connectors.warn(
+                "Alfresco: IOException: "
                     + e.getMessage(), e);
             handleIOException(e);
+          } finally {
+            try {
+              if(is!=null){
+                is.close();
+              }
+            } catch (InterruptedIOException e) {
+              errorCode = "Interrupted error";
+              errorDesc = e.getMessage();
+              throw new ManifoldCFException(e.getMessage(), e,
+                  ManifoldCFException.INTERRUPTED);
+            } catch (IOException e) {
+              errorCode = "IO ERROR";
+              errorDesc = e.getMessage();
+              Logging.connectors.warn(
+                  "Alfresco: IOException closing file input stream: "
+                      + e.getMessage(), e);
+              handleIOException(e);
+            }
+                      
+            session = null;
+            
+            activities.recordActivity(new Long(startTime), ACTIVITY_READ,
+                fileLength, nodeReference, errorCode, errorDesc, null);
           }
-                    
-          session = null;
-          
-          activities.recordActivity(new Long(startTime), ACTIVITY_READ,
-              fileLength, nodeReference, errorCode, errorDesc, null);
         }
-        
       }
       i++;
     }



Mime
View raw message