You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by rh...@apache.org on 2016/11/22 23:11:09 UTC

svn commit: r1770894 [1/3] - in /manifoldcf/branches/CONNECTORS-1290/connectors: ./ nuxeo/ nuxeo/connector/ nuxeo/connector/src/ nuxeo/connector/src/main/ nuxeo/connector/src/main/java/ nuxeo/connector/src/main/java/org/ nuxeo/connector/src/main/java/o...

Author: rharo
Date: Tue Nov 22 23:11:08 2016
New Revision: 1770894

URL: http://svn.apache.org/viewvc?rev=1770894&view=rev
Log:
CONNECTORS-1290: Initial Import Nuxeo Connector from Github

Added:
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Ace.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Acl.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Attachment.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Document.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/DocumentType.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/MutableAcl.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/MutableDocument.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/NuxeoResource.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/NuxeoResponse.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/builder/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/builder/NuxeoResourceBuilder.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/nuxeo/common_en_US.properties   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/nuxeo/common_es_ES.properties   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/nuxeo/common_en_US.properties   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/nuxeo/common_es_ES.properties   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/nuxeo/editConfiguration_conf.js   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/nuxeo/editConfiguration_conf_server.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/nuxeo/viewConfiguration_conf.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editConfiguration_conf.js   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editConfiguration_conf_server.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editSpecification_conf.js   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editSpecification_confDocuments.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editSpecification_confDocumentsType.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/editSpecification_confDomains.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/viewConfiguration_conf.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/nuxeo/viewSpecification_conf.html   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/authorities/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/authorities/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/authorities/nuxeo/tests/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/authorities/nuxeo/tests/NuxeoAuthorityTest.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/AbstractTest.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/NuxeoConnectorTest.java   (with props)
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/pom.xml   (with props)
Modified:
    manifoldcf/branches/CONNECTORS-1290/connectors/pom.xml

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md Tue Nov 22 23:11:08 2016
@@ -0,0 +1,30 @@
+# ManifoldCF - Connectors - Nuxeo Connector
+
+### Nuxeo repository connector
+
+The repository connector has been developed using an incremental mode for seeding. Each time a job is executed is stored the current date and the request is done using the last seed version. Except if it is the first run, then all documents are crawled if it meet the specifications [1].
+
+The metadata include with de document are: Uid, title, last modified, state, path, type, is checked out, repository, parent reference, description, language, coverage, valid, creators, contributors, last contributor, rights, expired, created, issued, nature, source, publisher, subjects and, optionally, attachments and tags. Specifically to note are included the notes and mime type.
+
+##### **Configurations**
+Required fields to connect are: protocol (http or https), host, port (default is 8080), path and if necessary a username and password.
+
+##### **Specifications**
+There are four possible specifications:
+- Select domains to be crawled.
+- Give the option of choosing if the tags must be processed.
+- Select documents type to be crawled.
+- Give the option of choosing if the attachments must be processed.
+
+### Nuxeo authority connector
+
+The authority connector has been developed using Acls [2]. Each document stores users and groups which have read permissions[3]. 
+
+When a user searches then their username and groups are obtained and it are compared with the usernames and groups of the documents. In this way, they can only see the documents which contain his groups or his username.
+
+##### **Configurations**
+It is the same as for the repository connector.
+
+[1] https://doc.nuxeo.com/display/NXDOC/REST+API  
+[2] https://doc.nuxeo.com/display/NXDOC/ACLs  
+[3] https://doc.nuxeo.com/display/NXDOC/Web+Adapters+for+the+REST+API
\ No newline at end of file

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/README.md
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,104 @@
+package org.apache.manifoldcf.authorities.authorities.nuxeo;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class Messages extends org.apache.manifoldcf.ui.i18n.Messages {
+
+	public static final String DEFAULT_BUNDLE_NAME = "org.apache.manifoldcf.authorities.authorities.nuxeo.common";
+	public static final String DEFAULT_PATH_NAME = "org.apache.manifoldcf.authorities.authorities.nuxeo";
+
+	/** Constructor - do no instantiate
+	  */
+	  protected Messages()
+	  {
+	  }
+
+	public static String getString(Locale locale, String messageKey) {
+		return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getAttributeString(Locale locale, String messageKey) {
+		return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getBodyString(Locale locale, String messageKey) {
+		return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getAttributeJavascriptString(Locale locale, String messageKey) {
+		return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getBodyJavascriptString(Locale locale, String messageKey) {
+		return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getString(Locale locale, String messageKey, Object[] args) {
+		return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getAttributeString(Locale locale, String messageKey, Object[] args) {
+		return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getBodyString(Locale locale, String messageKey, Object[] args) {
+		return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getAttributeJavascriptString(Locale locale, String messageKey, Object[] args) {
+		return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getBodyJavascriptString(Locale locale, String messageKey, Object[] args) {
+		return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	// More general methods which allow bundlenames and class loaders to be
+	// specified.
+
+	public static String getString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getAttributeString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getAttributeString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getBodyString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getBodyString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getAttributeJavascriptString(String bundleName, Locale locale, String messageKey,
+			Object[] args) {
+		return getAttributeJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getBodyJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getBodyJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	// Resource output
+
+	public static void outputResource(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, String> substitutionParameters, boolean mapToUpperCase) throws ManifoldCFException {
+		outputResource(output, Messages.class, DEFAULT_PATH_NAME, locale, resourceKey, substitutionParameters,
+				mapToUpperCase);
+	}
+
+	public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, String> substitutionParameters, boolean mapToUpperCase) throws ManifoldCFException {
+		outputResourceWithVelocity(output, Messages.class, DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+				substitutionParameters, mapToUpperCase);
+	}
+
+	public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, Object> contextObjects) throws ManifoldCFException {
+		outputResourceWithVelocity(output, Messages.class, DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+				contextObjects);
+	}
+
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,308 @@
+package org.apache.manifoldcf.authorities.authorities.nuxeo;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
+import org.apache.manifoldcf.authorities.authorities.BaseAuthorityConnector;
+import org.apache.manifoldcf.authorities.interfaces.AuthorizationResponse;
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.NuxeoConfiguration;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.client.NuxeoClient;
+
+/**
+ *
+ * Nuxeo Authority Connector class
+ * 
+ * @author David Arroyo Escobar <ar...@gmail.com>
+ *
+ */
+public class NuxeoAuthorityConnector extends BaseAuthorityConnector {
+
+	// Configuration tabs
+	private static final String CONF_SERVER_TAB_PROPERTY = "NuxeoAuthorityConnector.Server";
+
+	// Prefix for nuxeo configuration and specification parameters
+	private static final String PARAMETER_PREFIX = "nuxeo_";
+
+	// Templates
+	/**
+	 * Javascript to check the configuration parameters
+	 */
+	private static final String EDIT_CONFIG_HEADER_FORWARD = "editConfiguration_conf.js";
+
+	/**
+	 * Server edit tab template
+	 */
+	private static final String EDIT_CONFIG_FORWARD_SERVER = "editConfiguration_conf_server.html";
+
+	/**
+	 * Server view tab template
+	 */
+	private static final String VIEW_CONFIG_FORWARD = "viewConfiguration_conf.html";
+
+	/* Nuxeo instance parameters */
+	protected String protocol = null;
+	protected String host = null;
+	protected String port = null;
+	protected String path = null;
+	protected String username = null;
+	protected String password = null;
+
+	protected NuxeoClient nuxeoClient = null;
+
+	//Constructor
+	public NuxeoAuthorityConnector() {
+		super();
+	}
+
+	public void setNuxeoClient(NuxeoClient nuxeoClient) {
+		this.nuxeoClient = nuxeoClient;
+	}
+
+	// Close the connection.
+	public void disconenct() throws ManifoldCFException {
+		if (nuxeoClient != null)
+			nuxeoClient = null;
+
+		protocol = null;
+		host = null;
+		port = null;
+		path = null;
+		username = null;
+		password = null;
+	}
+
+	/** CONNECTION **/
+	
+	//Makes connection to server
+	@Override
+	public void connect(ConfigParams configParams) {
+		super.connect(configParams);
+
+		protocol = params.getParameter(NuxeoConfiguration.Server.PROTOCOL);
+		host = params.getParameter(NuxeoConfiguration.Server.HOST);
+		port = params.getParameter(NuxeoConfiguration.Server.PORT);
+		path = params.getParameter(NuxeoConfiguration.Server.PATH);
+		username = params.getParameter(NuxeoConfiguration.Server.USERNAME);
+		password = params.getObfuscatedParameter(NuxeoConfiguration.Server.PASSWORD);
+
+		try {
+			initNuxeoClient();
+		} catch (ManifoldCFException manifoldCFException) {
+			manifoldCFException.printStackTrace();
+		}
+	}
+
+	/**
+	 * Check the connection
+	 */
+	@Override
+	public String check() throws ManifoldCFException {
+		try {
+			if (!isConnected()) {
+				initNuxeoClient();
+			}
+
+			Boolean result = nuxeoClient.checkAuth();
+
+			if (result)
+				return super.check();
+			else
+				throw new ManifoldCFException("Nuxeo instance could not be reached");
+
+		} catch (ServiceInterruption serviceInterruption) {
+			return "Connection temporarily failed: " + serviceInterruption.getMessage();
+		} catch (ManifoldCFException manifoldCFException) {
+			return "Connection failed: " + manifoldCFException.getMessage();
+		} catch (Exception e) {
+			return "Connection failed: " + e.getMessage();
+		}
+	}
+
+	/**
+	 * Initialize Nuxeo client using the configured parameters.
+	 * 
+	 * @throws ManifoldCFException
+	 */
+	private void initNuxeoClient() throws ManifoldCFException {
+		int portInt;
+
+		if (nuxeoClient == null) {
+
+			if (StringUtils.isEmpty(protocol)) {
+				throw new ManifoldCFException(
+						"Parameter " + NuxeoConfiguration.Server.PROTOCOL + " required but not set");
+			}
+
+			if (StringUtils.isEmpty(host)) {
+				throw new ManifoldCFException("Parameter " + NuxeoConfiguration.Server.HOST + " required but not set");
+			}
+
+			if (port != null && port.length() > 0) {
+				try {
+					portInt = Integer.parseInt(port);
+				} catch (NumberFormatException formatException) {
+					throw new ManifoldCFException("Bad number: " + formatException.getMessage(), formatException);
+				}
+			} else {
+				if (protocol.toLowerCase(Locale.ROOT).equals("http")) {
+					portInt = 80;
+				} else {
+					portInt = 443;
+				}
+			}
+
+			nuxeoClient = new NuxeoClient(protocol, host, portInt, path, username, password);
+
+		}
+	}
+
+	/**
+	 * @return true if the connector instance is connected.
+	 */
+	@Override
+	public boolean isConnected() {
+		return nuxeoClient != null;
+	}
+
+	/** VIEW CONFIGURATION **/
+	@Override
+	public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters)
+			throws ManifoldCFException, IOException {
+
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		Messages.outputResourceWithVelocity(out, locale, VIEW_CONFIG_FORWARD, paramMap, true);
+	}
+
+	private static void fillInServerConfigurationMap(Map<String, String> serverMap, IPasswordMapperActivity mapper,
+			ConfigParams parameters) {
+
+		String nuxeoProtocol = parameters.getParameter(NuxeoConfiguration.Server.PROTOCOL);
+		String nuxeoHost = parameters.getParameter(NuxeoConfiguration.Server.HOST);
+		String nuxeoPort = parameters.getParameter(NuxeoConfiguration.Server.PORT);
+		String nuxeoPath = parameters.getParameter(NuxeoConfiguration.Server.PATH);
+		String nuxeoUsername = parameters.getParameter(NuxeoConfiguration.Server.USERNAME);
+		String nuxeoPassword = parameters.getParameter(NuxeoConfiguration.Server.PASSWORD);
+
+		if (nuxeoProtocol == null)
+			nuxeoProtocol = NuxeoConfiguration.Server.PROTOCOL_DEFAULT_VALUE;
+		if (nuxeoHost == null)
+			nuxeoHost = NuxeoConfiguration.Server.HOST_DEFAULT_VALUE;
+		if (nuxeoPort == null)
+			nuxeoPort = NuxeoConfiguration.Server.PORT_DEFAULT_VALUE;
+		if (nuxeoPath == null)
+			nuxeoPath = NuxeoConfiguration.Server.PATH_DEFAULT_VALUE;
+		if (nuxeoUsername == null)
+			nuxeoUsername = NuxeoConfiguration.Server.USERNAME_DEFAULT_VALUE;
+		if (nuxeoPassword == null)
+			nuxeoPassword = NuxeoConfiguration.Server.PASSWORD_DEFAULT_VALUE;
+		else
+			nuxeoPassword = mapper.mapKeyToPassword(nuxeoPassword);
+
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PROTOCOL, nuxeoProtocol);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.HOST, nuxeoHost);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PORT, nuxeoPort);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PATH, nuxeoPath);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.USERNAME, nuxeoUsername);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PASSWORD, nuxeoPassword);
+	}
+
+	/** CONFIGURATION CONNECTOR **/
+	@Override
+	public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, Locale locale,
+			ConfigParams parameters, List<String> tabsArray) throws ManifoldCFException, IOException {
+
+		// Server tab
+		tabsArray.add(Messages.getString(locale, CONF_SERVER_TAB_PROPERTY));
+
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		// Fill in the parameters form each tab
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		Messages.outputResourceWithVelocity(out, locale, EDIT_CONFIG_HEADER_FORWARD, paramMap, true);
+	}
+
+	@Override
+	public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, Locale locale,
+			ConfigParams parameters, String tabName) throws ManifoldCFException, IOException {
+
+		// Call the Velocity tempaltes for each tab
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		// Set the tab name
+		paramMap.put("TabName", tabName);
+
+		// Fill in the parameters
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		// Server tab
+		Messages.outputResourceWithVelocity(out, locale, EDIT_CONFIG_FORWARD_SERVER, paramMap, true);
+	}
+
+	@Override
+	public String processConfigurationPost(IThreadContext thredContext, IPostParameters variableContext,
+			ConfigParams parameters) {
+
+		String nuxeoProtocol = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PROTOCOL);
+		if (nuxeoProtocol != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PROTOCOL, nuxeoProtocol);
+
+		String nuxeoHost = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.HOST);
+		if (nuxeoHost != null)
+			parameters.setParameter(NuxeoConfiguration.Server.HOST, nuxeoHost);
+
+		String nuxeoPort = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PORT);
+		if (nuxeoPort != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PORT, nuxeoPort);
+
+		String nuxeoPath = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PATH);
+		if (nuxeoPath != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PATH, nuxeoPath);
+
+		String nuxeoUsername = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.USERNAME);
+		if (nuxeoUsername != null)
+			parameters.setParameter(NuxeoConfiguration.Server.USERNAME, nuxeoUsername);
+
+		String nuxeoPassword = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PASSWORD);
+		if (nuxeoPassword != null)
+			parameters.setObfuscatedParameter(NuxeoConfiguration.Server.PASSWORD,
+					variableContext.mapKeyToPassword(nuxeoPassword));
+
+		return null; // It returns null if the configuration has been successful
+	}
+
+	/** AUTHORITY **/
+	@Override
+	public AuthorizationResponse getDefaultAuthorizationResponse(String userName) {
+		return RESPONSE_UNREACHABLE;
+	}
+
+	@Override
+	public AuthorizationResponse getAuthorizationResponse(String username) throws ManifoldCFException {
+		try {
+			List<String> authorities = nuxeoClient.getUserAuthorities(username);
+			if (authorities == null || authorities.isEmpty()) {
+				return RESPONSE_USERNOTFOUND;
+			} else {
+				return new AuthorizationResponse(authorities.toArray(new String[0]), AuthorizationResponse.RESPONSE_OK);
+			}
+
+		} catch (Exception e) {
+			return RESPONSE_UNREACHABLE;
+		}
+	}
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,105 @@
+package org.apache.manifoldcf.crawler.connectors.nuxeo;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class Messages extends org.apache.manifoldcf.ui.i18n.Messages {
+
+	public static final String DEFAULT_BUNDLE_NAME = "org.apache.manifoldcf.crawler.connectors.nuxeo.common";
+	public static final String DEFAULT_PATH_NAME = "org.apache.manifoldcf.crawler.connectors.nuxeo";
+
+	/** Constructor - do no instantiate
+	 * @
+	  */
+	  protected Messages()
+	  {
+	  }
+
+	public static String getString(Locale locale, String messageKey) {
+		return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getAttributeString(Locale locale, String messageKey) {
+		return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getBodyString(Locale locale, String messageKey) {
+		return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getAttributeJavascriptString(Locale locale, String messageKey) {
+		return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getBodyJavascriptString(Locale locale, String messageKey) {
+		return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+	}
+
+	public static String getString(Locale locale, String messageKey, Object[] args) {
+		return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getAttributeString(Locale locale, String messageKey, Object[] args) {
+		return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getBodyString(Locale locale, String messageKey, Object[] args) {
+		return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getAttributeJavascriptString(Locale locale, String messageKey, Object[] args) {
+		return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	public static String getBodyJavascriptString(Locale locale, String messageKey, Object[] args) {
+		return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+	}
+
+	// More general methods which allow bundlenames and class loaders to be
+	// specified.
+
+	public static String getString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getAttributeString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getAttributeString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getBodyString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getBodyString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getAttributeJavascriptString(String bundleName, Locale locale, String messageKey,
+			Object[] args) {
+		return getAttributeJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	public static String getBodyJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args) {
+		return getBodyJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+	}
+
+	// Resource output
+
+	public static void outputResource(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, String> substitutionParameters, boolean mapToUpperCase) throws ManifoldCFException {
+		outputResource(output, Messages.class, DEFAULT_PATH_NAME, locale, resourceKey, substitutionParameters,
+				mapToUpperCase);
+	}
+
+	public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, String> substitutionParameters, boolean mapToUpperCase) throws ManifoldCFException {
+		outputResourceWithVelocity(output, Messages.class, DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+				substitutionParameters, mapToUpperCase);
+	}
+
+	public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+			Map<String, Object> contextObjects) throws ManifoldCFException {
+		outputResourceWithVelocity(output, Messages.class, DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+				contextObjects);
+	}
+
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,45 @@
+package org.apache.manifoldcf.crawler.connectors.nuxeo;
+
+/**
+ * 
+ * NuxeoConfiguration class
+ * 
+ * Class to keep the server configuration and specification paramenters.
+ * 
+ * @author David Arroyo Escobar <ar...@gmail.com>
+ *
+ */
+public class NuxeoConfiguration {
+
+	public static interface Server {
+
+		public static final String USERNAME = "username";
+		public static final String PASSWORD = "password";
+		public static final String PROTOCOL = "protocol";
+		public static final String HOST = "host";
+		public static final String PORT = "port";
+		public static final String PATH = "path";
+
+		public static final String PROTOCOL_DEFAULT_VALUE = "http";
+		public static final String HOST_DEFAULT_VALUE = "";
+		public static final String PORT_DEFAULT_VALUE = "8080";
+		public static final String PATH_DEFAULT_VALUE = "/nuxeo";
+		public static final String USERNAME_DEFAULT_VALUE = "";
+		public static final String PASSWORD_DEFAULT_VALUE = "";
+
+	}
+
+	public static interface Specification {
+
+		public static final String DOMAINS = "domains";
+		public static final String DOMAIN = "domain";
+		public static final String DOMAIN_KEY = "key";
+		public static final String DOCUMENTS = "documents";
+		public static final String PROCESS_TAGS = "process_tags";
+		public static final String PROCESS_ATTACHMENTS = "process_attachments";
+		public static final String DOCUMENTS_TYPE = "documentsType";
+		public static final String DOCUMENT_TYPE = "documentType";
+		public static final String DOCUMENT_TYPE_KEY = "key";
+
+	}
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,837 @@
+package org.apache.manifoldcf.crawler.connectors.nuxeo;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TimeZone;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
+import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.Specification;
+import org.apache.manifoldcf.core.interfaces.SpecificationNode;
+import org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.client.NuxeoClient;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Ace;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Acl;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Attachment;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Document;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.NuxeoResponse;
+import org.apache.manifoldcf.crawler.interfaces.IExistingVersions;
+import org.apache.manifoldcf.crawler.interfaces.IProcessActivity;
+import org.apache.manifoldcf.crawler.interfaces.IRepositoryConnector;
+import org.apache.manifoldcf.crawler.interfaces.ISeedingActivity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * 
+ * Nuxeo Repository Connector class
+ * 
+ * @author David Arroyo Escobar <ar...@gmail.com>
+ *
+ */
+public class NuxeoRepositoryConnector extends BaseRepositoryConnector {
+
+	protected final static String ACTIVITY_READ = "read document";
+
+	// Configuration tabs
+	private static final String NUXEO_SERVER_TAB_PROPERTY = "NuxeoRepositoryConnector.Server";
+
+	// Specification tabs
+	private static final String CONF_DOMAINS_TAB_PROPERTY = "NuxeoRepositoryConnector.Domains";
+	private static final String CONF_DOCUMENTS_TYPE_TAB_PROPERTY = "NuxeoRepositoryConnector.DocumentsType";
+	private static final String CONF_DOCUMENT_PROPERTY = "NuxeoRepositoryConnector.Documents";
+
+	// Prefix for nuxeo configuration and specification parameters
+	private static final String PARAMETER_PREFIX = "nuxeo_";
+
+	// Templates for Nuxeo configuration
+	/**
+	 * Javascript to check the configuration parameters
+	 */
+	private static final String EDIT_CONFIG_HEADER_FORWARD = "editConfiguration_conf.js";
+
+	/**
+	 * Server edit tab template
+	 */
+	private static final String EDIT_CONFIG_FORWARD_SERVER = "editConfiguration_conf_server.html";
+
+	/**
+	 * Server view tab template
+	 */
+	private static final String VIEW_CONFIG_FORWARD = "viewConfiguration_conf.html";
+
+	// Templates for Nuxeo specification
+	/**
+	 * Forward to the javascript to check the specification parameters for the
+	 * job
+	 */
+	private static final String EDIT_SPEC_HEADER_FORWARD = "editSpecification_conf.js";
+
+	/**
+	 * Forward to the template to edit domains for the job
+	 */
+	private static final String EDIT_SPEC_FORWARD_CONF_DOMAINS = "editSpecification_confDomains.html";
+
+	/**
+	 * Forward to the template to edit documents type for the job
+	 */
+	private static final String EDIT_SPEC_FORWARD_CONF_DOCUMENTS_TYPE = "editSpecification_confDocumentsType.html";
+
+	/**
+	 * Forward to the template to edit document properties for the job
+	 */
+	private static final String EDIT_SPEC_FORWARD_CONF_DOCUMENTS = "editSpecification_confDocuments.html";
+
+	/**
+	 * Forward to the template to view the specification parameters for the job
+	 */
+	private static final String VIEW_SPEC_FORWARD = "viewSpecification_conf.html";
+
+	protected long lastSessionFetch = -1L;
+	protected static final long timeToRelease = 300000L;
+
+	private Logger logger = LoggerFactory.getLogger(NuxeoRepositoryConnector.class);
+
+	/* Nuxeo instance parameters */
+	protected String protocol = null;
+	protected String host = null;
+	protected String port = null;
+	protected String path = null;
+	protected String username = null;
+	protected String password = null;
+
+	protected NuxeoClient nuxeoClient = null;
+
+	// Constructor
+	public NuxeoRepositoryConnector() {
+		super();
+	}
+
+	public void setNuxeoClient(NuxeoClient nuxeoClient) {
+		this.nuxeoClient = nuxeoClient;
+	}
+
+	@Override
+	public String[] getActivitiesList() {
+		return new String[] { ACTIVITY_READ };
+	}
+
+	@Override
+	public String[] getBinNames(String documentIdenfitier) {
+		return new String[] { host };
+	}
+
+	/** CONFIGURATION CONNECTOR **/
+	@Override
+	public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, Locale locale,
+			ConfigParams parameters, List<String> tabsArray) throws ManifoldCFException, IOException {
+
+		// Server tab
+		tabsArray.add(Messages.getString(locale, NUXEO_SERVER_TAB_PROPERTY));
+
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		// Fill in the parameters form each tab
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		Messages.outputResourceWithVelocity(out, locale, EDIT_CONFIG_HEADER_FORWARD, paramMap, true);
+	}
+
+	@Override
+	public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, Locale locale,
+			ConfigParams parameters, String tabName) throws ManifoldCFException, IOException {
+
+		// Call the Velocity tempaltes for each tab
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		// Set the tab name
+		paramMap.put("TabName", tabName);
+
+		// Fill in the parameters
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		// Server tab
+		Messages.outputResourceWithVelocity(out, locale, EDIT_CONFIG_FORWARD_SERVER, paramMap, true);
+
+	}
+
+	private static void fillInServerConfigurationMap(Map<String, String> serverMap, IPasswordMapperActivity mapper,
+			ConfigParams parameters) {
+
+		String nuxeoProtocol = parameters.getParameter(NuxeoConfiguration.Server.PROTOCOL);
+		String nuxeoHost = parameters.getParameter(NuxeoConfiguration.Server.HOST);
+		String nuxeoPort = parameters.getParameter(NuxeoConfiguration.Server.PORT);
+		String nuxeoPath = parameters.getParameter(NuxeoConfiguration.Server.PATH);
+		String nuxeoUsername = parameters.getParameter(NuxeoConfiguration.Server.USERNAME);
+		String nuxeoPassword = parameters.getParameter(NuxeoConfiguration.Server.PASSWORD);
+
+		if (nuxeoProtocol == null)
+			nuxeoProtocol = NuxeoConfiguration.Server.PROTOCOL_DEFAULT_VALUE;
+		if (nuxeoHost == null)
+			nuxeoHost = NuxeoConfiguration.Server.HOST_DEFAULT_VALUE;
+		if (nuxeoPort == null)
+			nuxeoPort = NuxeoConfiguration.Server.PORT_DEFAULT_VALUE;
+		if (nuxeoPath == null)
+			nuxeoPath = NuxeoConfiguration.Server.PATH_DEFAULT_VALUE;
+		if (nuxeoUsername == null)
+			nuxeoUsername = NuxeoConfiguration.Server.USERNAME_DEFAULT_VALUE;
+		if (nuxeoPassword == null)
+			nuxeoPassword = NuxeoConfiguration.Server.PASSWORD_DEFAULT_VALUE;
+		else
+			nuxeoPassword = mapper.mapKeyToPassword(nuxeoPassword);
+
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PROTOCOL, nuxeoProtocol);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.HOST, nuxeoHost);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PORT, nuxeoPort);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PATH, nuxeoPath);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.USERNAME, nuxeoUsername);
+		serverMap.put(PARAMETER_PREFIX + NuxeoConfiguration.Server.PASSWORD, nuxeoPassword);
+
+	}
+
+	@Override
+	public String processConfigurationPost(IThreadContext thredContext, IPostParameters variableContext,
+			ConfigParams parameters) {
+
+		String nuxeoProtocol = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PROTOCOL);
+		if (nuxeoProtocol != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PROTOCOL, nuxeoProtocol);
+
+		String nuxeoHost = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.HOST);
+		if (nuxeoHost != null)
+			parameters.setParameter(NuxeoConfiguration.Server.HOST, nuxeoHost);
+
+		String nuxeoPort = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PORT);
+		if (nuxeoPort != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PORT, nuxeoPort);
+
+		String nuxeoPath = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PATH);
+		if (nuxeoPath != null)
+			parameters.setParameter(NuxeoConfiguration.Server.PATH, nuxeoPath);
+
+		String nuxeoUsername = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.USERNAME);
+		if (nuxeoUsername != null)
+			parameters.setParameter(NuxeoConfiguration.Server.USERNAME, nuxeoUsername);
+
+		String nuxeoPassword = variableContext.getParameter(PARAMETER_PREFIX + NuxeoConfiguration.Server.PASSWORD);
+		if (nuxeoPassword != null)
+			parameters.setObfuscatedParameter(NuxeoConfiguration.Server.PASSWORD,
+					variableContext.mapKeyToPassword(nuxeoPassword));
+
+		return null;
+	}
+
+	@Override
+	public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters)
+			throws ManifoldCFException, IOException {
+
+		Map<String, String> paramMap = new HashMap<String, String>();
+
+		fillInServerConfigurationMap(paramMap, out, parameters);
+
+		Messages.outputResourceWithVelocity(out, locale, VIEW_CONFIG_FORWARD, paramMap, true);
+	}
+
+	/** CONNECTION **/
+	@Override
+	public void connect(ConfigParams configParams) {
+		super.connect(configParams);
+
+		protocol = params.getParameter(NuxeoConfiguration.Server.PROTOCOL);
+		host = params.getParameter(NuxeoConfiguration.Server.HOST);
+		port = params.getParameter(NuxeoConfiguration.Server.PORT);
+		path = params.getParameter(NuxeoConfiguration.Server.PATH);
+		username = params.getParameter(NuxeoConfiguration.Server.USERNAME);
+		password = params.getObfuscatedParameter(NuxeoConfiguration.Server.PASSWORD);
+
+		try {
+			initNuxeoClient();
+		} catch (ManifoldCFException manifoldCFException) {
+			logger.debug("Not possible to initialize Nuxeo client. Reason: {}", manifoldCFException.getMessage());
+			manifoldCFException.printStackTrace();
+		}
+	}
+
+	// Check the connection
+	@Override
+	public String check() throws ManifoldCFException {
+		try {
+			if (!isConnected()) {
+				initNuxeoClient();
+			}
+
+			Boolean result = nuxeoClient.check();
+
+			if (result)
+				return super.check();
+			else
+				throw new ManifoldCFException("Nuxeo instance could not be reached");
+
+		} catch (ServiceInterruption serviceInterruption) {
+			return "Connection temporarily failed: " + serviceInterruption.getMessage();
+		} catch (ManifoldCFException manifoldCFException) {
+			return "Connection failed: " + manifoldCFException.getMessage();
+		} catch (Exception e) {
+			return "Connection failed: " + e.getMessage();
+		}
+	}
+
+	/**
+	 * Initialize Nuxeo client using the configured parameters.
+	 * 
+	 * @throws ManifoldCFException
+	 */
+	private void initNuxeoClient() throws ManifoldCFException {
+		int portInt;
+
+		if (nuxeoClient == null) {
+
+			if (StringUtils.isEmpty(protocol)) {
+				throw new ManifoldCFException(
+						"Parameter " + NuxeoConfiguration.Server.PROTOCOL + " required but not set");
+			}
+
+			if (StringUtils.isEmpty(host)) {
+				throw new ManifoldCFException("Parameter " + NuxeoConfiguration.Server.HOST + " required but not set");
+			}
+
+			if (port != null && port.length() > 0) {
+				try {
+					portInt = Integer.parseInt(port);
+				} catch (NumberFormatException formatException) {
+					throw new ManifoldCFException("Bad number: " + formatException.getMessage(), formatException);
+				}
+			} else {
+				if (protocol.toLowerCase(Locale.ROOT).equals("http")) {
+					portInt = 80;
+				} else {
+					portInt = 443;
+				}
+			}
+
+			nuxeoClient = new NuxeoClient(protocol, host, portInt, path, username, password);
+
+			lastSessionFetch = System.currentTimeMillis();
+
+		}
+
+	}
+
+	@Override
+	public boolean isConnected() {
+		return nuxeoClient != null;
+	}
+
+	@Override
+	public void poll() throws ManifoldCFException {
+		if (lastSessionFetch == -1L) {
+			return;
+		}
+
+		long currentTime = System.currentTimeMillis();
+
+		if (currentTime > lastSessionFetch + timeToRelease) {
+			nuxeoClient.close();
+			nuxeoClient = null;
+			lastSessionFetch = -1;
+		}
+	}
+
+	/** SEEDING **/
+	@Override
+	public String addSeedDocuments(ISeedingActivity activities, Specification spec, String lastSeedVersion,
+			long seedTime, int jobMode) throws ManifoldCFException, ServiceInterruption {
+
+		if (!isConnected())
+			initNuxeoClient();
+
+		try {
+
+			int lastStart = 0;
+			int defaultSize = 50;
+			Boolean isLast = true;
+			NuxeoSpecification ns = NuxeoSpecification.from(spec);
+			List<String> domains = ns.getDomains();
+			List<String> documentsType = ns.getDocumentsType();
+
+			do {
+				final NuxeoResponse<Document> response = nuxeoClient.getDocuments(domains, documentsType,
+						lastSeedVersion, lastStart, defaultSize, isLast);
+
+				for (Document doc : response.getResults()) {
+					activities.addSeedDocument(doc.getUid());
+				}
+
+				lastStart++;
+				isLast = response.isLast();
+
+			} while (!isLast);
+
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+			sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+			lastSeedVersion = sdf.format(new Date());
+
+			return lastSeedVersion;
+		} catch (Exception exception) {
+			long interruptionRetryTime = 5L * 60L * 1000L;
+			String message = "Server appears down during seeding: " + exception.getMessage();
+			throw new ServiceInterruption(message, exception, System.currentTimeMillis() + interruptionRetryTime, -1L,
+					3, true);
+		}
+	}
+
+	/** PROCESS DOCUMENTS **/
+	@Override
+	public void processDocuments(String[] documentsIdentifieres, IExistingVersions statuses, Specification spec,
+			IProcessActivity activities, int jobMode, boolean usesDefaultAuthority)
+			throws ManifoldCFException, ServiceInterruption {
+
+		for (int i = 0; i < documentsIdentifieres.length; i++) {
+
+			String documentId = documentsIdentifieres[i];
+			String version = statuses.getIndexedVersionString(documentId);
+
+			long startTime = System.currentTimeMillis();
+			ProcessResult pResult = null;
+			boolean doLog = true;
+
+			try {
+
+				if (!isConnected()) {
+					initNuxeoClient();
+				}
+
+				pResult = processDocument(documentId, spec, version, activities, doLog,
+						Maps.<String, String> newHashMap());
+			} catch (Exception exception) {
+				long interruptionRetryTime = 5L * 60L * 1000L;
+				String message = "Server appears down during seeding: " + exception.getMessage();
+				throw new ServiceInterruption(message, exception, System.currentTimeMillis() + interruptionRetryTime,
+						-1L, 3, true);
+			} finally {
+				if (doLog)
+					if (pResult != null && pResult.errorCode != null && !pResult.errorCode.isEmpty())
+						activities.recordActivity(new Long(startTime), ACTIVITY_READ, pResult.fileSize, documentId,
+								pResult.errorCode, pResult.errorDecription, null);
+			}
+
+		}
+	}
+
+	/**
+	 * @param documentId
+	 * @param version
+	 * @param activities
+	 * @param doLog
+	 * @param newHashMap
+	 * @return
+	 */
+	private ProcessResult processDocument(String documentId, Specification spec, String version,
+			IProcessActivity activities, boolean doLog, HashMap<String, String> extraProperties)
+			throws ManifoldCFException, ServiceInterruption, IOException {
+
+		Document doc = nuxeoClient.getDocument(documentId);
+
+		return processDocumentInternal(doc, documentId, spec, version, activities, doLog, extraProperties);
+	}
+
+	/**
+	 * @param doc
+	 * @param documentId
+	 * @param version
+	 * @param activities
+	 * @param doLog
+	 * @param extraProperties
+	 * @return
+	 */
+	private ProcessResult processDocumentInternal(Document doc, String manifoldDocumentIdentifier, Specification spec,
+			String version, IProcessActivity activities, boolean doLog, HashMap<String, String> extraProperties)
+			throws ManifoldCFException, ServiceInterruption, IOException {
+
+		RepositoryDocument rd = new RepositoryDocument();
+		NuxeoSpecification ns = NuxeoSpecification.from(spec);
+
+		Date lastModified = doc.getLastModified();
+
+		DateFormat df = DateFormat.getDateTimeInstance();
+
+		String lastVersion = null;
+
+		if (lastModified != null)
+			lastVersion = df.format(lastModified);
+
+		if (doc.getState() != null && doc.getState().equalsIgnoreCase(Document.DELETED)) {
+			activities.deleteDocument(manifoldDocumentIdentifier);
+			return new ProcessResult(doc.getLenght(), "DELETED", "");
+		}
+
+		if (!activities.checkDocumentNeedsReindexing(manifoldDocumentIdentifier, lastVersion)) {
+			return new ProcessResult(doc.getLenght(), "RETAINED", "");
+		}
+
+		if (doc.getUid() == null) {
+			activities.deleteDocument(manifoldDocumentIdentifier);
+			return new ProcessResult(doc.getLenght(), "DELETED", "");
+		}
+
+		// Add respository document information
+		rd.setMimeType(doc.getMediatype());
+		if (lastModified != null)
+			rd.setModifiedDate(lastModified);
+		rd.setIndexingDate(new Date());
+
+		// Adding Document Metadata
+		Map<String, Object> docMetadata = doc.getMetadataAsMap();
+
+		for (Entry<String, Object> entry : docMetadata.entrySet()) {
+			if (entry.getValue() instanceof List) {
+				List<?> list = (List<?>) entry.getValue();
+				rd.addField(entry.getKey(), list.toArray(new String[list.size()]));
+			} else {
+				rd.addField(entry.getKey(), entry.getValue().toString());
+			}
+
+		}
+
+		if (ns.isProcessTags())
+			rd.addField("Tags", getTagsFromDocument(doc));
+
+		String documentUri = nuxeoClient.getPathDocument(doc.getUid());
+
+		// Set repository ACLs
+		String[] permissions = getPermissionDocument(doc);
+		rd.setSecurityACL(RepositoryDocument.SECURITY_TYPE_DOCUMENT, permissions);
+		rd.setSecurityDenyACL(RepositoryDocument.SECURITY_TYPE_DOCUMENT, new String[] { GLOBAL_DENY_TOKEN });
+		rd.setBinary(doc.getContentStream(), doc.getLenght());
+
+		// Action
+		activities.ingestDocumentWithException(manifoldDocumentIdentifier, lastVersion, documentUri, rd);
+
+		if (ns.isProcessAttachments())
+			for (Attachment att : doc.getAttachments()) {
+				RepositoryDocument att_rd = new RepositoryDocument();
+				String attDocumentUri = nuxeoClient.getPathDocument(doc.getUid()) + "_" + att.getName();
+
+				att_rd.setMimeType(att.getMime_type());
+				att_rd.setBinary(doc.getContentStream(), att.getLength());
+
+				if (lastModified != null)
+					att_rd.setModifiedDate(lastModified);
+				att_rd.setIndexingDate(new Date());
+
+				att_rd.addField(Attachment.ATT_KEY_NAME, att.getName());
+				att_rd.addField(Attachment.ATT_KEY_LENGTH, String.valueOf(att.getLength()));
+				att_rd.addField(Attachment.ATT_KEY_URL, att.getUrl());
+
+				// Set repository ACLs
+				att_rd.setSecurityACL(RepositoryDocument.SECURITY_TYPE_DOCUMENT, permissions);
+				att_rd.setSecurityDenyACL(RepositoryDocument.SECURITY_TYPE_DOCUMENT,
+						new String[] { GLOBAL_DENY_TOKEN });
+
+				activities.ingestDocumentWithException(manifoldDocumentIdentifier, attDocumentUri, lastVersion,
+						attDocumentUri, att_rd);
+			}
+
+		return new ProcessResult(doc.getLenght(), "OK", StringUtils.EMPTY);
+	}
+
+	public String[] getPermissionDocument(Document doc) {
+
+		List<String> permissions = new ArrayList<String>();
+		try {
+			Acl acl = nuxeoClient.getAcl(doc.getUid());
+
+			for (Ace ace : acl.getAces()) {
+				if (ace.getStatus().equalsIgnoreCase("effective") && ace.isGranted()) {
+					permissions.add(ace.getName());
+				}
+			}
+
+			return permissions.toArray(new String[0]);
+
+		} catch (Exception e) {
+			return new String[] {};
+		}
+	}
+
+	public String[] getTagsFromDocument(Document doc) {
+		try {
+			return nuxeoClient.getTags(doc.getUid());
+		} catch (Exception e) {
+			return new String[] {};
+		}
+	}
+
+	private class ProcessResult {
+		private long fileSize;
+		private String errorCode;
+		private String errorDecription;
+
+		private ProcessResult(long fileSize, String errorCode, String errorDescription) {
+			this.fileSize = fileSize;
+			this.errorCode = errorCode;
+			this.errorDecription = errorDescription;
+		}
+
+	}
+
+	@Override
+	public int getConnectorModel() {
+		return IRepositoryConnector.MODEL_ADD_CHANGE_DELETE;
+	}
+
+	/** Specifications **/
+
+	@Override
+	public void viewSpecification(IHTTPOutput out, Locale locale, Specification spec, int connectionSequenceNumber)
+			throws ManifoldCFException, IOException {
+
+		Map<String, Object> paramMap = new HashMap<String, Object>();
+		paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber));
+
+		NuxeoSpecification ns = NuxeoSpecification.from(spec);
+
+		paramMap.put(NuxeoConfiguration.Specification.DOMAINS.toUpperCase(), ns.getDomains());
+		paramMap.put(NuxeoConfiguration.Specification.DOCUMENTS_TYPE.toUpperCase(), ns.documentsType);
+		paramMap.put(NuxeoConfiguration.Specification.PROCESS_TAGS.toUpperCase(), ns.isProcessTags().toString());
+		paramMap.put(NuxeoConfiguration.Specification.PROCESS_ATTACHMENTS.toUpperCase(),
+				ns.isProcessAttachments().toString());
+
+		Messages.outputResourceWithVelocity(out, locale, VIEW_SPEC_FORWARD, paramMap);
+	}
+
+	@Override
+	public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds,
+			int connectionSequenceNumber) throws ManifoldCFException {
+
+		String seqPrefix = "s" + connectionSequenceNumber + "_";
+
+		// DOMAINS
+		String xc = variableContext.getParameter(seqPrefix + "domainscount");
+
+		if (xc != null) {
+			// Delete all preconfigured domains
+			int i = 0;
+			while (i < ds.getChildCount()) {
+				SpecificationNode sn = ds.getChild(i);
+				if (sn.getType().equals(NuxeoConfiguration.Specification.DOMAINS)) {
+					ds.removeChild(i);
+				} else {
+					i++;
+				}
+			}
+
+			SpecificationNode domains = new SpecificationNode(NuxeoConfiguration.Specification.DOMAINS);
+			ds.addChild(ds.getChildCount(), domains);
+			int domainsCount = Integer.parseInt(xc);
+			i = 0;
+			while (i < domainsCount) {
+				String domainDescription = "_" + Integer.toString(i);
+				String domainOpName = seqPrefix + "domainop" + domainDescription;
+				xc = variableContext.getParameter(domainOpName);
+				if (xc != null && xc.equals("Delete")) {
+					i++;
+					continue;
+				}
+
+				String domainKey = variableContext.getParameter(seqPrefix + "domain" + domainDescription);
+				SpecificationNode node = new SpecificationNode(NuxeoConfiguration.Specification.DOMAIN);
+				node.setAttribute(NuxeoConfiguration.Specification.DOMAIN_KEY, domainKey);
+				domains.addChild(domains.getChildCount(), node);
+				i++;
+			}
+
+			String op = variableContext.getParameter(seqPrefix + "domainop");
+			if (op != null && op.equals("Add")) {
+				String domainSpec = variableContext.getParameter(seqPrefix + "domain");
+				SpecificationNode node = new SpecificationNode(NuxeoConfiguration.Specification.DOMAIN);
+				node.setAttribute(NuxeoConfiguration.Specification.DOMAIN_KEY, domainSpec);
+				domains.addChild(domains.getChildCount(), node);
+			}
+		}
+
+		// TYPE OF DOCUMENTS
+		String xt = variableContext.getParameter(seqPrefix + "documentsTypecount");
+
+		if (xt != null) {
+			// Delete all preconfigured type of documents
+			int i = 0;
+			while (i < ds.getChildCount()) {
+				SpecificationNode sn = ds.getChild(i);
+				if (sn.getType().equals(NuxeoConfiguration.Specification.DOCUMENTS_TYPE)) {
+					ds.removeChild(i);
+				} else {
+					i++;
+				}
+			}
+
+			SpecificationNode documentsType = new SpecificationNode(NuxeoConfiguration.Specification.DOCUMENTS_TYPE);
+			ds.addChild(ds.getChildCount(), documentsType);
+			int documentsTypeCount = Integer.parseInt(xt);
+			i = 0;
+			while (i < documentsTypeCount) {
+				String documentTypeDescription = "_" + Integer.toString(i);
+				String documentTypeOpName = seqPrefix + "documentTypeop" + documentTypeDescription;
+				xt = variableContext.getParameter(documentTypeOpName);
+				if (xt != null && xt.equals("Delete")) {
+					i++;
+					continue;
+				}
+
+				String documentTypeKey = variableContext
+						.getParameter(seqPrefix + "documentType" + documentTypeDescription);
+				SpecificationNode node = new SpecificationNode(NuxeoConfiguration.Specification.DOCUMENT_TYPE);
+				node.setAttribute(NuxeoConfiguration.Specification.DOCUMENT_TYPE_KEY, documentTypeKey);
+				documentsType.addChild(documentsType.getChildCount(), node);
+				i++;
+			}
+
+			String op = variableContext.getParameter(seqPrefix + "documentTypeop");
+			if (op != null && op.equals("Add")) {
+				String documentTypeSpec = variableContext.getParameter(seqPrefix + "documentType");
+				SpecificationNode node = new SpecificationNode(NuxeoConfiguration.Specification.DOCUMENT_TYPE);
+				node.setAttribute(NuxeoConfiguration.Specification.DOCUMENT_TYPE_KEY, documentTypeSpec);
+				documentsType.addChild(documentsType.getChildCount(), node);
+			}
+
+		}
+
+		// TAGS
+		SpecificationNode documents = new SpecificationNode(NuxeoConfiguration.Specification.DOCUMENTS);
+		ds.addChild(ds.getChildCount(), documents);
+
+		String processTags = variableContext.getParameter(seqPrefix + NuxeoConfiguration.Specification.PROCESS_TAGS);
+		String processAttachments = variableContext
+				.getParameter(seqPrefix + NuxeoConfiguration.Specification.PROCESS_ATTACHMENTS);
+
+		if (processTags != null && !processTags.isEmpty()) {
+			documents.setAttribute(NuxeoConfiguration.Specification.PROCESS_TAGS, String.valueOf(processTags));
+		}
+		if (processAttachments != null && !processAttachments.isEmpty()) {
+			documents.setAttribute(NuxeoConfiguration.Specification.PROCESS_ATTACHMENTS,
+					String.valueOf(processAttachments));
+		}
+
+		return null;
+	}
+
+	@Override
+	public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification spec,
+			int connectionSequenceNumber, int actualSequenceNumber, String tabName)
+			throws ManifoldCFException, IOException {
+
+		Map<String, Object> paramMap = new HashMap<String, Object>();
+		paramMap.put("TabName", tabName);
+		paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber));
+		paramMap.put("SelectedNum", Integer.toString(actualSequenceNumber));
+
+		NuxeoSpecification ns = NuxeoSpecification.from(spec);
+
+		paramMap.put(NuxeoConfiguration.Specification.DOMAINS.toUpperCase(), ns.getDomains());
+		paramMap.put(NuxeoConfiguration.Specification.DOCUMENTS_TYPE.toUpperCase(), ns.getDocumentsType());
+		paramMap.put(NuxeoConfiguration.Specification.PROCESS_TAGS.toUpperCase(), ns.isProcessTags());
+		paramMap.put(NuxeoConfiguration.Specification.PROCESS_ATTACHMENTS.toUpperCase(), ns.isProcessAttachments());
+
+		Messages.outputResourceWithVelocity(out, locale, EDIT_SPEC_FORWARD_CONF_DOMAINS, paramMap);
+		Messages.outputResourceWithVelocity(out, locale, EDIT_SPEC_FORWARD_CONF_DOCUMENTS_TYPE, paramMap);
+		Messages.outputResourceWithVelocity(out, locale, EDIT_SPEC_FORWARD_CONF_DOCUMENTS, paramMap);
+
+	}
+
+	@Override
+	public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification spec,
+			int connectionSequenceNumber, List<String> tabsArray) throws ManifoldCFException, IOException {
+
+		tabsArray.add(Messages.getString(locale, CONF_DOMAINS_TAB_PROPERTY));
+		tabsArray.add(Messages.getString(locale, CONF_DOCUMENTS_TYPE_TAB_PROPERTY));
+		tabsArray.add(Messages.getString(locale, CONF_DOCUMENT_PROPERTY));
+
+		Map<String, Object> paramMap = new HashMap<String, Object>();
+		paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber));
+
+		Messages.outputResourceWithVelocity(out, locale, EDIT_SPEC_HEADER_FORWARD, paramMap);
+	}
+
+	public static class NuxeoSpecification {
+
+		private List<String> domains;
+		private List<String> documentsType;
+		private Boolean processTags = false;
+		private Boolean processAttahcments = false;
+
+		public List<String> getDomains() {
+			return this.domains;
+		}
+
+		public List<String> getDocumentsType() {
+			return this.documentsType;
+		}
+
+		public Boolean isProcessTags() {
+			return this.processTags;
+		}
+
+		public Boolean isProcessAttachments() {
+			return this.processAttahcments;
+		}
+
+		/**
+		 * @param spec
+		 * @return
+		 */
+		public static NuxeoSpecification from(Specification spec) {
+			NuxeoSpecification ns = new NuxeoSpecification();
+
+			ns.domains = Lists.newArrayList();
+			ns.documentsType = Lists.newArrayList();
+
+			for (int i = 0, len = spec.getChildCount(); i < len; i++) {
+				SpecificationNode sn = spec.getChild(i);
+
+				if (sn.getType().equals(NuxeoConfiguration.Specification.DOMAINS)) {
+					for (int j = 0, sLen = sn.getChildCount(); j < sLen; j++) {
+						SpecificationNode spectNode = sn.getChild(j);
+						if (spectNode.getType().equals(NuxeoConfiguration.Specification.DOMAIN)) {
+							ns.domains.add(spectNode.getAttributeValue(NuxeoConfiguration.Specification.DOMAIN_KEY));
+						}
+					}
+				} else if (sn.getType().equals(NuxeoConfiguration.Specification.DOCUMENTS_TYPE)) {
+					for (int j = 0, sLen = sn.getChildCount(); j < sLen; j++) {
+						SpecificationNode spectNode = sn.getChild(j);
+						if (spectNode.getType().equals(NuxeoConfiguration.Specification.DOCUMENT_TYPE)) {
+							ns.documentsType.add(
+									spectNode.getAttributeValue(NuxeoConfiguration.Specification.DOCUMENT_TYPE_KEY));
+						}
+					}
+				} else if (sn.getType().equals(NuxeoConfiguration.Specification.DOCUMENTS)) {
+					String procTags = sn.getAttributeValue(NuxeoConfiguration.Specification.PROCESS_TAGS);
+					ns.processTags = Boolean.valueOf(procTags);
+					String procAtt = sn.getAttributeValue(NuxeoConfiguration.Specification.PROCESS_ATTACHMENTS);
+					ns.processAttahcments = Boolean.valueOf(procAtt);
+				}
+			}
+
+			return ns;
+		}
+
+	}
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,480 @@
+/**
+ * 
+ */
+package org.apache.manifoldcf.crawler.connectors.nuxeo.client;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.net.ssl.SSLSocketFactory;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.protocol.HttpRequestExecutor;
+import org.apache.http.util.EntityUtils;
+import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
+import org.apache.manifoldcf.connectorcommon.common.InterruptibleSocketFactory;
+import org.apache.manifoldcf.connectorcommon.interfaces.KeystoreManagerFactory;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.util.URLEncoder;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Acl;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.Document;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.MutableAcl;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.MutableDocument;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.NuxeoResource;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.NuxeoResponse;
+import org.apache.manifoldcf.crawler.connectors.nuxeo.model.builder.NuxeoResourceBuilder;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author David Arroyo Escobar <ar...@gmail.com>
+ *
+ */
+public class NuxeoClient {
+	private static final String CONTENT_PATH = "site/api/v1/";
+	private static final String CONTENT_QUERY = CONTENT_PATH + "query";
+	private static final String CONTENT_UUID = CONTENT_PATH + "id";
+	public static final String CONTENT_AUTHORITY = CONTENT_PATH + "user";
+	public static final String CONTENT_TAG = CONTENT_PATH + "";
+
+	private Logger logger = LoggerFactory.getLogger(NuxeoClient.class);
+
+	private String protocol;
+	private Integer port;
+	private String host;
+	private String path;
+	private String username;
+	private String password;
+
+	private CloseableHttpClient httpClient;
+	private HttpClientContext httpContext;
+
+	public NuxeoClient(String protocol, String host, Integer port, String path, String username, String password)
+			throws ManifoldCFException {
+
+		this.protocol = protocol;
+		this.host = host;
+		this.port = port;
+		this.path = path;
+		this.username = username;
+		this.password = password;
+
+		connect();
+	}
+
+	private void connect() throws ManifoldCFException {
+		int socketTimeout = 900000;
+		int connectionTimeout = 60000;
+		int inactivityTimeout = 2000;
+
+		SSLSocketFactory httpsSocketFactory = KeystoreManagerFactory.getTrustingSecureSocketFactory();
+		SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
+				new InterruptibleSocketFactory(httpsSocketFactory, connectionTimeout), NoopHostnameVerifier.INSTANCE);
+
+		PoolingHttpClientConnectionManager poolingHttpClientConnectionManager = new PoolingHttpClientConnectionManager(
+				RegistryBuilder.<ConnectionSocketFactory> create()
+						.register("http", PlainConnectionSocketFactory.getSocketFactory())
+						.register("https", sslConnectionSocketFactory).build());
+
+		poolingHttpClientConnectionManager.setDefaultMaxPerRoute(1);
+		poolingHttpClientConnectionManager.setValidateAfterInactivity(inactivityTimeout);
+		poolingHttpClientConnectionManager
+				.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).setSoTimeout(socketTimeout).build());
+
+		RequestConfig.Builder requestBuilder = RequestConfig.custom().setCircularRedirectsAllowed(true)
+				.setSocketTimeout(socketTimeout).setExpectContinueEnabled(true).setConnectTimeout(connectionTimeout)
+				.setConnectionRequestTimeout(socketTimeout);
+
+		httpClient = HttpClients.custom().setConnectionManager(poolingHttpClientConnectionManager)
+				.disableAutomaticRetries().setDefaultRequestConfig(requestBuilder.build())
+				.setRequestExecutor(new HttpRequestExecutor(socketTimeout))
+				.setRedirectStrategy(new DefaultRedirectStrategy()).build();
+	}
+
+	public Boolean check() throws Exception {
+		HttpResponse response;
+
+		try {
+			if (httpClient == null)
+				connect();
+
+			String url = String.format("%s://%s:%s%s/%s?pageSize=1", protocol, host, port, path, CONTENT_QUERY);
+
+			HttpGet httpGet = createGetRequest(url);
+			response = httpClient.execute(httpGet);
+			int statusCode = response.getStatusLine().getStatusCode();
+			if (statusCode != 200)
+				throw new Exception("[Checking connection] Nuxeo server appears to be down");
+			else
+				return true;
+		} catch (IOException e) {
+			throw new Exception("Nuxeo apeears to be down", e);
+		}
+	}
+
+	public boolean checkAuth() throws Exception {
+		// HttpResponse response;
+
+		// try {
+		if (httpClient == null)
+			connect();
+
+		try {
+			getUserAuthorities("Administrator");
+			return true;
+		} catch (IOException e) {
+			throw new Exception("Nuxeo apeears to be down", e);
+		}
+	}
+
+	/**
+	 * @param url
+	 * @return
+	 */
+	private HttpGet createGetRequest(String url) {
+		String sanitizedUrl = sanitizedUrl(url);
+
+		HttpGet httpGet = new HttpGet(sanitizedUrl);
+
+		httpGet.addHeader("accepted", "application/json");
+
+		if (useBasicAuthentication())
+			httpGet.addHeader("Authorization", "Basic " + Base64.encodeBase64String(
+					String.format("%s:%s", this.username, this.password).getBytes(Charset.forName("UTF-8"))));
+
+		return httpGet;
+	}
+
+	/**
+	 * @param url
+	 * @return
+	 */
+	private String sanitizedUrl(String url) {
+		int colonIndex = url.indexOf(":");
+
+		String urlWithoutProtocol = url.startsWith("http") ? url.substring(colonIndex + 3) : url;
+		String sanitizedUrl = urlWithoutProtocol.replace("\\/+", "/");
+		return url.substring(0, colonIndex) + "://" + sanitizedUrl;
+	}
+
+	/**
+	 * @return
+	 */
+	private boolean useBasicAuthentication() {
+		return this.username != null && !"".equals(this.username) && this.password != null;
+	}
+
+	/**
+	 * @param lastStart
+	 * @param defaultSize
+	 * @param object
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public NuxeoResponse<Document> getDocuments(List<String> domains, List<String> documentsType,
+			String lastSeedVersion, int start, int limit, Object object) throws Exception {
+
+		String url = null;
+
+		String q = createQuery(lastSeedVersion, domains, documentsType);
+		if (lastSeedVersion == null || lastSeedVersion.isEmpty())
+			url = String.format("%s://%s:%s/%s/%s?%s&pageSize=%s&currentPageIndex=%s", protocol, host, port, path,
+					CONTENT_QUERY, q, limit, start);
+		else
+			url = String.format("%s://%s:%s/%s/%s?%s&pageSize=%s&currentPageIndex=%s&queryParams=%s", protocol, host,
+					port, path, CONTENT_QUERY, q, limit, start, lastSeedVersion);
+
+		url = sanitizedUrl(url);
+
+		return (NuxeoResponse<Document>) getNuxeoResource(url, Document.builder());
+	}
+
+	public String createQuery(String lastSeedVersion, List<String> domains, List<String> documentsType) {
+		String query = "SELECT * FROM Document";
+
+		if (!domains.isEmpty() || !documentsType.isEmpty() || (lastSeedVersion != null && !lastSeedVersion.isEmpty())) {
+			query += " WHERE ";
+
+			if (lastSeedVersion != null && !lastSeedVersion.isEmpty()) {
+				query += "dc:modified > ?";
+			}
+
+			if (!domains.isEmpty()) {
+				Iterator<String> itdom = domains.iterator();
+
+				if (lastSeedVersion != null && !lastSeedVersion.isEmpty())
+					query = String.format("%s %s", query, " AND ");
+
+				query = String.format("%s ( ecm:path STARTSWITH '/%s'", query, itdom.next());
+
+				while (itdom.hasNext()) {
+					query = String.format("%s OR ecm:path STARTSWITH '/%s'", query, itdom.next());
+				}
+
+				query = String.format("%s)", query);
+			}
+
+			if (!documentsType.isEmpty()) {
+				Iterator<String> itDocTy = documentsType.iterator();
+
+				if ((lastSeedVersion != null && !lastSeedVersion.isEmpty()) || !domains.isEmpty())
+					query = String.format("%s %s", query, " AND ");
+				query = String.format("%s ( ecm:primaryType = '%s'", query, itDocTy.next());
+
+				while (itDocTy.hasNext()) {
+					query = String.format("%s OR ecm:primaryType = '%s'", query, itDocTy.next());
+				}
+
+				query = String.format("%s)", query);
+			}
+
+		}
+
+		query = URLEncoder.encode(query);
+		query = String.format("%s%s", "query=", query);
+		return query;
+	}
+
+	/**
+	 * @param url
+	 * @param builder
+	 * @return
+	 */
+	private NuxeoResponse<? extends NuxeoResource> getNuxeoResource(String url,
+			NuxeoResourceBuilder<? extends Document> builder) throws Exception {
+
+		try {
+			HttpGet httpGet = createGetRequest(url);
+			HttpResponse response = executeRequest(httpGet);
+
+			NuxeoResponse<? extends NuxeoResource> nuxeoResponse = responseFromHttpEntity(response.getEntity(),
+					builder);
+			EntityUtils.consume(response.getEntity());
+			return nuxeoResponse;
+		} catch (IOException e) {
+			throw new Exception("Nuxeo appears to be down", e);
+		}
+	}
+
+	/**
+	 * @param entity
+	 * @param builder
+	 * @return
+	 */
+	private <T extends NuxeoResource> NuxeoResponse<T> responseFromHttpEntity(HttpEntity entity,
+			NuxeoResourceBuilder<T> builder) throws Exception {
+
+		String stringEntity = EntityUtils.toString(entity);
+
+		JSONObject responseObject;
+
+		try {
+			responseObject = new JSONObject(stringEntity);
+			NuxeoResponse<T> response = NuxeoResponse.fromJson(responseObject, builder);
+
+			return response;
+		} catch (JSONException e) {
+			throw new Exception();
+		}
+	}
+
+	/**
+	 * @param httpGet
+	 * @return
+	 */
+	private HttpResponse executeRequest(HttpUriRequest request) throws Exception {
+
+		HttpResponse response = httpClient.execute(request, httpContext);
+
+		if (response.getStatusLine().getStatusCode() != 200) {
+			throw new Exception("Nuxeo error. " + response.getStatusLine().getStatusCode() + " "
+					+ response.getStatusLine().getReasonPhrase());
+		}
+		return response;
+	}
+
+	/**
+	 * @param documentId
+	 * @return
+	 * @throws ServiceInterruption 
+	 */
+	public Document getDocument(String documentId) throws ServiceInterruption {
+
+		String url = getPathDocument(documentId);
+
+		url = sanitizedUrl(url);
+
+		try {
+
+			HttpGet httpGet = createGetRequest(url);
+			httpGet.addHeader("X-NXDocumentProperties", "*");
+			HttpResponse response = executeRequest(httpGet);
+			HttpEntity entity = response.getEntity();
+			MutableDocument mDocument = documentFromHttpEmpty(entity);
+			EntityUtils.consume(entity);
+
+			return mDocument;
+		} catch (Exception e) {
+			logger.debug("Failed documentId:" + documentId,e);
+			long interruptionRetryTime = 5L * 60L * 1000L;
+			String message = "Server appears down during seeding: " + e.getMessage();
+			throw new ServiceInterruption(message, e, System.currentTimeMillis() + interruptionRetryTime,
+					-1L, 3, true);
+		}
+	}
+
+	public Acl getAcl(String documentId) {
+
+		String url = getPathDocument(documentId);
+		url += "/@acl";
+
+		url = sanitizedUrl(url);
+
+		try {
+
+			HttpGet httpGet = createGetRequest(url);
+			HttpResponse response = executeRequest(httpGet);
+			HttpEntity entity = response.getEntity();
+			MutableAcl mAcl = aclFromHttpEmpty(entity);
+			EntityUtils.consume(entity);
+
+			return mAcl;
+		} catch (Exception e) {
+		}
+
+		return new Acl();
+	}
+
+	public String getPathDocument(String documentId) {
+		return String.format("%s://%s:%s%s/%s/%s", protocol, host, port, path, CONTENT_UUID, documentId);
+	}
+
+	/**
+	 * @param entity
+	 * @return
+	 */
+	private MutableDocument documentFromHttpEmpty(HttpEntity entity) throws Exception {
+		String stringEntity = EntityUtils.toString(entity);
+
+		JSONObject responseObject;
+
+		try {
+			responseObject = new JSONObject(stringEntity);
+
+			@SuppressWarnings("unchecked")
+			MutableDocument mDocument = ((NuxeoResourceBuilder<MutableDocument>) MutableDocument.builder())
+					.fromJson(responseObject, new MutableDocument());
+
+			return mDocument;
+		} catch (JSONException jsonException) {
+			throw new Exception("Error parsing JSON document response data");
+		}
+	}
+
+	private MutableAcl aclFromHttpEmpty(HttpEntity entity) throws Exception {
+		String stringEntity = EntityUtils.toString(entity);
+
+		JSONObject responseObject;
+
+		try {
+			responseObject = new JSONObject(stringEntity);
+
+			@SuppressWarnings("unchecked")
+			MutableAcl mAcl = ((NuxeoResourceBuilder<MutableAcl>) MutableAcl.builder()).fromJson(responseObject,
+					new MutableAcl());
+
+			return mAcl;
+		} catch (JSONException jsonException) {
+			throw new Exception("Error parsing JSON document response data");
+		}
+	}
+
+	public void close() {
+		if (httpClient != null) {
+			try {
+				httpClient.close();
+			} catch (IOException ioException) {
+				ioException.printStackTrace();
+			}
+		}
+
+	}
+
+	public List<String> getUserAuthorities(String username) throws Exception {
+		List<String> authorities = new ArrayList<String>();
+
+		String url = String.format("%s://%s:%s/%s/%s/%s", protocol, host, port, path, CONTENT_AUTHORITY, username);
+
+		url = sanitizedUrl(url);
+
+		HttpGet httpGet = createGetRequest(url);
+		HttpResponse response = executeRequest(httpGet);
+		HttpEntity entity = response.getEntity();
+		String stringEntity = EntityUtils.toString(entity);
+		EntityUtils.consume(entity);
+
+		JSONObject user = new JSONObject(stringEntity);
+		authorities.add(user.getString("id"));
+
+		JSONObject properties = user.optJSONObject("properties");
+
+		if (properties != null) {
+			JSONArray groups = properties.optJSONArray("groups");
+
+			for (int i = 0; i < groups.length(); i++) {
+				authorities.add(groups.getString(i));
+			}
+		}
+
+		return authorities;
+	}
+
+	/**
+	 * @param uid
+	 * @return
+	 * @throws Exception
+	 */
+	public String[] getTags(String uid) throws Exception {
+		List<String> tags = new ArrayList<>();
+
+		String query = "select%20*%20from%20Tagging%20where%20relation%3Asource='" + uid + "'";
+		String url = String.format("%s://%s:%s/%s/%s?query=%s", protocol, host, port, path, CONTENT_QUERY, query);
+		url = sanitizedUrl(url);
+
+		HttpGet httpGet = createGetRequest(url);
+		HttpResponse response = executeRequest(httpGet);
+		HttpEntity entity = response.getEntity();
+		String stringEntity = EntityUtils.toString(entity);
+		EntityUtils.consume(entity);
+
+		JSONArray tagsObject = new JSONObject(stringEntity).getJSONArray("entries");
+
+		for (int i = 0; i < tagsObject.length(); i++) {
+			tags.add(tagsObject.getJSONObject(i).getString("title"));
+		}
+
+		return tags.toArray(new String[tags.size()]);
+	}
+
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java
------------------------------------------------------------------------------
    svn:executable = *

Added: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java?rev=1770894&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java (added)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java Tue Nov 22 23:11:08 2016
@@ -0,0 +1,17 @@
+package org.apache.manifoldcf.crawler.connectors.nuxeo.exception;
+
+public class NuxeoException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7504820888917970500L;
+
+	public NuxeoException(String message) {
+		super(message);
+	}
+
+	public NuxeoException(String message, Throwable throwable) {
+		super(message, throwable);
+	}
+}

Propchange: manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java
------------------------------------------------------------------------------
    svn:executable = *