incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1215104 - in /incubator/lcf/branches/release-0.4-incubating-branch: ./ connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/
Date Fri, 16 Dec 2011 12:06:37 GMT
Author: kwright
Date: Fri Dec 16 12:06:36 2011
New Revision: 1215104

URL: http://svn.apache.org/viewvc?rev=1215104&view=rev
Log:
Pull up CONNECTORS-325 to release branch

Modified:
    incubator/lcf/branches/release-0.4-incubating-branch/   (props changed)
    incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/Constants.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentReader.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/NodeUtils.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/SearchUtils.java

Propchange: incubator/lcf/branches/release-0.4-incubating-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 16 12:06:36 2011
@@ -14,4 +14,4 @@
 /incubator/lcf/branches/CONNECTORS-290:1204836-1205502
 /incubator/lcf/branches/CONNECTORS-313:1213173-1214848
 /incubator/lcf/branches/CONNECTORS-32:1092556-1094216
-/incubator/lcf/trunk:1214045,1214707,1214850,1214893,1215025,1215091,1215096
+/incubator/lcf/trunk:1214045,1214707,1214850,1214893,1215025,1215091,1215096,1215099

Modified: incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt Fri Dec 16 12:06:36 2011
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 0.4-dev =====================
 
+CONNECTORS-325: Adeguate the content identifier with the Alfresco node reference
+(Piergiorgio Lucidi)
+
 CONNECTORS-326: Fix the ant image build target to not use build-dev.
 (Karl Wright)
 

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,6 @@
+/* $Id$ */
+
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Fri Dec 16 12:06:36 2011
@@ -1,4 +1,7 @@
+/* $Id$ */
+
 /**
+
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -149,7 +152,7 @@ public class AlfrescoRepositoryConnector
    */
   @Override
   public String[] getBinNames(String documentIdentifier) {
-    return new String[] { protocol+"://"+server+":"+port+path };
+    return new String[] { protocol+"://"+server+":"+port+"/"+path };
   }
 
   /** 
@@ -373,10 +376,11 @@ public class AlfrescoRepositoryConnector
       ResultSet resultSet = queryResult.getResultSet();
       ResultSetRow[] resultSetRows = resultSet.getRows();
       for (ResultSetRow resultSetRow : resultSetRows) {
-        activities.addSeedDocument(resultSetRow.getNode().getId());
+          NamedValue[] properties = resultSetRow.getColumns();
+          String nodeReference = PropertiesUtils.getNodeReference(properties);
+          activities.addSeedDocument(nodeReference);
+        }
       }
-    }
-
   }
 
   /** Get the maximum number of documents to amalgamate together into one batch, for this
connector.
@@ -805,15 +809,16 @@ public class AlfrescoRepositoryConnector
 
     while (i < documentIdentifiers.length) {
       long startTime = System.currentTimeMillis();
-      String nodeId = documentIdentifiers[i];
+      String nodeReference = documentIdentifiers[i];
+      String uuid = NodeUtils.getUuidFromNodeReference(nodeReference);
 
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("Alfresco: Processing document identifier '"
-            + nodeId + "'");
+            + nodeReference + "'");
 
       Reference reference = new Reference();
       reference.setStore(SearchUtils.STORE);
-      reference.setUuid(nodeId);
+      reference.setUuid(uuid);
 
       Predicate predicate = new Predicate();
       predicate.setStore(SearchUtils.STORE);
@@ -837,9 +842,9 @@ public class AlfrescoRepositoryConnector
         ResultSet resultSet = queryResult.getResultSet();
         ResultSetRow[] resultSetRows = resultSet.getRows();
         for (ResultSetRow resultSetRow : resultSetRows) {
-          String childNodeId = resultSetRow.getNode().getId();
-          activities.addDocumentReference(childNodeId, nodeId,
-              RELATIONSHIP_CHILD);
+          NamedValue[] childProperties = resultSetRow.getColumns();
+          String childNodeReference = PropertiesUtils.getNodeReference(childProperties);
+          activities.addDocumentReference(childNodeReference, nodeReference, RELATIONSHIP_CHILD);
         }
       } 
       
@@ -885,7 +890,7 @@ public class AlfrescoRepositoryConnector
           session = null;
           
           activities.recordActivity(new Long(startTime), ACTIVITY_READ,
-              fileLength, nodeId, errorCode, errorDesc, null);
+              fileLength, nodeReference, errorCode, errorDesc, null);
         }
         
       }
@@ -912,20 +917,24 @@ public class AlfrescoRepositoryConnector
     String[] rval = new String[documentIdentifiers.length];
     int i = 0;
     while (i < rval.length){
+      String nodeReference = documentIdentifiers[i];
+      String uuid = NodeUtils.getUuidFromNodeReference(nodeReference);
+      
       Reference reference = new Reference();
       reference.setStore(SearchUtils.STORE);
-      reference.setUuid(documentIdentifiers[i]);
+      reference.setUuid(uuid);
       
       Predicate predicate = new Predicate();
       predicate.setStore(SearchUtils.STORE);
       predicate.setNodes(new Reference[]{reference});
       
       Node node = NodeUtils.get(username, password, session, predicate);
-      boolean isDocument = ContentModelUtils.isDocument(node.getProperties());
+      NamedValue[] properties = node.getProperties();
+      boolean isDocument = ContentModelUtils.isDocument(properties);
       if(isDocument){
         boolean isVersioned = NodeUtils.isVersioned(node.getAspects());
         if(isVersioned){
-          rval[i] = NodeUtils.getVersionLabel(node.getProperties());
+          rval[i] = NodeUtils.getVersionLabel(properties);
         } else {
           //a document that doesn't contain versioning information will always be processed
           rval[i] = StringUtils.EMPTY;

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/Constants.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/Constants.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/Constants.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/Constants.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,6 @@
+/* $Id$ */
+
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
@@ -16,8 +19,12 @@
  */
 package org.apache.manifoldcf.crawler.connectors.alfresco;
 
+
 public class Constants extends org.alfresco.webservice.util.Constants {
   
   public static final String PROP_VERSION_LABEL = createQNameString(NAMESPACE_CONTENT_MODEL,
"versionLabel");
-  
+  public static final String PROP_NODE_UUID = createQNameString(NAMESPACE_SYSTEM_MODEL, "node-uuid");
+  public static final String PROP_STORE_PROTOCOL = createQNameString(NAMESPACE_SYSTEM_MODEL,
"store-protocol");
+  public static final String PROP_STORE_ID = createQNameString(NAMESPACE_SYSTEM_MODEL, "store-identifier");
+
 }

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,5 @@
+/* $Id$ */
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentReader.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentReader.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentReader.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentReader.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,5 @@
+/* $Id$ */
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/NodeUtils.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/NodeUtils.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/NodeUtils.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/NodeUtils.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,5 @@
+/* $Id$ */
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
@@ -28,8 +30,25 @@ import org.alfresco.webservice.util.WebS
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.crawler.system.Logging;
 
+/**
+ * 
+ * This is an utility class dedicated to the Alfresco Node Web Services API  
+ *
+ */
 public class NodeUtils {
+  
+  /** the splitter character to split the node reference */
+  private static final String NODE_REFERENCE_SPLIT = "/";
 
+  /**
+   * Retrieve a specific instance of a content required in the predicate object
+   * 
+   * @param username
+   * @param password
+   * @param session
+   * @param predicate
+   * @return the Node object instance of the current content
+   */
   public static Node get(String username, String password, AuthenticationDetails session,
Predicate predicate){
     Node[] resultNodes = null;
     try {
@@ -56,6 +75,11 @@ public class NodeUtils {
     }
   }
   
+  /**
+   * 
+   * @param aspects
+   * @return TRUE if the current node is versioned, otherwise FALSE
+   */
   public static boolean isVersioned(String[] aspects){
     for (String aspect : aspects) {
       if(Constants.ASPECT_VERSIONABLE.equals(aspect)){
@@ -65,6 +89,11 @@ public class NodeUtils {
     return false;
   }
   
+  /**
+   * 
+   * @param properties
+   * @return the version label for the current node
+   */
   public static String getVersionLabel(NamedValue[] properties){
     for (NamedValue property : properties) {
       if(property.getName().equals(Constants.PROP_VERSION_LABEL)){
@@ -74,4 +103,20 @@ public class NodeUtils {
     return StringUtils.EMPTY;
   }
   
+  /**
+   * Build the UUID starting from the Alfresco node reference
+   * @param nodeReference
+   * @return the UUID for the current node
+   */
+  public static String getUuidFromNodeReference(String nodeReference){
+    String uuid = StringUtils.EMPTY;
+    String[] nodeReferenceSplitted = StringUtils.split(nodeReference, NODE_REFERENCE_SPLIT);
+    if(nodeReferenceSplitted!=null
+        && nodeReferenceSplitted.length>2
+        && StringUtils.isNotEmpty(nodeReferenceSplitted[2])){
+      uuid = nodeReferenceSplitted[2];
+    }
+    return uuid;
+  }
+  
 }

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,5 @@
+/* $Id$ */
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
@@ -80,7 +82,35 @@ public class PropertiesUtils {
       }
     }
     return contentProperties;
-    
+  }
+  
+  /**
+   * Build the Alfresco node identifier
+   * @param properties
+   * @return the node reference for the current document
+   */
+  public static String getNodeReference(NamedValue[] properties){
+    String nodeReference = StringUtils.EMPTY;
+    String storeProtocol = StringUtils.EMPTY;
+    String storeId = StringUtils.EMPTY;
+    String uuid = StringUtils.EMPTY;
+    if(properties!=null){
+      for (NamedValue property : properties) {
+        if(Constants.PROP_STORE_PROTOCOL.equals(property.getName())){
+          storeProtocol = property.getValue();
+        } else if(Constants.PROP_STORE_ID.equals(property.getName())){
+          storeId = property.getValue();
+        } else if(Constants.PROP_NODE_UUID.equals(property.getName())){
+          uuid = property.getValue();
+        }
+      }
+    }
+    if(StringUtils.isNotEmpty(storeProtocol)
+        && StringUtils.isNotEmpty(storeId)
+        && StringUtils.isNotEmpty(uuid)) {
+      nodeReference = storeProtocol+"://"+storeId+"/"+uuid;
+    }
+    return nodeReference;
   }
   
 }

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/SearchUtils.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/SearchUtils.java?rev=1215104&r1=1215103&r2=1215104&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/SearchUtils.java
(original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/SearchUtils.java
Fri Dec 16 12:06:36 2011
@@ -1,3 +1,5 @@
+/* $Id$ */
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with



Mime
View raw message