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 2013/03/19 01:23:24 UTC
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/
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