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

svn commit: r1770925 [1/3] - in /manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src: main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/ main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/ main/java/org/apache/manifoldc...

Author: kwright
Date: Wed Nov 23 07:28:32 2016
New Revision: 1770925

URL: http://svn.apache.org/viewvc?rev=1770925&view=rev
Log:
Bring into compliance with MCF header and formatting rules

Added:
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/AbstractTestBase.java
      - copied, changed from r1770899, manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/AbstractTest.java
Removed:
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/AbstractTest.java
Modified:
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoRepositoryConnector.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/client/NuxeoClient.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/exception/NuxeoException.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Ace.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Acl.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Attachment.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/Document.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/DocumentType.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/MutableAcl.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/MutableDocument.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/NuxeoResource.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/NuxeoResponse.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/model/builder/NuxeoResourceBuilder.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/authorities/nuxeo/tests/NuxeoAuthorityTest.java
    manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/nuxeo/tests/NuxeoConnectorTest.java

Modified: 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=1770925&r1=1770924&r2=1770925&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java (original)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/Messages.java Wed Nov 23 07:28:32 2016
@@ -1,3 +1,21 @@
+/* $Id: DefaultAuthenticator.java 1688076 2015-06-28 23:04:30Z kwright $ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.manifoldcf.authorities.authorities.nuxeo;
 
 import java.util.Locale;
@@ -8,97 +26,97 @@ import org.apache.manifoldcf.core.interf
 
 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";
+  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);
-	}
+  /** 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);
+  }
 
 }

Modified: 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=1770925&r1=1770924&r2=1770925&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nuxeo/NuxeoAuthorityConnector.java Wed Nov 23 07:28:32 2016
@@ -1,3 +1,21 @@
+/* $Id: DefaultAuthenticator.java 1688076 2015-06-28 23:04:30Z kwright $ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.manifoldcf.authorities.authorities.nuxeo;
 
 import java.io.IOException;
@@ -28,281 +46,281 @@ import org.apache.manifoldcf.crawler.con
  */
 public class NuxeoAuthorityConnector extends BaseAuthorityConnector {
 
-	// Configuration tabs
-	private static final String CONF_SERVER_TAB_PROPERTY = "NuxeoAuthorityConnector.Server";
+  // 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_";
+  // 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;
-		}
-	}
+  // 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;
+    }
+  }
 }

Modified: 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=1770925&r1=1770924&r2=1770925&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java (original)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/Messages.java Wed Nov 23 07:28:32 2016
@@ -1,3 +1,21 @@
+/* $Id: DefaultAuthenticator.java 1688076 2015-06-28 23:04:30Z kwright $ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.manifoldcf.crawler.connectors.nuxeo;
 
 import java.util.Locale;
@@ -8,98 +26,98 @@ import org.apache.manifoldcf.core.interf
 
 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";
+  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);
-	}
+  /** 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);
+  }
 
 }

Modified: 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=1770925&r1=1770924&r2=1770925&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java (original)
+++ manifoldcf/branches/CONNECTORS-1290/connectors/nuxeo/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/nuxeo/NuxeoConfiguration.java Wed Nov 23 07:28:32 2016
@@ -1,3 +1,21 @@
+/* $Id: DefaultAuthenticator.java 1688076 2015-06-28 23:04:30Z kwright $ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.manifoldcf.crawler.connectors.nuxeo;
 
 /**
@@ -11,35 +29,35 @@ package org.apache.manifoldcf.crawler.co
  */
 public class NuxeoConfiguration {
 
-	public static interface Server {
+  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";
+    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";
 
-	}
+  }
 }