Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B5FBAE18D for ; Tue, 19 Mar 2013 00:23:46 +0000 (UTC) Received: (qmail 37367 invoked by uid 500); 19 Mar 2013 00:23:46 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 37326 invoked by uid 500); 19 Mar 2013 00:23:46 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 37319 invoked by uid 99); 19 Mar 2013 00:23:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Mar 2013 00:23:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Mar 2013 00:23:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 820D9238889B; Tue, 19 Mar 2013 00:23:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1458070 - in /manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main: java/org/apache/manifoldcf/crawler/connectors/livelink/ native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/ Date: Tue, 19 Mar 2013 00:23:24 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130319002324.820D9238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Tue Mar 19 00:23:23 2013 New Revision: 1458070 URL: http://svn.apache.org/r1458070 Log: Hook up session initialization into keystore and other new parameters. Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LLSERVER.java manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LLSERVER.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LLSERVER.java?rev=1458070&r1=1458069&r2=1458070&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LLSERVER.java (original) +++ manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LLSERVER.java Tue Mar 19 00:23:23 2013 @@ -134,8 +134,23 @@ public class LLSERVER OutputStreamWriter osw = new OutputStreamWriter(fos,"ASCII"); try { + osw.write("-----BEGIN CERTIFICATE-----\n"); String certBase64 = new Base64().encodeByteArray(certData); - osw.write(certBase64); + int offset = 0; + while (offset < certBase64.length()) + { + int remainder = certBase64.length() - offset; + if (remainder < 64) + { + osw.write(certBase64,offset,remainder); + osw.write("\n"); + break; + } + osw.write(certBase64,offset,64); + offset += 64; + osw.write("\n"); + } + osw.write("-----END CERTIFICATE-----\n"); } finally { Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java?rev=1458070&r1=1458069&r2=1458070&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java (original) +++ manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java Tue Mar 19 00:23:23 2013 @@ -45,10 +45,11 @@ public class LivelinkAuthority extends o { public static final String _rcsid = "@(#)$Id: LivelinkAuthority.java 988245 2010-08-23 18:39:35Z kwright $"; + boolean hasConnected = false; + // Data from the parameters private String serverProtocol = null; private String serverName = null; - private String serverPortString = null; private int serverPort = -1; private String serverUsername = null; private String serverPassword = null; @@ -119,65 +120,93 @@ public class LivelinkAuthority extends o public void connect(ConfigParams configParams) { super.connect(configParams); - - // First, create server object (llServer) - serverName = configParams.getParameter(LiveLinkParameters.serverName); - serverPortString = configParams.getParameter(LiveLinkParameters.serverPort); - serverUsername = configParams.getParameter(LiveLinkParameters.serverUsername); - serverPassword = configParams.getObfuscatedParameter(LiveLinkParameters.serverPassword); - - // These have been deprecated - String userNamePattern = configParams.getParameter(LiveLinkParameters.userNameRegexp); - String userEvalExpression = configParams.getParameter(LiveLinkParameters.livelinkNameSpec); - String userNameMapping = configParams.getParameter(LiveLinkParameters.userNameMapping); - if ((userNameMapping == null || userNameMapping.length() == 0) && userNamePattern != null && userEvalExpression != null) - { - // Create a matchmap using the old system - matchMap = new MatchMap(); - matchMap.appendOldstyleMatchPair(userNamePattern,userEvalExpression); - } - else - { - if (userNameMapping == null) - userNameMapping = "(.*)\\\\@([A-Z|a-z|0-9|_|-]*)\\\\.(.*)=$(2)\\$(1l)"; - matchMap = new MatchMap(userNameMapping); - } - - if (serverPortString == null) - serverPort = 80; - else - serverPort = new Integer(serverPortString).intValue(); - - cacheLifetime = configParams.getParameter(LiveLinkParameters.cacheLifetime); - if (cacheLifetime == null) - cacheLifetime = "1"; - cacheLRUsize = configParams.getParameter(LiveLinkParameters.cacheLRUSize); - if (cacheLRUsize == null) - cacheLRUsize = "1000"; - - } - protected void attemptToConnect() + protected void getSession() throws ManifoldCFException, ServiceInterruption { - try + if (!hasConnected) { - responseLifetime = Long.parseLong(this.cacheLifetime) * 60L * 1000L; - LRUsize = Integer.parseInt(this.cacheLRUsize); - } - catch (NumberFormatException e) - { - throw new ManifoldCFException("Cache lifetime or Cache LRU size must be an integer: "+e.getMessage(),e); - } + // Server parameters + serverProtocol = params.getParameter(LiveLinkParameters.serverProtocol); + serverName = params.getParameter(LiveLinkParameters.serverName); + String serverPortString = params.getParameter(LiveLinkParameters.serverPort); + serverUsername = params.getParameter(LiveLinkParameters.serverUsername); + serverPassword = params.getObfuscatedParameter(LiveLinkParameters.serverPassword); + serverHTTPCgi = params.getParameter(LiveLinkParameters.serverHTTPCgiPath); + serverHTTPNTLMDomain = params.getParameter(LiveLinkParameters.serverHTTPNTLMDomain); + serverHTTPNTLMUsername = params.getParameter(LiveLinkParameters.serverHTTPNTLMUsername); + serverHTTPNTLMPassword = params.getObfuscatedParameter(LiveLinkParameters.serverHTTPNTLMPassword); + + // These have been deprecated + String userNamePattern = params.getParameter(LiveLinkParameters.userNameRegexp); + String userEvalExpression = params.getParameter(LiveLinkParameters.livelinkNameSpec); + String userNameMapping = params.getParameter(LiveLinkParameters.userNameMapping); + if ((userNameMapping == null || userNameMapping.length() == 0) && userNamePattern != null && userEvalExpression != null) + { + // Create a matchmap using the old system + matchMap = new MatchMap(); + matchMap.appendOldstyleMatchPair(userNamePattern,userEvalExpression); + } + else + { + if (userNameMapping == null) + userNameMapping = "(.*)\\\\@([A-Z|a-z|0-9|_|-]*)\\\\.(.*)=$(2)\\$(1l)"; + matchMap = new MatchMap(userNameMapping); + } - if (LLUsers == null) - { + // Server parameter processing + + if (serverProtocol == null || serverProtocol.length() == 0) + serverProtocol = "internal"; + + if (serverPortString == null) + serverPort = 2099; + else + serverPort = new Integer(serverPortString).intValue(); + + if (serverHTTPNTLMDomain != null && serverHTTPNTLMDomain.length() == 0) + serverHTTPNTLMDomain = null; + if (serverHTTPNTLMUsername == null || serverHTTPNTLMUsername.length() == 0) + { + serverHTTPNTLMUsername = serverUsername; + if (serverHTTPNTLMPassword == null || serverHTTPNTLMPassword.length() == 0) + serverHTTPNTLMPassword = serverPassword; + } + else + { + if (serverHTTPNTLMUsername == null) + serverHTTPNTLMUsername = ""; + if (serverHTTPNTLMPassword == null) + serverHTTPNTLMPassword = ""; + } + + // Set up server ssl if indicated + String serverHTTPSKeystoreData = params.getParameter(LiveLinkParameters.serverHTTPSKeystore); + if (serverHTTPSKeystoreData != null) + serverHTTPSKeystore = KeystoreManagerFactory.make("",serverHTTPSKeystoreData); + + cacheLifetime = params.getParameter(LiveLinkParameters.cacheLifetime); + if (cacheLifetime == null) + cacheLifetime = "1"; + cacheLRUsize = params.getParameter(LiveLinkParameters.cacheLRUSize); + if (cacheLRUsize == null) + cacheLRUsize = "1000"; + + try + { + responseLifetime = Long.parseLong(this.cacheLifetime) * 60L * 1000L; + LRUsize = Integer.parseInt(this.cacheLRUsize); + } + catch (NumberFormatException e) + { + throw new ManifoldCFException("Cache lifetime or Cache LRU size must be an integer: "+e.getMessage(),e); + } if (Logging.authorityConnectors.isDebugEnabled()) { String passwordExists = (serverPassword!=null && serverPassword.length() > 0)?"password exists":""; - Logging.authorityConnectors.debug("Livelink: Livelink connection parameters: Server='"+serverName+"'; port='"+serverPortString+"'; user name='"+serverUsername+"'; "+passwordExists); + Logging.authorityConnectors.debug("Livelink: Livelink connection parameters: Server='"+serverName+"'; port='"+serverPort+"'; user name='"+serverUsername+"'; "+passwordExists); } int sanityRetryCount = FAILURE_RETRY_COUNT; @@ -196,6 +225,7 @@ public class LivelinkAuthority extends o { Logging.authorityConnectors.debug("Livelink: Livelink session created."); } + hasConnected = true; return; } catch (RuntimeException e) @@ -218,8 +248,8 @@ public class LivelinkAuthority extends o try { // Reestablish the session - LLUsers = null; - attemptToConnect(); + hasConnected = false; + getSession(); // Get user info for the crawl user, to make sure it works int sanityRetryCount = FAILURE_RETRY_COUNT; while (true) @@ -261,15 +291,23 @@ public class LivelinkAuthority extends o } LLUsers = null; matchMap = null; + + serverProtocol = null; serverName = null; - serverPortString = null; serverPort = -1; serverUsername = null; serverPassword = null; - + serverHTTPCgi = null; + serverHTTPNTLMDomain = null; + serverHTTPNTLMUsername = null; + serverHTTPNTLMPassword = null; + serverHTTPSKeystore = null; + cacheLifetime = null; cacheLRUsize = null; + hasConnected = false; + super.disconnect(); } @@ -337,7 +375,7 @@ public class LivelinkAuthority extends o try { - attemptToConnect(); + getSession(); int sanityRetryCount = FAILURE_RETRY_COUNT; while (true) Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1458070&r1=1458069&r2=1458070&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java (original) +++ manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java Tue Mar 19 00:23:23 2013 @@ -157,7 +157,6 @@ public class LivelinkConnector extends o private String ingestNtlmPassword = null; // SSL support for ingestion - private String ingestKeystoreData = null; private IKeystoreManager ingestKeystoreManager = null; // Connection management @@ -319,9 +318,14 @@ public class LivelinkConnector extends o ingestNtlmUsername = params.getParameter(LiveLinkParameters.ingestNtlmUsername); ingestNtlmPassword = params.getObfuscatedParameter(LiveLinkParameters.ingestNtlmPassword); + serverProtocol = params.getParameter(LiveLinkParameters.serverProtocol); String serverPortString = params.getParameter(LiveLinkParameters.serverPort); serverUsername = params.getParameter(LiveLinkParameters.serverUsername); serverPassword = params.getObfuscatedParameter(LiveLinkParameters.serverPassword); + serverHTTPCgi = params.getParameter(LiveLinkParameters.serverHTTPCgiPath); + serverHTTPNTLMDomain = params.getParameter(LiveLinkParameters.serverHTTPNTLMDomain); + serverHTTPNTLMUsername = params.getParameter(LiveLinkParameters.serverHTTPNTLMUsername); + serverHTTPNTLMPassword = params.getObfuscatedParameter(LiveLinkParameters.serverHTTPNTLMPassword); if (ingestProtocol == null || ingestProtocol.length() == 0) ingestProtocol = "http"; @@ -404,18 +408,43 @@ public class LivelinkConnector extends o } } - // First, create server object (llServer) + // Server parameter processing + if (serverProtocol == null || serverProtocol.length() == 0) + serverProtocol = "internal"; + if (serverPortString == null) serverPort = 2099; else serverPort = new Integer(serverPortString).intValue(); + + if (serverHTTPNTLMDomain != null && serverHTTPNTLMDomain.length() == 0) + serverHTTPNTLMDomain = null; + if (serverHTTPNTLMUsername == null || serverHTTPNTLMUsername.length() == 0) + { + serverHTTPNTLMUsername = serverUsername; + if (serverHTTPNTLMPassword == null || serverHTTPNTLMPassword.length() == 0) + serverHTTPNTLMPassword = serverPassword; + } + else + { + if (serverHTTPNTLMUsername == null) + serverHTTPNTLMUsername = ""; + if (serverHTTPNTLMPassword == null) + serverHTTPNTLMPassword = ""; + } // Set up connection manager PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager(); localConnectionManager.setMaxTotal(1); - // Set up ssl if indicated - ingestKeystoreData = params.getParameter(LiveLinkParameters.ingestKeystore); + + // Set up server ssl if indicated + String serverHTTPSKeystoreData = params.getParameter(LiveLinkParameters.serverHTTPSKeystore); + if (serverHTTPSKeystoreData != null) + serverHTTPSKeystore = KeystoreManagerFactory.make("",serverHTTPSKeystoreData); + + // Set up ingest ssl if indicated + String ingestKeystoreData = params.getParameter(LiveLinkParameters.ingestKeystore); if (ingestKeystoreData != null) { ingestKeystoreManager = KeystoreManagerFactory.make("",ingestKeystoreData); @@ -628,14 +657,19 @@ public class LivelinkConnector extends o llServer = null; LLDocs = null; LLAttributes = null; - ingestKeystoreData = null; ingestKeystoreManager = null; ingestPortNumber = -1; + serverProtocol = null; serverName = null; serverPort = -1; serverUsername = null; serverPassword = null; + serverHTTPCgi = null; + serverHTTPNTLMDomain = null; + serverHTTPNTLMUsername = null; + serverHTTPNTLMPassword = null; + serverHTTPSKeystore = null; ingestPort = null; ingestProtocol = null; @@ -1526,6 +1560,20 @@ public class LivelinkConnector extends o " editconnection.serverport.focus();\n"+ " return false;\n"+ " }\n"+ +" if (editconnection.serverhttpcgipath.value == \"\")\n"+ +" {\n"+ +" alert(\""+Messages.getBodyJavascriptString(locale,"LivelinkConnector.EnterTheServerCgiPathToLivelink")+"\");\n"+ +" SelectTab(\"" + Messages.getBodyJavascriptString(locale,"LivelinkConnector.Server") + "\");\n"+ +" editconnection.serverhttpcgipath.focus();\n"+ +" return false;\n"+ +" }\n"+ +" if (editconnection.serverhttpcgipath.value.substring(0,1) != \"/\")\n"+ +" {\n"+ +" alert(\""+Messages.getBodyJavascriptString(locale,"LivelinkConnector.TheServerCgiPathMustBeginWithACharacter")+"\");\n"+ +" SelectTab(\"" + Messages.getBodyJavascriptString(locale,"LivelinkConnector.Server") + "\");\n"+ +" editconnection.serverhttpcgipath.focus();\n"+ +" return false;\n"+ +" }\n"+ " if (editconnection.ingestcgipath.value == \"\")\n"+ " {\n"+ " alert(\""+Messages.getBodyJavascriptString(locale,"LivelinkConnector.EnterTheCrawlCgiPathToLivelink")+"\");\n"+ @@ -1588,7 +1636,7 @@ public class LivelinkConnector extends o serverPassword = ""; String serverHTTPCgiPath = parameters.getParameter(LiveLinkParameters.serverHTTPCgiPath); if (serverHTTPCgiPath == null) - serverHTTPCgiPath = ""; + serverHTTPCgiPath = "/livelink/livelink.exe"; String serverHTTPNTLMDomain = parameters.getParameter(LiveLinkParameters.serverHTTPNTLMDomain); if (serverHTTPNTLMDomain == null) serverHTTPNTLMDomain = ""; Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties?rev=1458070&r1=1458069&r2=1458070&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties (original) +++ manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties Tue Mar 19 00:23:23 2013 @@ -139,3 +139,5 @@ LivelinkConnector.ServerHTTPNTLMDomain=S LivelinkConnector.ServerHTTPNTLMUsername=Server HTTP NTLM user name: LivelinkConnector.ServerHTTPNTLMPassword=Server HTTP NTLM password: LivelinkConnector.ServerSSLCertificateList=Server SSL certificate list: +LivelinkConnector.EnterTheServerCgiPathToLivelink=Enter the server CGI path to reach Livelink +LivelinkConnector.TheServerCgiPathMustBeginWithACharacter=The server CGI path must begin with a '/' character Modified: manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties?rev=1458070&r1=1458069&r2=1458070&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties (original) +++ manifoldcf/branches/CONNECTORS-664/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties Tue Mar 19 00:23:23 2013 @@ -139,3 +139,5 @@ LivelinkConnector.ServerHTTPNTLMDomain=S LivelinkConnector.ServerHTTPNTLMUsername=Server HTTP NTLM user name: LivelinkConnector.ServerHTTPNTLMPassword=Server HTTP NTLM password: LivelinkConnector.ServerSSLCertificateList=Server SSL certificate list: +LivelinkConnector.EnterTheServerCgiPathToLivelink=Enter the server CGI path to reach Livelink +LivelinkConnector.TheServerCgiPathMustBeginWithACharacter=The server CGI path must begin with a '/' character