Author: molgun
Date: Tue Oct 21 13:40:22 2014
New Revision: 1633378
URL: http://svn.apache.org/r1633378
Log:
CONNECTORS-1077: For GTS and some improvements for ES and OpenSearch
Modified:
manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerAction.java
Modified:
manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java?rev=1633378&r1=1633377&r2=1633378&view=diff
==============================================================================
---
manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
(original)
+++
manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
Tue Oct 21 13:40:22 2014
@@ -23,7 +23,9 @@ import org.apache.http.client.methods.Ht
import org.apache.http.client.HttpClient;
import java.io.IOException;
+import java.util.Locale;
+import org.apache.manifoldcf.agents.interfaces.IOutputHistoryActivity;
import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
import org.apache.manifoldcf.crawler.system.Logging;
@@ -51,7 +53,7 @@ public class ElasticSearchAction extends
String error = checkJson(jsonException);
if (getResult() == Result.OK && error == null)
return;
- setResult(Result.ERROR, error);
+ setResult(IOutputHistoryActivity.JSON_ERROR,Result.ERROR, error);
Logging.connectors.warn("ES: Commit failed: "+getResponse());
}
@@ -61,7 +63,7 @@ public class ElasticSearchAction extends
// We want a quicker failure here!!
if (e instanceof java.io.InterruptedIOException && !(e instanceof
java.net.SocketTimeoutException))
throw new
ManifoldCFException(e.getMessage(),ManifoldCFException.INTERRUPTED);
- setResult(Result.ERROR, e.getMessage());
+
setResult(e.getClass().getSimpleName().toUpperCase(Locale.ROOT),Result.ERROR,
e.getMessage());
long currentTime = System.currentTimeMillis();
// One notification attempt, then we're done.
throw new ServiceInterruption("IO exception: "+e.getMessage(),e,
Modified:
manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java?rev=1633378&r1=1633377&r2=1633378&view=diff
==============================================================================
---
manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
(original)
+++
manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
Tue Oct 21 13:40:22 2014
@@ -178,6 +178,7 @@ public class HttpPoster
}
else
// Can't accept the document, because we don't know how to secure it
+
activities.recordActivity(null,GTSConnector.INGEST_ACTIVITY,null,documentURI,activities.UNKNOWN_SECURITY,"Rejected
document that has security info which GTS does not recognize: '"+ securityType
+ "'");
return false;
}
@@ -209,7 +210,7 @@ public class HttpPoster
// Log the activity, if any, regardless of any exception
if (t.getActivityCode() != null)
-
activities.recordActivity(t.getActivityStart(),GTSConnector.INGEST_ACTIVITY,t.getActivityBytes(),documentURI,t.getActivityCode(),t.getActivityDetails());
+
activities.recordActivity(t.getActivityStart(),GTSConnector.INGEST_ACTIVITY,t.getActivityBytes(),documentURI,t.getException().getClass().getSimpleName().toUpperCase(Locale.ROOT),t.getActivityDetails());
readFromDocumentStreamYet = (readFromDocumentStreamYet ||
t.getReadFromDocumentStreamYet());
@@ -410,7 +411,7 @@ public class HttpPoster
// Log the activity, if any, regardless of any exception
if (t.getActivityCode() != null)
-
activities.recordActivity(t.getActivityStart(),GTSConnector.REMOVE_ACTIVITY,null,documentURI,t.getActivityCode(),t.getActivityDetails());
+
activities.recordActivity(t.getActivityStart(),GTSConnector.REMOVE_ACTIVITY,null,documentURI,t.getException().getClass().getSimpleName().toUpperCase(Locale.ROOT),t.getActivityDetails());
Throwable thr = t.getException();
if (thr != null)
Modified:
manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerAction.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerAction.java?rev=1633378&r1=1633377&r2=1633378&view=diff
==============================================================================
---
manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerAction.java
(original)
+++
manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerAction.java
Tue Oct 21 13:40:22 2014
@@ -39,6 +39,6 @@ public class OpenSearchServerAction exte
call(method);
if ("OK".equals(checkXPath(xPathStatus)))
return;
- setResult(IOutputHistoryActivity.JSON_ERROR,Result.ERROR,
checkXPath(xPathException));
+ setResult(IOutputHistoryActivity.XPATH_EXCEPTION,Result.ERROR,
checkXPath(xPathException));
}
}