incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1226128 - in /incubator/lcf/trunk: ./ connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/
Date Sat, 31 Dec 2011 16:30:14 GMT
Author: piergiorgio
Date: Sat Dec 31 16:30:14 2011
New Revision: 1226128

URL: http://svn.apache.org/viewvc?rev=1226128&view=rev
Log:
- added explicit support for Multi-Tenancy in the job configuration (CONNECTORS-328)
- content binary is not correctly read (CONNECTORS-349)

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration_en_US.html
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration_en_US.html

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Sat Dec 31 16:30:14 2011
@@ -3,6 +3,12 @@ $Id$
 
 ======================= 0.5-dev =====================
 
+CONNECTORS-328: added explicit support for Multi-Tenancy in the job configuration
+(Piergiorgio Lucidi)
+
+CONNECTORS-349: content binary is not correctly read
+(Piergiorgio Lucidi)
+
 CONNECTORS-337: Pay attention to -DskipIT for alfresco, cmis, and
 wiki tests on Maven build.
 (Karl Wright)

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
Sat Dec 31 16:30:14 2011
@@ -24,27 +24,33 @@ package org.apache.manifoldcf.crawler.co
 */
 public class AlfrescoConfig {
 
-  /** Username */
+  /** Username parameter */
   public static final String USERNAME_PARAM = "username";
  
-  /** Password */
+  /** Password parameter */
   public static final String PASSWORD_PARAM = "password";
   
-  /** Protocol */
+  /** Protocol parameter */
   public static final String PROTOCOL_PARAM = "protocol";
   
-  /** Server name */
+  /** Server name parameter */
   public static final String SERVER_PARAM = "server";
   
-  /** Port */
+  /** Port parameter */
   public static final String PORT_PARAM = "port";
   
-  /** Path of the context of the Alfresco Web Services API */
+  /** Parameter for the path of the context of the Alfresco Web Services API */
   public static final String PATH_PARAM = "path";
   
   /** The Lucene Query parameter */
   public static final String LUCENE_QUERY_PARAM = "luceneQuery";
   
+  /** Tenant domain parameter (optional) */
+  public static final String TENANT_DOMAIN_PARAM = "tenantDomain";
+  
+  /** Separator for the username field dedicated to the tenant domain */
+  public static final String TENANT_DOMAIN_SEP = "@";
+  
   //default values
   public static final String USERNAME_DEFAULT_VALUE = "admin";
   public static final String PASSWORD_DEFAULT_VALUE = "admin";

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Sat Dec 31 16:30:14 2011
@@ -19,17 +19,14 @@
  */
 package org.apache.manifoldcf.crawler.connectors.alfresco;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.InterruptedIOException;
-import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.HashMap;
 
 import org.alfresco.webservice.authentication.AuthenticationFault;
 import org.alfresco.webservice.content.Content;
@@ -44,7 +41,6 @@ import org.alfresco.webservice.util.Auth
 import org.alfresco.webservice.util.AuthenticationUtils;
 import org.alfresco.webservice.util.WebServiceException;
 import org.alfresco.webservice.util.WebServiceFactory;
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
@@ -59,7 +55,6 @@ import org.apache.manifoldcf.crawler.int
 import org.apache.manifoldcf.crawler.interfaces.IProcessActivity;
 import org.apache.manifoldcf.crawler.interfaces.ISeedingActivity;
 import org.apache.manifoldcf.crawler.system.Logging;
-import org.apache.manifoldcf.ui.util.Encoder;
 
 public class AlfrescoRepositoryConnector extends BaseRepositoryConnector {
 
@@ -84,6 +79,9 @@ public class AlfrescoRepositoryConnector
   /** Endpoint context path of the Alfresco webapp */
   protected String path = null;
   
+  /** Alfresco Tenant domain */
+  protected String tenantDomain = null;
+  
   protected AuthenticationDetails session = null;
 
   protected static final long timeToRelease = 300000L;
@@ -175,6 +173,7 @@ public class AlfrescoRepositoryConnector
     server = null;
     port = null;
     path = null;
+    tenantDomain = null;
 
   }
 
@@ -192,6 +191,12 @@ public class AlfrescoRepositoryConnector
     server = params.getParameter(AlfrescoConfig.SERVER_PARAM);
     port = params.getParameter(AlfrescoConfig.PORT_PARAM);
     path = params.getParameter(AlfrescoConfig.PATH_PARAM);
+    tenantDomain = params.getParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM);
+    
+    //tenant domain (optional parameter). Pattern: username@tenantDomain
+    if(StringUtils.isNotEmpty(tenantDomain)){
+      username += AlfrescoConfig.TENANT_DOMAIN_SEP + tenantDomain;
+    }
   }
 
   /** Test the connection.  Returns a string describing the connection integrity.
@@ -251,9 +256,9 @@ public class AlfrescoRepositoryConnector
       session = AuthenticationUtils.getAuthenticationDetails();
     } catch (AuthenticationFault e) {
       Logging.connectors.warn(
-          "Alfresco: Error during authentication. Username: "+username + ", endpoint: "+endpoint
+          "Alfresco: Error during authentication. Username: "+username + ", endpoint: "+endpoint+".
"
               + e.getMessage(), e);
-      throw new ManifoldCFException("Alfresco: Error during authentication. Username: "+username
+ ", endpoint: "+endpoint
+      throw new ManifoldCFException("Alfresco: Error during authentication. Username: "+username
+ ", endpoint: "+endpoint+". "
           + e.getMessage(), e);
     } catch (WebServiceException e){
       Logging.connectors.warn(
@@ -473,7 +478,13 @@ public class AlfrescoRepositoryConnector
       parameters.setParameter(AlfrescoConfig.PATH_PARAM, AlfrescoConfig.PATH_DEFAULT_VALUE);
     }
     
+    String tenantDomain = parameters.getParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM);
+    if (StringUtils.isEmpty(tenantDomain)){
+      parameters.setParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM, StringUtils.EMPTY);
+    }
+
     outputResource(VIEW_CONFIG_FORWARD, out, locale, parameters);
+
   }
 
   /**
@@ -521,6 +532,7 @@ public class AlfrescoRepositoryConnector
     String server = parameters.getParameter(AlfrescoConfig.SERVER_PARAM);
     String port = parameters.getParameter(AlfrescoConfig.PORT_PARAM);
     String path = parameters.getParameter(AlfrescoConfig.PATH_PARAM);
+      String tenantDomain = parameters.getParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM);
       
     if (username == null)
       username = "admin";
@@ -534,19 +546,24 @@ public class AlfrescoRepositoryConnector
       port = "8080";
     if (path == null)
       path = "/alfresco/api";
-  
-    ConfigParams newMap = new ConfigParams();
-    newMap.setParameter(AlfrescoConfig.USERNAME_PARAM, username);
-    newMap.setParameter(AlfrescoConfig.PASSWORD_PARAM, password);
-    newMap.setParameter(AlfrescoConfig.PROTOCOL_PARAM, protocol);
-    newMap.setParameter(AlfrescoConfig.SERVER_PARAM, server);
-    newMap.setParameter(AlfrescoConfig.PORT_PARAM, port);
-    newMap.setParameter(AlfrescoConfig.PATH_PARAM, path);
     
+    if(StringUtils.isEmpty(tenantDomain))
+      tenantDomain = StringUtils.EMPTY;
+  
+    parameters.setParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM, tenantDomain);
+    parameters.setParameter(AlfrescoConfig.USERNAME_PARAM, username);
+    parameters.setParameter(AlfrescoConfig.PASSWORD_PARAM, password);
+    parameters.setParameter(AlfrescoConfig.PROTOCOL_PARAM, protocol);
+    parameters.setParameter(AlfrescoConfig.SERVER_PARAM, server);
+    parameters.setParameter(AlfrescoConfig.PORT_PARAM, port);
+    parameters.setParameter(AlfrescoConfig.PATH_PARAM, path);
+    parameters.setParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM, tenantDomain);
+      
     if(ALFRESCO_SERVER_TAB_NAME.equals(tabName)){
-      outputResource(EDIT_CONFIG_FORWARD, out, locale, newMap);  
+      outputResource(EDIT_CONFIG_FORWARD, out, locale, parameters);  
+
     } else {
-      outputResource(HIDDEN_CONFIG_FORWARD, out, locale, newMap);
+      outputResource(HIDDEN_CONFIG_FORWARD, out, locale, parameters);
     }
   }
 
@@ -608,6 +625,14 @@ public class AlfrescoRepositoryConnector
     if (StringUtils.isNotEmpty(path)) {
       parameters.setParameter(AlfrescoConfig.PATH_PARAM, path);
     }
+    
+    String tenantDomain = variableContext.getParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM);
+    if(StringUtils.isNotEmpty(tenantDomain)){
+      parameters.setParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM, tenantDomain);
+    } else {
+      parameters.setParameter(AlfrescoConfig.TENANT_DOMAIN_PARAM, StringUtils.EMPTY);
+    }
+    
     return null;
   }
 
@@ -897,19 +922,21 @@ public class AlfrescoRepositoryConnector
       predicate.setNodes(new Reference[]{reference});
       
       Node node = NodeUtils.get(username, password, session, predicate);
-      NamedValue[] properties = node.getProperties();
-      boolean isDocument = ContentModelUtils.isDocument(properties);
-      if(isDocument){
-        boolean isVersioned = NodeUtils.isVersioned(node.getAspects());
-        if(isVersioned){
-          rval[i] = NodeUtils.getVersionLabel(properties);
+      if(node.getProperties()!=null){
+        NamedValue[] properties = node.getProperties();
+        boolean isDocument = ContentModelUtils.isDocument(properties);
+        if(isDocument){
+          boolean isVersioned = NodeUtils.isVersioned(node.getAspects());
+          if(isVersioned){
+            rval[i] = NodeUtils.getVersionLabel(properties);
+          } else {
+            //a document that doesn't contain versioning information will always be processed
+            rval[i] = StringUtils.EMPTY;
+          }
         } else {
-          //a document that doesn't contain versioning information will always be processed
+          //a space will always be processed
           rval[i] = StringUtils.EMPTY;
         }
-      } else {
-        //a space will always be processed
-        rval[i] = StringUtils.EMPTY;
       }
       i++;
     }

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/PropertiesUtils.java
Sat Dec 31 16:30:14 2011
@@ -28,7 +28,7 @@ import org.apache.manifoldcf.core.interf
 
 public class PropertiesUtils {
 
-  private static final String PROP_CONTENT_PREFIX = "ContentData";
+  private static final String PROP_CONTENT_PREFIX = "contentUrl";
   
   public static String[] getPropertyValues(NamedValue[]  properties, String qname){
     String[] propertyValues = null;

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
Sat Dec 31 16:30:14 2011
@@ -22,6 +22,16 @@
 		</td>
 	</tr>
 	<tr>
+    <td class="description">
+      <nobr>
+        Tenant domain:
+      </nobr>
+    </td>
+    <td class="value">
+        <input id="tenantDomain" name="tenantDomain" type="text" size="32" value="${TENANTDOMAIN:A}"
/>
+    </td>
+  </tr>
+	<tr>
 		<td class="description">
 			<nobr>
 				Username:

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration_en_US.html
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration_en_US.html?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration_en_US.html
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration_en_US.html
Sat Dec 31 16:30:14 2011
@@ -19,4 +19,5 @@
 <input type="hidden" name="protocol" value="${PROTOCOL:A}" />
 <input type="hidden" name="server" value="${SERVER:A}" />
 <input type="hidden" name="port" value="${PORT:A}" />
-<input type="hidden" name="path" value="${PATH:A}" />
\ No newline at end of file
+<input type="hidden" name="path" value="${PATH:A}" />
+<input type="hidden" name="tenantDomain" value="${TENANTDOMAIN:A}" />
\ No newline at end of file

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration_en_US.html
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration_en_US.html?rev=1226128&r1=1226127&r2=1226128&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration_en_US.html
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration_en_US.html
Sat Dec 31 16:30:14 2011
@@ -23,6 +23,10 @@
 			</nobr>
 		</td>
 		<td class="value" colspan="3">
+		  <nobr>
+        tenantDomain=${TENANTDOMAIN:B}
+      </nobr>
+      <br />
 			<nobr>
 				username=${USERNAME:B}
 			</nobr>



Mime
View raw message