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 2012/02/05 23:00:40 UTC

svn commit: r1240849 [1/2] - in /incubator/lcf/branches/CONNECTORS-288: ./ connectors/elasticsearch/ connectors/elasticsearch/connector/ connectors/elasticsearch/connector/src/ connectors/elasticsearch/connector/src/main/ connectors/elasticsearch/conne...

Author: kwright
Date: Sun Feb  5 22:00:38 2012
New Revision: 1240849

URL: http://svn.apache.org/viewvc?rev=1240849&view=rev
Log:
Include patch from CONNECTORS-288.  Committed on behalf of Luca Stancapiano.

Added:
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/build.xml
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/
    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/ElasticSearchConfig.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/ElasticSearchDelete.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchParam.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSchema.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSpecs.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/Messages.java
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_en_US.properties
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_ja_JP.properties
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.js
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.js
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editSpecification_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editSpecification_en_US.js
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editSpecification_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editSpecification_ja_JP.js
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/hiddenConfiguration_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/hiddenConfiguration_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/hiddenSpecification_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/hiddenSpecification_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/viewConfiguration_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/viewConfiguration_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/viewSpecification_en_US.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/viewSpecification_ja_JP.html
    incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/pom.xml
Modified:
    incubator/lcf/branches/CONNECTORS-288/build.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/included-connectors.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/index.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/javadoc.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/en_US/writing-output-connectors.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/end-user-documentation.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/included-connectors_ja_JP.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/index.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/javadoc_ja_JP.xml
    incubator/lcf/branches/CONNECTORS-288/site/src/documentation/content/xdocs/ja_JP/writing-output-connectors.xml

Modified: incubator/lcf/branches/CONNECTORS-288/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/build.xml?rev=1240849&r1=1240848&r2=1240849&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/build.xml (original)
+++ incubator/lcf/branches/CONNECTORS-288/build.xml Sun Feb  5 22:00:38 2012
@@ -46,6 +46,7 @@
         <ant dir="connectors/memex" target="clean"/>
         <ant dir="connectors/meridio" target="clean"/>
         <ant dir="connectors/opensearchserver" target="clean"/>
+        <ant dir="connectors/elasticsearch" target="clean"/>
         <ant dir="connectors/nullauthority" target="clean"/>
         <ant dir="connectors/nulloutput" target="clean"/>
         <ant dir="connectors/rss" target="clean"/>
@@ -92,6 +93,7 @@
         <ant dir="connectors/memex" target="clean"/>
         <ant dir="connectors/meridio" target="clean"/>
         <ant dir="connectors/opensearchserver" target="clean"/>
+        <ant dir="connectors/elasticsearch" target="clean"/>
         <ant dir="connectors/nullauthority" target="clean"/>
         <ant dir="connectors/nulloutput" target="clean"/>
         <ant dir="connectors/rss" target="clean"/>
@@ -676,6 +678,47 @@
     <target name="run-tests-HSQLDB-opensearchserver-connector" depends="setup-opensearchserver-connector,setup-opensearchserver-connector-tests">
         <ant dir="connectors/opensearchserver" target="run-tests-HSQLDB"/>
     </target>
+	
+	
+	
+	
+
+
+    <target name="setup-elasticsearch-connector" depends="build-framework"/>
+
+    <target name="setup-elasticsearch-connector-tests" depends="build-tests-framework"/>
+
+    <target name="build-elasticsearch-connector" depends="setup-elasticsearch-connector">
+      <ant dir="connectors/elasticsearch" target="build"/>
+    </target>
+
+    <target name="doc-elasticsearch-connector" depends="setup-elasticsearch-connector">
+        <ant dir="connectors/elasticsearch" target="doc"/>
+    </target>
+
+    <target name="build-tests-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="build-tests"/>
+    </target>
+
+    <target name="run-tests-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="run-tests"/>
+    </target>
+
+    <target name="run-tests-derby-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="run-tests-derby"/>
+    </target>
+
+    <target name="run-tests-postgresql-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="run-tests-postgresql"/>
+    </target>
+
+    <target name="run-tests-mysql-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="run-tests-mysql"/>
+    </target>
+
+    <target name="run-tests-HSQLDB-elasticsearch-connector" depends="setup-elasticsearch-connector,setup-elasticsearch-connector-tests">
+        <ant dir="connectors/elasticsearch" target="run-tests-HSQLDB"/>
+    </target>
 
     <target name="setup-nullauthority-connector" depends="build-framework"/>
     
@@ -1457,6 +1500,36 @@
             <param name="connector-name" value="opensearchserver"/>
         </antcall>
     </target>
+	
+    <target name="calculate-elasticsearch-condition" depends="build-elasticsearch-connector">
+      <available file="connectors/elasticsearch/dist/lib" type="dir" property="elasticsearch.exists"/>
+      <condition property="elasticsearch.include">
+          <isset property="elasticsearch.exists"/>
+      </condition>
+    </target>
+
+    <target name="calculate-elasticsearch-doc-condition" depends="doc-elasticsearch-connector">
+        <available file="connectors/elasticsearch/dist/doc" type="dir" property="elasticsearch-doc.exists"/>
+        <condition property="elasticsearch-doc.include">
+            <isset property="elasticsearch-doc.exists"/>
+        </condition>
+    </target>
+
+   <target name="deliver-elasticsearch-connector" depends="calculate-elasticsearch-condition" if="elasticsearch.include">
+        <antcall target="general-connector-delivery">
+            <param name="connector-name" value="elasticsearch"/>
+        </antcall>
+        <antcall target="general-add-output-connector">
+            <param name="connector-name" value="OpenSearchServer"/>
+            <param name="connector-class" value="org.apache.manifoldcf.agents.output.elasticsearch.OpenSearchServerConnector"/>
+        </antcall>
+    </target>
+
+    <target name="deliver-elasticsearch-connector-doc" depends="calculate-elasticsearch-doc-condition" if="elasticsearch-doc.include">
+        <antcall target="general-connector-doc-delivery">
+            <param name="connector-name" value="elasticsearch"/>
+        </antcall>
+    </target>
 
     <target name="calculate-nullauthority-condition" depends="build-nullauthority-connector">
         <available file="connectors/nullauthority/dist/lib" type="dir" property="nullauthority.exists"/>
@@ -1975,19 +2048,19 @@
     
     <target name="end-to-end-tests-derby" depends="run-filesystem-tests-derby,run-wiki-tests-derby,run-alfresco-tests-derby,run-cmis-tests-derby,run-sharepoint-tests-derby"/>
 
-    <target name="run-tests-postgresql-open-connectors" depends="run-tests-postgresql-activedirectory-connector,run-tests-postgresql-alfresco-connector,run-tests-postgresql-cmis-connector,run-tests-postgresql-filesystem-connector,run-tests-postgresql-nullauthority-connector,run-tests-postgresql-nulloutput-connector,run-tests-postgresql-rss-connector,run-tests-postgresql-solr-connector,run-tests-postgresql-webcrawler-connector,run-tests-postgresql-wiki-connector,run-tests-postgresql-jdbc-connector,run-tests-postgresql-opensearchserver-connector"/>
+    <target name="run-tests-postgresql-open-connectors" depends="run-tests-postgresql-activedirectory-connector,run-tests-postgresql-alfresco-connector,run-tests-postgresql-cmis-connector,run-tests-postgresql-filesystem-connector,run-tests-postgresql-nullauthority-connector,run-tests-postgresql-nulloutput-connector,run-tests-postgresql-rss-connector,run-tests-postgresql-solr-connector,run-tests-postgresql-webcrawler-connector,run-tests-postgresql-wiki-connector,run-tests-postgresql-jdbc-connector,run-tests-postgresql-opensearchserver-connector,run-tests-postgresql-elasticsearch-connector"/>
     <target name="run-tests-postgresql-lgpl-connectors" depends="run-tests-postgresql-jcifs-connector"/>
     <target name="run-tests-postgresql-proprietary-connectors" depends="run-tests-postgresql-documentum-connector,run-tests-postgresql-filenet-connector,run-tests-postgresql-livelink-connector,run-tests-postgresql-memex-connector,run-tests-postgresql-meridio-connector,run-tests-postgresql-sharepoint-connector"/>
     
     <target name="end-to-end-tests-postgresql" depends="run-filesystem-tests-postgresql,run-wiki-tests-postgresql,run-alfresco-tests-postgresql,run-cmis-tests-postgresql,run-sharepoint-tests-postgresql"/>
 
-    <target name="run-tests-mysql-open-connectors" depends="run-tests-mysql-activedirectory-connector,run-tests-mysql-alfresco-connector,run-tests-mysql-cmis-connector,run-tests-mysql-filesystem-connector,run-tests-mysql-nullauthority-connector,run-tests-mysql-nulloutput-connector,run-tests-mysql-rss-connector,run-tests-mysql-solr-connector,run-tests-mysql-webcrawler-connector,run-tests-mysql-wiki-connector,run-tests-mysql-jdbc-connector,run-tests-mysql-opensearchserver-connector"/>
+    <target name="run-tests-mysql-open-connectors" depends="run-tests-mysql-activedirectory-connector,run-tests-mysql-alfresco-connector,run-tests-mysql-cmis-connector,run-tests-mysql-filesystem-connector,run-tests-mysql-nullauthority-connector,run-tests-mysql-nulloutput-connector,run-tests-mysql-rss-connector,run-tests-mysql-solr-connector,run-tests-mysql-webcrawler-connector,run-tests-mysql-wiki-connector,run-tests-mysql-jdbc-connector,run-tests-mysql-opensearchserver-connector,run-tests-mysql-elasticsearch-connector"/>
     <target name="run-tests-mysql-lgpl-connectors" depends="run-tests-mysql-jcifs-connector"/>
     <target name="run-tests-mysql-proprietary-connectors" depends="run-tests-mysql-documentum-connector,run-tests-mysql-filenet-connector,run-tests-mysql-livelink-connector,run-tests-mysql-memex-connector,run-tests-mysql-meridio-connector,run-tests-mysql-sharepoint-connector"/>
     
     <target name="end-to-end-tests-mysql" depends="run-filesystem-tests-mysql,run-wiki-tests-mysql,run-alfresco-tests-mysql,run-cmis-tests-mysql,run-sharepoint-tests-mysql"/>
 
-    <target name="run-tests-HSQLDB-open-connectors" depends="run-tests-HSQLDB-activedirectory-connector,run-tests-HSQLDB-alfresco-connector,run-tests-HSQLDB-cmis-connector,run-tests-HSQLDB-filesystem-connector,run-tests-HSQLDB-nullauthority-connector,run-tests-HSQLDB-nulloutput-connector,run-tests-HSQLDB-rss-connector,run-tests-HSQLDB-solr-connector,run-tests-HSQLDB-webcrawler-connector,run-tests-HSQLDB-wiki-connector,run-tests-HSQLDB-jdbc-connector,run-tests-HSQLDB-opensearchserver-connector"/>
+    <target name="run-tests-HSQLDB-open-connectors" depends="run-tests-HSQLDB-activedirectory-connector,run-tests-HSQLDB-alfresco-connector,run-tests-HSQLDB-cmis-connector,run-tests-HSQLDB-filesystem-connector,run-tests-HSQLDB-nullauthority-connector,run-tests-HSQLDB-nulloutput-connector,run-tests-HSQLDB-rss-connector,run-tests-HSQLDB-solr-connector,run-tests-HSQLDB-webcrawler-connector,run-tests-HSQLDB-wiki-connector,run-tests-HSQLDB-jdbc-connector,run-tests-HSQLDB-opensearchserver-connector,run-tests-HSQLDB-elasticsearch-connector"/>
     <target name="run-tests-HSQLDB-lgpl-connectors" depends="run-tests-HSQLDB-jcifs-connector"/>
     <target name="run-tests-HSQLDB-proprietary-connectors" depends="run-tests-HSQLDB-documentum-connector,run-tests-HSQLDB-filenet-connector,run-tests-HSQLDB-livelink-connector,run-tests-HSQLDB-memex-connector,run-tests-HSQLDB-meridio-connector,run-tests-HSQLDB-sharepoint-connector"/>
     
@@ -2005,8 +2078,8 @@
     <target name="deliver-open-connectors" depends="deliver-nullauthority-connector,deliver-activedirectory-connector,deliver-alfresco-connector,deliver-cmis-connector,deliver-filesystem-connector,deliver-rss-connector,deliver-webcrawler-connector,deliver-wiki-connector,deliver-jdbc-connector"/>
     <target name="deliver-open-connectors-doc" depends="deliver-nullauthority-connector-doc,deliver-activedirectory-connector-doc,deliver-alfresco-connector-doc,deliver-cmis-connector-doc,deliver-filesystem-connector-doc,deliver-rss-connector-doc,deliver-webcrawler-connector-doc,deliver-wiki-connector-doc,deliver-jdbc-connector-doc"/>
     
-    <target name="deliver-output-connectors" depends="deliver-gts-connector,deliver-solr-connector,deliver-nulloutput-connector,deliver-opensearchserver-connector"/>
-    <target name="deliver-output-connectors-doc" depends="deliver-gts-connector-doc,deliver-solr-connector-doc,deliver-nulloutput-connector-doc,deliver-opensearchserver-connector-doc"/>
+    <target name="deliver-output-connectors" depends="deliver-gts-connector,deliver-solr-connector,deliver-nulloutput-connector,deliver-opensearchserver-connector,deliver-elasticsearch-connector"/>
+    <target name="deliver-output-connectors-doc" depends="deliver-gts-connector-doc,deliver-solr-connector-doc,deliver-nulloutput-connector-doc,deliver-opensearchserver-connector-doc,deliver-elasticsearch-connector-doc"/>
     
     <target name="deliver-lgpl-connectors" depends="deliver-jcifs-connector"/>
     <target name="deliver-lgpl-connectors-doc" depends="deliver-jcifs-connector-doc"/>

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/build.xml?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/build.xml (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/build.xml Sun Feb  5 22:00:38 2012
@@ -0,0 +1,22 @@
+<!--
+ 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.
+-->
+
+<project name="elasticsearch" default="all">
+
+    <import file="../connector-build.xml"/>
+
+</project>

Added: 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=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchAction.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,41 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class ElasticSearchAction extends ElasticSearchConnection {
+
+  public enum CommandEnum {
+    optimize, reload;
+  }
+
+  public ElasticSearchAction(CommandEnum cmd, ElasticSearchConfig config)
+      throws ManifoldCFException {
+    super(config);
+    StringBuffer url = getApiUrl("action");
+    url.append("&action=");
+    url.append(cmd.name());
+    GetMethod method = new GetMethod(url.toString());
+    call(method);
+    if ("OK".equals(checkXPath(xPathStatus)))
+      return;
+    setResult(Result.ERROR, checkXPath(xPathException));
+  }
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConfig.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConfig.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConfig.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,92 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+
+public class ElasticSearchConfig extends ElasticSearchParam {
+
+  /**
+	 * 
+	 */
+  private static final long serialVersionUID = -2071296573398352538L;
+
+  /**
+   * Parameters used for the configuration
+   */
+  final private static ParameterEnum[] CONFIGURATIONLIST = {
+      ParameterEnum.SERVERLOCATION, ParameterEnum.INDEXNAME,
+      ParameterEnum.USERNAME, ParameterEnum.APIKEY };
+
+  /**
+   * Build a set of ElasticSearchParameters by reading ConfigParams. If the
+   * value returned by ConfigParams.getParameter is null, the default value is
+   * set.
+   * 
+   * @param paramList
+   * @param params
+   */
+  public ElasticSearchConfig(ConfigParams params) {
+    super(CONFIGURATIONLIST);
+    for (ParameterEnum param : CONFIGURATIONLIST) {
+      String value = params.getParameter(param.name());
+      if (value == null)
+        value = param.defaultValue;
+      put(param, value);
+    }
+  }
+
+  /**
+   * 
+   * @return a unique identifier for one index on one ElasticSearch instance.
+   */
+  public String getUniqueIndexIdentifier() {
+    StringBuffer sb = new StringBuffer();
+    sb.append(getServerLocation());
+    if (sb.charAt(sb.length() - 1) != '/')
+      sb.append('/');
+    sb.append(getIndexName());
+    return sb.toString();
+  }
+
+  public final static void contextToConfig(IPostParameters variableContext,
+      ConfigParams parameters) {
+    for (ParameterEnum param : CONFIGURATIONLIST) {
+      String p = variableContext.getParameter(param.name().toLowerCase());
+      if (p != null)
+        parameters.setParameter(param.name(), p);
+    }
+  }
+
+  final public String getServerLocation() {
+    return get(ParameterEnum.SERVERLOCATION);
+  }
+
+  final public String getIndexName() {
+    return get(ParameterEnum.INDEXNAME);
+  }
+
+  final public String getUserName() {
+    return get(ParameterEnum.USERNAME);
+  }
+
+  final public String getApiKey() {
+    return get(ParameterEnum.APIKEY);
+  }
+}

Added: 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=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,196 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.io.IOUtils;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ElasticSearchConnection {
+
+  private String serverLocation;
+
+  private String userName;
+
+  private String apiKey;
+
+  private String resultDescription;
+
+  private String callUrlSnippet;
+
+  private String response;
+
+  private Document xmlResponse;
+
+  protected String xPathStatus = "/response/entry[@key='Status']/text()";
+  protected String xPathException = "/response/entry[@key='Exception']/text()";
+
+  public enum Result {
+    OK, ERROR, UNKNOWN;
+  }
+
+  private Result result;
+
+  protected ElasticSearchConnection(ElasticSearchConfig config) {
+    result = Result.UNKNOWN;
+    response = null;
+    xmlResponse = null;
+    resultDescription = "";
+    callUrlSnippet = null;
+    serverLocation = config.getServerLocation();
+    userName = config.getUserName();
+    apiKey = config.getApiKey();
+  }
+
+  protected final String urlEncode(String t) throws ManifoldCFException {
+    try {
+      return URLEncoder.encode(t, "UTF-8");
+    } catch (UnsupportedEncodingException e) {
+      throw new ManifoldCFException(e);
+    }
+  }
+
+  protected StringBuffer getApiUrl(String command) throws ManifoldCFException {
+    StringBuffer url = new StringBuffer(serverLocation);
+    if (!serverLocation.endsWith("/"))
+      url.append('/');
+    url.append(command);
+    callUrlSnippet = url.toString();
+    if (userName != null && apiKey != null && userName.length() > 0
+        && apiKey.length() > 0) {
+      url.append("&login=");
+      url.append(urlEncode(userName));
+      url.append("&key=");
+      url.append(apiKey);
+    }
+    return url;
+  }
+
+  protected void call(HttpMethod method) throws ManifoldCFException {
+    HttpClient hc = new HttpClient();
+    try {
+      hc.executeMethod(method);
+      if (!checkResultCode(method.getStatusCode()))
+        throw new ManifoldCFException(getResultDescription());
+      response = IOUtils.toString(method.getResponseBodyAsStream());
+    } catch (HttpException e) {
+      setResult(Result.ERROR, e.getMessage());
+      throw new ManifoldCFException(e);
+    } catch (IOException e) {
+      setResult(Result.ERROR, e.getMessage());
+      throw new ManifoldCFException(e);
+    } finally {
+      if (method != null)
+        method.releaseConnection();
+    }
+  }
+
+  private void readXmlResponse() throws ManifoldCFException {
+    if (xmlResponse != null)
+      return;
+    StringReader sw = null;
+    try {
+      sw = new StringReader(response);
+      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+      dbf.setNamespaceAware(true); // never forget this!
+      DocumentBuilder builder;
+      builder = dbf.newDocumentBuilder();
+      xmlResponse = builder.parse(new InputSource(sw));
+    } catch (ParserConfigurationException e) {
+      throw new ManifoldCFException(e);
+    } catch (SAXException e) {
+      throw new ManifoldCFException(e);
+    } catch (IOException e) {
+      throw new ManifoldCFException(e);
+    } finally {
+      if (sw != null)
+        IOUtils.closeQuietly(sw);
+    }
+  }
+
+  protected String checkXPath(String xPathQuery) throws ManifoldCFException {
+    try {
+      readXmlResponse();
+      XPathFactory factory = XPathFactory.newInstance();
+      XPath xpath = factory.newXPath();
+      XPathExpression xPathExpr = xpath.compile(xPathQuery);
+      return xPathExpr.evaluate(xmlResponse);
+    } catch (XPathExpressionException e) {
+      throw new ManifoldCFException(e);
+    }
+  }
+
+  protected void setResult(Result res, String desc) {
+    if (res != null)
+      result = res;
+    if (desc != null)
+      if (desc.length() > 0)
+        resultDescription = desc;
+  }
+
+  public String getResultDescription() {
+    return resultDescription;
+  }
+
+  protected String getResponse() {
+    return response;
+  }
+
+  private boolean checkResultCode(int code) {
+    switch (code) {
+    case 0:
+      setResult(Result.UNKNOWN, null);
+      return false;
+    case 200:
+      setResult(Result.OK, null);
+      return true;
+    case 404:
+      setResult(Result.ERROR, "Server/page not found");
+      return false;
+    default:
+      setResult(Result.ERROR, null);
+      return false;
+    }
+  }
+
+  public Result getResult() {
+    return result;
+  }
+
+  public String getCallUrlSnippet() {
+    return callUrlSnippet;
+  }
+}

Added: 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=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,352 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import java.io.File;
+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.io.FilenameUtils;
+import org.apache.manifoldcf.agents.interfaces.IOutputAddActivity;
+import org.apache.manifoldcf.agents.interfaces.IOutputNotifyActivity;
+import org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity;
+import org.apache.manifoldcf.agents.interfaces.OutputSpecification;
+import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
+import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
+import org.apache.manifoldcf.agents.output.BaseOutputConnector;
+import org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchAction.CommandEnum;
+import org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchConnection.Result;
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.ConfigurationNode;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.SpecificationNode;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class ElasticSearchConnector extends BaseOutputConnector {
+
+  private final static String ELASTICSEARCH_INDEXATION_ACTIVITY = "Optimize";
+  private final static String ELASTICSEARCH_DELETION_ACTIVITY = "Deletion";
+  private final static String ELASTICSEARCH_OPTIMIZE_ACTIVITY = "Indexation";
+
+  private final static String[] ELASTICSEARCH_ACTIVITIES = {
+      ELASTICSEARCH_INDEXATION_ACTIVITY, ELASTICSEARCH_DELETION_ACTIVITY,
+      ELASTICSEARCH_OPTIMIZE_ACTIVITY };
+
+  private final static String ELASTICSEARCH_TAB_ELASTICSEARCH = "ElasticSearch";
+
+  /** Forward to the HTML template for rendering hidden fields when the Server tab is not selected */
+  private static final String HIDDEN_CONFIG_FORWARD = "hiddenConfiguration.html";
+  
+  /** Forward to the HTML template for rendering hidden fields when the CMIS Query tab is not selected */
+  private static final String HIDDEN_SPEC_FORWARD = "hiddenSpecification.html";
+  
+  /** Forward to the HTML template to edit the configuration parameters */
+  private static final String EDIT_CONFIG_FORWARD = "editConfiguration.html";
+  
+  /** Forward to the HTML template to view the configuration parameters */
+  private static final String VIEW_CONFIG_FORWARD = "viewConfiguration.html";
+ 
+  /** Forward to the javascript to check the configuration parameters */
+  private static final String EDIT_CONFIG_HEADER_FORWARD = "editConfiguration.js";
+
+  /** Forward to the template to view the specification parameters for the job */
+  private static final String VIEW_SPEC_FORWARD = "viewSpecification.html";
+  
+  /** Forward to the template to edit the configuration parameters for the job */
+  private static final String EDIT_SPEC_FORWARD = "editSpecification.html";
+
+  /** Forward to the javascript to check the specification parameters for the job */
+  private static final String EDIT_SPEC_HEADER_FORWARD = "editSpecification.js";
+
+  private String specsCacheOutpuDescription;
+  private ElasticSearchSpecs specsCache;
+
+  public ElasticSearchConnector() {
+    specsCacheOutpuDescription = null;
+    specsCache = null;
+  }
+
+  @Override
+  public String[] getActivitiesList() {
+    return ELASTICSEARCH_ACTIVITIES;
+  }
+
+  /**
+   * Read the content of a resource, replace the variable ${PARAMNAME} with the
+   * value and copy it to the out.
+   * 
+   * @param resName
+   * @param out
+   * @throws ManifoldCFException
+   */
+  private static void outputResource(String resName, IHTTPOutput out,
+      Locale locale, ElasticSearchParam params) throws ManifoldCFException {
+    Messages.outputResource(out,locale,resName,(params==null)?null:params.buildMap(),false);
+  }
+
+  @Override
+  public void outputConfigurationHeader(IThreadContext threadContext,
+      IHTTPOutput out, Locale locale, ConfigParams parameters, List<String> tabsArray)
+      throws ManifoldCFException, IOException {
+    super.outputConfigurationHeader(threadContext, out, locale, parameters, tabsArray);
+    tabsArray.add(Messages.getString(locale,"ElasticSearchConnector.Parameters"));
+    outputResource(EDIT_CONFIG_HEADER_FORWARD, out, locale, null);
+  }
+
+  @Override
+  public void outputConfigurationBody(IThreadContext threadContext,
+      IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName)
+      throws ManifoldCFException, IOException {
+    super.outputConfigurationBody(threadContext, out, locale, parameters, tabName);
+    ElasticSearchConfig config = this.getConfigParameters(parameters);
+    if (Messages.getString(locale,"ElasticSearchConnector.Parameters").equals(tabName)) {
+      outputResource(EDIT_CONFIG_FORWARD, out, locale, config);
+    } else {
+      outputResource(HIDDEN_CONFIG_FORWARD, out, locale, config);
+    }
+  }
+
+  @Override
+  public void outputSpecificationHeader(IHTTPOutput out,
+      Locale locale, OutputSpecification os, List<String> tabsArray)
+      throws ManifoldCFException, IOException {
+    super.outputSpecificationHeader(out, locale, os, tabsArray);
+    tabsArray.add(ELASTICSEARCH_TAB_ELASTICSEARCH);
+    outputResource(EDIT_SPEC_HEADER_FORWARD, out, locale, null);
+  }
+
+  final private SpecificationNode getSpecNode(OutputSpecification os) {
+    int l = os.getChildCount();
+    for (int i = 0; i < l; i++) {
+      SpecificationNode node = os.getChild(i);
+      if (ElasticSearchSpecs.ELASTICSEARCH_SPECS_NODE.equals(node
+          .getType())) {
+        return node;
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public void outputSpecificationBody(IHTTPOutput out, Locale locale, OutputSpecification os,
+      String tabName) throws ManifoldCFException, IOException {
+    super.outputSpecificationBody(out, locale, os, tabName);
+    ElasticSearchSpecs specs = getSpecParameters(os);
+    if (ELASTICSEARCH_TAB_ELASTICSEARCH.equals(tabName)) {
+      outputResource(EDIT_SPEC_FORWARD, out, locale, specs);
+    } else {
+      outputResource(HIDDEN_SPEC_FORWARD, out, locale, specs);
+    }
+  }
+
+  @Override
+  public String processSpecificationPost(IPostParameters variableContext,
+      Locale locale, OutputSpecification os) throws ManifoldCFException {
+    ConfigurationNode specNode = getSpecNode(os);
+    boolean bAdd = (specNode == null);
+    if (bAdd) {
+      specNode = new SpecificationNode(
+          ElasticSearchSpecs.ELASTICSEARCH_SPECS_NODE);
+    }
+    ElasticSearchSpecs.contextToSpecNode(variableContext, specNode);
+    if (bAdd)
+      os.addChild(os.getChildCount(), specNode);
+    return null;
+  }
+
+  /**
+   * Build a Set of ElasticSearch parameters. If configParams is null,
+   * getConfiguration() is used.
+   * 
+   * @param configParams
+   */
+  final private ElasticSearchConfig getConfigParameters(
+      ConfigParams configParams) {
+    if (configParams == null)
+      configParams = getConfiguration();
+    synchronized (this) {
+      return new ElasticSearchConfig(configParams);
+    }
+  }
+
+  final private ElasticSearchSpecs getSpecParameters(OutputSpecification os)
+      throws ManifoldCFException {
+    return new ElasticSearchSpecs(getSpecNode(os));
+  }
+
+  final private ElasticSearchSpecs getSpecsCache(String outputDescription)
+      throws ManifoldCFException {
+    try {
+      synchronized (this) {
+        if (!outputDescription.equals(specsCacheOutpuDescription))
+          specsCache = null;
+        if (specsCache == null)
+          specsCache = new ElasticSearchSpecs(new JSONObject(
+              outputDescription));
+        return specsCache;
+      }
+    } catch (JSONException e) {
+      throw new ManifoldCFException(e);
+    }
+  }
+
+  @Override
+  public String getOutputDescription(OutputSpecification os)
+      throws ManifoldCFException {
+    ElasticSearchSpecs specs = new ElasticSearchSpecs(getSpecNode(os));
+    return specs.toJson().toString();
+  }
+
+  @Override
+  public boolean checkLengthIndexable(String outputDescription, long length)
+      throws ManifoldCFException, ServiceInterruption {
+    ElasticSearchSpecs specs = getSpecsCache(outputDescription);
+    long maxFileSize = specs.getMaxFileSize();
+    if (length > maxFileSize)
+      return false;
+    return super.checkLengthIndexable(outputDescription, length);
+  }
+
+  @Override
+  public boolean checkDocumentIndexable(String outputDescription, File localFile)
+      throws ManifoldCFException, ServiceInterruption {
+    ElasticSearchSpecs specs = getSpecsCache(outputDescription);
+    return specs
+        .checkExtension(FilenameUtils.getExtension(localFile.getName()));
+  }
+
+  @Override
+  public boolean checkMimeTypeIndexable(String outputDescription,
+      String mimeType) throws ManifoldCFException, ServiceInterruption {
+    ElasticSearchSpecs specs = getSpecsCache(outputDescription);
+    return specs.checkMimeType(mimeType);
+  }
+
+  @Override
+  public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out,
+      Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException {
+    outputResource(VIEW_CONFIG_FORWARD, out, locale, getConfigParameters(parameters));
+  }
+
+  @Override
+  public void viewSpecification(IHTTPOutput out, Locale locale, OutputSpecification os)
+      throws ManifoldCFException, IOException {
+    outputResource(VIEW_SPEC_FORWARD, out, locale, getSpecParameters(os));
+  }
+
+  @Override
+  public String processConfigurationPost(IThreadContext threadContext,
+      IPostParameters variableContext, ConfigParams parameters)
+      throws ManifoldCFException {
+    ElasticSearchConfig.contextToConfig(variableContext, parameters);
+    return null;
+  }
+
+  private static Map<String, Integer> ossInstances = null;
+
+  private synchronized final Integer addInstance(ElasticSearchConfig config) {
+    if (ossInstances == null)
+      ossInstances = new TreeMap<String, Integer>();
+    synchronized (ossInstances) {
+      String uii = config.getUniqueIndexIdentifier();
+      Integer count = ossInstances.get(uii);
+      if (count == null) {
+        count = new Integer(1);
+        ossInstances.put(uii, count);
+      } else
+        count++;
+      return count;
+    }
+  }
+
+  private synchronized final void removeInstance(ElasticSearchConfig config) {
+    if (ossInstances == null)
+      return;
+    synchronized (ossInstances) {
+      String uii = config.getUniqueIndexIdentifier();
+      Integer count = ossInstances.get(uii);
+      if (count == null)
+        return;
+      if (--count == 0)
+        ossInstances.remove(uii);
+    }
+  }
+
+  @Override
+  public int addOrReplaceDocument(String documentURI, String outputDescription,
+      RepositoryDocument document, String authorityNameString,
+      IOutputAddActivity activities) throws ManifoldCFException,
+      ServiceInterruption {
+    ElasticSearchConfig config = getConfigParameters(null);
+    Integer count = addInstance(config);
+    synchronized (count) {
+      InputStream inputStream = document.getBinaryStream();
+      try {
+        long startTime = System.currentTimeMillis();
+        ElasticSearchIndex oi = new ElasticSearchIndex(documentURI,
+            inputStream, config);
+        activities.recordActivity(startTime,
+            ELASTICSEARCH_INDEXATION_ACTIVITY, document.getBinaryLength(),
+            documentURI, oi.getResult().name(), oi.getResultDescription());
+        if (oi.getResult() != Result.OK)
+          return DOCUMENTSTATUS_REJECTED;
+      } finally {
+        removeInstance(config);
+      }
+      return DOCUMENTSTATUS_ACCEPTED;
+    }
+  }
+
+  @Override
+  public void removeDocument(String documentURI, String outputDescription,
+      IOutputRemoveActivity activities) throws ManifoldCFException,
+      ServiceInterruption {
+    long startTime = System.currentTimeMillis();
+    ElasticSearchDelete od = new ElasticSearchDelete(documentURI,
+        getConfigParameters(null));
+    activities.recordActivity(startTime, ELASTICSEARCH_DELETION_ACTIVITY,
+        null, documentURI, od.getResult().name(), od.getResultDescription());
+  }
+
+  @Override
+  public String check() throws ManifoldCFException {
+    ElasticSearchSchema oss = new ElasticSearchSchema(
+        getConfigParameters(null));
+    return oss.getResult().name() + " " + oss.getResultDescription();
+  }
+
+  @Override
+  public void noteJobComplete(IOutputNotifyActivity activities)
+      throws ManifoldCFException, ServiceInterruption {
+    long startTime = System.currentTimeMillis();
+    ElasticSearchAction oo = new ElasticSearchAction(
+        CommandEnum.optimize, getConfigParameters(null));
+    activities.recordActivity(startTime, ELASTICSEARCH_OPTIMIZE_ACTIVITY,
+        null, oo.getCallUrlSnippet(), oo.getResult().name(),
+        oo.getResultDescription());
+  }
+
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,37 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class ElasticSearchDelete extends ElasticSearchConnection {
+
+  public ElasticSearchDelete(String documentURI,
+      ElasticSearchConfig config) throws ManifoldCFException {
+    super(config);
+    StringBuffer url = getApiUrl("delete");
+    url.append("&uniq=");
+    url.append(urlEncode(documentURI));
+    GetMethod method = new GetMethod(url.toString());
+    call(method);
+    if ("OK".equals(checkXPath(xPathStatus)))
+      return;
+    setResult(Result.ERROR, checkXPath(xPathException));
+  }
+}

Added: 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=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,115 @@
+/**
+ * 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.agents.output.elasticsearch;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.manifoldcf.core.common.Base64;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class ElasticSearchIndex extends ElasticSearchConnection {
+
+	private class IndexRequestEntity implements RequestEntity {
+
+		private String documentURI;
+
+		private InputStream inputStream;
+
+		private String fileName;
+
+		public IndexRequestEntity(String documentURI, InputStream inputStream) {
+			this.documentURI = documentURI;
+			this.inputStream = inputStream;
+			this.fileName = FilenameUtils.getName(documentURI);
+		}
+
+		public long getContentLength() {
+			return -1;
+		}
+
+		public String getContentType() {
+			return "text/xml; charset=utf-8";
+		}
+
+		public boolean isRepeatable() {
+			return false;
+		}
+
+		public void writeRequest(OutputStream out) throws IOException {
+			PrintWriter pw = new PrintWriter(out);
+			try {
+				pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
+				pw.println("<index>);");
+				pw.print("<document><field name=\"uri\"><value>");
+				pw.print(documentURI);
+				pw.println("</value></field>");
+				pw.print("<binary fileName=\"");
+				pw.print(fileName);
+				pw.println("\">");
+				Base64 base64 = new Base64();
+				base64.encodeStream(inputStream, pw);
+				pw.println("</binary></document>");
+				pw.println("</index>");
+			} catch (ManifoldCFException e) {
+				throw new IOException(e.getMessage());
+			} finally {
+				IOUtils.closeQuietly(pw);
+			}
+		}
+	}
+
+	public ElasticSearchIndex(String documentURI, InputStream inputStream,
+			ElasticSearchConfig config) throws ManifoldCFException {
+		super(config);
+		StringBuffer url = getApiUrl(getPath(documentURI));
+		PutMethod put = new PutMethod(url.toString());
+		RequestEntity entity = new IndexRequestEntity(documentURI, inputStream);
+		put.setRequestEntity(entity);
+		call(put);
+		if ("OK".equals(checkXPath(xPathStatus)))
+			return;
+		String error = checkXPath(xPathException);
+		setResult(Result.ERROR, error);
+		System.err.println(getResponse());
+	}
+
+	private String getPath(String documentURI) {
+		String path = null;
+		try {
+			URL url = new URL(documentURI);
+			path = url.getPath();
+			if (path != null && path.length() > 0)
+				path = path.substring(1);
+		} catch (MalformedURLException e) {
+			// It is not a url so it surely a path
+			e.printStackTrace();
+			path = documentURI;
+		}
+		return path;
+	}
+
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchParam.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchParam.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchParam.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchParam.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,83 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchParam.ParameterEnum;
+
+public class ElasticSearchParam extends HashMap<ParameterEnum, String> {
+
+  /**
+   * Parameters constants
+   */
+  public enum ParameterEnum {
+    SERVERLOCATION("http://localhost:9200/"),
+
+    INDEXNAME(""),
+
+    USERNAME(""),
+
+    APIKEY(""),
+
+    FIELDLIST(""),
+
+    MAXFILESIZE("16777216"),
+
+    MIMETYPES(
+        "application/msword\n"
+            + "application/vnd.ms-excel\n"
+            + "application/vnd.openxmlformats-officedocument.wordprocessingml.document\n"
+            + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\n"
+            + "text/html\n"
+            + "application/pdf\n"
+            + "application/vnd.ms-powerpoint\n"
+            + "application/vnd.openxmlformats-officedocument.presentationml.presentation\n"
+            + "application/vnd.oasis.opendocument.text\n"
+            + "application/vnd.oasis.opendocument.spreadsheet\n"
+            + "application/vnd.oasis.opendocument.formula\n"
+            + "application/rtf\n" + "text/plain\n" + "audio/mpeg\n"
+            + "audio/x-wav\n" + "audio/ogg\n" + "audio/flac\n"
+            + "application/x-bittorrent"),
+
+    EXTENSIONS("doc\n" + "docx\n" + "xls\n" + "xlsx\n" + "ppt\n" + "pptx\n"
+        + "html\n" + "pdf\n" + "odt\n" + "ods\n" + "rtf\n" + "txt\n" + "mp3\n"
+        + "mp4\n" + "wav\n" + "ogg\n" + "flac\n" + "torrent");
+
+    final protected String defaultValue;
+
+    private ParameterEnum(String defaultValue) {
+      this.defaultValue = defaultValue;
+    }
+  }
+
+  private static final long serialVersionUID = -1593234685772720029L;
+
+  protected ElasticSearchParam(ParameterEnum[] params) {
+    super(params.length);
+  }
+
+  final public Map<String,String> buildMap() {
+    Map<String,String> rval = new HashMap<String,String>();
+    for (Map.Entry<ParameterEnum, String> entry : this.entrySet())
+      rval.put(entry.getKey().name(), entry.getValue());
+    return rval;
+  }
+  
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSchema.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSchema.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSchema.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSchema.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,38 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+public class ElasticSearchSchema extends ElasticSearchConnection {
+
+  public ElasticSearchSchema(ElasticSearchConfig config)
+      throws ManifoldCFException {
+    super(config);
+    String indexName = config.getIndexName();
+    StringBuffer url = getApiUrl("schema");
+    url.append("&cmd=indexList");
+    GetMethod method = new GetMethod(url.toString());
+    String xpath = "count(/response/index[@name='" + indexName + "'])";
+    call(method);
+    if ("1".equals(checkXPath(xpath)))
+      return;
+    setResult(Result.ERROR, "Index not found");
+  }
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSpecs.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSpecs.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSpecs.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchSpecs.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,154 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.manifoldcf.core.interfaces.ConfigurationNode;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class ElasticSearchSpecs extends ElasticSearchParam {
+
+  /**
+	 * 
+	 */
+  private static final long serialVersionUID = 1859653440572662025L;
+
+  final public static ParameterEnum[] SPECIFICATIONLIST = {
+      ParameterEnum.MAXFILESIZE, ParameterEnum.MIMETYPES,
+      ParameterEnum.EXTENSIONS };
+
+  final public static String ELASTICSEARCH_SPECS_NODE = "ELASTICSEARCH_SPECS_NODE";
+
+  private Set<String> extensionSet;
+
+  private Set<String> mimeTypeSet;
+
+  /**
+   * Build a set of ElasticSearch parameters by reading an JSON object
+   * 
+   * @param json
+   * @throws JSONException
+   * @throws ManifoldCFException
+   */
+  public ElasticSearchSpecs(JSONObject json) throws JSONException,
+      ManifoldCFException {
+    super(SPECIFICATIONLIST);
+    extensionSet = null;
+    mimeTypeSet = null;
+    for (ParameterEnum param : SPECIFICATIONLIST) {
+      String value = null;
+      value = json.getString(param.name());
+      if (value == null)
+        value = param.defaultValue;
+      put(param, value);
+    }
+    extensionSet = createStringSet(getExtensions());
+    mimeTypeSet = createStringSet(getMimeTypes());
+  }
+
+  /**
+   * Build a set of ElasticSearch parameters by reading an instance of
+   * SpecificationNode.
+   * 
+   * @param node
+   * @throws ManifoldCFException
+   */
+  public ElasticSearchSpecs(ConfigurationNode node)
+      throws ManifoldCFException {
+    super(SPECIFICATIONLIST);
+    for (ParameterEnum param : SPECIFICATIONLIST) {
+      String value = null;
+      if (node != null)
+        value = node.getAttributeValue(param.name());
+      if (value == null)
+        value = param.defaultValue;
+      put(param, value);
+    }
+    extensionSet = createStringSet(getExtensions());
+    mimeTypeSet = createStringSet(getMimeTypes());
+  }
+
+  public static void contextToSpecNode(IPostParameters variableContext,
+      ConfigurationNode specNode) {
+    for (ParameterEnum param : SPECIFICATIONLIST) {
+      String p = variableContext.getParameter(param.name().toLowerCase());
+      if (p != null)
+        specNode.setAttribute(param.name(), p);
+    }
+  }
+
+  /**
+   * 
+   * @return a JSON representation of the parameter list
+   */
+  public JSONObject toJson() {
+    return new JSONObject(this);
+  }
+
+  public long getMaxFileSize() {
+    return Long.parseLong(get(ParameterEnum.MAXFILESIZE));
+  }
+
+  public String getMimeTypes() {
+    return get(ParameterEnum.MIMETYPES);
+  }
+
+  public String getExtensions() {
+    return get(ParameterEnum.EXTENSIONS);
+  }
+
+  private final static TreeSet<String> createStringSet(String content)
+      throws ManifoldCFException {
+    TreeSet<String> set = new TreeSet<String>();
+    BufferedReader br = null;
+    StringReader sr = null;
+    try {
+      sr = new StringReader(content);
+      br = new BufferedReader(sr);
+      String line = null;
+      while ((line = br.readLine()) != null) {
+        line = line.trim();
+        if (line.length() > 0)
+          set.add(line);
+      }
+      return set;
+    } catch (IOException e) {
+      throw new ManifoldCFException(e);
+    } finally {
+      if (br != null)
+        IOUtils.closeQuietly(br);
+    }
+  }
+
+  public boolean checkExtension(String extension) {
+    return extensionSet.contains(extension);
+  }
+
+  public boolean checkMimeType(String mimeType) {
+    return mimeTypeSet.contains(mimeType);
+  }
+}

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/Messages.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/Messages.java?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/Messages.java (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/Messages.java Sun Feb  5 22:00:38 2012
@@ -0,0 +1,123 @@
+/**
+* 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.agents.output.elasticsearch;
+
+import java.util.Locale;
+import java.util.Map;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+
+public class Messages extends org.apache.manifoldcf.ui.i18n.Messages
+{
+  public static final String DEFAULT_BUNDLE_NAME="org.apache.manifoldcf.agents.output.elasticsearch.common";
+  public static final String DEFAULT_PATH_NAME="org.apache.manifoldcf.crawler.connectors.elasticsearch";
+  
+  /** 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.getClassLoader(), bundleName, locale, messageKey, args);
+  }
+
+  public static String getAttributeString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeString(Messages.class.getClassLoader(), bundleName, locale, messageKey, args);
+  }
+
+  public static String getBodyString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyString(Messages.class.getClassLoader(), bundleName, locale, messageKey, args);
+  }
+  
+  public static String getAttributeJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeJavascriptString(Messages.class.getClassLoader(), bundleName, locale, messageKey, args);
+  }
+
+  public static String getBodyJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyJavascriptString(Messages.class.getClassLoader(), 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);
+  }
+  
+}
+

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_en_US.properties
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_en_US.properties?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_en_US.properties (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_en_US.properties Sun Feb  5 22:00:38 2012
@@ -0,0 +1,25 @@
+# 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.
+
+ElasticSearchConnector.configurationJs=configuration.js
+ElasticSearchConnector.configurationHtml=configuration.html
+ElasticSearchConnector.specificationsHtml=specifications.html
+ElasticSearchConnector.viewHtml=view.html
+ElasticSearchConnector.viewSpecHtml=viewSpec.html
+ElasticSearchConnector.Parameters=Parameters
+ElasticSearchConnector.Optimize=Optimize
+ElasticSearchConnector.Deletion=Deletion
+ElasticSearchConnector.Indexation=Indexation
+

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_ja_JP.properties?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_ja_JP.properties (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/elasticsearch/common_ja_JP.properties Sun Feb  5 22:00:38 2012
@@ -0,0 +1,25 @@
+# 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.
+
+ElasticSearchConnector.configurationJs=configuration_ja.js
+ElasticSearchConnector.configurationHtml=configuration_ja.html
+ElasticSearchConnector.specificationsHtml=specifications_ja.html
+ElasticSearchConnector.viewHtml=view_ja.html
+ElasticSearchConnector.viewSpecHtml=viewSpec_ja.html
+ElasticSearchConnector.Parameters=引数
+ElasticSearchConnector.Optimize=Optimize
+ElasticSearchConnector.Deletion=Deletion
+ElasticSearchConnector.Indexation=Indexation
+

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.html?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.html (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.html Sun Feb  5 22:00:38 2012
@@ -0,0 +1,40 @@
+<!--
+ 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.
+-->
+
+<table class="displaytable">
+	<tr>
+		<td class="description"><nobr>Server Location</nobr> (URL):</td>
+		<td class="value"><input name="serverlocation"
+			value="${SERVERLOCATION:A}" size="48" />
+		</td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>Index name:</nobr></td>
+		<td class="value"><input name="indexname" value="${INDEXNAME:A}"
+			size="24" /></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>User name:</nobr></td>
+		<td class="value"><input name="username" value="${USERNAME:A}"
+			size="24" /></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>API Key:</nobr></td>
+		<td class="value"><input name="apikey" value="${APIKEY:A}"
+			size="40" /></td>
+	</tr>
+</table>
\ No newline at end of file

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.js
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.js?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.js (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_en_US.js Sun Feb  5 22:00:38 2012
@@ -0,0 +1,42 @@
+<!--
+ 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.
+-->
+
+<script type="text/javascript">
+<!--
+function checkConfig() {
+	if (editconnection.serverlocation) {
+		if (editconnection.serverlocation.value == "") {
+			alert("Please supply a valid ElasticSearch server location");
+			editconnection.serverlocation.focus();
+			return false;
+		}
+	}
+	if (editconnection.indexname) {
+		if (editconnection.indexname.value == "") {
+			alert("Please supply a valid index name");
+			editconnection.indexname.focus();
+			return false;
+		}
+	}
+	return true;
+}
+
+function checkConfigForSave() {
+	return checkConfig();
+}
+//-->
+</script>

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.html?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.html (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.html Sun Feb  5 22:00:38 2012
@@ -0,0 +1,40 @@
+<!--
+ 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.
+-->
+
+<table class="displaytable">
+	<tr>
+		<td class="description"><nobr>サーバ</nobr>(URL):</td>
+		<td class="value"><input name="serverlocation"
+			value="${SERVERLOCATION:A}" size="48" />
+		</td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>索引名:</nobr></td>
+		<td class="value"><input name="indexname" value="${INDEXNAME:A}"
+			size="24" /></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>ユーザ名:</nobr></td>
+		<td class="value"><input name="username" value="${USERNAME:A}"
+			size="24" /></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>APIキー:</nobr></td>
+		<td class="value"><input name="apikey" value="${APIKEY:A}"
+			size="40" /></td>
+	</tr>
+</table>

Added: incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.js
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.js?rev=1240849&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.js (added)
+++ incubator/lcf/branches/CONNECTORS-288/connectors/elasticsearch/connector/src/main/resources/org/apache/manifoldcf/agents/output/elasticsearch/editConfiguration_ja_JP.js Sun Feb  5 22:00:38 2012
@@ -0,0 +1,42 @@
+<!--
+ 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.
+-->
+
+<script type="text/javascript">
+<!--
+function checkConfig() {
+	if (editconnection.serverlocation) {
+		if (editconnection.serverlocation.value == "") {
+			alert("正しいElasticSearchサーバURLを入力してください");
+			editconnection.serverlocation.focus();
+			return false;
+		}
+	}
+	if (editconnection.indexname) {
+		if (editconnection.indexname.value == "") {
+			alert("正しい索引名を入力してください");
+			editconnection.indexname.focus();
+			return false;
+		}
+	}
+	return true;
+}
+
+function checkConfigForSave() {
+	return checkConfig();
+}
+//-->
+</script>