Thrift: Upgrade to thrift 0.6.1, closes #986.
This commit is contained in:
parent
c134233241
commit
a9112b4698
|
@ -16,7 +16,7 @@
|
||||||
<orderEntry type="module-library">
|
<orderEntry type="module-library">
|
||||||
<library name="libthrift">
|
<library name="libthrift">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$GRADLE_REPOSITORY$/org.elasticsearch/es-libthrift/jars/es-libthrift-0.5.0.jar!/" />
|
<root url="jar://$GRADLE_REPOSITORY$/org.elasticsearch/es-libthrift/jars/es-libthrift-0.6.1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|
|
@ -33,11 +33,11 @@ configurations {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':elasticsearch')
|
compile project(':elasticsearch')
|
||||||
compile 'org.elasticsearch:es-libthrift:0.5.0'
|
compile 'org.elasticsearch:es-libthrift:0.6.1'
|
||||||
compile 'org.slf4j:slf4j-api:1.5.11'
|
compile 'org.slf4j:slf4j-api:1.5.11'
|
||||||
compile('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false }
|
compile('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false }
|
||||||
|
|
||||||
distLib("org.elasticsearch:es-libthrift:0.5.0") { transitive = false }
|
distLib("org.elasticsearch:es-libthrift:0.6.1") { transitive = false }
|
||||||
distLib 'org.slf4j:slf4j-api:1.5.11'
|
distLib 'org.slf4j:slf4j-api:1.5.11'
|
||||||
distLib('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false }
|
distLib('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
* Licensed to Elastic Search and Shay Banon under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. Elastic Search 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autogenerated by Thrift
|
* Autogenerated by Thrift
|
||||||
*
|
*
|
||||||
|
@ -25,9 +6,7 @@
|
||||||
package org.elasticsearch.thrift;
|
package org.elasticsearch.thrift;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.thrift.TEnum;
|
public enum Method implements org.apache.thrift.TEnum {
|
||||||
|
|
||||||
public enum Method implements TEnum {
|
|
||||||
GET(0),
|
GET(0),
|
||||||
PUT(1),
|
PUT(1),
|
||||||
POST(2),
|
POST(2),
|
||||||
|
|
|
@ -5,75 +5,72 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.thrift;
|
package org.elasticsearch.thrift;
|
||||||
|
|
||||||
import org.apache.thrift.*;
|
|
||||||
import org.apache.thrift.async.*;
|
|
||||||
import org.apache.thrift.meta_data.FieldMetaData;
|
|
||||||
import org.apache.thrift.meta_data.StructMetaData;
|
|
||||||
import org.apache.thrift.protocol.*;
|
|
||||||
import org.apache.thrift.transport.TMemoryInputTransport;
|
|
||||||
import org.apache.thrift.transport.TNonblockingTransport;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Rest {
|
public class Rest {
|
||||||
|
|
||||||
public interface Iface {
|
public interface Iface {
|
||||||
|
|
||||||
public RestResponse execute(RestRequest request) throws TException;
|
public RestResponse execute(RestRequest request) throws org.apache.thrift.TException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface AsyncIface {
|
public interface AsyncIface {
|
||||||
|
|
||||||
public void execute(RestRequest request, AsyncMethodCallback<AsyncClient.execute_call> resultHandler) throws TException;
|
public void execute(RestRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.execute_call> resultHandler) throws org.apache.thrift.TException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Client implements TServiceClient, Iface {
|
public static class Client implements org.apache.thrift.TServiceClient, Iface {
|
||||||
public static class Factory implements TServiceClientFactory<Client> {
|
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
|
||||||
public Factory() {
|
public Factory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Client getClient(TProtocol prot) {
|
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
|
||||||
return new Client(prot);
|
return new Client(prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Client getClient(TProtocol iprot, TProtocol oprot) {
|
public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
|
||||||
return new Client(iprot, oprot);
|
return new Client(iprot, oprot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Client(TProtocol prot) {
|
public Client(org.apache.thrift.protocol.TProtocol prot) {
|
||||||
this(prot, prot);
|
this(prot, prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Client(TProtocol iprot, TProtocol oprot) {
|
public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
|
||||||
iprot_ = iprot;
|
iprot_ = iprot;
|
||||||
oprot_ = oprot;
|
oprot_ = oprot;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TProtocol iprot_;
|
protected org.apache.thrift.protocol.TProtocol iprot_;
|
||||||
protected TProtocol oprot_;
|
protected org.apache.thrift.protocol.TProtocol oprot_;
|
||||||
|
|
||||||
protected int seqid_;
|
protected int seqid_;
|
||||||
|
|
||||||
public TProtocol getInputProtocol() {
|
public org.apache.thrift.protocol.TProtocol getInputProtocol() {
|
||||||
return this.iprot_;
|
return this.iprot_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TProtocol getOutputProtocol() {
|
public org.apache.thrift.protocol.TProtocol getOutputProtocol() {
|
||||||
return this.oprot_;
|
return this.oprot_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestResponse execute(RestRequest request) throws TException {
|
public RestResponse execute(RestRequest request) throws org.apache.thrift.TException {
|
||||||
send_execute(request);
|
send_execute(request);
|
||||||
return recv_execute();
|
return recv_execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send_execute(RestRequest request) throws TException {
|
public void send_execute(RestRequest request) throws org.apache.thrift.TException {
|
||||||
oprot_.writeMessageBegin(new TMessage("execute", TMessageType.CALL, ++seqid_));
|
oprot_.writeMessageBegin(new org.apache.thrift.protocol.TMessage("execute", org.apache.thrift.protocol.TMessageType.CALL, ++seqid_));
|
||||||
execute_args args = new execute_args();
|
execute_args args = new execute_args();
|
||||||
args.setRequest(request);
|
args.setRequest(request);
|
||||||
args.write(oprot_);
|
args.write(oprot_);
|
||||||
|
@ -81,15 +78,15 @@ public class Rest {
|
||||||
oprot_.getTransport().flush();
|
oprot_.getTransport().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestResponse recv_execute() throws TException {
|
public RestResponse recv_execute() throws org.apache.thrift.TException {
|
||||||
TMessage msg = iprot_.readMessageBegin();
|
org.apache.thrift.protocol.TMessage msg = iprot_.readMessageBegin();
|
||||||
if (msg.type == TMessageType.EXCEPTION) {
|
if (msg.type == org.apache.thrift.protocol.TMessageType.EXCEPTION) {
|
||||||
TApplicationException x = TApplicationException.read(iprot_);
|
org.apache.thrift.TApplicationException x = org.apache.thrift.TApplicationException.read(iprot_);
|
||||||
iprot_.readMessageEnd();
|
iprot_.readMessageEnd();
|
||||||
throw x;
|
throw x;
|
||||||
}
|
}
|
||||||
if (msg.seqid != seqid_) {
|
if (msg.seqid != seqid_) {
|
||||||
throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "execute failed: out of sequence response");
|
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.BAD_SEQUENCE_ID, "execute failed: out of sequence response");
|
||||||
}
|
}
|
||||||
execute_result result = new execute_result();
|
execute_result result = new execute_result();
|
||||||
result.read(iprot_);
|
result.read(iprot_);
|
||||||
|
@ -97,65 +94,66 @@ public class Rest {
|
||||||
if (result.isSetSuccess()) {
|
if (result.isSetSuccess()) {
|
||||||
return result.success;
|
return result.success;
|
||||||
}
|
}
|
||||||
throw new TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result");
|
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "execute failed: unknown result");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AsyncClient extends TAsyncClient implements AsyncIface {
|
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
|
||||||
public static class Factory implements TAsyncClientFactory<AsyncClient> {
|
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
|
||||||
private TAsyncClientManager clientManager;
|
private org.apache.thrift.async.TAsyncClientManager clientManager;
|
||||||
private TProtocolFactory protocolFactory;
|
private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
|
||||||
|
|
||||||
public Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory) {
|
public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
|
||||||
this.clientManager = clientManager;
|
this.clientManager = clientManager;
|
||||||
this.protocolFactory = protocolFactory;
|
this.protocolFactory = protocolFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncClient getAsyncClient(TNonblockingTransport transport) {
|
public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
|
||||||
return new AsyncClient(protocolFactory, clientManager, transport);
|
return new AsyncClient(protocolFactory, clientManager, transport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport) {
|
public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
|
||||||
super(protocolFactory, clientManager, transport);
|
super(protocolFactory, clientManager, transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(RestRequest request, AsyncMethodCallback<execute_call> resultHandler) throws TException {
|
public void execute(RestRequest request, org.apache.thrift.async.AsyncMethodCallback<execute_call> resultHandler) throws org.apache.thrift.TException {
|
||||||
checkReady();
|
checkReady();
|
||||||
execute_call method_call = new execute_call(request, resultHandler, this, protocolFactory, transport);
|
execute_call method_call = new execute_call(request, resultHandler, this, protocolFactory, transport);
|
||||||
|
this.currentMethod = method_call;
|
||||||
manager.call(method_call);
|
manager.call(method_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class execute_call extends TAsyncMethodCall {
|
public static class execute_call extends org.apache.thrift.async.TAsyncMethodCall {
|
||||||
private RestRequest request;
|
private RestRequest request;
|
||||||
|
|
||||||
public execute_call(RestRequest request, AsyncMethodCallback<execute_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException {
|
public execute_call(RestRequest request, org.apache.thrift.async.AsyncMethodCallback<execute_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
|
||||||
super(client, protocolFactory, transport, resultHandler, false);
|
super(client, protocolFactory, transport, resultHandler, false);
|
||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write_args(TProtocol prot) throws TException {
|
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
|
||||||
prot.writeMessageBegin(new TMessage("execute", TMessageType.CALL, 0));
|
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("execute", org.apache.thrift.protocol.TMessageType.CALL, 0));
|
||||||
execute_args args = new execute_args();
|
execute_args args = new execute_args();
|
||||||
args.setRequest(request);
|
args.setRequest(request);
|
||||||
args.write(prot);
|
args.write(prot);
|
||||||
prot.writeMessageEnd();
|
prot.writeMessageEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestResponse getResult() throws TException {
|
public RestResponse getResult() throws org.apache.thrift.TException {
|
||||||
if (getState() != State.RESPONSE_READ) {
|
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
|
||||||
throw new IllegalStateException("Method call not finished!");
|
throw new IllegalStateException("Method call not finished!");
|
||||||
}
|
}
|
||||||
TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array());
|
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
|
||||||
TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
|
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
|
||||||
return (new Client(prot)).recv_execute();
|
return (new Client(prot)).recv_execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Processor implements TProcessor {
|
public static class Processor implements org.apache.thrift.TProcessor {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
|
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
|
||||||
|
|
||||||
public Processor(Iface iface) {
|
public Processor(Iface iface) {
|
||||||
|
@ -164,20 +162,20 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static interface ProcessFunction {
|
protected static interface ProcessFunction {
|
||||||
public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
|
public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iface iface_;
|
private Iface iface_;
|
||||||
protected final HashMap<String, ProcessFunction> processMap_ = new HashMap<String, ProcessFunction>();
|
protected final HashMap<String, ProcessFunction> processMap_ = new HashMap<String, ProcessFunction>();
|
||||||
|
|
||||||
public boolean process(TProtocol iprot, TProtocol oprot) throws TException {
|
public boolean process(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
TMessage msg = iprot.readMessageBegin();
|
org.apache.thrift.protocol.TMessage msg = iprot.readMessageBegin();
|
||||||
ProcessFunction fn = processMap_.get(msg.name);
|
ProcessFunction fn = processMap_.get(msg.name);
|
||||||
if (fn == null) {
|
if (fn == null) {
|
||||||
TProtocolUtil.skip(iprot, TType.STRUCT);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, org.apache.thrift.protocol.TType.STRUCT);
|
||||||
iprot.readMessageEnd();
|
iprot.readMessageEnd();
|
||||||
TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '" + msg.name + "'");
|
org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.UNKNOWN_METHOD, "Invalid method name: '" + msg.name + "'");
|
||||||
oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
|
oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage(msg.name, org.apache.thrift.protocol.TMessageType.EXCEPTION, msg.seqid));
|
||||||
x.write(oprot);
|
x.write(oprot);
|
||||||
oprot.writeMessageEnd();
|
oprot.writeMessageEnd();
|
||||||
oprot.getTransport().flush();
|
oprot.getTransport().flush();
|
||||||
|
@ -188,14 +186,14 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class execute implements ProcessFunction {
|
private class execute implements ProcessFunction {
|
||||||
public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException {
|
public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
execute_args args = new execute_args();
|
execute_args args = new execute_args();
|
||||||
try {
|
try {
|
||||||
args.read(iprot);
|
args.read(iprot);
|
||||||
} catch (TProtocolException e) {
|
} catch (org.apache.thrift.protocol.TProtocolException e) {
|
||||||
iprot.readMessageEnd();
|
iprot.readMessageEnd();
|
||||||
TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
|
org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.PROTOCOL_ERROR, e.getMessage());
|
||||||
oprot.writeMessageBegin(new TMessage("execute", TMessageType.EXCEPTION, seqid));
|
oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("execute", org.apache.thrift.protocol.TMessageType.EXCEPTION, seqid));
|
||||||
x.write(oprot);
|
x.write(oprot);
|
||||||
oprot.writeMessageEnd();
|
oprot.writeMessageEnd();
|
||||||
oprot.getTransport().flush();
|
oprot.getTransport().flush();
|
||||||
|
@ -204,7 +202,7 @@ public class Rest {
|
||||||
iprot.readMessageEnd();
|
iprot.readMessageEnd();
|
||||||
execute_result result = new execute_result();
|
execute_result result = new execute_result();
|
||||||
result.success = iface_.execute(args.request);
|
result.success = iface_.execute(args.request);
|
||||||
oprot.writeMessageBegin(new TMessage("execute", TMessageType.REPLY, seqid));
|
oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("execute", org.apache.thrift.protocol.TMessageType.REPLY, seqid));
|
||||||
result.write(oprot);
|
result.write(oprot);
|
||||||
oprot.writeMessageEnd();
|
oprot.writeMessageEnd();
|
||||||
oprot.getTransport().flush();
|
oprot.getTransport().flush();
|
||||||
|
@ -214,17 +212,17 @@ public class Rest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class execute_args implements TBase<execute_args, execute_args._Fields>, java.io.Serializable, Cloneable {
|
public static class execute_args implements org.apache.thrift.TBase<execute_args, execute_args._Fields>, java.io.Serializable, Cloneable {
|
||||||
private static final TStruct STRUCT_DESC = new TStruct("execute_args");
|
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("execute_args");
|
||||||
|
|
||||||
private static final TField REQUEST_FIELD_DESC = new TField("request", TType.STRUCT, (short) 1);
|
private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short) 1);
|
||||||
|
|
||||||
public RestRequest request;
|
public RestRequest request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
||||||
*/
|
*/
|
||||||
public enum _Fields implements TFieldIdEnum {
|
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||||
REQUEST((short) 1, "request");
|
REQUEST((short) 1, "request");
|
||||||
|
|
||||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||||
|
@ -283,14 +281,14 @@ public class Rest {
|
||||||
|
|
||||||
// isset id assignments
|
// isset id assignments
|
||||||
|
|
||||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||||
tmpMap.put(_Fields.REQUEST, new FieldMetaData("request", TFieldRequirementType.REQUIRED,
|
tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.REQUIRED,
|
||||||
new StructMetaData(TType.STRUCT, RestRequest.class)));
|
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RestRequest.class)));
|
||||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||||
FieldMetaData.addStructMetaDataMap(execute_args.class, metaDataMap);
|
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(execute_args.class, metaDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public execute_args() {
|
public execute_args() {
|
||||||
|
@ -334,7 +332,7 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field request is set (has been asigned a value) and false otherwise
|
* Returns true if field request is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetRequest() {
|
public boolean isSetRequest() {
|
||||||
return this.request != null;
|
return this.request != null;
|
||||||
|
@ -369,7 +367,7 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
|
* Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSet(_Fields field) {
|
public boolean isSet(_Fields field) {
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
|
@ -426,7 +424,7 @@ public class Rest {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetRequest()) {
|
if (isSetRequest()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.request, typedOther.request);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -438,25 +436,25 @@ public class Rest {
|
||||||
return _Fields.findByThriftId(fieldId);
|
return _Fields.findByThriftId(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(TProtocol iprot) throws TException {
|
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||||
TField field;
|
org.apache.thrift.protocol.TField field;
|
||||||
iprot.readStructBegin();
|
iprot.readStructBegin();
|
||||||
while (true) {
|
while (true) {
|
||||||
field = iprot.readFieldBegin();
|
field = iprot.readFieldBegin();
|
||||||
if (field.type == TType.STOP) {
|
if (field.type == org.apache.thrift.protocol.TType.STOP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (field.id) {
|
switch (field.id) {
|
||||||
case 1: // REQUEST
|
case 1: // REQUEST
|
||||||
if (field.type == TType.STRUCT) {
|
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||||
this.request = new RestRequest();
|
this.request = new RestRequest();
|
||||||
this.request.read(iprot);
|
this.request.read(iprot);
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
iprot.readFieldEnd();
|
iprot.readFieldEnd();
|
||||||
}
|
}
|
||||||
|
@ -466,7 +464,7 @@ public class Rest {
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(TProtocol oprot) throws TException {
|
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
oprot.writeStructBegin(STRUCT_DESC);
|
oprot.writeStructBegin(STRUCT_DESC);
|
||||||
|
@ -495,26 +493,42 @@ public class Rest {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate() throws TException {
|
public void validate() throws org.apache.thrift.TException {
|
||||||
// check for required fields
|
// check for required fields
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
throw new TProtocolException("Required field 'request' was not present! Struct: " + toString());
|
throw new org.apache.thrift.protocol.TProtocolException("Required field 'request' was not present! Struct: " + toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||||
|
try {
|
||||||
|
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||||
|
try {
|
||||||
|
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class execute_result implements TBase<execute_result, execute_result._Fields>, java.io.Serializable, Cloneable {
|
public static class execute_result implements org.apache.thrift.TBase<execute_result, execute_result._Fields>, java.io.Serializable, Cloneable {
|
||||||
private static final TStruct STRUCT_DESC = new TStruct("execute_result");
|
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("execute_result");
|
||||||
|
|
||||||
private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short) 0);
|
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short) 0);
|
||||||
|
|
||||||
public RestResponse success;
|
public RestResponse success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
||||||
*/
|
*/
|
||||||
public enum _Fields implements TFieldIdEnum {
|
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||||
SUCCESS((short) 0, "success");
|
SUCCESS((short) 0, "success");
|
||||||
|
|
||||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||||
|
@ -573,14 +587,14 @@ public class Rest {
|
||||||
|
|
||||||
// isset id assignments
|
// isset id assignments
|
||||||
|
|
||||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||||
tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT,
|
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||||
new StructMetaData(TType.STRUCT, RestResponse.class)));
|
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RestResponse.class)));
|
||||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||||
FieldMetaData.addStructMetaDataMap(execute_result.class, metaDataMap);
|
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(execute_result.class, metaDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public execute_result() {
|
public execute_result() {
|
||||||
|
@ -624,7 +638,7 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field success is set (has been asigned a value) and false otherwise
|
* Returns true if field success is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetSuccess() {
|
public boolean isSetSuccess() {
|
||||||
return this.success != null;
|
return this.success != null;
|
||||||
|
@ -659,7 +673,7 @@ public class Rest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
|
* Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSet(_Fields field) {
|
public boolean isSet(_Fields field) {
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
|
@ -716,7 +730,7 @@ public class Rest {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetSuccess()) {
|
if (isSetSuccess()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -728,25 +742,25 @@ public class Rest {
|
||||||
return _Fields.findByThriftId(fieldId);
|
return _Fields.findByThriftId(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(TProtocol iprot) throws TException {
|
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||||
TField field;
|
org.apache.thrift.protocol.TField field;
|
||||||
iprot.readStructBegin();
|
iprot.readStructBegin();
|
||||||
while (true) {
|
while (true) {
|
||||||
field = iprot.readFieldBegin();
|
field = iprot.readFieldBegin();
|
||||||
if (field.type == TType.STOP) {
|
if (field.type == org.apache.thrift.protocol.TType.STOP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (field.id) {
|
switch (field.id) {
|
||||||
case 0: // SUCCESS
|
case 0: // SUCCESS
|
||||||
if (field.type == TType.STRUCT) {
|
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||||
this.success = new RestResponse();
|
this.success = new RestResponse();
|
||||||
this.success.read(iprot);
|
this.success.read(iprot);
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
iprot.readFieldEnd();
|
iprot.readFieldEnd();
|
||||||
}
|
}
|
||||||
|
@ -756,7 +770,7 @@ public class Rest {
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(TProtocol oprot) throws TException {
|
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
oprot.writeStructBegin(STRUCT_DESC);
|
oprot.writeStructBegin(STRUCT_DESC);
|
||||||
|
|
||||||
if (this.isSetSuccess()) {
|
if (this.isSetSuccess()) {
|
||||||
|
@ -784,10 +798,26 @@ public class Rest {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate() throws TException {
|
public void validate() throws org.apache.thrift.TException {
|
||||||
// check for required fields
|
// check for required fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||||
|
try {
|
||||||
|
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||||
|
try {
|
||||||
|
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
* Licensed to Elastic Search and Shay Banon under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. Elastic Search 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autogenerated by Thrift
|
* Autogenerated by Thrift
|
||||||
*
|
*
|
||||||
|
@ -24,27 +5,24 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.thrift;
|
package org.elasticsearch.thrift;
|
||||||
|
|
||||||
import org.apache.thrift.*;
|
|
||||||
import org.apache.thrift.meta_data.EnumMetaData;
|
|
||||||
import org.apache.thrift.meta_data.FieldMetaData;
|
|
||||||
import org.apache.thrift.meta_data.FieldValueMetaData;
|
|
||||||
import org.apache.thrift.meta_data.MapMetaData;
|
|
||||||
import org.apache.thrift.protocol.*;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, java.io.Serializable, Cloneable {
|
public class RestRequest implements org.apache.thrift.TBase<RestRequest, RestRequest._Fields>, java.io.Serializable, Cloneable {
|
||||||
private static final TStruct STRUCT_DESC = new TStruct("RestRequest");
|
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RestRequest");
|
||||||
|
|
||||||
private static final TField METHOD_FIELD_DESC = new TField("method", TType.I32, (short) 1);
|
private static final org.apache.thrift.protocol.TField METHOD_FIELD_DESC = new org.apache.thrift.protocol.TField("method", org.apache.thrift.protocol.TType.I32, (short) 1);
|
||||||
private static final TField URI_FIELD_DESC = new TField("uri", TType.STRING, (short) 2);
|
private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short) 2);
|
||||||
private static final TField PARAMETERS_FIELD_DESC = new TField("parameters", TType.MAP, (short) 3);
|
private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.MAP, (short) 3);
|
||||||
private static final TField HEADERS_FIELD_DESC = new TField("headers", TType.MAP, (short) 4);
|
private static final org.apache.thrift.protocol.TField HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("headers", org.apache.thrift.protocol.TType.MAP, (short) 4);
|
||||||
private static final TField BODY_FIELD_DESC = new TField("body", TType.STRING, (short) 5);
|
private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short) 5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Method
|
* @see Method
|
||||||
*/
|
*/
|
||||||
public Method method;
|
public Method method;
|
||||||
public String uri;
|
public String uri;
|
||||||
|
@ -55,9 +33,9 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
/**
|
/**
|
||||||
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
||||||
*/
|
*/
|
||||||
public enum _Fields implements TFieldIdEnum {
|
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Method
|
* @see Method
|
||||||
*/
|
*/
|
||||||
METHOD((short) 1, "method"),
|
METHOD((short) 1, "method"),
|
||||||
URI((short) 2, "uri"),
|
URI((short) 2, "uri"),
|
||||||
|
@ -129,26 +107,26 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
|
|
||||||
// isset id assignments
|
// isset id assignments
|
||||||
|
|
||||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||||
tmpMap.put(_Fields.METHOD, new FieldMetaData("method", TFieldRequirementType.REQUIRED,
|
tmpMap.put(_Fields.METHOD, new org.apache.thrift.meta_data.FieldMetaData("method", org.apache.thrift.TFieldRequirementType.REQUIRED,
|
||||||
new EnumMetaData(TType.ENUM, Method.class)));
|
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Method.class)));
|
||||||
tmpMap.put(_Fields.URI, new FieldMetaData("uri", TFieldRequirementType.REQUIRED,
|
tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.REQUIRED,
|
||||||
new FieldValueMetaData(TType.STRING)));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||||
tmpMap.put(_Fields.PARAMETERS, new FieldMetaData("parameters", TFieldRequirementType.OPTIONAL,
|
tmpMap.put(_Fields.PARAMETERS, new org.apache.thrift.meta_data.FieldMetaData("parameters", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||||
new MapMetaData(TType.MAP,
|
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
|
||||||
new FieldValueMetaData(TType.STRING),
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
|
||||||
new FieldValueMetaData(TType.STRING))));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||||
tmpMap.put(_Fields.HEADERS, new FieldMetaData("headers", TFieldRequirementType.OPTIONAL,
|
tmpMap.put(_Fields.HEADERS, new org.apache.thrift.meta_data.FieldMetaData("headers", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||||
new MapMetaData(TType.MAP,
|
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
|
||||||
new FieldValueMetaData(TType.STRING),
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
|
||||||
new FieldValueMetaData(TType.STRING))));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||||
tmpMap.put(_Fields.BODY, new FieldMetaData("body", TFieldRequirementType.OPTIONAL,
|
tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||||
new FieldValueMetaData(TType.STRING)));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
|
||||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||||
FieldMetaData.addStructMetaDataMap(RestRequest.class, metaDataMap);
|
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RestRequest.class, metaDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestRequest() {
|
public RestRequest() {
|
||||||
|
@ -203,7 +181,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
this.headers = __this__headers;
|
this.headers = __this__headers;
|
||||||
}
|
}
|
||||||
if (other.isSetBody()) {
|
if (other.isSetBody()) {
|
||||||
this.body = TBaseHelper.copyBinary(other.body);
|
this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,14 +200,14 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Method
|
* @see Method
|
||||||
*/
|
*/
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return this.method;
|
return this.method;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Method
|
* @see Method
|
||||||
*/
|
*/
|
||||||
public RestRequest setMethod(Method method) {
|
public RestRequest setMethod(Method method) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
|
@ -241,7 +219,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field method is set (has been asigned a value) and false otherwise
|
* Returns true if field method is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetMethod() {
|
public boolean isSetMethod() {
|
||||||
return this.method != null;
|
return this.method != null;
|
||||||
|
@ -267,7 +245,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field uri is set (has been asigned a value) and false otherwise
|
* Returns true if field uri is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetUri() {
|
public boolean isSetUri() {
|
||||||
return this.uri != null;
|
return this.uri != null;
|
||||||
|
@ -304,7 +282,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field parameters is set (has been asigned a value) and false otherwise
|
* Returns true if field parameters is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetParameters() {
|
public boolean isSetParameters() {
|
||||||
return this.parameters != null;
|
return this.parameters != null;
|
||||||
|
@ -341,7 +319,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field headers is set (has been asigned a value) and false otherwise
|
* Returns true if field headers is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetHeaders() {
|
public boolean isSetHeaders() {
|
||||||
return this.headers != null;
|
return this.headers != null;
|
||||||
|
@ -354,16 +332,16 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBody() {
|
public byte[] getBody() {
|
||||||
setBody(TBaseHelper.rightSize(body));
|
setBody(org.apache.thrift.TBaseHelper.rightSize(body));
|
||||||
return body.array();
|
return body == null ? null : body.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer BufferForBody() {
|
public ByteBuffer bufferForBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestRequest setBody(byte[] body) {
|
public RestRequest setBody(byte[] body) {
|
||||||
setBody(ByteBuffer.wrap(body));
|
setBody(body == null ? (ByteBuffer) null : ByteBuffer.wrap(body));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +355,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field body is set (has been asigned a value) and false otherwise
|
* Returns true if field body is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetBody() {
|
public boolean isSetBody() {
|
||||||
return this.body != null;
|
return this.body != null;
|
||||||
|
@ -456,7 +434,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
|
* Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSet(_Fields field) {
|
public boolean isSet(_Fields field) {
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
|
@ -557,7 +535,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetMethod()) {
|
if (isSetMethod()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.method, typedOther.method);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.method, typedOther.method);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +545,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetUri()) {
|
if (isSetUri()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.uri, typedOther.uri);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, typedOther.uri);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +555,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetParameters()) {
|
if (isSetParameters()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.parameters, typedOther.parameters);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parameters, typedOther.parameters);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -587,7 +565,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetHeaders()) {
|
if (isSetHeaders()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.headers, typedOther.headers);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, typedOther.headers);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +575,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetBody()) {
|
if (isSetBody()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.body, typedOther.body);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -609,33 +587,33 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return _Fields.findByThriftId(fieldId);
|
return _Fields.findByThriftId(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(TProtocol iprot) throws TException {
|
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||||
TField field;
|
org.apache.thrift.protocol.TField field;
|
||||||
iprot.readStructBegin();
|
iprot.readStructBegin();
|
||||||
while (true) {
|
while (true) {
|
||||||
field = iprot.readFieldBegin();
|
field = iprot.readFieldBegin();
|
||||||
if (field.type == TType.STOP) {
|
if (field.type == org.apache.thrift.protocol.TType.STOP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (field.id) {
|
switch (field.id) {
|
||||||
case 1: // METHOD
|
case 1: // METHOD
|
||||||
if (field.type == TType.I32) {
|
if (field.type == org.apache.thrift.protocol.TType.I32) {
|
||||||
this.method = Method.findByValue(iprot.readI32());
|
this.method = Method.findByValue(iprot.readI32());
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // URI
|
case 2: // URI
|
||||||
if (field.type == TType.STRING) {
|
if (field.type == org.apache.thrift.protocol.TType.STRING) {
|
||||||
this.uri = iprot.readString();
|
this.uri = iprot.readString();
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // PARAMETERS
|
case 3: // PARAMETERS
|
||||||
if (field.type == TType.MAP) {
|
if (field.type == org.apache.thrift.protocol.TType.MAP) {
|
||||||
{
|
{
|
||||||
TMap _map0 = iprot.readMapBegin();
|
org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
|
||||||
this.parameters = new HashMap<String, String>(2 * _map0.size);
|
this.parameters = new HashMap<String, String>(2 * _map0.size);
|
||||||
for (int _i1 = 0; _i1 < _map0.size; ++_i1) {
|
for (int _i1 = 0; _i1 < _map0.size; ++_i1) {
|
||||||
String _key2;
|
String _key2;
|
||||||
|
@ -647,13 +625,13 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
iprot.readMapEnd();
|
iprot.readMapEnd();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // HEADERS
|
case 4: // HEADERS
|
||||||
if (field.type == TType.MAP) {
|
if (field.type == org.apache.thrift.protocol.TType.MAP) {
|
||||||
{
|
{
|
||||||
TMap _map4 = iprot.readMapBegin();
|
org.apache.thrift.protocol.TMap _map4 = iprot.readMapBegin();
|
||||||
this.headers = new HashMap<String, String>(2 * _map4.size);
|
this.headers = new HashMap<String, String>(2 * _map4.size);
|
||||||
for (int _i5 = 0; _i5 < _map4.size; ++_i5) {
|
for (int _i5 = 0; _i5 < _map4.size; ++_i5) {
|
||||||
String _key6;
|
String _key6;
|
||||||
|
@ -665,18 +643,18 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
iprot.readMapEnd();
|
iprot.readMapEnd();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5: // BODY
|
case 5: // BODY
|
||||||
if (field.type == TType.STRING) {
|
if (field.type == org.apache.thrift.protocol.TType.STRING) {
|
||||||
this.body = iprot.readBinary();
|
this.body = iprot.readBinary();
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
iprot.readFieldEnd();
|
iprot.readFieldEnd();
|
||||||
}
|
}
|
||||||
|
@ -686,7 +664,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(TProtocol oprot) throws TException {
|
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
oprot.writeStructBegin(STRUCT_DESC);
|
oprot.writeStructBegin(STRUCT_DESC);
|
||||||
|
@ -704,7 +682,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
if (isSetParameters()) {
|
if (isSetParameters()) {
|
||||||
oprot.writeFieldBegin(PARAMETERS_FIELD_DESC);
|
oprot.writeFieldBegin(PARAMETERS_FIELD_DESC);
|
||||||
{
|
{
|
||||||
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.parameters.size()));
|
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.parameters.size()));
|
||||||
for (Map.Entry<String, String> _iter8 : this.parameters.entrySet()) {
|
for (Map.Entry<String, String> _iter8 : this.parameters.entrySet()) {
|
||||||
oprot.writeString(_iter8.getKey());
|
oprot.writeString(_iter8.getKey());
|
||||||
oprot.writeString(_iter8.getValue());
|
oprot.writeString(_iter8.getValue());
|
||||||
|
@ -718,7 +696,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
if (isSetHeaders()) {
|
if (isSetHeaders()) {
|
||||||
oprot.writeFieldBegin(HEADERS_FIELD_DESC);
|
oprot.writeFieldBegin(HEADERS_FIELD_DESC);
|
||||||
{
|
{
|
||||||
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.headers.size()));
|
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.headers.size()));
|
||||||
for (Map.Entry<String, String> _iter9 : this.headers.entrySet()) {
|
for (Map.Entry<String, String> _iter9 : this.headers.entrySet()) {
|
||||||
oprot.writeString(_iter9.getKey());
|
oprot.writeString(_iter9.getKey());
|
||||||
oprot.writeString(_iter9.getValue());
|
oprot.writeString(_iter9.getValue());
|
||||||
|
@ -785,7 +763,7 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
if (this.body == null) {
|
if (this.body == null) {
|
||||||
sb.append("null");
|
sb.append("null");
|
||||||
} else {
|
} else {
|
||||||
TBaseHelper.toString(this.body, sb);
|
org.apache.thrift.TBaseHelper.toString(this.body, sb);
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
@ -793,13 +771,29 @@ public class RestRequest implements TBase<RestRequest, RestRequest._Fields>, jav
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate() throws TException {
|
public void validate() throws org.apache.thrift.TException {
|
||||||
// check for required fields
|
// check for required fields
|
||||||
if (method == null) {
|
if (method == null) {
|
||||||
throw new TProtocolException("Required field 'method' was not present! Struct: " + toString());
|
throw new org.apache.thrift.protocol.TProtocolException("Required field 'method' was not present! Struct: " + toString());
|
||||||
}
|
}
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
throw new TProtocolException("Required field 'uri' was not present! Struct: " + toString());
|
throw new org.apache.thrift.protocol.TProtocolException("Required field 'uri' was not present! Struct: " + toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||||
|
try {
|
||||||
|
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||||
|
try {
|
||||||
|
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
* Licensed to Elastic Search and Shay Banon under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. Elastic Search 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autogenerated by Thrift
|
* Autogenerated by Thrift
|
||||||
*
|
*
|
||||||
|
@ -24,25 +5,22 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.thrift;
|
package org.elasticsearch.thrift;
|
||||||
|
|
||||||
import org.apache.thrift.*;
|
|
||||||
import org.apache.thrift.meta_data.EnumMetaData;
|
|
||||||
import org.apache.thrift.meta_data.FieldMetaData;
|
|
||||||
import org.apache.thrift.meta_data.FieldValueMetaData;
|
|
||||||
import org.apache.thrift.meta_data.MapMetaData;
|
|
||||||
import org.apache.thrift.protocol.*;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RestResponse implements TBase<RestResponse, RestResponse._Fields>, java.io.Serializable, Cloneable {
|
public class RestResponse implements org.apache.thrift.TBase<RestResponse, RestResponse._Fields>, java.io.Serializable, Cloneable {
|
||||||
private static final TStruct STRUCT_DESC = new TStruct("RestResponse");
|
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RestResponse");
|
||||||
|
|
||||||
private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short) 1);
|
private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short) 1);
|
||||||
private static final TField HEADERS_FIELD_DESC = new TField("headers", TType.MAP, (short) 2);
|
private static final org.apache.thrift.protocol.TField HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("headers", org.apache.thrift.protocol.TType.MAP, (short) 2);
|
||||||
private static final TField BODY_FIELD_DESC = new TField("body", TType.STRING, (short) 3);
|
private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short) 3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Status
|
* @see Status
|
||||||
*/
|
*/
|
||||||
public Status status;
|
public Status status;
|
||||||
public Map<String, String> headers;
|
public Map<String, String> headers;
|
||||||
|
@ -51,9 +29,9 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
/**
|
/**
|
||||||
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
* The set of fields this struct contains, along with convenience methods for finding and manipulating them.
|
||||||
*/
|
*/
|
||||||
public enum _Fields implements TFieldIdEnum {
|
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Status
|
* @see Status
|
||||||
*/
|
*/
|
||||||
STATUS((short) 1, "status"),
|
STATUS((short) 1, "status"),
|
||||||
HEADERS((short) 2, "headers"),
|
HEADERS((short) 2, "headers"),
|
||||||
|
@ -119,20 +97,20 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
|
|
||||||
// isset id assignments
|
// isset id assignments
|
||||||
|
|
||||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||||
tmpMap.put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.REQUIRED,
|
tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
|
||||||
new EnumMetaData(TType.ENUM, Status.class)));
|
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
|
||||||
tmpMap.put(_Fields.HEADERS, new FieldMetaData("headers", TFieldRequirementType.OPTIONAL,
|
tmpMap.put(_Fields.HEADERS, new org.apache.thrift.meta_data.FieldMetaData("headers", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||||
new MapMetaData(TType.MAP,
|
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
|
||||||
new FieldValueMetaData(TType.STRING),
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
|
||||||
new FieldValueMetaData(TType.STRING))));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||||
tmpMap.put(_Fields.BODY, new FieldMetaData("body", TFieldRequirementType.OPTIONAL,
|
tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||||
new FieldValueMetaData(TType.STRING)));
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
|
||||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||||
FieldMetaData.addStructMetaDataMap(RestResponse.class, metaDataMap);
|
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RestResponse.class, metaDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestResponse() {
|
public RestResponse() {
|
||||||
|
@ -167,7 +145,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
this.headers = __this__headers;
|
this.headers = __this__headers;
|
||||||
}
|
}
|
||||||
if (other.isSetBody()) {
|
if (other.isSetBody()) {
|
||||||
this.body = TBaseHelper.copyBinary(other.body);
|
this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,14 +162,14 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Status
|
* @see Status
|
||||||
*/
|
*/
|
||||||
public Status getStatus() {
|
public Status getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.elasticsearch.thrift.Status
|
* @see Status
|
||||||
*/
|
*/
|
||||||
public RestResponse setStatus(Status status) {
|
public RestResponse setStatus(Status status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
@ -203,7 +181,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field status is set (has been asigned a value) and false otherwise
|
* Returns true if field status is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetStatus() {
|
public boolean isSetStatus() {
|
||||||
return this.status != null;
|
return this.status != null;
|
||||||
|
@ -240,7 +218,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field headers is set (has been asigned a value) and false otherwise
|
* Returns true if field headers is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetHeaders() {
|
public boolean isSetHeaders() {
|
||||||
return this.headers != null;
|
return this.headers != null;
|
||||||
|
@ -253,16 +231,16 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBody() {
|
public byte[] getBody() {
|
||||||
setBody(TBaseHelper.rightSize(body));
|
setBody(org.apache.thrift.TBaseHelper.rightSize(body));
|
||||||
return body.array();
|
return body == null ? null : body.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer BufferForBody() {
|
public ByteBuffer bufferForBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestResponse setBody(byte[] body) {
|
public RestResponse setBody(byte[] body) {
|
||||||
setBody(ByteBuffer.wrap(body));
|
setBody(body == null ? (ByteBuffer) null : ByteBuffer.wrap(body));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +254,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field body is set (has been asigned a value) and false otherwise
|
* Returns true if field body is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSetBody() {
|
public boolean isSetBody() {
|
||||||
return this.body != null;
|
return this.body != null;
|
||||||
|
@ -333,7 +311,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
|
* Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isSet(_Fields field) {
|
public boolean isSet(_Fields field) {
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
|
@ -412,7 +390,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetStatus()) {
|
if (isSetStatus()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.status, typedOther.status);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +400,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetHeaders()) {
|
if (isSetHeaders()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.headers, typedOther.headers);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, typedOther.headers);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -432,7 +410,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
if (isSetBody()) {
|
if (isSetBody()) {
|
||||||
lastComparison = TBaseHelper.compareTo(this.body, typedOther.body);
|
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body);
|
||||||
if (lastComparison != 0) {
|
if (lastComparison != 0) {
|
||||||
return lastComparison;
|
return lastComparison;
|
||||||
}
|
}
|
||||||
|
@ -444,26 +422,26 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
return _Fields.findByThriftId(fieldId);
|
return _Fields.findByThriftId(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(TProtocol iprot) throws TException {
|
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||||
TField field;
|
org.apache.thrift.protocol.TField field;
|
||||||
iprot.readStructBegin();
|
iprot.readStructBegin();
|
||||||
while (true) {
|
while (true) {
|
||||||
field = iprot.readFieldBegin();
|
field = iprot.readFieldBegin();
|
||||||
if (field.type == TType.STOP) {
|
if (field.type == org.apache.thrift.protocol.TType.STOP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (field.id) {
|
switch (field.id) {
|
||||||
case 1: // STATUS
|
case 1: // STATUS
|
||||||
if (field.type == TType.I32) {
|
if (field.type == org.apache.thrift.protocol.TType.I32) {
|
||||||
this.status = Status.findByValue(iprot.readI32());
|
this.status = Status.findByValue(iprot.readI32());
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // HEADERS
|
case 2: // HEADERS
|
||||||
if (field.type == TType.MAP) {
|
if (field.type == org.apache.thrift.protocol.TType.MAP) {
|
||||||
{
|
{
|
||||||
TMap _map10 = iprot.readMapBegin();
|
org.apache.thrift.protocol.TMap _map10 = iprot.readMapBegin();
|
||||||
this.headers = new HashMap<String, String>(2 * _map10.size);
|
this.headers = new HashMap<String, String>(2 * _map10.size);
|
||||||
for (int _i11 = 0; _i11 < _map10.size; ++_i11) {
|
for (int _i11 = 0; _i11 < _map10.size; ++_i11) {
|
||||||
String _key12;
|
String _key12;
|
||||||
|
@ -475,18 +453,18 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
iprot.readMapEnd();
|
iprot.readMapEnd();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // BODY
|
case 3: // BODY
|
||||||
if (field.type == TType.STRING) {
|
if (field.type == org.apache.thrift.protocol.TType.STRING) {
|
||||||
this.body = iprot.readBinary();
|
this.body = iprot.readBinary();
|
||||||
} else {
|
} else {
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TProtocolUtil.skip(iprot, field.type);
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
|
||||||
}
|
}
|
||||||
iprot.readFieldEnd();
|
iprot.readFieldEnd();
|
||||||
}
|
}
|
||||||
|
@ -496,7 +474,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(TProtocol oprot) throws TException {
|
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
oprot.writeStructBegin(STRUCT_DESC);
|
oprot.writeStructBegin(STRUCT_DESC);
|
||||||
|
@ -509,7 +487,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
if (isSetHeaders()) {
|
if (isSetHeaders()) {
|
||||||
oprot.writeFieldBegin(HEADERS_FIELD_DESC);
|
oprot.writeFieldBegin(HEADERS_FIELD_DESC);
|
||||||
{
|
{
|
||||||
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.headers.size()));
|
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.headers.size()));
|
||||||
for (Map.Entry<String, String> _iter14 : this.headers.entrySet()) {
|
for (Map.Entry<String, String> _iter14 : this.headers.entrySet()) {
|
||||||
oprot.writeString(_iter14.getKey());
|
oprot.writeString(_iter14.getKey());
|
||||||
oprot.writeString(_iter14.getValue());
|
oprot.writeString(_iter14.getValue());
|
||||||
|
@ -558,7 +536,7 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
if (this.body == null) {
|
if (this.body == null) {
|
||||||
sb.append("null");
|
sb.append("null");
|
||||||
} else {
|
} else {
|
||||||
TBaseHelper.toString(this.body, sb);
|
org.apache.thrift.TBaseHelper.toString(this.body, sb);
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
@ -566,10 +544,26 @@ public class RestResponse implements TBase<RestResponse, RestResponse._Fields>,
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate() throws TException {
|
public void validate() throws org.apache.thrift.TException {
|
||||||
// check for required fields
|
// check for required fields
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
throw new TProtocolException("Required field 'status' was not present! Struct: " + toString());
|
throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' was not present! Struct: " + toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||||
|
try {
|
||||||
|
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||||
|
try {
|
||||||
|
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||||
|
} catch (org.apache.thrift.TException te) {
|
||||||
|
throw new java.io.IOException(te);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
package org.elasticsearch.thrift;
|
package org.elasticsearch.thrift;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.thrift.TEnum;
|
public enum Status implements org.apache.thrift.TEnum {
|
||||||
|
|
||||||
public enum Status implements TEnum {
|
|
||||||
CONT(100),
|
CONT(100),
|
||||||
SWITCHING_PROTOCOLS(101),
|
SWITCHING_PROTOCOLS(101),
|
||||||
OK(200),
|
OK(200),
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ThriftRestRequest extends AbstractRestRequest implements org.elasti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean hasContent() {
|
@Override public boolean hasContent() {
|
||||||
return request.isSetBody() && request.BufferForBody().remaining() > 0;
|
return request.isSetBody() && request.bufferForBody().remaining() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean contentUnsafe() {
|
@Override public boolean contentUnsafe() {
|
||||||
|
@ -89,21 +89,21 @@ public class ThriftRestRequest extends AbstractRestRequest implements org.elasti
|
||||||
if (!request.isSetBody()) {
|
if (!request.isSetBody()) {
|
||||||
return Bytes.EMPTY_ARRAY;
|
return Bytes.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
return request.BufferForBody().array();
|
return request.bufferForBody().array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int contentByteArrayOffset() {
|
@Override public int contentByteArrayOffset() {
|
||||||
if (!request.isSetBody()) {
|
if (!request.isSetBody()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return request.BufferForBody().arrayOffset();
|
return request.bufferForBody().arrayOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int contentLength() {
|
@Override public int contentLength() {
|
||||||
if (!request.isSetBody()) {
|
if (!request.isSetBody()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return request.BufferForBody().remaining();
|
return request.bufferForBody().remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String contentAsString() {
|
@Override public String contentAsString() {
|
||||||
|
|
|
@ -22,11 +22,11 @@ package org.elasticsearch.thrift;
|
||||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||||
import org.apache.thrift.protocol.TCompactProtocol;
|
import org.apache.thrift.protocol.TCompactProtocol;
|
||||||
import org.apache.thrift.protocol.TProtocolFactory;
|
import org.apache.thrift.protocol.TProtocolFactory;
|
||||||
import org.apache.thrift.server.THsHaServer;
|
|
||||||
import org.apache.thrift.server.TNonblockingServer;
|
|
||||||
import org.apache.thrift.server.TServer;
|
import org.apache.thrift.server.TServer;
|
||||||
import org.apache.thrift.server.TThreadPoolServer;
|
import org.apache.thrift.server.TThreadPoolServer;
|
||||||
import org.apache.thrift.transport.*;
|
import org.apache.thrift.transport.TFramedTransport;
|
||||||
|
import org.apache.thrift.transport.TServerSocket;
|
||||||
|
import org.apache.thrift.transport.TTransportFactory;
|
||||||
import org.elasticsearch.ElasticSearchException;
|
import org.elasticsearch.ElasticSearchException;
|
||||||
import org.elasticsearch.action.admin.cluster.node.info.TransportNodesInfoAction;
|
import org.elasticsearch.action.admin.cluster.node.info.TransportNodesInfoAction;
|
||||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||||
|
@ -34,8 +34,11 @@ import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.network.NetworkService;
|
import org.elasticsearch.common.network.NetworkService;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.PortsRange;
|
import org.elasticsearch.common.transport.PortsRange;
|
||||||
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.transport.BindTransportException;
|
import org.elasticsearch.transport.BindTransportException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ import static org.elasticsearch.common.util.concurrent.EsExecutors.*;
|
||||||
*/
|
*/
|
||||||
public class ThriftServer extends AbstractLifecycleComponent<ThriftServer> {
|
public class ThriftServer extends AbstractLifecycleComponent<ThriftServer> {
|
||||||
|
|
||||||
final String type;
|
final int frame;
|
||||||
|
|
||||||
final String port;
|
final String port;
|
||||||
|
|
||||||
|
@ -71,10 +74,10 @@ public class ThriftServer extends AbstractLifecycleComponent<ThriftServer> {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.networkService = networkService;
|
this.networkService = networkService;
|
||||||
this.nodesInfoAction = nodesInfoAction;
|
this.nodesInfoAction = nodesInfoAction;
|
||||||
this.type = componentSettings.get("type", "threadpool");
|
this.frame = (int) componentSettings.getAsBytesSize("frame", new ByteSizeValue(-1)).bytes();
|
||||||
this.port = componentSettings.get("port", "9500-9600");
|
this.port = componentSettings.get("port", "9500-9600");
|
||||||
this.bindHost = componentSettings.get("bind_host");
|
this.bindHost = componentSettings.get("bind_host", settings.get("transport.bind_host", settings.get("transport.host")));
|
||||||
this.publishHost = componentSettings.get("publish_host");
|
this.publishHost = componentSettings.get("publish_host", settings.get("transport.publish_host", settings.get("transport.host")));
|
||||||
|
|
||||||
if (componentSettings.get("protocol", "binary").equals("compact")) {
|
if (componentSettings.get("protocol", "binary").equals("compact")) {
|
||||||
protocolFactory = new TCompactProtocol.Factory();
|
protocolFactory = new TCompactProtocol.Factory();
|
||||||
|
@ -84,6 +87,14 @@ public class ThriftServer extends AbstractLifecycleComponent<ThriftServer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void doStart() throws ElasticSearchException {
|
@Override protected void doStart() throws ElasticSearchException {
|
||||||
|
InetAddress bindAddrX;
|
||||||
|
try {
|
||||||
|
bindAddrX = networkService.resolveBindHostAddress(bindHost);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BindTransportException("Failed to resolve host [" + bindHost + "]", e);
|
||||||
|
}
|
||||||
|
final InetAddress bindAddr = bindAddrX;
|
||||||
|
|
||||||
PortsRange portsRange = new PortsRange(port);
|
PortsRange portsRange = new PortsRange(port);
|
||||||
final AtomicReference<Exception> lastException = new AtomicReference<Exception>();
|
final AtomicReference<Exception> lastException = new AtomicReference<Exception>();
|
||||||
boolean success = portsRange.iterate(new PortsRange.PortCallback() {
|
boolean success = portsRange.iterate(new PortsRange.PortCallback() {
|
||||||
|
@ -91,24 +102,26 @@ public class ThriftServer extends AbstractLifecycleComponent<ThriftServer> {
|
||||||
ThriftServer.this.portNumber = portNumber;
|
ThriftServer.this.portNumber = portNumber;
|
||||||
try {
|
try {
|
||||||
Rest.Processor processor = new Rest.Processor(client);
|
Rest.Processor processor = new Rest.Processor(client);
|
||||||
if ("threadpool_framed".equals(type) || "threadpool".equals("threadpool")) {
|
|
||||||
TTransportFactory transportFactory;
|
// Bind and start to accept incoming connections.
|
||||||
if ("threadpool_framed".equals(type)) {
|
TServerSocket serverSocket = new TServerSocket(new InetSocketAddress(bindAddr, portNumber));
|
||||||
transportFactory = new TFramedTransport.Factory();
|
|
||||||
} else {
|
TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverSocket)
|
||||||
transportFactory = new TTransportFactory();
|
.minWorkerThreads(16)
|
||||||
}
|
.maxWorkerThreads(Integer.MAX_VALUE)
|
||||||
TServerTransport serverTransport = new TServerSocket(portNumber);
|
.inputProtocolFactory(protocolFactory)
|
||||||
server = new TThreadPoolServer(processor, serverTransport, transportFactory, protocolFactory);
|
.outputProtocolFactory(protocolFactory)
|
||||||
} else if ("nonblocking".equals(type) || "hsha".equals(type)) {
|
.processor(processor);
|
||||||
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(portNumber);
|
|
||||||
TFramedTransport.Factory transportFactory = new TFramedTransport.Factory();
|
if (frame <= 0) {
|
||||||
if ("nonblocking".equals(type)) {
|
args.inputTransportFactory(new TTransportFactory());
|
||||||
server = new TNonblockingServer(processor, serverTransport, transportFactory, protocolFactory);
|
args.outputTransportFactory(new TTransportFactory());
|
||||||
} else {
|
} else {
|
||||||
server = new THsHaServer(processor, serverTransport, transportFactory, protocolFactory);
|
args.inputTransportFactory(new TFramedTransport.Factory(frame));
|
||||||
}
|
args.outputTransportFactory(new TFramedTransport.Factory(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server = new TThreadPoolServer(args);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
lastException.set(e);
|
lastException.set(e);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,7 +27,11 @@ import org.apache.thrift.transport.TTransportException;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.thrift.*;
|
import org.elasticsearch.thrift.Method;
|
||||||
|
import org.elasticsearch.thrift.Rest;
|
||||||
|
import org.elasticsearch.thrift.RestRequest;
|
||||||
|
import org.elasticsearch.thrift.RestResponse;
|
||||||
|
import org.elasticsearch.thrift.Status;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -83,6 +87,6 @@ public class SimpleThriftTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> parseBody(RestResponse response) throws IOException {
|
private Map<String, Object> parseBody(RestResponse response) throws IOException {
|
||||||
return XContentFactory.xContent(XContentType.JSON).createParser(response.BufferForBody().array(), response.BufferForBody().arrayOffset(), response.BufferForBody().remaining()).map();
|
return XContentFactory.xContent(XContentType.JSON).createParser(response.bufferForBody().array(), response.bufferForBody().arrayOffset(), response.bufferForBody().remaining()).map();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue