Permalink
Browse files

Support ElasticSearch 1.0.0:

 - replace ElasticSearchException with ElastisearchException
 - indices now returned as a ImutableOpenMap
  • Loading branch information...
1 parent a4b695f commit d012a97344c697b9231dd6dac1182c082e39eb01 Alexandru Dragomir committed Feb 13, 2014
View
@@ -18,7 +18,7 @@ Version Compatibility:
+------------------------------------------------------------------+
| Plugin | Couchbase | ElasticSearch |
+------------------------------------------------------------------+
- | master | 2.2 | 0.90.5 |
+ | master | 2.2 | 1.0.0 |
+------------------------------------------------------------------+
| 1.2.0 | 2.2 | 0.90.5 |
+------------------------------------------------------------------+
View
@@ -2,10 +2,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.couchbase</groupId>
<artifactId>elasticsearch-transport-couchbase</artifactId>
- <version>1.2.0</version>
+ <version>1.3.0-SNAPSHOT</version>
<properties>
- <elasticsearch.version>0.90.3</elasticsearch.version>
+ <elasticsearch.version>1.0.0</elasticsearch.version>
</properties>
<repositories>
@@ -13,7 +13,7 @@
*/
package org.elasticsearch.transport.couchbase;
-import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@@ -38,7 +38,7 @@ public CouchbaseCAPI(Settings settings, CouchbaseCAPITransport transport,
}
@Override
- protected void doStart() throws ElasticSearchException {
+ protected void doStart() throws ElasticsearchException {
transport.start();
if (logger.isInfoEnabled()) {
logger.info("{}", transport.boundAddress());
@@ -47,13 +47,13 @@ protected void doStart() throws ElasticSearchException {
}
@Override
- protected void doStop() throws ElasticSearchException {
+ protected void doStop() throws ElasticsearchException {
nodeService.removeNodeAttribute("couchbase_address");
transport.stop();
}
@Override
- protected void doClose() throws ElasticSearchException {
+ protected void doClose() throws ElasticsearchException {
transport.close();
}
@@ -18,7 +18,7 @@
import java.net.InetSocketAddress;
import java.util.concurrent.atomic.AtomicReference;
-import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.MetaDataMappingService;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
@@ -97,7 +97,7 @@ public CouchbaseCAPITransportImpl(Settings settings, RestController restControll
}
@Override
- protected void doStart() throws ElasticSearchException {
+ protected void doStart() throws ElasticsearchException {
// Bind and start to accept incoming connections.
InetAddress hostAddressX;
@@ -158,18 +158,18 @@ public boolean onPortNumber(int portNumber) {
}
@Override
- protected void doStop() throws ElasticSearchException {
+ protected void doStop() throws ElasticsearchException {
if(server != null) {
try {
server.stop();
} catch (Exception e) {
- throw new ElasticSearchException("Error stopping jetty", e);
+ throw new ElasticsearchException("Error stopping jetty", e);
}
}
}
@Override
- protected void doClose() throws ElasticSearchException {
+ protected void doClose() throws ElasticsearchException {
}
@@ -31,6 +31,8 @@
import org.elasticsearch.cluster.metadata.IndexMetaData;
import com.couchbase.capi.CouchbaseBehavior;
+import org.elasticsearch.common.collect.ImmutableOpenMap;
+import org.elasticsearch.common.hppc.cursors.ObjectCursor;
public class ElasticSearchCouchbaseBehavior implements CouchbaseBehavior {
@@ -79,9 +81,9 @@ public String getPoolUUID(String pool) {
ClusterStateRequestBuilder stateBuilder = client.admin().cluster().prepareState();
ClusterStateResponse response = stateBuilder.execute().actionGet();
- Map<String, IndexMetaData> indices = response.getState().getMetaData().getIndices();
- for (String index : indices.keySet()) {
- bucketNameList.add(index);
+ ImmutableOpenMap<String, IndexMetaData> indices = response.getState().getMetaData().getIndices();
+ for (ObjectCursor<String> index : indices.keys()) {
+ bucketNameList.add(index.value);
}
return bucketNameList;

0 comments on commit d012a97

Please sign in to comment.