incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1294698 - /incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/
Date Tue, 28 Feb 2012 15:38:38 GMT
Author: piergiorgio
Date: Tue Feb 28 15:38:38 2012
New Revision: 1294698

URL: http://svn.apache.org/viewvc?rev=1294698&view=rev
Log:
added a fix for the check method of the ElasticSearch connector: now the connector works correctly
using the search server without any index defined

Modified:
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java

Modified: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java?rev=1294698&r1=1294697&r2=1294698&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
(original)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java
Tue Feb 28 15:38:38 2012
@@ -29,11 +29,11 @@ public class ElasticSearchAction extends
     _optimize, _refresh, _status;
   }
 
-  public ElasticSearchAction(HttpClient client, CommandEnum cmd, ElasticSearchConfig config)
+  public ElasticSearchAction(HttpClient client, CommandEnum cmd, ElasticSearchConfig config,
boolean checkConnection)
       throws ManifoldCFException
   {
     super(config, client);
-    StringBuffer url = getApiUrl(cmd.toString());
+    StringBuffer url = getApiUrl(cmd.toString(), checkConnection);
     GetMethod method = new GetMethod(url.toString());
     call(method);
     if ("true".equals(checkJson(jsonStatus)))

Modified: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java?rev=1294698&r1=1294697&r2=1294698&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
(original)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
Tue Feb 28 15:38:38 2012
@@ -79,13 +79,14 @@ public class ElasticSearchConnection
     }
   }
 
-  protected StringBuffer getApiUrl(String command) throws ManifoldCFException
+  protected StringBuffer getApiUrl(String command, boolean checkConnection) throws ManifoldCFException
   {
     StringBuffer url = new StringBuffer(serverLocation);
     if (!serverLocation.endsWith("/"))
       url.append('/');
-    url.append(urlEncode(indexName));
-    url.append("/" + command);
+    if(!checkConnection)
+      url.append(urlEncode(indexName)+"/");
+    url.append(command);
     callUrlSnippet = url.toString();
     if (userName != null && apiKey != null && userName.length() > 0
         && apiKey.length() > 0)

Modified: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java?rev=1294698&r1=1294697&r2=1294698&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
(original)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
Tue Feb 28 15:38:38 2012
@@ -22,9 +22,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
-import java.util.TreeMap;
 
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.manifoldcf.agents.interfaces.IOutputAddActivity;
 import org.apache.manifoldcf.agents.interfaces.IOutputNotifyActivity;
@@ -42,8 +42,6 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.IThreadContext;
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -370,7 +368,7 @@ public class ElasticSearchConnector exte
   public String check() throws ManifoldCFException
   {
     ElasticSearchAction oss = new ElasticSearchAction(client, CommandEnum._status,
-      getConfigParameters(null));
+      getConfigParameters(null), true);
     String resultName = oss.getResult().name();
     if (resultName.equals("OK"))
       return super.check();
@@ -383,7 +381,7 @@ public class ElasticSearchConnector exte
   {
     long startTime = System.currentTimeMillis();
     ElasticSearchAction oo = new ElasticSearchAction(client, CommandEnum._optimize,
-        getConfigParameters(null));
+        getConfigParameters(null), false);
     activities.recordActivity(startTime, ELASTICSEARCH_OPTIMIZE_ACTIVITY, null,
         oo.getCallUrlSnippet(), oo.getResult().name(),
         oo.getResultDescription());

Modified: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java?rev=1294698&r1=1294697&r2=1294698&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
(original)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Tue Feb 28 15:38:38 2012
@@ -102,7 +102,7 @@ public class ElasticSearchIndex extends 
   {
     super(config, client);
     String fileName = FilenameUtils.getName(documentURI);
-    StringBuffer url = getApiUrl(config.getIndexType() + "/" + fileName);
+    StringBuffer url = getApiUrl(config.getIndexType() + "/" + fileName, false);
     PutMethod put = new PutMethod(url.toString());
     RequestEntity entity = new IndexRequestEntity(documentURI, inputStream);
     put.setRequestEntity(entity);



Mime
View raw message