From 551fe66626379447411ce91c261bc70c18855f09 Mon Sep 17 00:00:00 2001 From: YangruiEmma Date: Fri, 19 Jul 2019 20:12:39 +0800 Subject: [PATCH] delete useless class && modify exception throws type && upgrade version of jackson-databind --- .../check/http/meta/ServiceIfaceInfo.java | 55 - .../dorado/check/http/meta/ServiceInfo.java | 78 - .../meituan/dorado/codec/octo/OctoCodec.java | 4 +- .../test/java/com/meituan/dorado/Echo.java | 1020 -- .../java/com/meituan/dorado/EchoImpl.java | 25 - .../check/http/HttpCheckHandlerTest.java | 72 - .../com/meituan/dorado/mock/MockCodec.java | 4 +- .../bootstrap/provider/ProviderStatus.java | 45 - .../dorado/bootstrap/provider/ServerInfo.java | 51 - .../java/com/meituan/dorado/codec/Codec.java | 6 +- .../com/meituan/dorado/mock/MockCodec.java | 4 +- .../meituan/dorado/demo/thrift/api/Echo.java | 1020 -- .../dorado/demo/thrift/api/EchoImpl.java | 25 - .../dorado/demo/thrift/api/HelloService.java | 1815 --- .../thrift/api/HelloServiceAsyncImpl.java | 29 - .../demo/thrift/api/HelloServiceImpl.java | 31 - .../src/test/resources/thrift/echo.thrift | 4 - .../src/test/resources/thrift/hello.thrift | 6 - .../dorado/registry/api/HelloService.java | 1815 --- .../dorado/registry/api/HelloServiceImpl.java | 31 - .../java/com/meituan/dorado/api/Echo.java | 1024 -- .../java/com/meituan/dorado/api/Echo.java | 1024 -- .../java/com/meituan/dorado/api/EchoImpl.java | 55 - .../thrift/exception/api1/ApiVersion1.java | 1088 -- .../test/thrift/exception/api1/Result.java | 606 - .../thrift/exception/api2/ApiVersion1.java | 1088 -- .../test/thrift/exception/api2/Result.java | 501 - .../dorado/banchmark/simple/api/Echo.java | 1022 -- .../dorado/banchmark/simple/api/EchoImpl.java | 26 - .../com/meituan/dorado/test/echo/Echo.java | 977 -- .../src/main/resources/thriftidl/echo.thrift | 9 - .../test/thrift/MistakeInterfaceNameTest.java | 55 - .../meituan/dorado/test/thrift/api/Echo.java | 974 -- .../meituan/dorado/test/thrift/api/Echo2.java | 1020 -- .../dorado/test/thrift/api/EchoImpl.java | 25 - .../dorado/test/thrift/api/HelloService.java | 1828 --- .../thrift/api/HelloServiceAsyncImpl.java | 41 - .../test/thrift/api/HelloServiceImpl.java | 31 - .../thrift/api/HelloServiceTimeoutImpl.java | 40 - .../dorado/test/thrift/api2/MyException.java | 398 - .../dorado/test/thrift/api2/TestService.java | 6878 -------- .../test/thrift/api2/TestServiceImpl.java | 70 - .../test/thrift/apitwitter/Location.java | 486 - .../apitwitter/ThriftTestConstants.java | 41 - .../dorado/test/thrift/apitwitter/Tweet.java | 936 -- .../thrift/apitwitter/TweetSearchResult.java | 447 - .../test/thrift/apitwitter/TweetType.java | 51 - .../test/thrift/apitwitter/Twitter.java | 13029 ---------------- .../test/thrift/apitwitter/TwitterImpl.java | 113 - .../thrift/apitwitter/TwitterUnavailable.java | 398 - .../thrift/directconn/DirectConnTest.java | 62 - .../thrift/exception/ProtocolClientTest.java | 67 - .../exception/ProtocolExceptionTest.java | 70 - .../exception/TransportExceptionTest.java | 59 - .../test/thrift/exception/api/Echo.java | 1088 -- .../test/thrift/exception/api/EchoResult.java | 501 - .../test/thrift/exception/api2/Echo.java | 1088 -- .../thrift/exception/api2/EchoResult.java | 606 - .../test/resources/thrift/TestSuite.thrift | 20 - .../test/resources/thrift/ThriftTest.thrift | 58 - .../thrift/direconn/thrift-consumer.xml | 40 - .../thrift/direconn/thrift-provider.xml | 35 - .../src/test/resources/thrift/echo.thrift | 4 - .../resources/thrift/exception/echo.thrift | 11 - .../resources/thrift/exception/echo2.thrift | 11 - .../protocolClient/thrift-consumer.xml | 21 - .../src/test/resources/thrift/hello.thrift | 6 - .../thrift/thrift-mistake-interface.xml | 42 - .../com/meituan/dorado/test/echo/Echo.java | 984 -- .../meituan/dorado/test/echo/EchoImpl.java | 26 - .../src/main/resources/thriftidl/echo.thrift | 9 - .../meituan/dorado/trace/cat/api/Echo.java | 1020 -- .../dorado/trace/cat/api/EchoImpl.java | 27 - dorado/pom.xml | 2 +- 74 files changed, 10 insertions(+), 46268 deletions(-) delete mode 100644 dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceIfaceInfo.java delete mode 100644 dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceInfo.java delete mode 100644 dorado/dorado-core-default/src/test/java/com/meituan/dorado/Echo.java delete mode 100644 dorado/dorado-core-default/src/test/java/com/meituan/dorado/EchoImpl.java delete mode 100644 dorado/dorado-core-default/src/test/java/com/meituan/dorado/check/http/HttpCheckHandlerTest.java delete mode 100644 dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ProviderStatus.java delete mode 100644 dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ServerInfo.java delete mode 100644 dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/Echo.java delete mode 100644 dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/EchoImpl.java delete mode 100644 dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloService.java delete mode 100644 dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceAsyncImpl.java delete mode 100644 dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceImpl.java delete mode 100644 dorado/dorado-demo/src/test/resources/thrift/echo.thrift delete mode 100644 dorado/dorado-demo/src/test/resources/thrift/hello.thrift delete mode 100644 dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloService.java delete mode 100644 dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloServiceImpl.java delete mode 100644 dorado/dorado-test/dorado-benchmark-client/src/main/java/com/meituan/dorado/api/Echo.java delete mode 100644 dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/Echo.java delete mode 100644 dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/EchoImpl.java delete mode 100644 dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/ApiVersion1.java delete mode 100644 dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/Result.java delete mode 100644 dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/ApiVersion1.java delete mode 100644 dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/Result.java delete mode 100644 dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/EchoImpl.java delete mode 100644 dorado/dorado-test/dorado-test-client/src/main/java/com/meituan/dorado/test/echo/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-client/src/main/resources/thriftidl/echo.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/MistakeInterfaceNameTest.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo2.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/EchoImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloService.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceAsyncImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceTimeoutImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/MyException.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestService.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestServiceImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Location.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/ThriftTestConstants.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Tweet.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetSearchResult.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetType.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Twitter.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterImpl.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterUnavailable.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/directconn/DirectConnTest.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolClientTest.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolExceptionTest.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/TransportExceptionTest.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/EchoResult.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/EchoResult.java delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/TestSuite.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/ThriftTest.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-consumer.xml delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-provider.xml delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/echo.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo2.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/protocolClient/thrift-consumer.xml delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/hello.thrift delete mode 100644 dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/thrift-mistake-interface.xml delete mode 100644 dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/Echo.java delete mode 100644 dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/EchoImpl.java delete mode 100644 dorado/dorado-test/dorado-test-server/src/main/resources/thriftidl/echo.thrift delete mode 100644 dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/Echo.java delete mode 100644 dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/EchoImpl.java diff --git a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceIfaceInfo.java b/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceIfaceInfo.java deleted file mode 100644 index e100d47..0000000 --- a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceIfaceInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.check.http.meta; - -public class ServiceIfaceInfo { - - private String port; - - private String ifaceName; - - private String implName; - - public ServiceIfaceInfo(String portStr, String ifaceName, String implName) { - this.port = portStr; - this.ifaceName = ifaceName; - this.implName = implName; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public String getIfaceName() { - return ifaceName; - } - - public void setIfaceName(String ifaceName) { - this.ifaceName = ifaceName; - } - - public String getImplName() { - return implName; - } - - public void setImplName(String implName) { - this.implName = implName; - } -} diff --git a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceInfo.java b/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceInfo.java deleted file mode 100644 index 9e27ed9..0000000 --- a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/check/http/meta/ServiceInfo.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.check.http.meta; - -import com.meituan.dorado.common.util.VersionUtil; - -import java.util.Map; - -public class ServiceInfo { - - private String appkey; - private Map portStatus; - private Map serviceInfo; // - private String env; - private String startTime; - private String version = VersionUtil.getDoradoVersion(); - - public String getAppkey() { - return appkey; - } - - public void setAppkey(String appkey) { - this.appkey = appkey; - } - - public Map getPortStatus() { - return portStatus; - } - - public void setPortStatus(Map portStatus) { - this.portStatus = portStatus; - } - - public Map getServiceInfo() { - return serviceInfo; - } - - public void setServiceInfo(Map serviceInfo) { - this.serviceInfo = serviceInfo; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getEnv() { - return env; - } - - public void setEnv(String env) { - this.env = env; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } -} diff --git a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/codec/octo/OctoCodec.java b/dorado/dorado-core-default/src/main/java/com/meituan/dorado/codec/octo/OctoCodec.java index 3f29043..d676131 100644 --- a/dorado/dorado-core-default/src/main/java/com/meituan/dorado/codec/octo/OctoCodec.java +++ b/dorado/dorado-core-default/src/main/java/com/meituan/dorado/codec/octo/OctoCodec.java @@ -73,7 +73,7 @@ public abstract class OctoCodec implements Codec { private static final String ATTACH_INFO_SERIALIZE_CODE = "serializeCode"; @Override - public byte[] encode(Channel channel, Object message, Map attachments) throws IOException { + public byte[] encode(Channel channel, Object message, Map attachments) throws ProtocolException { Object obj; byte[] bodyBytes = new byte[0]; if (message instanceof DefaultRequest) { @@ -120,7 +120,7 @@ public byte[] encode(Channel channel, Object message, Map attach } @Override - public Object decode(Channel channel, byte[] buffer, Map attachments) throws IOException { + public Object decode(Channel channel, byte[] buffer, Map attachments) throws ProtocolException { if (buffer.length < PACKAGE_HEAD_LENGTH) { throw new ProtocolException("Message length less than header length"); } diff --git a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/Echo.java b/dorado/dorado-core-default/src/test/java/com/meituan/dorado/Echo.java deleted file mode 100644 index e884b00..0000000 --- a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/Echo.java +++ /dev/null @@ -1,1020 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/EchoImpl.java b/dorado/dorado-core-default/src/test/java/com/meituan/dorado/EchoImpl.java deleted file mode 100644 index edeaf63..0000000 --- a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/EchoImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - @Override - public String echo(String messge) throws TException { - return messge; - } -} diff --git a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/check/http/HttpCheckHandlerTest.java b/dorado/dorado-core-default/src/test/java/com/meituan/dorado/check/http/HttpCheckHandlerTest.java deleted file mode 100644 index 003d8a5..0000000 --- a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/check/http/HttpCheckHandlerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.check.http; - - -import com.meituan.dorado.MockUtil; -import com.meituan.dorado.common.RpcRole; -import org.junit.Assert; -import org.junit.Test; - -public class HttpCheckHandlerTest { - - @Test - public void testInvokerHttpCheck() { - DoradoHttpCheckHandler httpCheckHandler = new DoradoHttpCheckHandler(); - httpCheckHandler.setRole(RpcRole.INVOKER); - Assert.assertTrue(httpCheckHandler.getRole() == RpcRole.INVOKER); - - String uri = "/invoke/getInterface?param1=a¶m2=b"; - byte[] content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/service.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/call.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/auth.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - } - - @Test - public void testProviderHttpCheck() { - DoradoHttpCheckHandler httpCheckHandler = new DoradoHttpCheckHandler(); - httpCheckHandler.setRole(RpcRole.PROVIDER); - Assert.assertTrue(httpCheckHandler.getRole() == RpcRole.PROVIDER); - - String uri = "/invoke/getInterface?param1=a¶m2=b"; - byte[] content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/service.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/call.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - - uri = "/auth.info"; - content = "test http check handler".getBytes(); - httpCheckHandler.handle(MockUtil.getHttpSender(), uri, content); - } - -} diff --git a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockCodec.java b/dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockCodec.java index 26cb80b..9e5e5ac 100644 --- a/dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockCodec.java +++ b/dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockCodec.java @@ -25,12 +25,12 @@ public class MockCodec implements Codec { @Override - public byte[] encode(Channel channel, Object message, Map attachments) throws IOException { + public byte[] encode(Channel channel, Object message, Map attachments) { return new byte[0]; } @Override - public Object decode(Channel channel, byte[] buffer, Map attachments) throws IOException { + public Object decode(Channel channel, byte[] buffer, Map attachments) { return null; } } diff --git a/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ProviderStatus.java b/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ProviderStatus.java deleted file mode 100644 index cddc966..0000000 --- a/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ProviderStatus.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.bootstrap.provider; - -public enum ProviderStatus { - DEAD(0), STARTING(1), ALIVE(2), STOPPING(3), STOPPED(4); - - private int code; - - ProviderStatus(int code) { - this.code = code; - } - - public int getCode() { - return code; - } - - public static boolean isNotAliveStatus(int statusCode) { - switch (statusCode) { - case 0: - return true; - case 1: - return true; - case 3: - return true; - case 4: - return true; - default: - return false; - } - } -} diff --git a/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ServerInfo.java b/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ServerInfo.java deleted file mode 100644 index d21557d..0000000 --- a/dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/provider/ServerInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.bootstrap.provider; - -import java.util.Date; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * Provider端服务信息 - */ -public class ServerInfo { - - private static final ConcurrentHashMap serverStatus = new ConcurrentHashMap<>(); - private static final ConcurrentHashMap serverStartTime = new ConcurrentHashMap<>(); - - - public static int getStatus(int port) { - ProviderStatus status = serverStatus.get(port); - if (status == null) { - return ProviderStatus.DEAD.getCode(); - } - return status.getCode(); - } - - public static ConcurrentMap getServerStatus() { - return serverStatus; - } - - public static void alive(int port) { - serverStatus.put(port, ProviderStatus.ALIVE); - serverStartTime.putIfAbsent(port, new Date()); - } - - public static void dead(int port) { - serverStatus.put(port, ProviderStatus.DEAD); - } -} diff --git a/dorado/dorado-core/src/main/java/com/meituan/dorado/codec/Codec.java b/dorado/dorado-core/src/main/java/com/meituan/dorado/codec/Codec.java index ed7a34b..a03acba 100644 --- a/dorado/dorado-core/src/main/java/com/meituan/dorado/codec/Codec.java +++ b/dorado/dorado-core/src/main/java/com/meituan/dorado/codec/Codec.java @@ -15,16 +15,16 @@ */ package com.meituan.dorado.codec; +import com.meituan.dorado.common.exception.ProtocolException; import com.meituan.dorado.common.extension.SPI; import com.meituan.dorado.transport.Channel; -import java.io.IOException; import java.util.Map; @SPI public interface Codec { - byte[] encode(Channel channel, Object message, Map attachments) throws IOException; + byte[] encode(Channel channel, Object message, Map attachments) throws ProtocolException; - Object decode(Channel channel, byte[] buffer, Map attachments) throws IOException; + Object decode(Channel channel, byte[] buffer, Map attachments) throws ProtocolException; } diff --git a/dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockCodec.java b/dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockCodec.java index 26cb80b..9e5e5ac 100644 --- a/dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockCodec.java +++ b/dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockCodec.java @@ -25,12 +25,12 @@ public class MockCodec implements Codec { @Override - public byte[] encode(Channel channel, Object message, Map attachments) throws IOException { + public byte[] encode(Channel channel, Object message, Map attachments) { return new byte[0]; } @Override - public Object decode(Channel channel, byte[] buffer, Map attachments) throws IOException { + public Object decode(Channel channel, byte[] buffer, Map attachments) { return null; } } diff --git a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/Echo.java b/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/Echo.java deleted file mode 100644 index 80fee71..0000000 --- a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/Echo.java +++ /dev/null @@ -1,1020 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.demo.thrift.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/EchoImpl.java b/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/EchoImpl.java deleted file mode 100644 index 7d0009f..0000000 --- a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/EchoImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.demo.thrift.api; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - @Override - public String echo(String messge) throws TException { - return "echo: " + messge; - } -} diff --git a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloService.java b/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloService.java deleted file mode 100644 index d1fdb03..0000000 --- a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloService.java +++ /dev/null @@ -1,1815 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.demo.thrift.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-12-09") -public class HelloService { - - public interface Iface { - - public String sayHello(String username) throws TException; - - public String sayBye(String username) throws TException; - - } - - public interface AsyncIface { - - public void sayHello(String username, AsyncMethodCallback resultHandler) throws TException; - - public void sayBye(String username, AsyncMethodCallback resultHandler) throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String sayHello(String username) throws TException - { - send_sayHello(username); - return recv_sayHello(); - } - - public void send_sayHello(String username) throws TException - { - sayHello_args args = new sayHello_args(); - args.setUsername(username); - sendBase("sayHello", args); - } - - public String recv_sayHello() throws TException - { - sayHello_result result = new sayHello_result(); - receiveBase(result, "sayHello"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayHello failed: unknown result"); - } - - public String sayBye(String username) throws TException - { - send_sayBye(username); - return recv_sayBye(); - } - - public void send_sayBye(String username) throws TException - { - sayBye_args args = new sayBye_args(); - args.setUsername(username); - sendBase("sayBye", args); - } - - public String recv_sayBye() throws TException - { - sayBye_result result = new sayBye_result(); - receiveBase(result, "sayBye"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayBye failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void sayHello(String username, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - sayHello_call method_call = new sayHello_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayHello_call(String username, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayHello_args args = new sayHello_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayHello(); - } - } - - public void sayBye(String username, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - sayBye_call method_call = new sayBye_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayBye_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayBye_call(String username, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayBye", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayBye_args args = new sayBye_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayBye(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.ProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayHello_result getResult(I iface, sayHello_args args) throws TException { - sayHello_result result = new sayHello_result(); - result.success = iface.sayHello(args.username); - return result; - } - } - - public static class sayBye extends org.apache.thrift.ProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayBye_result getResult(I iface, sayBye_args args) throws TException { - sayBye_result result = new sayBye_result(); - result.success = iface.sayBye(args.username); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.AsyncProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayHello_result result = new sayHello_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayHello_result result = new sayHello_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayHello_args args, AsyncMethodCallback resultHandler) throws TException { - iface.sayHello(args.username,resultHandler); - } - } - - public static class sayBye extends org.apache.thrift.AsyncProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayBye_result result = new sayBye_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayBye_result result = new sayBye_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayBye_args args, AsyncMethodCallback resultHandler) throws TException { - iface.sayBye(args.username,resultHandler); - } - } - - } - - public static class sayHello_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_args.class, metaDataMap); - } - - public sayHello_args() { - } - - public sayHello_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_args(sayHello_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayHello_args deepCopy() { - return new sayHello_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayHello_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_args) - return this.equals((sayHello_args)that); - return false; - } - - public boolean equals(sayHello_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { - public sayHello_argsStandardScheme getScheme() { - return new sayHello_argsStandardScheme(); - } - } - - private static class sayHello_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { - public sayHello_argsTupleScheme getScheme() { - return new sayHello_argsTupleScheme(); - } - } - - private static class sayHello_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayHello_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_result.class, metaDataMap); - } - - public sayHello_result() { - } - - public sayHello_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_result(sayHello_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayHello_result deepCopy() { - return new sayHello_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayHello_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_result) - return this.equals((sayHello_result)that); - return false; - } - - public boolean equals(sayHello_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { - public sayHello_resultStandardScheme getScheme() { - return new sayHello_resultStandardScheme(); - } - } - - private static class sayHello_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { - public sayHello_resultTupleScheme getScheme() { - return new sayHello_resultTupleScheme(); - } - } - - private static class sayHello_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class sayBye_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_args.class, metaDataMap); - } - - public sayBye_args() { - } - - public sayBye_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_args(sayBye_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayBye_args deepCopy() { - return new sayBye_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayBye_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_args) - return this.equals((sayBye_args)that); - return false; - } - - public boolean equals(sayBye_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayBye_argsStandardSchemeFactory implements SchemeFactory { - public sayBye_argsStandardScheme getScheme() { - return new sayBye_argsStandardScheme(); - } - } - - private static class sayBye_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_argsTupleSchemeFactory implements SchemeFactory { - public sayBye_argsTupleScheme getScheme() { - return new sayBye_argsTupleScheme(); - } - } - - private static class sayBye_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayBye_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_result.class, metaDataMap); - } - - public sayBye_result() { - } - - public sayBye_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_result(sayBye_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayBye_result deepCopy() { - return new sayBye_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayBye_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_result) - return this.equals((sayBye_result)that); - return false; - } - - public boolean equals(sayBye_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayBye_resultStandardSchemeFactory implements SchemeFactory { - public sayBye_resultStandardScheme getScheme() { - return new sayBye_resultStandardScheme(); - } - } - - private static class sayBye_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_resultTupleSchemeFactory implements SchemeFactory { - public sayBye_resultTupleScheme getScheme() { - return new sayBye_resultTupleScheme(); - } - } - - private static class sayBye_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceAsyncImpl.java b/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceAsyncImpl.java deleted file mode 100644 index cba2c23..0000000 --- a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceAsyncImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.demo.thrift.api; - -public class HelloServiceAsyncImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - String result = "Hello " + name; - return result; - } - - @Override - public String sayBye(String username) { - return "Bye " + username; - } -} diff --git a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceImpl.java b/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceImpl.java deleted file mode 100644 index ed07c34..0000000 --- a/dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/api/HelloServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.demo.thrift.api; - -import org.apache.thrift.TException; - -public class HelloServiceImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - String result = "Hello " + name; - return result; - } - - @Override - public String sayBye(String username) throws TException { - return "Bye " + username; - } -} diff --git a/dorado/dorado-demo/src/test/resources/thrift/echo.thrift b/dorado/dorado-demo/src/test/resources/thrift/echo.thrift deleted file mode 100644 index a6a6274..0000000 --- a/dorado/dorado-demo/src/test/resources/thrift/echo.thrift +++ /dev/null @@ -1,4 +0,0 @@ -namespace java com.meituan.dorado.demo.thrift.api -service Echo { - string echo(1:string messge) -} \ No newline at end of file diff --git a/dorado/dorado-demo/src/test/resources/thrift/hello.thrift b/dorado/dorado-demo/src/test/resources/thrift/hello.thrift deleted file mode 100644 index b8e1511..0000000 --- a/dorado/dorado-demo/src/test/resources/thrift/hello.thrift +++ /dev/null @@ -1,6 +0,0 @@ -namespace java com.meituan.dorado.demo.thrift.api -service HelloService -{ - string sayHello(1:string username) - string sayBye(1:string username) -} diff --git a/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloService.java b/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloService.java deleted file mode 100644 index 7c2fd13..0000000 --- a/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloService.java +++ /dev/null @@ -1,1815 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.registry.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-12-09") -public class HelloService { - - public interface Iface { - - public String sayHello(String username) throws TException; - - public String sayBye(String username) throws TException; - - } - - public interface AsyncIface { - - public void sayHello(String username, AsyncMethodCallback resultHandler) throws TException; - - public void sayBye(String username, AsyncMethodCallback resultHandler) throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String sayHello(String username) throws TException - { - send_sayHello(username); - return recv_sayHello(); - } - - public void send_sayHello(String username) throws TException - { - sayHello_args args = new sayHello_args(); - args.setUsername(username); - sendBase("sayHello", args); - } - - public String recv_sayHello() throws TException - { - sayHello_result result = new sayHello_result(); - receiveBase(result, "sayHello"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayHello failed: unknown result"); - } - - public String sayBye(String username) throws TException - { - send_sayBye(username); - return recv_sayBye(); - } - - public void send_sayBye(String username) throws TException - { - sayBye_args args = new sayBye_args(); - args.setUsername(username); - sendBase("sayBye", args); - } - - public String recv_sayBye() throws TException - { - sayBye_result result = new sayBye_result(); - receiveBase(result, "sayBye"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayBye failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void sayHello(String username, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - sayHello_call method_call = new sayHello_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayHello_call(String username, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayHello_args args = new sayHello_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayHello(); - } - } - - public void sayBye(String username, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - sayBye_call method_call = new sayBye_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayBye_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayBye_call(String username, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayBye", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayBye_args args = new sayBye_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayBye(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.ProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayHello_result getResult(I iface, sayHello_args args) throws TException { - sayHello_result result = new sayHello_result(); - result.success = iface.sayHello(args.username); - return result; - } - } - - public static class sayBye extends org.apache.thrift.ProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayBye_result getResult(I iface, sayBye_args args) throws TException { - sayBye_result result = new sayBye_result(); - result.success = iface.sayBye(args.username); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.AsyncProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayHello_result result = new sayHello_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayHello_result result = new sayHello_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayHello_args args, AsyncMethodCallback resultHandler) throws TException { - iface.sayHello(args.username,resultHandler); - } - } - - public static class sayBye extends org.apache.thrift.AsyncProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayBye_result result = new sayBye_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayBye_result result = new sayBye_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayBye_args args, AsyncMethodCallback resultHandler) throws TException { - iface.sayBye(args.username,resultHandler); - } - } - - } - - public static class sayHello_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_args.class, metaDataMap); - } - - public sayHello_args() { - } - - public sayHello_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_args(sayHello_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayHello_args deepCopy() { - return new sayHello_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayHello_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_args) - return this.equals((sayHello_args)that); - return false; - } - - public boolean equals(sayHello_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { - public sayHello_argsStandardScheme getScheme() { - return new sayHello_argsStandardScheme(); - } - } - - private static class sayHello_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { - public sayHello_argsTupleScheme getScheme() { - return new sayHello_argsTupleScheme(); - } - } - - private static class sayHello_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayHello_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_result.class, metaDataMap); - } - - public sayHello_result() { - } - - public sayHello_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_result(sayHello_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayHello_result deepCopy() { - return new sayHello_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayHello_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_result) - return this.equals((sayHello_result)that); - return false; - } - - public boolean equals(sayHello_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { - public sayHello_resultStandardScheme getScheme() { - return new sayHello_resultStandardScheme(); - } - } - - private static class sayHello_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { - public sayHello_resultTupleScheme getScheme() { - return new sayHello_resultTupleScheme(); - } - } - - private static class sayHello_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class sayBye_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_args.class, metaDataMap); - } - - public sayBye_args() { - } - - public sayBye_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_args(sayBye_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayBye_args deepCopy() { - return new sayBye_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayBye_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_args) - return this.equals((sayBye_args)that); - return false; - } - - public boolean equals(sayBye_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayBye_argsStandardSchemeFactory implements SchemeFactory { - public sayBye_argsStandardScheme getScheme() { - return new sayBye_argsStandardScheme(); - } - } - - private static class sayBye_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_argsTupleSchemeFactory implements SchemeFactory { - public sayBye_argsTupleScheme getScheme() { - return new sayBye_argsTupleScheme(); - } - } - - private static class sayBye_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayBye_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_result.class, metaDataMap); - } - - public sayBye_result() { - } - - public sayBye_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_result(sayBye_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayBye_result deepCopy() { - return new sayBye_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayBye_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_result) - return this.equals((sayBye_result)that); - return false; - } - - public boolean equals(sayBye_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class sayBye_resultStandardSchemeFactory implements SchemeFactory { - public sayBye_resultStandardScheme getScheme() { - return new sayBye_resultStandardScheme(); - } - } - - private static class sayBye_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_resultTupleSchemeFactory implements SchemeFactory { - public sayBye_resultTupleScheme getScheme() { - return new sayBye_resultTupleScheme(); - } - } - - private static class sayBye_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloServiceImpl.java b/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloServiceImpl.java deleted file mode 100644 index fce88a1..0000000 --- a/dorado/dorado-registry/dorado-registry-mns/src/test/java/com/meituan/dorado/registry/api/HelloServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.registry.api; - -import org.apache.thrift.TException; - -public class HelloServiceImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - String result = "Hello " + name; - return result; - } - - @Override - public String sayBye(String username) throws TException { - return "Bye " + username; - } -} diff --git a/dorado/dorado-test/dorado-benchmark-client/src/main/java/com/meituan/dorado/api/Echo.java b/dorado/dorado-test/dorado-benchmark-client/src/main/java/com/meituan/dorado/api/Echo.java deleted file mode 100644 index 39ead50..0000000 --- a/dorado/dorado-test/dorado-benchmark-client/src/main/java/com/meituan/dorado/api/Echo.java +++ /dev/null @@ -1,1024 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.api; - -import org.apache.thrift.AsyncProcessFunction; -import org.apache.thrift.ProcessFunction; -import org.apache.thrift.TBase; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.meta_data.FieldMetaData; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/Echo.java b/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/Echo.java deleted file mode 100644 index 39ead50..0000000 --- a/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/Echo.java +++ /dev/null @@ -1,1024 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.api; - -import org.apache.thrift.AsyncProcessFunction; -import org.apache.thrift.ProcessFunction; -import org.apache.thrift.TBase; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.meta_data.FieldMetaData; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/EchoImpl.java b/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/EchoImpl.java deleted file mode 100644 index b2790ad..0000000 --- a/dorado/dorado-test/dorado-benchmark-server/src/main/java/com/meituan/dorado/api/EchoImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.api; - -import org.apache.thrift.TException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -public class EchoImpl implements Echo.Iface { - - public static final Logger logger = LoggerFactory.getLogger(EchoImpl.class); - private static volatile AtomicLong counter = new AtomicLong(0); - private static long timeWindow = 10; - - private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); - - static { - service.scheduleWithFixedDelay(new Runnable() { - @Override - public void run() { - try { - long tps = counter.get() / timeWindow; - counter.set(0); - logger.info("TPS:" + tps); - } catch (Exception e) { - e.printStackTrace(); - } - } - }, 0, timeWindow, TimeUnit.SECONDS); - } - - @Override - public String echo(String messge) throws TException { - counter.addAndGet(1); - return messge; - } -} diff --git a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/ApiVersion1.java b/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/ApiVersion1.java deleted file mode 100644 index faad23e..0000000 --- a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/ApiVersion1.java +++ /dev/null @@ -1,1088 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api1; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-03-29") -public class ApiVersion1 { - - public interface Iface { - - public Result send(String message, String param) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void send(String message, String param, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public Result send(String message, String param) throws org.apache.thrift.TException - { - send_send(message, param); - return recv_send(); - } - - public void send_send(String message, String param) throws org.apache.thrift.TException - { - send_args args = new send_args(); - args.setMessage(message); - args.setParam(param); - sendBase("send", args); - } - - public Result recv_send() throws org.apache.thrift.TException - { - send_result result = new send_result(); - receiveBase(result, "send"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "send failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void send(String message, String param, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - send_call method_call = new send_call(message, param, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class send_call extends org.apache.thrift.async.TAsyncMethodCall { - private String message; - private String param; - public send_call(String message, String param, org.apache.thrift.async.AsyncMethodCallback 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); - this.message = message; - this.param = param; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("send", org.apache.thrift.protocol.TMessageType.CALL, 0)); - send_args args = new send_args(); - args.setMessage(message); - args.setParam(param); - args.write(prot); - prot.writeMessageEnd(); - } - - public Result getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_send(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("send", new send()); - return processMap; - } - - public static class send extends org.apache.thrift.ProcessFunction { - public send() { - super("send"); - } - - public send_args getEmptyArgsInstance() { - return new send_args(); - } - - protected boolean isOneway() { - return false; - } - - public send_result getResult(I iface, send_args args) throws org.apache.thrift.TException { - send_result result = new send_result(); - result.success = iface.send(args.message, args.param); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("send", new send()); - return processMap; - } - - public static class send extends org.apache.thrift.AsyncProcessFunction { - public send() { - super("send"); - } - - public send_args getEmptyArgsInstance() { - return new send_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Result o) { - send_result result = new send_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - send_result result = new send_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, send_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.send(args.message, args.param,resultHandler); - } - } - - } - - public static class send_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("send_args"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAM_FIELD_DESC = new org.apache.thrift.protocol.TField("param", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new send_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new send_argsTupleSchemeFactory()); - } - - public String message; // required - public String param; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"), - PARAM((short)2, "param"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - case 2: // PARAM - return PARAM; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAM, new org.apache.thrift.meta_data.FieldMetaData("param", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(send_args.class, metaDataMap); - } - - public send_args() { - } - - public send_args( - String message, - String param) - { - this(); - this.message = message; - this.param = param; - } - - /** - * Performs a deep copy on other. - */ - public send_args(send_args other) { - if (other.isSetMessage()) { - this.message = other.message; - } - if (other.isSetParam()) { - this.param = other.param; - } - } - - public send_args deepCopy() { - return new send_args(this); - } - - @Override - public void clear() { - this.message = null; - this.param = null; - } - - public String getMessage() { - return this.message; - } - - public send_args setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public String getParam() { - return this.param; - } - - public send_args setParam(String param) { - this.param = param; - return this; - } - - public void unsetParam() { - this.param = null; - } - - /** Returns true if field param is set (has been assigned a value) and false otherwise */ - public boolean isSetParam() { - return this.param != null; - } - - public void setParamIsSet(boolean value) { - if (!value) { - this.param = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - case PARAM: - if (value == null) { - unsetParam(); - } else { - setParam((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - case PARAM: - return getParam(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - case PARAM: - return isSetParam(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof send_args) - return this.equals((send_args)that); - return false; - } - - public boolean equals(send_args that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - boolean this_present_param = true && this.isSetParam(); - boolean that_present_param = true && that.isSetParam(); - if (this_present_param || that_present_param) { - if (!(this_present_param && that_present_param)) - return false; - if (!this.param.equals(that.param)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - boolean present_param = true && (isSetParam()); - list.add(present_param); - if (present_param) - list.add(param); - - return list.hashCode(); - } - - @Override - public int compareTo(send_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetParam()).compareTo(other.isSetParam()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParam()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.param, other.param); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("send_args("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - if (!first) sb.append(", "); - sb.append("param:"); - if (this.param == null) { - sb.append("null"); - } else { - sb.append(this.param); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class send_argsStandardSchemeFactory implements SchemeFactory { - public send_argsStandardScheme getScheme() { - return new send_argsStandardScheme(); - } - } - - private static class send_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, send_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAM - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, send_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - if (struct.param != null) { - oprot.writeFieldBegin(PARAM_FIELD_DESC); - oprot.writeString(struct.param); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class send_argsTupleSchemeFactory implements SchemeFactory { - public send_argsTupleScheme getScheme() { - return new send_argsTupleScheme(); - } - } - - private static class send_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, send_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - if (struct.isSetParam()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - if (struct.isSetParam()) { - oprot.writeString(struct.param); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, send_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - if (incoming.get(1)) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } - } - } - - } - - public static class send_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("send_result"); - - 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); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new send_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new send_resultTupleSchemeFactory()); - } - - public Result success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Result.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(send_result.class, metaDataMap); - } - - public send_result() { - } - - public send_result( - Result success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public send_result(send_result other) { - if (other.isSetSuccess()) { - this.success = new Result(other.success); - } - } - - public send_result deepCopy() { - return new send_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public Result getSuccess() { - return this.success; - } - - public send_result setSuccess(Result success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Result)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof send_result) - return this.equals((send_result)that); - return false; - } - - public boolean equals(send_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(send_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("send_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - 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); - } - } - - private static class send_resultStandardSchemeFactory implements SchemeFactory { - public send_resultStandardScheme getScheme() { - return new send_resultStandardScheme(); - } - } - - private static class send_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, send_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new Result(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, send_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class send_resultTupleSchemeFactory implements SchemeFactory { - public send_resultTupleScheme getScheme() { - return new send_resultTupleScheme(); - } - } - - private static class send_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, send_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, send_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = new Result(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/Result.java b/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/Result.java deleted file mode 100644 index 5d32852..0000000 --- a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api1/Result.java +++ /dev/null @@ -1,606 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api1; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-03-29") -public class Result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Result"); - - private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I32, (short)2); - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)3); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new ResultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new ResultTupleSchemeFactory()); - } - - public String result; // required - public int id; // required - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - RESULT((short)1, "result"), - ID((short)2, "id"), - MESSAGE((short)3, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // RESULT - return RESULT; - case 2: // ID - return ID; - case 3: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __ID_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.RESULT, new org.apache.thrift.meta_data.FieldMetaData("result", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Result.class, metaDataMap); - } - - public Result() { - } - - public Result( - String result, - int id, - String message) - { - this(); - this.result = result; - this.id = id; - setIdIsSet(true); - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public Result(Result other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetResult()) { - this.result = other.result; - } - this.id = other.id; - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public Result deepCopy() { - return new Result(this); - } - - @Override - public void clear() { - this.result = null; - setIdIsSet(false); - this.id = 0; - this.message = null; - } - - public String getResult() { - return this.result; - } - - public Result setResult(String result) { - this.result = result; - return this; - } - - public void unsetResult() { - this.result = null; - } - - /** Returns true if field result is set (has been assigned a value) and false otherwise */ - public boolean isSetResult() { - return this.result != null; - } - - public void setResultIsSet(boolean value) { - if (!value) { - this.result = null; - } - } - - public int getId() { - return this.id; - } - - public Result setId(int id) { - this.id = id; - setIdIsSet(true); - return this; - } - - public void unsetId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); - } - - /** Returns true if field id is set (has been assigned a value) and false otherwise */ - public boolean isSetId() { - return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); - } - - public void setIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); - } - - public String getMessage() { - return this.message; - } - - public Result setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case RESULT: - if (value == null) { - unsetResult(); - } else { - setResult((String)value); - } - break; - - case ID: - if (value == null) { - unsetId(); - } else { - setId((Integer)value); - } - break; - - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case RESULT: - return getResult(); - - case ID: - return getId(); - - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case RESULT: - return isSetResult(); - case ID: - return isSetId(); - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof Result) - return this.equals((Result)that); - return false; - } - - public boolean equals(Result that) { - if (that == null) - return false; - - boolean this_present_result = true && this.isSetResult(); - boolean that_present_result = true && that.isSetResult(); - if (this_present_result || that_present_result) { - if (!(this_present_result && that_present_result)) - return false; - if (!this.result.equals(that.result)) - return false; - } - - boolean this_present_id = true; - boolean that_present_id = true; - if (this_present_id || that_present_id) { - if (!(this_present_id && that_present_id)) - return false; - if (this.id != that.id) - return false; - } - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_result = true && (isSetResult()); - list.add(present_result); - if (present_result) - list.add(result); - - boolean present_id = true; - list.add(present_id); - if (present_id) - list.add(id); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - return list.hashCode(); - } - - @Override - public int compareTo(Result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetResult()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("Result("); - boolean first = true; - - sb.append("result:"); - if (this.result == null) { - sb.append("null"); - } else { - sb.append(this.result); - } - first = false; - if (!first) sb.append(", "); - sb.append("id:"); - sb.append(this.id); - first = false; - if (!first) sb.append(", "); - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class ResultStandardSchemeFactory implements SchemeFactory { - public ResultStandardScheme getScheme() { - return new ResultStandardScheme(); - } - } - - private static class ResultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, Result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // RESULT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, Result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.result != null) { - oprot.writeFieldBegin(RESULT_FIELD_DESC); - oprot.writeString(struct.result); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(ID_FIELD_DESC); - oprot.writeI32(struct.id); - oprot.writeFieldEnd(); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class ResultTupleSchemeFactory implements SchemeFactory { - public ResultTupleScheme getScheme() { - return new ResultTupleScheme(); - } - } - - private static class ResultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, Result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetResult()) { - optionals.set(0); - } - if (struct.isSetId()) { - optionals.set(1); - } - if (struct.isSetMessage()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetResult()) { - oprot.writeString(struct.result); - } - if (struct.isSetId()) { - oprot.writeI32(struct.id); - } - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, Result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } - if (incoming.get(1)) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } - if (incoming.get(2)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/ApiVersion1.java b/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/ApiVersion1.java deleted file mode 100644 index 157228b..0000000 --- a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/ApiVersion1.java +++ /dev/null @@ -1,1088 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-03-29") -public class ApiVersion1 { - - public interface Iface { - - public Result send(String message, String param) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void send(String message, String param, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public Result send(String message, String param) throws org.apache.thrift.TException - { - send_send(message, param); - return recv_send(); - } - - public void send_send(String message, String param) throws org.apache.thrift.TException - { - send_args args = new send_args(); - args.setMessage(message); - args.setParam(param); - sendBase("send", args); - } - - public Result recv_send() throws org.apache.thrift.TException - { - send_result result = new send_result(); - receiveBase(result, "send"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "send failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void send(String message, String param, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - send_call method_call = new send_call(message, param, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class send_call extends org.apache.thrift.async.TAsyncMethodCall { - private String message; - private String param; - public send_call(String message, String param, org.apache.thrift.async.AsyncMethodCallback 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); - this.message = message; - this.param = param; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("send", org.apache.thrift.protocol.TMessageType.CALL, 0)); - send_args args = new send_args(); - args.setMessage(message); - args.setParam(param); - args.write(prot); - prot.writeMessageEnd(); - } - - public Result getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_send(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("send", new send()); - return processMap; - } - - public static class send extends org.apache.thrift.ProcessFunction { - public send() { - super("send"); - } - - public send_args getEmptyArgsInstance() { - return new send_args(); - } - - protected boolean isOneway() { - return false; - } - - public send_result getResult(I iface, send_args args) throws org.apache.thrift.TException { - send_result result = new send_result(); - result.success = iface.send(args.message, args.param); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("send", new send()); - return processMap; - } - - public static class send extends org.apache.thrift.AsyncProcessFunction { - public send() { - super("send"); - } - - public send_args getEmptyArgsInstance() { - return new send_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Result o) { - send_result result = new send_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - send_result result = new send_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, send_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.send(args.message, args.param,resultHandler); - } - } - - } - - public static class send_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("send_args"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAM_FIELD_DESC = new org.apache.thrift.protocol.TField("param", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new send_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new send_argsTupleSchemeFactory()); - } - - public String message; // required - public String param; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"), - PARAM((short)2, "param"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - case 2: // PARAM - return PARAM; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAM, new org.apache.thrift.meta_data.FieldMetaData("param", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(send_args.class, metaDataMap); - } - - public send_args() { - } - - public send_args( - String message, - String param) - { - this(); - this.message = message; - this.param = param; - } - - /** - * Performs a deep copy on other. - */ - public send_args(send_args other) { - if (other.isSetMessage()) { - this.message = other.message; - } - if (other.isSetParam()) { - this.param = other.param; - } - } - - public send_args deepCopy() { - return new send_args(this); - } - - @Override - public void clear() { - this.message = null; - this.param = null; - } - - public String getMessage() { - return this.message; - } - - public send_args setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public String getParam() { - return this.param; - } - - public send_args setParam(String param) { - this.param = param; - return this; - } - - public void unsetParam() { - this.param = null; - } - - /** Returns true if field param is set (has been assigned a value) and false otherwise */ - public boolean isSetParam() { - return this.param != null; - } - - public void setParamIsSet(boolean value) { - if (!value) { - this.param = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - case PARAM: - if (value == null) { - unsetParam(); - } else { - setParam((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - case PARAM: - return getParam(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - case PARAM: - return isSetParam(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof send_args) - return this.equals((send_args)that); - return false; - } - - public boolean equals(send_args that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - boolean this_present_param = true && this.isSetParam(); - boolean that_present_param = true && that.isSetParam(); - if (this_present_param || that_present_param) { - if (!(this_present_param && that_present_param)) - return false; - if (!this.param.equals(that.param)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - boolean present_param = true && (isSetParam()); - list.add(present_param); - if (present_param) - list.add(param); - - return list.hashCode(); - } - - @Override - public int compareTo(send_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetParam()).compareTo(other.isSetParam()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParam()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.param, other.param); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("send_args("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - if (!first) sb.append(", "); - sb.append("param:"); - if (this.param == null) { - sb.append("null"); - } else { - sb.append(this.param); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class send_argsStandardSchemeFactory implements SchemeFactory { - public send_argsStandardScheme getScheme() { - return new send_argsStandardScheme(); - } - } - - private static class send_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, send_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAM - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, send_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - if (struct.param != null) { - oprot.writeFieldBegin(PARAM_FIELD_DESC); - oprot.writeString(struct.param); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class send_argsTupleSchemeFactory implements SchemeFactory { - public send_argsTupleScheme getScheme() { - return new send_argsTupleScheme(); - } - } - - private static class send_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, send_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - if (struct.isSetParam()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - if (struct.isSetParam()) { - oprot.writeString(struct.param); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, send_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - if (incoming.get(1)) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } - } - } - - } - - public static class send_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("send_result"); - - 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); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new send_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new send_resultTupleSchemeFactory()); - } - - public Result success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Result.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(send_result.class, metaDataMap); - } - - public send_result() { - } - - public send_result( - Result success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public send_result(send_result other) { - if (other.isSetSuccess()) { - this.success = new Result(other.success); - } - } - - public send_result deepCopy() { - return new send_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public Result getSuccess() { - return this.success; - } - - public send_result setSuccess(Result success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Result)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof send_result) - return this.equals((send_result)that); - return false; - } - - public boolean equals(send_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(send_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("send_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - 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); - } - } - - private static class send_resultStandardSchemeFactory implements SchemeFactory { - public send_resultStandardScheme getScheme() { - return new send_resultStandardScheme(); - } - } - - private static class send_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, send_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new Result(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, send_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class send_resultTupleSchemeFactory implements SchemeFactory { - public send_resultTupleScheme getScheme() { - return new send_resultTupleScheme(); - } - } - - private static class send_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, send_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, send_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = new Result(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/Result.java b/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/Result.java deleted file mode 100644 index ba72491..0000000 --- a/dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api2/Result.java +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-03-29") -public class Result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Result"); - - private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I32, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new ResultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new ResultTupleSchemeFactory()); - } - - public String result; // required - public int id; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - RESULT((short)1, "result"), - ID((short)2, "id"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // RESULT - return RESULT; - case 2: // ID - return ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __ID_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.RESULT, new org.apache.thrift.meta_data.FieldMetaData("result", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Result.class, metaDataMap); - } - - public Result() { - } - - public Result( - String result, - int id) - { - this(); - this.result = result; - this.id = id; - setIdIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public Result(Result other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetResult()) { - this.result = other.result; - } - this.id = other.id; - } - - public Result deepCopy() { - return new Result(this); - } - - @Override - public void clear() { - this.result = null; - setIdIsSet(false); - this.id = 0; - } - - public String getResult() { - return this.result; - } - - public Result setResult(String result) { - this.result = result; - return this; - } - - public void unsetResult() { - this.result = null; - } - - /** Returns true if field result is set (has been assigned a value) and false otherwise */ - public boolean isSetResult() { - return this.result != null; - } - - public void setResultIsSet(boolean value) { - if (!value) { - this.result = null; - } - } - - public int getId() { - return this.id; - } - - public Result setId(int id) { - this.id = id; - setIdIsSet(true); - return this; - } - - public void unsetId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); - } - - /** Returns true if field id is set (has been assigned a value) and false otherwise */ - public boolean isSetId() { - return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); - } - - public void setIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case RESULT: - if (value == null) { - unsetResult(); - } else { - setResult((String)value); - } - break; - - case ID: - if (value == null) { - unsetId(); - } else { - setId((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case RESULT: - return getResult(); - - case ID: - return getId(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case RESULT: - return isSetResult(); - case ID: - return isSetId(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof Result) - return this.equals((Result)that); - return false; - } - - public boolean equals(Result that) { - if (that == null) - return false; - - boolean this_present_result = true && this.isSetResult(); - boolean that_present_result = true && that.isSetResult(); - if (this_present_result || that_present_result) { - if (!(this_present_result && that_present_result)) - return false; - if (!this.result.equals(that.result)) - return false; - } - - boolean this_present_id = true; - boolean that_present_id = true; - if (this_present_id || that_present_id) { - if (!(this_present_id && that_present_id)) - return false; - if (this.id != that.id) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_result = true && (isSetResult()); - list.add(present_result); - if (present_result) - list.add(result); - - boolean present_id = true; - list.add(present_id); - if (present_id) - list.add(id); - - return list.hashCode(); - } - - @Override - public int compareTo(Result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetResult()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("Result("); - boolean first = true; - - sb.append("result:"); - if (this.result == null) { - sb.append("null"); - } else { - sb.append(this.result); - } - first = false; - if (!first) sb.append(", "); - sb.append("id:"); - sb.append(this.id); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class ResultStandardSchemeFactory implements SchemeFactory { - public ResultStandardScheme getScheme() { - return new ResultStandardScheme(); - } - } - - private static class ResultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, Result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // RESULT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, Result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.result != null) { - oprot.writeFieldBegin(RESULT_FIELD_DESC); - oprot.writeString(struct.result); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(ID_FIELD_DESC); - oprot.writeI32(struct.id); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class ResultTupleSchemeFactory implements SchemeFactory { - public ResultTupleScheme getScheme() { - return new ResultTupleScheme(); - } - } - - private static class ResultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, Result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetResult()) { - optionals.set(0); - } - if (struct.isSetId()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetResult()) { - oprot.writeString(struct.result); - } - if (struct.isSetId()) { - oprot.writeI32(struct.id); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, Result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } - if (incoming.get(1)) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/Echo.java b/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/Echo.java deleted file mode 100644 index 1ae7744..0000000 --- a/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/Echo.java +++ /dev/null @@ -1,1022 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.banchmark.simple.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({"cast", "rawtypes", "serial", - "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") -public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/EchoImpl.java b/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/EchoImpl.java deleted file mode 100644 index ced5d72..0000000 --- a/dorado/dorado-test/dorado-test-benchmark/src/test/java/com/meituan/dorado/banchmark/simple/api/EchoImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.banchmark.simple.api; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - - @Override - public String echo(String messge) throws TException { - return messge; - } -} diff --git a/dorado/dorado-test/dorado-test-client/src/main/java/com/meituan/dorado/test/echo/Echo.java b/dorado/dorado-test/dorado-test-client/src/main/java/com/meituan/dorado/test/echo/Echo.java deleted file mode 100644 index 462508c..0000000 --- a/dorado/dorado-test/dorado-test-client/src/main/java/com/meituan/dorado/test/echo/Echo.java +++ /dev/null @@ -1,977 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed 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 Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.echo; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-11-23") -public class Echo { - - public interface Iface { - - public String echo(String arg) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String arg) throws org.apache.thrift.TException - { - send_echo(arg); - return recv_echo(); - } - - public void send_echo(String arg) throws org.apache.thrift.TException - { - echo_args args = new echo_args(); - args.setArg(arg); - sendBase("echozk", args); - } - - public String recv_echo() throws org.apache.thrift.TException - { - echo_result result = new echo_result(); - receiveBase(result, "echozk"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "echo failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - echo_call method_call = new echo_call(arg, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String arg; - public echo_call(String arg, org.apache.thrift.async.AsyncMethodCallback 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); - this.arg = arg; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("echozk", org.apache.thrift.protocol.TMessageType.CALL, 0)); - echo_args args = new echo_args(); - args.setArg(arg); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echozk", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echozk"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws org.apache.thrift.TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.arg); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echozk", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echozk"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.arg,resultHandler); - } - } - - } - - public static class echo_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_args"); - - private static final org.apache.thrift.protocol.TField ARG_FIELD_DESC = new org.apache.thrift.protocol.TField("arg", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - public String arg; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - ARG((short)1, "arg"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // ARG - return ARG; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.ARG, new org.apache.thrift.meta_data.FieldMetaData("arg", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public echo_args() { - } - - public echo_args( - String arg) - { - this(); - this.arg = arg; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetArg()) { - this.arg = other.arg; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.arg = null; - } - - public String getArg() { - return this.arg; - } - - public echo_args setArg(String arg) { - this.arg = arg; - return this; - } - - public void unsetArg() { - this.arg = null; - } - - /** Returns true if field arg is set (has been assigned a value) and false otherwise */ - public boolean isSetArg() { - return this.arg != null; - } - - public void setArgIsSet(boolean value) { - if (!value) { - this.arg = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case ARG: - if (value == null) { - unsetArg(); - } else { - setArg((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case ARG: - return getArg(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case ARG: - return isSetArg(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args)that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_arg = true && this.isSetArg(); - boolean that_present_arg = true && that.isSetArg(); - if (this_present_arg || that_present_arg) { - if (!(this_present_arg && that_present_arg)) - return false; - if (!this.arg.equals(that.arg)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_arg = true && (isSetArg()); - list.add(present_arg); - if (present_arg) - list.add(arg); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetArg()).compareTo(other.isSetArg()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetArg()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arg, other.arg); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("arg:"); - if (this.arg == null) { - sb.append("null"); - } else { - sb.append(this.arg); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // ARG - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.arg = iprot.readString(); - struct.setArgIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.arg != null) { - oprot.writeFieldBegin(ARG_FIELD_DESC); - oprot.writeString(struct.arg); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetArg()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetArg()) { - oprot.writeString(struct.arg); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.arg = iprot.readString(); - struct.setArgIsSet(true); - } - } - } - - } - - public static class echo_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public echo_result() { - } - - public echo_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result)that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-client/src/main/resources/thriftidl/echo.thrift b/dorado/dorado-test/dorado-test-client/src/main/resources/thriftidl/echo.thrift deleted file mode 100644 index 0c0a5a9..0000000 --- a/dorado/dorado-test/dorado-test-client/src/main/resources/thriftidl/echo.thrift +++ /dev/null @@ -1,9 +0,0 @@ -namespace cpp echo -namespace py echo -namespace java echo - -service Echo -{ - string echo(1: string arg); -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/MistakeInterfaceNameTest.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/MistakeInterfaceNameTest.java deleted file mode 100644 index 1598de4..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/MistakeInterfaceNameTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift; - -import com.meituan.dorado.common.exception.TimeoutException; -import com.meituan.dorado.test.thrift.api.Echo2; -import com.meituan.dorado.test.thrift.filter.ClientQpsLimitFilter; -import com.meituan.dorado.test.thrift.filter.ServerQpsLimitFilter; -import org.apache.thrift.TException; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class MistakeInterfaceNameTest { - - ClassPathXmlApplicationContext beanFactory; - - @Before - public void init() { - beanFactory = new ClassPathXmlApplicationContext("thrift/thrift-mistake-interface.xml"); - ClientQpsLimitFilter.disable(); - ServerQpsLimitFilter.disable(); - } - - @Test - public void test() { - Echo2.Iface echo = (Echo2.Iface) beanFactory.getBean("echoService"); - try { - echo.echo("Hello world"); - } catch (Exception e) { - e.printStackTrace(); - Assert.assertTrue(e instanceof TimeoutException); - } - } - - @After - public void stop() { - beanFactory.destroy(); - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo.java deleted file mode 100644 index 64a6dc7..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo.java +++ /dev/null @@ -1,974 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-07") -public class Echo { - - public interface Iface { - - public String echo(String messge) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void echo(String messge, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws org.apache.thrift.TException - { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws org.apache.thrift.TException - { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws org.apache.thrift.TException - { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "echo failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void echo(String messge, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - public echo_call(String messge, org.apache.thrift.async.AsyncMethodCallback 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); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws org.apache.thrift.TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge,resultHandler); - } - } - - } - - public static class echo_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_args"); - - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField("messge", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - public String messge; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short)1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public echo_args() { - } - - public echo_args( - String messge) - { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** Returns true if field messge is set (has been assigned a value) and false otherwise */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args)that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public echo_result() { - } - - public echo_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result)that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo2.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo2.java deleted file mode 100644 index 3936de7..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/Echo2.java +++ /dev/null @@ -1,1020 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo2 { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/EchoImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/EchoImpl.java deleted file mode 100644 index a438621..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/EchoImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - @Override - public String echo(String messge) throws TException { - return "echo: " + messge; - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloService.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloService.java deleted file mode 100644 index c50bf48..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloService.java +++ /dev/null @@ -1,1828 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-07") -public class HelloService { - - public interface Iface { - - public String sayHello(String username) throws org.apache.thrift.TException; - - public String sayBye(String username) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void sayHello(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void sayBye(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String sayHello(String username) throws org.apache.thrift.TException - { - send_sayHello(username); - return recv_sayHello(); - } - - public void send_sayHello(String username) throws org.apache.thrift.TException - { - sayHello_args args = new sayHello_args(); - args.setUsername(username); - sendBase("sayHello", args); - } - - public String recv_sayHello() throws org.apache.thrift.TException - { - sayHello_result result = new sayHello_result(); - receiveBase(result, "sayHello"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayHello failed: unknown result"); - } - - public String sayBye(String username) throws org.apache.thrift.TException - { - send_sayBye(username); - return recv_sayBye(); - } - - public void send_sayBye(String username) throws org.apache.thrift.TException - { - sayBye_args args = new sayBye_args(); - args.setUsername(username); - sendBase("sayBye", args); - } - - public String recv_sayBye() throws org.apache.thrift.TException - { - sayBye_result result = new sayBye_result(); - receiveBase(result, "sayBye"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sayBye failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void sayHello(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - sayHello_call method_call = new sayHello_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayHello_call(String username, org.apache.thrift.async.AsyncMethodCallback 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); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayHello_args args = new sayHello_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayHello(); - } - } - - public void sayBye(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - sayBye_call method_call = new sayBye_call(username, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class sayBye_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - public sayBye_call(String username, org.apache.thrift.async.AsyncMethodCallback 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); - this.username = username; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sayBye", org.apache.thrift.protocol.TMessageType.CALL, 0)); - sayBye_args args = new sayBye_args(); - args.setUsername(username); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_sayBye(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.ProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayHello_result getResult(I iface, sayHello_args args) throws org.apache.thrift.TException { - sayHello_result result = new sayHello_result(); - result.success = iface.sayHello(args.username); - return result; - } - } - - public static class sayBye extends org.apache.thrift.ProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - protected boolean isOneway() { - return false; - } - - public sayBye_result getResult(I iface, sayBye_args args) throws org.apache.thrift.TException { - sayBye_result result = new sayBye_result(); - result.success = iface.sayBye(args.username); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("sayHello", new sayHello()); - processMap.put("sayBye", new sayBye()); - return processMap; - } - - public static class sayHello extends org.apache.thrift.AsyncProcessFunction { - public sayHello() { - super("sayHello"); - } - - public sayHello_args getEmptyArgsInstance() { - return new sayHello_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayHello_result result = new sayHello_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayHello_result result = new sayHello_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayHello_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.sayHello(args.username,resultHandler); - } - } - - public static class sayBye extends org.apache.thrift.AsyncProcessFunction { - public sayBye() { - super("sayBye"); - } - - public sayBye_args getEmptyArgsInstance() { - return new sayBye_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - sayBye_result result = new sayBye_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - sayBye_result result = new sayBye_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, sayBye_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.sayBye(args.username,resultHandler); - } - } - - } - - public static class sayHello_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_args.class, metaDataMap); - } - - public sayHello_args() { - } - - public sayHello_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_args(sayHello_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayHello_args deepCopy() { - return new sayHello_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayHello_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_args) - return this.equals((sayHello_args)that); - return false; - } - - public boolean equals(sayHello_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { - public sayHello_argsStandardScheme getScheme() { - return new sayHello_argsStandardScheme(); - } - } - - private static class sayHello_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { - public sayHello_argsTupleScheme getScheme() { - return new sayHello_argsTupleScheme(); - } - } - - private static class sayHello_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayHello_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayHello_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayHello_result.class, metaDataMap); - } - - public sayHello_result() { - } - - public sayHello_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayHello_result(sayHello_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayHello_result deepCopy() { - return new sayHello_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayHello_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayHello_result) - return this.equals((sayHello_result)that); - return false; - } - - public boolean equals(sayHello_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayHello_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayHello_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { - public sayHello_resultStandardScheme getScheme() { - return new sayHello_resultStandardScheme(); - } - } - - private static class sayHello_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { - public sayHello_resultTupleScheme getScheme() { - return new sayHello_resultTupleScheme(); - } - } - - private static class sayHello_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class sayBye_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_argsTupleSchemeFactory()); - } - - public String username; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_args.class, metaDataMap); - } - - public sayBye_args() { - } - - public sayBye_args( - String username) - { - this(); - this.username = username; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_args(sayBye_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - } - - public sayBye_args deepCopy() { - return new sayBye_args(this); - } - - @Override - public void clear() { - this.username = null; - } - - public String getUsername() { - return this.username; - } - - public sayBye_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_args) - return this.equals((sayBye_args)that); - return false; - } - - public boolean equals(sayBye_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_username = true && (isSetUsername()); - list.add(present_username); - if (present_username) - list.add(username); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class sayBye_argsStandardSchemeFactory implements SchemeFactory { - public sayBye_argsStandardScheme getScheme() { - return new sayBye_argsStandardScheme(); - } - } - - private static class sayBye_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_argsTupleSchemeFactory implements SchemeFactory { - public sayBye_argsTupleScheme getScheme() { - return new sayBye_argsTupleScheme(); - } - } - - private static class sayBye_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - } - } - - } - - public static class sayBye_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sayBye_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new sayBye_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new sayBye_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sayBye_result.class, metaDataMap); - } - - public sayBye_result() { - } - - public sayBye_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public sayBye_result(sayBye_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public sayBye_result deepCopy() { - return new sayBye_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public sayBye_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof sayBye_result) - return this.equals((sayBye_result)that); - return false; - } - - public boolean equals(sayBye_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(sayBye_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("sayBye_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class sayBye_resultStandardSchemeFactory implements SchemeFactory { - public sayBye_resultStandardScheme getScheme() { - return new sayBye_resultStandardScheme(); - } - } - - private static class sayBye_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, sayBye_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, sayBye_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class sayBye_resultTupleSchemeFactory implements SchemeFactory { - public sayBye_resultTupleScheme getScheme() { - return new sayBye_resultTupleScheme(); - } - } - - private static class sayBye_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, sayBye_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceAsyncImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceAsyncImpl.java deleted file mode 100644 index 5ab6594..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceAsyncImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.TException; - -public class HelloServiceAsyncImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - String result = "Hello " + name; - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return result; - } - - @Override - public String sayBye(String username) throws TException { - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return "Bye " + username; - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceImpl.java deleted file mode 100644 index d00d68b..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.TException; - -public class HelloServiceImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - String result = "Hello " + name; - return result; - } - - @Override - public String sayBye(String username) throws TException { - return "Bye " + username; - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceTimeoutImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceTimeoutImpl.java deleted file mode 100644 index 98359b1..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api/HelloServiceTimeoutImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.api; - -import org.apache.thrift.TException; - -public class HelloServiceTimeoutImpl implements HelloService.Iface { - @Override - public String sayHello(String name) { - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return "Hello " + name; - } - - @Override - public String sayBye(String username) throws TException { - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return "Bye " + username; - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/MyException.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/MyException.java deleted file mode 100644 index 443dc0d..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/MyException.java +++ /dev/null @@ -1,398 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-07") -public class MyException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("MyException"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new MyExceptionStandardSchemeFactory()); - schemes.put(TupleScheme.class, new MyExceptionTupleSchemeFactory()); - } - - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MyException.class, metaDataMap); - } - - public MyException() { - } - - public MyException( - String message) - { - this(); - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public MyException(MyException other) { - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public MyException deepCopy() { - return new MyException(this); - } - - @Override - public void clear() { - this.message = null; - } - - public String getMessage() { - return this.message; - } - - public MyException setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof MyException) - return this.equals((MyException)that); - return false; - } - - public boolean equals(MyException that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - return list.hashCode(); - } - - @Override - public int compareTo(MyException other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("MyException("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class MyExceptionStandardSchemeFactory implements SchemeFactory { - public MyExceptionStandardScheme getScheme() { - return new MyExceptionStandardScheme(); - } - } - - private static class MyExceptionStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, MyException struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, MyException struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class MyExceptionTupleSchemeFactory implements SchemeFactory { - public MyExceptionTupleScheme getScheme() { - return new MyExceptionTupleScheme(); - } - } - - private static class MyExceptionTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, MyException struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, MyException struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestService.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestService.java deleted file mode 100644 index bdce417..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestService.java +++ /dev/null @@ -1,6878 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-07") -public class TestService { - - public interface Iface { - - public String testMock(String str) throws org.apache.thrift.TException; - - public long testLong(long n) throws org.apache.thrift.TException; - - public void testProtocolMisMatch() throws org.apache.thrift.TException; - - public void testTransportException() throws org.apache.thrift.TException; - - public void testTimeout() throws org.apache.thrift.TException; - - public String testReturnNull() throws org.apache.thrift.TException; - - public String testNull() throws org.apache.thrift.TException; - - public String testException() throws MyException, org.apache.thrift.TException; - - public int testBaseTypeException() throws MyException, org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void testMock(String str, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testLong(long n, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testProtocolMisMatch(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testTransportException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testTimeout(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testReturnNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testBaseTypeException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String testMock(String str) throws org.apache.thrift.TException - { - send_testMock(str); - return recv_testMock(); - } - - public void send_testMock(String str) throws org.apache.thrift.TException - { - testMock_args args = new testMock_args(); - args.setStr(str); - sendBase("testMock", args); - } - - public String recv_testMock() throws org.apache.thrift.TException - { - testMock_result result = new testMock_result(); - receiveBase(result, "testMock"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testMock failed: unknown result"); - } - - public long testLong(long n) throws org.apache.thrift.TException - { - send_testLong(n); - return recv_testLong(); - } - - public void send_testLong(long n) throws org.apache.thrift.TException - { - testLong_args args = new testLong_args(); - args.setN(n); - sendBase("testLong", args); - } - - public long recv_testLong() throws org.apache.thrift.TException - { - testLong_result result = new testLong_result(); - receiveBase(result, "testLong"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testLong failed: unknown result"); - } - - public void testProtocolMisMatch() throws org.apache.thrift.TException - { - send_testProtocolMisMatch(); - recv_testProtocolMisMatch(); - } - - public void send_testProtocolMisMatch() throws org.apache.thrift.TException - { - testProtocolMisMatch_args args = new testProtocolMisMatch_args(); - sendBase("testProtocolMisMatch", args); - } - - public void recv_testProtocolMisMatch() throws org.apache.thrift.TException - { - testProtocolMisMatch_result result = new testProtocolMisMatch_result(); - receiveBase(result, "testProtocolMisMatch"); - return; - } - - public void testTransportException() throws org.apache.thrift.TException - { - send_testTransportException(); - recv_testTransportException(); - } - - public void send_testTransportException() throws org.apache.thrift.TException - { - testTransportException_args args = new testTransportException_args(); - sendBase("testTransportException", args); - } - - public void recv_testTransportException() throws org.apache.thrift.TException - { - testTransportException_result result = new testTransportException_result(); - receiveBase(result, "testTransportException"); - return; - } - - public void testTimeout() throws org.apache.thrift.TException - { - send_testTimeout(); - recv_testTimeout(); - } - - public void send_testTimeout() throws org.apache.thrift.TException - { - testTimeout_args args = new testTimeout_args(); - sendBase("testTimeout", args); - } - - public void recv_testTimeout() throws org.apache.thrift.TException - { - testTimeout_result result = new testTimeout_result(); - receiveBase(result, "testTimeout"); - return; - } - - public String testReturnNull() throws org.apache.thrift.TException - { - send_testReturnNull(); - return recv_testReturnNull(); - } - - public void send_testReturnNull() throws org.apache.thrift.TException - { - testReturnNull_args args = new testReturnNull_args(); - sendBase("testReturnNull", args); - } - - public String recv_testReturnNull() throws org.apache.thrift.TException - { - testReturnNull_result result = new testReturnNull_result(); - receiveBase(result, "testReturnNull"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testReturnNull failed: unknown result"); - } - - public String testNull() throws org.apache.thrift.TException - { - send_testNull(); - return recv_testNull(); - } - - public void send_testNull() throws org.apache.thrift.TException - { - testNull_args args = new testNull_args(); - sendBase("testNull", args); - } - - public String recv_testNull() throws org.apache.thrift.TException - { - testNull_result result = new testNull_result(); - receiveBase(result, "testNull"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testNull failed: unknown result"); - } - - public String testException() throws MyException, org.apache.thrift.TException - { - send_testException(); - return recv_testException(); - } - - public void send_testException() throws org.apache.thrift.TException - { - testException_args args = new testException_args(); - sendBase("testException", args); - } - - public String recv_testException() throws MyException, org.apache.thrift.TException - { - testException_result result = new testException_result(); - receiveBase(result, "testException"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.myException != null) { - throw result.myException; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testException failed: unknown result"); - } - - public int testBaseTypeException() throws MyException, org.apache.thrift.TException - { - send_testBaseTypeException(); - return recv_testBaseTypeException(); - } - - public void send_testBaseTypeException() throws org.apache.thrift.TException - { - testBaseTypeException_args args = new testBaseTypeException_args(); - sendBase("testBaseTypeException", args); - } - - public int recv_testBaseTypeException() throws MyException, org.apache.thrift.TException - { - testBaseTypeException_result result = new testBaseTypeException_result(); - receiveBase(result, "testBaseTypeException"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.myException != null) { - throw result.myException; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testBaseTypeException failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void testMock(String str, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testMock_call method_call = new testMock_call(str, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testMock_call extends org.apache.thrift.async.TAsyncMethodCall { - private String str; - public testMock_call(String str, org.apache.thrift.async.AsyncMethodCallback 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); - this.str = str; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testMock", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testMock_args args = new testMock_args(); - args.setStr(str); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testMock(); - } - } - - public void testLong(long n, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testLong_call method_call = new testLong_call(n, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testLong_call extends org.apache.thrift.async.TAsyncMethodCall { - private long n; - public testLong_call(long n, org.apache.thrift.async.AsyncMethodCallback 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); - this.n = n; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testLong", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testLong_args args = new testLong_args(); - args.setN(n); - args.write(prot); - prot.writeMessageEnd(); - } - - public long getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testLong(); - } - } - - public void testProtocolMisMatch(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testProtocolMisMatch_call method_call = new testProtocolMisMatch_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testProtocolMisMatch_call extends org.apache.thrift.async.TAsyncMethodCall { - public testProtocolMisMatch_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testProtocolMisMatch", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testProtocolMisMatch_args args = new testProtocolMisMatch_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public void getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - (new Client(prot)).recv_testProtocolMisMatch(); - } - } - - public void testTransportException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testTransportException_call method_call = new testTransportException_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testTransportException_call extends org.apache.thrift.async.TAsyncMethodCall { - public testTransportException_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testTransportException", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testTransportException_args args = new testTransportException_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public void getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - (new Client(prot)).recv_testTransportException(); - } - } - - public void testTimeout(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testTimeout_call method_call = new testTimeout_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testTimeout_call extends org.apache.thrift.async.TAsyncMethodCall { - public testTimeout_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testTimeout", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testTimeout_args args = new testTimeout_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public void getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - (new Client(prot)).recv_testTimeout(); - } - } - - public void testReturnNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testReturnNull_call method_call = new testReturnNull_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testReturnNull_call extends org.apache.thrift.async.TAsyncMethodCall { - public testReturnNull_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testReturnNull", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testReturnNull_args args = new testReturnNull_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testReturnNull(); - } - } - - public void testNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testNull_call method_call = new testNull_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testNull_call extends org.apache.thrift.async.TAsyncMethodCall { - public testNull_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testNull", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testNull_args args = new testNull_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testNull(); - } - } - - public void testException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testException_call method_call = new testException_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testException_call extends org.apache.thrift.async.TAsyncMethodCall { - public testException_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testException", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testException_args args = new testException_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws MyException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testException(); - } - } - - public void testBaseTypeException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testBaseTypeException_call method_call = new testBaseTypeException_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testBaseTypeException_call extends org.apache.thrift.async.TAsyncMethodCall { - public testBaseTypeException_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testBaseTypeException", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testBaseTypeException_args args = new testBaseTypeException_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public int getResult() throws MyException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testBaseTypeException(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("testMock", new testMock()); - processMap.put("testLong", new testLong()); - processMap.put("testProtocolMisMatch", new testProtocolMisMatch()); - processMap.put("testTransportException", new testTransportException()); - processMap.put("testTimeout", new testTimeout()); - processMap.put("testReturnNull", new testReturnNull()); - processMap.put("testNull", new testNull()); - processMap.put("testException", new testException()); - processMap.put("testBaseTypeException", new testBaseTypeException()); - return processMap; - } - - public static class testMock extends org.apache.thrift.ProcessFunction { - public testMock() { - super("testMock"); - } - - public testMock_args getEmptyArgsInstance() { - return new testMock_args(); - } - - protected boolean isOneway() { - return false; - } - - public testMock_result getResult(I iface, testMock_args args) throws org.apache.thrift.TException { - testMock_result result = new testMock_result(); - result.success = iface.testMock(args.str); - return result; - } - } - - public static class testLong extends org.apache.thrift.ProcessFunction { - public testLong() { - super("testLong"); - } - - public testLong_args getEmptyArgsInstance() { - return new testLong_args(); - } - - protected boolean isOneway() { - return false; - } - - public testLong_result getResult(I iface, testLong_args args) throws org.apache.thrift.TException { - testLong_result result = new testLong_result(); - result.success = iface.testLong(args.n); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testProtocolMisMatch extends org.apache.thrift.ProcessFunction { - public testProtocolMisMatch() { - super("testProtocolMisMatch"); - } - - public testProtocolMisMatch_args getEmptyArgsInstance() { - return new testProtocolMisMatch_args(); - } - - protected boolean isOneway() { - return false; - } - - public testProtocolMisMatch_result getResult(I iface, testProtocolMisMatch_args args) throws org.apache.thrift.TException { - testProtocolMisMatch_result result = new testProtocolMisMatch_result(); - iface.testProtocolMisMatch(); - return result; - } - } - - public static class testTransportException extends org.apache.thrift.ProcessFunction { - public testTransportException() { - super("testTransportException"); - } - - public testTransportException_args getEmptyArgsInstance() { - return new testTransportException_args(); - } - - protected boolean isOneway() { - return false; - } - - public testTransportException_result getResult(I iface, testTransportException_args args) throws org.apache.thrift.TException { - testTransportException_result result = new testTransportException_result(); - iface.testTransportException(); - return result; - } - } - - public static class testTimeout extends org.apache.thrift.ProcessFunction { - public testTimeout() { - super("testTimeout"); - } - - public testTimeout_args getEmptyArgsInstance() { - return new testTimeout_args(); - } - - protected boolean isOneway() { - return false; - } - - public testTimeout_result getResult(I iface, testTimeout_args args) throws org.apache.thrift.TException { - testTimeout_result result = new testTimeout_result(); - iface.testTimeout(); - return result; - } - } - - public static class testReturnNull extends org.apache.thrift.ProcessFunction { - public testReturnNull() { - super("testReturnNull"); - } - - public testReturnNull_args getEmptyArgsInstance() { - return new testReturnNull_args(); - } - - protected boolean isOneway() { - return false; - } - - public testReturnNull_result getResult(I iface, testReturnNull_args args) throws org.apache.thrift.TException { - testReturnNull_result result = new testReturnNull_result(); - result.success = iface.testReturnNull(); - return result; - } - } - - public static class testNull extends org.apache.thrift.ProcessFunction { - public testNull() { - super("testNull"); - } - - public testNull_args getEmptyArgsInstance() { - return new testNull_args(); - } - - protected boolean isOneway() { - return false; - } - - public testNull_result getResult(I iface, testNull_args args) throws org.apache.thrift.TException { - testNull_result result = new testNull_result(); - result.success = iface.testNull(); - return result; - } - } - - public static class testException extends org.apache.thrift.ProcessFunction { - public testException() { - super("testException"); - } - - public testException_args getEmptyArgsInstance() { - return new testException_args(); - } - - protected boolean isOneway() { - return false; - } - - public testException_result getResult(I iface, testException_args args) throws org.apache.thrift.TException { - testException_result result = new testException_result(); - try { - result.success = iface.testException(); - } catch (MyException myException) { - result.myException = myException; - } - return result; - } - } - - public static class testBaseTypeException extends org.apache.thrift.ProcessFunction { - public testBaseTypeException() { - super("testBaseTypeException"); - } - - public testBaseTypeException_args getEmptyArgsInstance() { - return new testBaseTypeException_args(); - } - - protected boolean isOneway() { - return false; - } - - public testBaseTypeException_result getResult(I iface, testBaseTypeException_args args) throws org.apache.thrift.TException { - testBaseTypeException_result result = new testBaseTypeException_result(); - try { - result.success = iface.testBaseTypeException(); - result.setSuccessIsSet(true); - } catch (MyException myException) { - result.myException = myException; - } - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("testMock", new testMock()); - processMap.put("testLong", new testLong()); - processMap.put("testProtocolMisMatch", new testProtocolMisMatch()); - processMap.put("testTransportException", new testTransportException()); - processMap.put("testTimeout", new testTimeout()); - processMap.put("testReturnNull", new testReturnNull()); - processMap.put("testNull", new testNull()); - processMap.put("testException", new testException()); - processMap.put("testBaseTypeException", new testBaseTypeException()); - return processMap; - } - - public static class testMock extends org.apache.thrift.AsyncProcessFunction { - public testMock() { - super("testMock"); - } - - public testMock_args getEmptyArgsInstance() { - return new testMock_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testMock_result result = new testMock_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testMock_result result = new testMock_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testMock_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testMock(args.str,resultHandler); - } - } - - public static class testLong extends org.apache.thrift.AsyncProcessFunction { - public testLong() { - super("testLong"); - } - - public testLong_args getEmptyArgsInstance() { - return new testLong_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Long o) { - testLong_result result = new testLong_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testLong_result result = new testLong_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testLong_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testLong(args.n,resultHandler); - } - } - - public static class testProtocolMisMatch extends org.apache.thrift.AsyncProcessFunction { - public testProtocolMisMatch() { - super("testProtocolMisMatch"); - } - - public testProtocolMisMatch_args getEmptyArgsInstance() { - return new testProtocolMisMatch_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - testProtocolMisMatch_result result = new testProtocolMisMatch_result(); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testProtocolMisMatch_result result = new testProtocolMisMatch_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testProtocolMisMatch_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testProtocolMisMatch(resultHandler); - } - } - - public static class testTransportException extends org.apache.thrift.AsyncProcessFunction { - public testTransportException() { - super("testTransportException"); - } - - public testTransportException_args getEmptyArgsInstance() { - return new testTransportException_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - testTransportException_result result = new testTransportException_result(); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testTransportException_result result = new testTransportException_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testTransportException_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testTransportException(resultHandler); - } - } - - public static class testTimeout extends org.apache.thrift.AsyncProcessFunction { - public testTimeout() { - super("testTimeout"); - } - - public testTimeout_args getEmptyArgsInstance() { - return new testTimeout_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - testTimeout_result result = new testTimeout_result(); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testTimeout_result result = new testTimeout_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testTimeout_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testTimeout(resultHandler); - } - } - - public static class testReturnNull extends org.apache.thrift.AsyncProcessFunction { - public testReturnNull() { - super("testReturnNull"); - } - - public testReturnNull_args getEmptyArgsInstance() { - return new testReturnNull_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testReturnNull_result result = new testReturnNull_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testReturnNull_result result = new testReturnNull_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testReturnNull_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testReturnNull(resultHandler); - } - } - - public static class testNull extends org.apache.thrift.AsyncProcessFunction { - public testNull() { - super("testNull"); - } - - public testNull_args getEmptyArgsInstance() { - return new testNull_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testNull_result result = new testNull_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testNull_result result = new testNull_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testNull_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testNull(resultHandler); - } - } - - public static class testException extends org.apache.thrift.AsyncProcessFunction { - public testException() { - super("testException"); - } - - public testException_args getEmptyArgsInstance() { - return new testException_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testException_result result = new testException_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testException_result result = new testException_result(); - if (e instanceof MyException) { - result.myException = (MyException) e; - result.setMyExceptionIsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testException_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testException(resultHandler); - } - } - - public static class testBaseTypeException extends org.apache.thrift.AsyncProcessFunction { - public testBaseTypeException() { - super("testBaseTypeException"); - } - - public testBaseTypeException_args getEmptyArgsInstance() { - return new testBaseTypeException_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Integer o) { - testBaseTypeException_result result = new testBaseTypeException_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testBaseTypeException_result result = new testBaseTypeException_result(); - if (e instanceof MyException) { - result.myException = (MyException) e; - result.setMyExceptionIsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testBaseTypeException_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testBaseTypeException(resultHandler); - } - } - - } - - public static class testMock_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testMock_args"); - - private static final org.apache.thrift.protocol.TField STR_FIELD_DESC = new org.apache.thrift.protocol.TField("str", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testMock_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testMock_argsTupleSchemeFactory()); - } - - public String str; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - STR((short)1, "str"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // STR - return STR; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.STR, new org.apache.thrift.meta_data.FieldMetaData("str", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testMock_args.class, metaDataMap); - } - - public testMock_args() { - } - - public testMock_args( - String str) - { - this(); - this.str = str; - } - - /** - * Performs a deep copy on other. - */ - public testMock_args(testMock_args other) { - if (other.isSetStr()) { - this.str = other.str; - } - } - - public testMock_args deepCopy() { - return new testMock_args(this); - } - - @Override - public void clear() { - this.str = null; - } - - public String getStr() { - return this.str; - } - - public testMock_args setStr(String str) { - this.str = str; - return this; - } - - public void unsetStr() { - this.str = null; - } - - /** Returns true if field str is set (has been assigned a value) and false otherwise */ - public boolean isSetStr() { - return this.str != null; - } - - public void setStrIsSet(boolean value) { - if (!value) { - this.str = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case STR: - if (value == null) { - unsetStr(); - } else { - setStr((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case STR: - return getStr(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case STR: - return isSetStr(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testMock_args) - return this.equals((testMock_args)that); - return false; - } - - public boolean equals(testMock_args that) { - if (that == null) - return false; - - boolean this_present_str = true && this.isSetStr(); - boolean that_present_str = true && that.isSetStr(); - if (this_present_str || that_present_str) { - if (!(this_present_str && that_present_str)) - return false; - if (!this.str.equals(that.str)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_str = true && (isSetStr()); - list.add(present_str); - if (present_str) - list.add(str); - - return list.hashCode(); - } - - @Override - public int compareTo(testMock_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetStr()).compareTo(other.isSetStr()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetStr()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.str, other.str); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testMock_args("); - boolean first = true; - - sb.append("str:"); - if (this.str == null) { - sb.append("null"); - } else { - sb.append(this.str); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testMock_argsStandardSchemeFactory implements SchemeFactory { - public testMock_argsStandardScheme getScheme() { - return new testMock_argsStandardScheme(); - } - } - - private static class testMock_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testMock_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // STR - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.str = iprot.readString(); - struct.setStrIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testMock_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.str != null) { - oprot.writeFieldBegin(STR_FIELD_DESC); - oprot.writeString(struct.str); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testMock_argsTupleSchemeFactory implements SchemeFactory { - public testMock_argsTupleScheme getScheme() { - return new testMock_argsTupleScheme(); - } - } - - private static class testMock_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testMock_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetStr()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetStr()) { - oprot.writeString(struct.str); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testMock_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.str = iprot.readString(); - struct.setStrIsSet(true); - } - } - } - - } - - public static class testMock_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testMock_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testMock_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testMock_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testMock_result.class, metaDataMap); - } - - public testMock_result() { - } - - public testMock_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testMock_result(testMock_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public testMock_result deepCopy() { - return new testMock_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public testMock_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testMock_result) - return this.equals((testMock_result)that); - return false; - } - - public boolean equals(testMock_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testMock_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testMock_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testMock_resultStandardSchemeFactory implements SchemeFactory { - public testMock_resultStandardScheme getScheme() { - return new testMock_resultStandardScheme(); - } - } - - private static class testMock_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testMock_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testMock_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testMock_resultTupleSchemeFactory implements SchemeFactory { - public testMock_resultTupleScheme getScheme() { - return new testMock_resultTupleScheme(); - } - } - - private static class testMock_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testMock_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testMock_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testLong_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testLong_args"); - - private static final org.apache.thrift.protocol.TField N_FIELD_DESC = new org.apache.thrift.protocol.TField("n", org.apache.thrift.protocol.TType.I64, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testLong_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testLong_argsTupleSchemeFactory()); - } - - public long n; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - N((short)2, "n"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 2: // N - return N; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __N_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.N, new org.apache.thrift.meta_data.FieldMetaData("n", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testLong_args.class, metaDataMap); - } - - public testLong_args() { - } - - public testLong_args( - long n) - { - this(); - this.n = n; - setNIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testLong_args(testLong_args other) { - __isset_bitfield = other.__isset_bitfield; - this.n = other.n; - } - - public testLong_args deepCopy() { - return new testLong_args(this); - } - - @Override - public void clear() { - setNIsSet(false); - this.n = 0; - } - - public long getN() { - return this.n; - } - - public testLong_args setN(long n) { - this.n = n; - setNIsSet(true); - return this; - } - - public void unsetN() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __N_ISSET_ID); - } - - /** Returns true if field n is set (has been assigned a value) and false otherwise */ - public boolean isSetN() { - return EncodingUtils.testBit(__isset_bitfield, __N_ISSET_ID); - } - - public void setNIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __N_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case N: - if (value == null) { - unsetN(); - } else { - setN((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case N: - return getN(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case N: - return isSetN(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testLong_args) - return this.equals((testLong_args)that); - return false; - } - - public boolean equals(testLong_args that) { - if (that == null) - return false; - - boolean this_present_n = true; - boolean that_present_n = true; - if (this_present_n || that_present_n) { - if (!(this_present_n && that_present_n)) - return false; - if (this.n != that.n) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_n = true; - list.add(present_n); - if (present_n) - list.add(n); - - return list.hashCode(); - } - - @Override - public int compareTo(testLong_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetN()).compareTo(other.isSetN()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetN()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.n, other.n); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testLong_args("); - boolean first = true; - - sb.append("n:"); - sb.append(this.n); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testLong_argsStandardSchemeFactory implements SchemeFactory { - public testLong_argsStandardScheme getScheme() { - return new testLong_argsStandardScheme(); - } - } - - private static class testLong_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testLong_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 2: // N - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.n = iprot.readI64(); - struct.setNIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testLong_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(N_FIELD_DESC); - oprot.writeI64(struct.n); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testLong_argsTupleSchemeFactory implements SchemeFactory { - public testLong_argsTupleScheme getScheme() { - return new testLong_argsTupleScheme(); - } - } - - private static class testLong_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testLong_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetN()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetN()) { - oprot.writeI64(struct.n); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testLong_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.n = iprot.readI64(); - struct.setNIsSet(true); - } - } - } - - } - - public static class testLong_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testLong_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testLong_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testLong_resultTupleSchemeFactory()); - } - - public long success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testLong_result.class, metaDataMap); - } - - public testLong_result() { - } - - public testLong_result( - long success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testLong_result(testLong_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testLong_result deepCopy() { - return new testLong_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - } - - public long getSuccess() { - return this.success; - } - - public testLong_result setSuccess(long success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testLong_result) - return this.equals((testLong_result)that); - return false; - } - - public boolean equals(testLong_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testLong_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testLong_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testLong_resultStandardSchemeFactory implements SchemeFactory { - public testLong_resultStandardScheme getScheme() { - return new testLong_resultStandardScheme(); - } - } - - private static class testLong_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testLong_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.success = iprot.readI64(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testLong_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeI64(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testLong_resultTupleSchemeFactory implements SchemeFactory { - public testLong_resultTupleScheme getScheme() { - return new testLong_resultTupleScheme(); - } - } - - private static class testLong_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testLong_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeI64(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testLong_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readI64(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testProtocolMisMatch_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testProtocolMisMatch_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testProtocolMisMatch_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testProtocolMisMatch_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testProtocolMisMatch_args.class, metaDataMap); - } - - public testProtocolMisMatch_args() { - } - - /** - * Performs a deep copy on other. - */ - public testProtocolMisMatch_args(testProtocolMisMatch_args other) { - } - - public testProtocolMisMatch_args deepCopy() { - return new testProtocolMisMatch_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testProtocolMisMatch_args) - return this.equals((testProtocolMisMatch_args)that); - return false; - } - - public boolean equals(testProtocolMisMatch_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testProtocolMisMatch_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testProtocolMisMatch_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testProtocolMisMatch_argsStandardSchemeFactory implements SchemeFactory { - public testProtocolMisMatch_argsStandardScheme getScheme() { - return new testProtocolMisMatch_argsStandardScheme(); - } - } - - private static class testProtocolMisMatch_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testProtocolMisMatch_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testProtocolMisMatch_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testProtocolMisMatch_argsTupleSchemeFactory implements SchemeFactory { - public testProtocolMisMatch_argsTupleScheme getScheme() { - return new testProtocolMisMatch_argsTupleScheme(); - } - } - - private static class testProtocolMisMatch_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testProtocolMisMatch_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testProtocolMisMatch_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testProtocolMisMatch_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testProtocolMisMatch_result"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testProtocolMisMatch_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testProtocolMisMatch_resultTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testProtocolMisMatch_result.class, metaDataMap); - } - - public testProtocolMisMatch_result() { - } - - /** - * Performs a deep copy on other. - */ - public testProtocolMisMatch_result(testProtocolMisMatch_result other) { - } - - public testProtocolMisMatch_result deepCopy() { - return new testProtocolMisMatch_result(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testProtocolMisMatch_result) - return this.equals((testProtocolMisMatch_result)that); - return false; - } - - public boolean equals(testProtocolMisMatch_result that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testProtocolMisMatch_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testProtocolMisMatch_result("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testProtocolMisMatch_resultStandardSchemeFactory implements SchemeFactory { - public testProtocolMisMatch_resultStandardScheme getScheme() { - return new testProtocolMisMatch_resultStandardScheme(); - } - } - - private static class testProtocolMisMatch_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testProtocolMisMatch_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testProtocolMisMatch_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testProtocolMisMatch_resultTupleSchemeFactory implements SchemeFactory { - public testProtocolMisMatch_resultTupleScheme getScheme() { - return new testProtocolMisMatch_resultTupleScheme(); - } - } - - private static class testProtocolMisMatch_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testProtocolMisMatch_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testProtocolMisMatch_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testTransportException_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testTransportException_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testTransportException_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testTransportException_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testTransportException_args.class, metaDataMap); - } - - public testTransportException_args() { - } - - /** - * Performs a deep copy on other. - */ - public testTransportException_args(testTransportException_args other) { - } - - public testTransportException_args deepCopy() { - return new testTransportException_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testTransportException_args) - return this.equals((testTransportException_args)that); - return false; - } - - public boolean equals(testTransportException_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testTransportException_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testTransportException_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testTransportException_argsStandardSchemeFactory implements SchemeFactory { - public testTransportException_argsStandardScheme getScheme() { - return new testTransportException_argsStandardScheme(); - } - } - - private static class testTransportException_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testTransportException_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testTransportException_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testTransportException_argsTupleSchemeFactory implements SchemeFactory { - public testTransportException_argsTupleScheme getScheme() { - return new testTransportException_argsTupleScheme(); - } - } - - private static class testTransportException_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testTransportException_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testTransportException_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testTransportException_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testTransportException_result"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testTransportException_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testTransportException_resultTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testTransportException_result.class, metaDataMap); - } - - public testTransportException_result() { - } - - /** - * Performs a deep copy on other. - */ - public testTransportException_result(testTransportException_result other) { - } - - public testTransportException_result deepCopy() { - return new testTransportException_result(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testTransportException_result) - return this.equals((testTransportException_result)that); - return false; - } - - public boolean equals(testTransportException_result that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testTransportException_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testTransportException_result("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testTransportException_resultStandardSchemeFactory implements SchemeFactory { - public testTransportException_resultStandardScheme getScheme() { - return new testTransportException_resultStandardScheme(); - } - } - - private static class testTransportException_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testTransportException_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testTransportException_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testTransportException_resultTupleSchemeFactory implements SchemeFactory { - public testTransportException_resultTupleScheme getScheme() { - return new testTransportException_resultTupleScheme(); - } - } - - private static class testTransportException_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testTransportException_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testTransportException_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testTimeout_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testTimeout_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testTimeout_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testTimeout_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testTimeout_args.class, metaDataMap); - } - - public testTimeout_args() { - } - - /** - * Performs a deep copy on other. - */ - public testTimeout_args(testTimeout_args other) { - } - - public testTimeout_args deepCopy() { - return new testTimeout_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testTimeout_args) - return this.equals((testTimeout_args)that); - return false; - } - - public boolean equals(testTimeout_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testTimeout_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testTimeout_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testTimeout_argsStandardSchemeFactory implements SchemeFactory { - public testTimeout_argsStandardScheme getScheme() { - return new testTimeout_argsStandardScheme(); - } - } - - private static class testTimeout_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testTimeout_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testTimeout_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testTimeout_argsTupleSchemeFactory implements SchemeFactory { - public testTimeout_argsTupleScheme getScheme() { - return new testTimeout_argsTupleScheme(); - } - } - - private static class testTimeout_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testTimeout_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testTimeout_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testTimeout_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testTimeout_result"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testTimeout_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testTimeout_resultTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testTimeout_result.class, metaDataMap); - } - - public testTimeout_result() { - } - - /** - * Performs a deep copy on other. - */ - public testTimeout_result(testTimeout_result other) { - } - - public testTimeout_result deepCopy() { - return new testTimeout_result(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testTimeout_result) - return this.equals((testTimeout_result)that); - return false; - } - - public boolean equals(testTimeout_result that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testTimeout_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testTimeout_result("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testTimeout_resultStandardSchemeFactory implements SchemeFactory { - public testTimeout_resultStandardScheme getScheme() { - return new testTimeout_resultStandardScheme(); - } - } - - private static class testTimeout_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testTimeout_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testTimeout_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testTimeout_resultTupleSchemeFactory implements SchemeFactory { - public testTimeout_resultTupleScheme getScheme() { - return new testTimeout_resultTupleScheme(); - } - } - - private static class testTimeout_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testTimeout_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testTimeout_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testReturnNull_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testReturnNull_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testReturnNull_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testReturnNull_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testReturnNull_args.class, metaDataMap); - } - - public testReturnNull_args() { - } - - /** - * Performs a deep copy on other. - */ - public testReturnNull_args(testReturnNull_args other) { - } - - public testReturnNull_args deepCopy() { - return new testReturnNull_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testReturnNull_args) - return this.equals((testReturnNull_args)that); - return false; - } - - public boolean equals(testReturnNull_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testReturnNull_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testReturnNull_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testReturnNull_argsStandardSchemeFactory implements SchemeFactory { - public testReturnNull_argsStandardScheme getScheme() { - return new testReturnNull_argsStandardScheme(); - } - } - - private static class testReturnNull_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testReturnNull_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testReturnNull_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testReturnNull_argsTupleSchemeFactory implements SchemeFactory { - public testReturnNull_argsTupleScheme getScheme() { - return new testReturnNull_argsTupleScheme(); - } - } - - private static class testReturnNull_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testReturnNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testReturnNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testReturnNull_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testReturnNull_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testReturnNull_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testReturnNull_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testReturnNull_result.class, metaDataMap); - } - - public testReturnNull_result() { - } - - public testReturnNull_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testReturnNull_result(testReturnNull_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public testReturnNull_result deepCopy() { - return new testReturnNull_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public testReturnNull_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testReturnNull_result) - return this.equals((testReturnNull_result)that); - return false; - } - - public boolean equals(testReturnNull_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testReturnNull_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testReturnNull_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testReturnNull_resultStandardSchemeFactory implements SchemeFactory { - public testReturnNull_resultStandardScheme getScheme() { - return new testReturnNull_resultStandardScheme(); - } - } - - private static class testReturnNull_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testReturnNull_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testReturnNull_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testReturnNull_resultTupleSchemeFactory implements SchemeFactory { - public testReturnNull_resultTupleScheme getScheme() { - return new testReturnNull_resultTupleScheme(); - } - } - - private static class testReturnNull_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testReturnNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testReturnNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testNull_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testNull_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testNull_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testNull_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testNull_args.class, metaDataMap); - } - - public testNull_args() { - } - - /** - * Performs a deep copy on other. - */ - public testNull_args(testNull_args other) { - } - - public testNull_args deepCopy() { - return new testNull_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testNull_args) - return this.equals((testNull_args)that); - return false; - } - - public boolean equals(testNull_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testNull_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testNull_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testNull_argsStandardSchemeFactory implements SchemeFactory { - public testNull_argsStandardScheme getScheme() { - return new testNull_argsStandardScheme(); - } - } - - private static class testNull_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testNull_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testNull_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testNull_argsTupleSchemeFactory implements SchemeFactory { - public testNull_argsTupleScheme getScheme() { - return new testNull_argsTupleScheme(); - } - } - - private static class testNull_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testNull_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testNull_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testNull_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testNull_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testNull_result.class, metaDataMap); - } - - public testNull_result() { - } - - public testNull_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testNull_result(testNull_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public testNull_result deepCopy() { - return new testNull_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public testNull_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testNull_result) - return this.equals((testNull_result)that); - return false; - } - - public boolean equals(testNull_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testNull_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testNull_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testNull_resultStandardSchemeFactory implements SchemeFactory { - public testNull_resultStandardScheme getScheme() { - return new testNull_resultStandardScheme(); - } - } - - private static class testNull_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testNull_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testNull_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testNull_resultTupleSchemeFactory implements SchemeFactory { - public testNull_resultTupleScheme getScheme() { - return new testNull_resultTupleScheme(); - } - } - - private static class testNull_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testException_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testException_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testException_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testException_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testException_args.class, metaDataMap); - } - - public testException_args() { - } - - /** - * Performs a deep copy on other. - */ - public testException_args(testException_args other) { - } - - public testException_args deepCopy() { - return new testException_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testException_args) - return this.equals((testException_args)that); - return false; - } - - public boolean equals(testException_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testException_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testException_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testException_argsStandardSchemeFactory implements SchemeFactory { - public testException_argsStandardScheme getScheme() { - return new testException_argsStandardScheme(); - } - } - - private static class testException_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testException_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testException_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testException_argsTupleSchemeFactory implements SchemeFactory { - public testException_argsTupleScheme getScheme() { - return new testException_argsTupleScheme(); - } - } - - private static class testException_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testException_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testException_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testException_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testException_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - private static final org.apache.thrift.protocol.TField MY_EXCEPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("myException", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testException_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testException_resultTupleSchemeFactory()); - } - - public String success; // required - public MyException myException; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - MY_EXCEPTION((short)1, "myException"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // MY_EXCEPTION - return MY_EXCEPTION; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.MY_EXCEPTION, new org.apache.thrift.meta_data.FieldMetaData("myException", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testException_result.class, metaDataMap); - } - - public testException_result() { - } - - public testException_result( - String success, - MyException myException) - { - this(); - this.success = success; - this.myException = myException; - } - - /** - * Performs a deep copy on other. - */ - public testException_result(testException_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - if (other.isSetMyException()) { - this.myException = new MyException(other.myException); - } - } - - public testException_result deepCopy() { - return new testException_result(this); - } - - @Override - public void clear() { - this.success = null; - this.myException = null; - } - - public String getSuccess() { - return this.success; - } - - public testException_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public MyException getMyException() { - return this.myException; - } - - public testException_result setMyException(MyException myException) { - this.myException = myException; - return this; - } - - public void unsetMyException() { - this.myException = null; - } - - /** Returns true if field myException is set (has been assigned a value) and false otherwise */ - public boolean isSetMyException() { - return this.myException != null; - } - - public void setMyExceptionIsSet(boolean value) { - if (!value) { - this.myException = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - case MY_EXCEPTION: - if (value == null) { - unsetMyException(); - } else { - setMyException((MyException)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case MY_EXCEPTION: - return getMyException(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case MY_EXCEPTION: - return isSetMyException(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testException_result) - return this.equals((testException_result)that); - return false; - } - - public boolean equals(testException_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_myException = true && this.isSetMyException(); - boolean that_present_myException = true && that.isSetMyException(); - if (this_present_myException || that_present_myException) { - if (!(this_present_myException && that_present_myException)) - return false; - if (!this.myException.equals(that.myException)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - boolean present_myException = true && (isSetMyException()); - list.add(present_myException); - if (present_myException) - list.add(myException); - - return list.hashCode(); - } - - @Override - public int compareTo(testException_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMyException()).compareTo(other.isSetMyException()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMyException()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.myException, other.myException); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testException_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("myException:"); - if (this.myException == null) { - sb.append("null"); - } else { - sb.append(this.myException); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testException_resultStandardSchemeFactory implements SchemeFactory { - public testException_resultStandardScheme getScheme() { - return new testException_resultStandardScheme(); - } - } - - private static class testException_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testException_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // MY_EXCEPTION - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.myException = new MyException(); - struct.myException.read(iprot); - struct.setMyExceptionIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testException_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - if (struct.myException != null) { - oprot.writeFieldBegin(MY_EXCEPTION_FIELD_DESC); - struct.myException.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testException_resultTupleSchemeFactory implements SchemeFactory { - public testException_resultTupleScheme getScheme() { - return new testException_resultTupleScheme(); - } - } - - private static class testException_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testException_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetMyException()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - if (struct.isSetMyException()) { - struct.myException.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testException_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.myException = new MyException(); - struct.myException.read(iprot); - struct.setMyExceptionIsSet(true); - } - } - } - - } - - public static class testBaseTypeException_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBaseTypeException_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBaseTypeException_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBaseTypeException_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBaseTypeException_args.class, metaDataMap); - } - - public testBaseTypeException_args() { - } - - /** - * Performs a deep copy on other. - */ - public testBaseTypeException_args(testBaseTypeException_args other) { - } - - public testBaseTypeException_args deepCopy() { - return new testBaseTypeException_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBaseTypeException_args) - return this.equals((testBaseTypeException_args)that); - return false; - } - - public boolean equals(testBaseTypeException_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testBaseTypeException_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBaseTypeException_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testBaseTypeException_argsStandardSchemeFactory implements SchemeFactory { - public testBaseTypeException_argsStandardScheme getScheme() { - return new testBaseTypeException_argsStandardScheme(); - } - } - - private static class testBaseTypeException_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBaseTypeException_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBaseTypeException_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBaseTypeException_argsTupleSchemeFactory implements SchemeFactory { - public testBaseTypeException_argsTupleScheme getScheme() { - return new testBaseTypeException_argsTupleScheme(); - } - } - - private static class testBaseTypeException_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBaseTypeException_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBaseTypeException_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testBaseTypeException_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBaseTypeException_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0); - private static final org.apache.thrift.protocol.TField MY_EXCEPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("myException", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBaseTypeException_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBaseTypeException_resultTupleSchemeFactory()); - } - - public int success; // required - public MyException myException; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - MY_EXCEPTION((short)1, "myException"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // MY_EXCEPTION - return MY_EXCEPTION; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.MY_EXCEPTION, new org.apache.thrift.meta_data.FieldMetaData("myException", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBaseTypeException_result.class, metaDataMap); - } - - public testBaseTypeException_result() { - } - - public testBaseTypeException_result( - int success, - MyException myException) - { - this(); - this.success = success; - setSuccessIsSet(true); - this.myException = myException; - } - - /** - * Performs a deep copy on other. - */ - public testBaseTypeException_result(testBaseTypeException_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - if (other.isSetMyException()) { - this.myException = new MyException(other.myException); - } - } - - public testBaseTypeException_result deepCopy() { - return new testBaseTypeException_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - this.myException = null; - } - - public int getSuccess() { - return this.success; - } - - public testBaseTypeException_result setSuccess(int success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public MyException getMyException() { - return this.myException; - } - - public testBaseTypeException_result setMyException(MyException myException) { - this.myException = myException; - return this; - } - - public void unsetMyException() { - this.myException = null; - } - - /** Returns true if field myException is set (has been assigned a value) and false otherwise */ - public boolean isSetMyException() { - return this.myException != null; - } - - public void setMyExceptionIsSet(boolean value) { - if (!value) { - this.myException = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Integer)value); - } - break; - - case MY_EXCEPTION: - if (value == null) { - unsetMyException(); - } else { - setMyException((MyException)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case MY_EXCEPTION: - return getMyException(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case MY_EXCEPTION: - return isSetMyException(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBaseTypeException_result) - return this.equals((testBaseTypeException_result)that); - return false; - } - - public boolean equals(testBaseTypeException_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - boolean this_present_myException = true && this.isSetMyException(); - boolean that_present_myException = true && that.isSetMyException(); - if (this_present_myException || that_present_myException) { - if (!(this_present_myException && that_present_myException)) - return false; - if (!this.myException.equals(that.myException)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - boolean present_myException = true && (isSetMyException()); - list.add(present_myException); - if (present_myException) - list.add(myException); - - return list.hashCode(); - } - - @Override - public int compareTo(testBaseTypeException_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMyException()).compareTo(other.isSetMyException()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMyException()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.myException, other.myException); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBaseTypeException_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - if (!first) sb.append(", "); - sb.append("myException:"); - if (this.myException == null) { - sb.append("null"); - } else { - sb.append(this.myException); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testBaseTypeException_resultStandardSchemeFactory implements SchemeFactory { - public testBaseTypeException_resultStandardScheme getScheme() { - return new testBaseTypeException_resultStandardScheme(); - } - } - - private static class testBaseTypeException_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBaseTypeException_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.success = iprot.readI32(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // MY_EXCEPTION - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.myException = new MyException(); - struct.myException.read(iprot); - struct.setMyExceptionIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBaseTypeException_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeI32(struct.success); - oprot.writeFieldEnd(); - } - if (struct.myException != null) { - oprot.writeFieldBegin(MY_EXCEPTION_FIELD_DESC); - struct.myException.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBaseTypeException_resultTupleSchemeFactory implements SchemeFactory { - public testBaseTypeException_resultTupleScheme getScheme() { - return new testBaseTypeException_resultTupleScheme(); - } - } - - private static class testBaseTypeException_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBaseTypeException_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetMyException()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - oprot.writeI32(struct.success); - } - if (struct.isSetMyException()) { - struct.myException.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBaseTypeException_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = iprot.readI32(); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.myException = new MyException(); - struct.myException.read(iprot); - struct.setMyExceptionIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestServiceImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestServiceImpl.java deleted file mode 100644 index c933978..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/api2/TestServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.api2; - -import org.apache.thrift.TException; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.transport.TTransportException; - -public class TestServiceImpl implements TestService.Iface { - - public String testNull() throws TException { - String str1 = null; - str1.length(); - return ""; - } - - public String testException() throws MyException, TException { - System.out.println("testException!"); - throw new MyException("error"); - } - - @Override - public int testBaseTypeException() throws MyException, TException { - System.out.println("testBaseTypeException!"); - throw new MyException("error"); - } - - public String testMock(String str) throws TException { - System.out.println("testMock!"); - return str; - } - - public long testLong(long n) throws TException { - return n; - } - - public void testProtocolMisMatch() throws TException { - throw new TProtocolException("testProtocolMisMatch"); - } - - public void testTransportException() throws TException { - throw new TTransportException("testTransportException"); - } - - public void testTimeout() throws TException { - try { - Thread.sleep(1000000L); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - - public String testReturnNull() throws TException { - return null; - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Location.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Location.java deleted file mode 100644 index e24f4a6..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Location.java +++ /dev/null @@ -1,486 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-04") -public class Location implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Location"); - - private static final org.apache.thrift.protocol.TField LATITUDE_FIELD_DESC = new org.apache.thrift.protocol.TField("latitude", org.apache.thrift.protocol.TType.DOUBLE, (short)1); - private static final org.apache.thrift.protocol.TField LONGITUDE_FIELD_DESC = new org.apache.thrift.protocol.TField("longitude", org.apache.thrift.protocol.TType.DOUBLE, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new LocationStandardSchemeFactory()); - schemes.put(TupleScheme.class, new LocationTupleSchemeFactory()); - } - - public double latitude; // required - public double longitude; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - LATITUDE((short)1, "latitude"), - LONGITUDE((short)2, "longitude"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // LATITUDE - return LATITUDE; - case 2: // LONGITUDE - return LONGITUDE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __LATITUDE_ISSET_ID = 0; - private static final int __LONGITUDE_ISSET_ID = 1; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.LATITUDE, new org.apache.thrift.meta_data.FieldMetaData("latitude", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); - tmpMap.put(_Fields.LONGITUDE, new org.apache.thrift.meta_data.FieldMetaData("longitude", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Location.class, metaDataMap); - } - - public Location() { - } - - public Location( - double latitude, - double longitude) - { - this(); - this.latitude = latitude; - setLatitudeIsSet(true); - this.longitude = longitude; - setLongitudeIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public Location(Location other) { - __isset_bitfield = other.__isset_bitfield; - this.latitude = other.latitude; - this.longitude = other.longitude; - } - - public Location deepCopy() { - return new Location(this); - } - - @Override - public void clear() { - setLatitudeIsSet(false); - this.latitude = 0.0; - setLongitudeIsSet(false); - this.longitude = 0.0; - } - - public double getLatitude() { - return this.latitude; - } - - public Location setLatitude(double latitude) { - this.latitude = latitude; - setLatitudeIsSet(true); - return this; - } - - public void unsetLatitude() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LATITUDE_ISSET_ID); - } - - /** Returns true if field latitude is set (has been assigned a value) and false otherwise */ - public boolean isSetLatitude() { - return EncodingUtils.testBit(__isset_bitfield, __LATITUDE_ISSET_ID); - } - - public void setLatitudeIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LATITUDE_ISSET_ID, value); - } - - public double getLongitude() { - return this.longitude; - } - - public Location setLongitude(double longitude) { - this.longitude = longitude; - setLongitudeIsSet(true); - return this; - } - - public void unsetLongitude() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LONGITUDE_ISSET_ID); - } - - /** Returns true if field longitude is set (has been assigned a value) and false otherwise */ - public boolean isSetLongitude() { - return EncodingUtils.testBit(__isset_bitfield, __LONGITUDE_ISSET_ID); - } - - public void setLongitudeIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LONGITUDE_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case LATITUDE: - if (value == null) { - unsetLatitude(); - } else { - setLatitude((Double)value); - } - break; - - case LONGITUDE: - if (value == null) { - unsetLongitude(); - } else { - setLongitude((Double)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case LATITUDE: - return getLatitude(); - - case LONGITUDE: - return getLongitude(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case LATITUDE: - return isSetLatitude(); - case LONGITUDE: - return isSetLongitude(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof Location) - return this.equals((Location)that); - return false; - } - - public boolean equals(Location that) { - if (that == null) - return false; - - boolean this_present_latitude = true; - boolean that_present_latitude = true; - if (this_present_latitude || that_present_latitude) { - if (!(this_present_latitude && that_present_latitude)) - return false; - if (this.latitude != that.latitude) - return false; - } - - boolean this_present_longitude = true; - boolean that_present_longitude = true; - if (this_present_longitude || that_present_longitude) { - if (!(this_present_longitude && that_present_longitude)) - return false; - if (this.longitude != that.longitude) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_latitude = true; - list.add(present_latitude); - if (present_latitude) - list.add(latitude); - - boolean present_longitude = true; - list.add(present_longitude); - if (present_longitude) - list.add(longitude); - - return list.hashCode(); - } - - @Override - public int compareTo(Location other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetLatitude()).compareTo(other.isSetLatitude()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetLatitude()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.latitude, other.latitude); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetLongitude()).compareTo(other.isSetLongitude()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetLongitude()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.longitude, other.longitude); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("Location("); - boolean first = true; - - sb.append("latitude:"); - sb.append(this.latitude); - first = false; - if (!first) sb.append(", "); - sb.append("longitude:"); - sb.append(this.longitude); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // alas, we cannot check 'latitude' because it's a primitive and you chose the non-beans generator. - // alas, we cannot check 'longitude' because it's a primitive and you chose the non-beans generator. - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class LocationStandardSchemeFactory implements SchemeFactory { - public LocationStandardScheme getScheme() { - return new LocationStandardScheme(); - } - } - - private static class LocationStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, Location struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // LATITUDE - if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { - struct.latitude = iprot.readDouble(); - struct.setLatitudeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // LONGITUDE - if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { - struct.longitude = iprot.readDouble(); - struct.setLongitudeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - if (!struct.isSetLatitude()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'latitude' was not found in serialized data! Struct: " + toString()); - } - if (!struct.isSetLongitude()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'longitude' was not found in serialized data! Struct: " + toString()); - } - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, Location struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(LATITUDE_FIELD_DESC); - oprot.writeDouble(struct.latitude); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(LONGITUDE_FIELD_DESC); - oprot.writeDouble(struct.longitude); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class LocationTupleSchemeFactory implements SchemeFactory { - public LocationTupleScheme getScheme() { - return new LocationTupleScheme(); - } - } - - private static class LocationTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, Location struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - oprot.writeDouble(struct.latitude); - oprot.writeDouble(struct.longitude); - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, Location struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - struct.latitude = iprot.readDouble(); - struct.setLatitudeIsSet(true); - struct.longitude = iprot.readDouble(); - struct.setLongitudeIsSet(true); - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/ThriftTestConstants.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/ThriftTestConstants.java deleted file mode 100644 index b03c80c..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/ThriftTestConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -public class ThriftTestConstants { - - public static final int DEFAULT_AGE = 18; - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Tweet.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Tweet.java deleted file mode 100644 index 0c5451d..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Tweet.java +++ /dev/null @@ -1,936 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-04") -public class Tweet implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Tweet"); - - private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("text", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField LOC_FIELD_DESC = new org.apache.thrift.protocol.TField("loc", org.apache.thrift.protocol.TType.STRUCT, (short)4); - private static final org.apache.thrift.protocol.TField TWEET_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tweetType", org.apache.thrift.protocol.TType.I32, (short)5); - private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short)16); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TweetStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TweetTupleSchemeFactory()); - } - - public int userId; // required - public String userName; // required - public String text; // required - public Location loc; // optional - /** - * - * @see TweetType - */ - public TweetType tweetType; // optional - public int age; // optional - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USER_ID((short)1, "userId"), - USER_NAME((short)2, "userName"), - TEXT((short)3, "text"), - LOC((short)4, "loc"), - /** - * - * @see TweetType - */ - TWEET_TYPE((short)5, "tweetType"), - AGE((short)16, "age"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USER_ID - return USER_ID; - case 2: // USER_NAME - return USER_NAME; - case 3: // TEXT - return TEXT; - case 4: // LOC - return LOC; - case 5: // TWEET_TYPE - return TWEET_TYPE; - case 16: // AGE - return AGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __USERID_ISSET_ID = 0; - private static final int __AGE_ISSET_ID = 1; - private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.LOC,_Fields.TWEET_TYPE,_Fields.AGE}; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.TEXT, new org.apache.thrift.meta_data.FieldMetaData("text", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.LOC, new org.apache.thrift.meta_data.FieldMetaData("loc", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Location.class))); - tmpMap.put(_Fields.TWEET_TYPE, new org.apache.thrift.meta_data.FieldMetaData("tweetType", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TweetType.class))); - tmpMap.put(_Fields.AGE, new org.apache.thrift.meta_data.FieldMetaData("age", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Tweet.class, metaDataMap); - } - - public Tweet() { - this.tweetType = com.meituan.dorado.test.thrift.apitwitter.TweetType.TWEET; - - this.age = 18; - - } - - public Tweet( - int userId, - String userName, - String text) - { - this(); - this.userId = userId; - setUserIdIsSet(true); - this.userName = userName; - this.text = text; - } - - /** - * Performs a deep copy on other. - */ - public Tweet(Tweet other) { - __isset_bitfield = other.__isset_bitfield; - this.userId = other.userId; - if (other.isSetUserName()) { - this.userName = other.userName; - } - if (other.isSetText()) { - this.text = other.text; - } - if (other.isSetLoc()) { - this.loc = new Location(other.loc); - } - if (other.isSetTweetType()) { - this.tweetType = other.tweetType; - } - this.age = other.age; - } - - public Tweet deepCopy() { - return new Tweet(this); - } - - @Override - public void clear() { - setUserIdIsSet(false); - this.userId = 0; - this.userName = null; - this.text = null; - this.loc = null; - this.tweetType = com.meituan.dorado.test.thrift.apitwitter.TweetType.TWEET; - - this.age = 18; - - } - - public int getUserId() { - return this.userId; - } - - public Tweet setUserId(int userId) { - this.userId = userId; - setUserIdIsSet(true); - return this; - } - - public void unsetUserId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USERID_ISSET_ID); - } - - /** Returns true if field userId is set (has been assigned a value) and false otherwise */ - public boolean isSetUserId() { - return EncodingUtils.testBit(__isset_bitfield, __USERID_ISSET_ID); - } - - public void setUserIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USERID_ISSET_ID, value); - } - - public String getUserName() { - return this.userName; - } - - public Tweet setUserName(String userName) { - this.userName = userName; - return this; - } - - public void unsetUserName() { - this.userName = null; - } - - /** Returns true if field userName is set (has been assigned a value) and false otherwise */ - public boolean isSetUserName() { - return this.userName != null; - } - - public void setUserNameIsSet(boolean value) { - if (!value) { - this.userName = null; - } - } - - public String getText() { - return this.text; - } - - public Tweet setText(String text) { - this.text = text; - return this; - } - - public void unsetText() { - this.text = null; - } - - /** Returns true if field text is set (has been assigned a value) and false otherwise */ - public boolean isSetText() { - return this.text != null; - } - - public void setTextIsSet(boolean value) { - if (!value) { - this.text = null; - } - } - - public Location getLoc() { - return this.loc; - } - - public Tweet setLoc(Location loc) { - this.loc = loc; - return this; - } - - public void unsetLoc() { - this.loc = null; - } - - /** Returns true if field loc is set (has been assigned a value) and false otherwise */ - public boolean isSetLoc() { - return this.loc != null; - } - - public void setLocIsSet(boolean value) { - if (!value) { - this.loc = null; - } - } - - /** - * - * @see TweetType - */ - public TweetType getTweetType() { - return this.tweetType; - } - - /** - * - * @see TweetType - */ - public Tweet setTweetType(TweetType tweetType) { - this.tweetType = tweetType; - return this; - } - - public void unsetTweetType() { - this.tweetType = null; - } - - /** Returns true if field tweetType is set (has been assigned a value) and false otherwise */ - public boolean isSetTweetType() { - return this.tweetType != null; - } - - public void setTweetTypeIsSet(boolean value) { - if (!value) { - this.tweetType = null; - } - } - - public int getAge() { - return this.age; - } - - public Tweet setAge(int age) { - this.age = age; - setAgeIsSet(true); - return this; - } - - public void unsetAge() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); - } - - /** Returns true if field age is set (has been assigned a value) and false otherwise */ - public boolean isSetAge() { - return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); - } - - public void setAgeIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USER_ID: - if (value == null) { - unsetUserId(); - } else { - setUserId((Integer)value); - } - break; - - case USER_NAME: - if (value == null) { - unsetUserName(); - } else { - setUserName((String)value); - } - break; - - case TEXT: - if (value == null) { - unsetText(); - } else { - setText((String)value); - } - break; - - case LOC: - if (value == null) { - unsetLoc(); - } else { - setLoc((Location)value); - } - break; - - case TWEET_TYPE: - if (value == null) { - unsetTweetType(); - } else { - setTweetType((TweetType)value); - } - break; - - case AGE: - if (value == null) { - unsetAge(); - } else { - setAge((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USER_ID: - return getUserId(); - - case USER_NAME: - return getUserName(); - - case TEXT: - return getText(); - - case LOC: - return getLoc(); - - case TWEET_TYPE: - return getTweetType(); - - case AGE: - return getAge(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USER_ID: - return isSetUserId(); - case USER_NAME: - return isSetUserName(); - case TEXT: - return isSetText(); - case LOC: - return isSetLoc(); - case TWEET_TYPE: - return isSetTweetType(); - case AGE: - return isSetAge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof Tweet) - return this.equals((Tweet)that); - return false; - } - - public boolean equals(Tweet that) { - if (that == null) - return false; - - boolean this_present_userId = true; - boolean that_present_userId = true; - if (this_present_userId || that_present_userId) { - if (!(this_present_userId && that_present_userId)) - return false; - if (this.userId != that.userId) - return false; - } - - boolean this_present_userName = true && this.isSetUserName(); - boolean that_present_userName = true && that.isSetUserName(); - if (this_present_userName || that_present_userName) { - if (!(this_present_userName && that_present_userName)) - return false; - if (!this.userName.equals(that.userName)) - return false; - } - - boolean this_present_text = true && this.isSetText(); - boolean that_present_text = true && that.isSetText(); - if (this_present_text || that_present_text) { - if (!(this_present_text && that_present_text)) - return false; - if (!this.text.equals(that.text)) - return false; - } - - boolean this_present_loc = true && this.isSetLoc(); - boolean that_present_loc = true && that.isSetLoc(); - if (this_present_loc || that_present_loc) { - if (!(this_present_loc && that_present_loc)) - return false; - if (!this.loc.equals(that.loc)) - return false; - } - - boolean this_present_tweetType = true && this.isSetTweetType(); - boolean that_present_tweetType = true && that.isSetTweetType(); - if (this_present_tweetType || that_present_tweetType) { - if (!(this_present_tweetType && that_present_tweetType)) - return false; - if (!this.tweetType.equals(that.tweetType)) - return false; - } - - boolean this_present_age = true && this.isSetAge(); - boolean that_present_age = true && that.isSetAge(); - if (this_present_age || that_present_age) { - if (!(this_present_age && that_present_age)) - return false; - if (this.age != that.age) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_userId = true; - list.add(present_userId); - if (present_userId) - list.add(userId); - - boolean present_userName = true && (isSetUserName()); - list.add(present_userName); - if (present_userName) - list.add(userName); - - boolean present_text = true && (isSetText()); - list.add(present_text); - if (present_text) - list.add(text); - - boolean present_loc = true && (isSetLoc()); - list.add(present_loc); - if (present_loc) - list.add(loc); - - boolean present_tweetType = true && (isSetTweetType()); - list.add(present_tweetType); - if (present_tweetType) - list.add(tweetType.getValue()); - - boolean present_age = true && (isSetAge()); - list.add(present_age); - if (present_age) - list.add(age); - - return list.hashCode(); - } - - @Override - public int compareTo(Tweet other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUserId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUserName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetText()).compareTo(other.isSetText()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetText()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.text, other.text); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetLoc()).compareTo(other.isSetLoc()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetLoc()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loc, other.loc); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetTweetType()).compareTo(other.isSetTweetType()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetTweetType()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tweetType, other.tweetType); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("Tweet("); - boolean first = true; - - sb.append("userId:"); - sb.append(this.userId); - first = false; - if (!first) sb.append(", "); - sb.append("userName:"); - if (this.userName == null) { - sb.append("null"); - } else { - sb.append(this.userName); - } - first = false; - if (!first) sb.append(", "); - sb.append("text:"); - if (this.text == null) { - sb.append("null"); - } else { - sb.append(this.text); - } - first = false; - if (isSetLoc()) { - if (!first) sb.append(", "); - sb.append("loc:"); - if (this.loc == null) { - sb.append("null"); - } else { - sb.append(this.loc); - } - first = false; - } - if (isSetTweetType()) { - if (!first) sb.append(", "); - sb.append("tweetType:"); - if (this.tweetType == null) { - sb.append("null"); - } else { - sb.append(this.tweetType); - } - first = false; - } - if (isSetAge()) { - if (!first) sb.append(", "); - sb.append("age:"); - sb.append(this.age); - first = false; - } - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // alas, we cannot check 'userId' because it's a primitive and you chose the non-beans generator. - if (userName == null) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' was not present! Struct: " + toString()); - } - if (text == null) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'text' was not present! Struct: " + toString()); - } - // check for sub-struct validity - if (loc != null) { - loc.validate(); - } - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class TweetStandardSchemeFactory implements SchemeFactory { - public TweetStandardScheme getScheme() { - return new TweetStandardScheme(); - } - } - - private static class TweetStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, Tweet struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USER_ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.userId = iprot.readI32(); - struct.setUserIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // USER_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.userName = iprot.readString(); - struct.setUserNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // TEXT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.text = iprot.readString(); - struct.setTextIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // LOC - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.loc = new Location(); - struct.loc.read(iprot); - struct.setLocIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // TWEET_TYPE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.tweetType = com.meituan.dorado.test.thrift.apitwitter.TweetType.findByValue(iprot.readI32()); - struct.setTweetTypeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 16: // AGE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.age = iprot.readI32(); - struct.setAgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - if (!struct.isSetUserId()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'userId' was not found in serialized data! Struct: " + toString()); - } - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, Tweet struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(USER_ID_FIELD_DESC); - oprot.writeI32(struct.userId); - oprot.writeFieldEnd(); - if (struct.userName != null) { - oprot.writeFieldBegin(USER_NAME_FIELD_DESC); - oprot.writeString(struct.userName); - oprot.writeFieldEnd(); - } - if (struct.text != null) { - oprot.writeFieldBegin(TEXT_FIELD_DESC); - oprot.writeString(struct.text); - oprot.writeFieldEnd(); - } - if (struct.loc != null) { - if (struct.isSetLoc()) { - oprot.writeFieldBegin(LOC_FIELD_DESC); - struct.loc.write(oprot); - oprot.writeFieldEnd(); - } - } - if (struct.tweetType != null) { - if (struct.isSetTweetType()) { - oprot.writeFieldBegin(TWEET_TYPE_FIELD_DESC); - oprot.writeI32(struct.tweetType.getValue()); - oprot.writeFieldEnd(); - } - } - if (struct.isSetAge()) { - oprot.writeFieldBegin(AGE_FIELD_DESC); - oprot.writeI32(struct.age); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class TweetTupleSchemeFactory implements SchemeFactory { - public TweetTupleScheme getScheme() { - return new TweetTupleScheme(); - } - } - - private static class TweetTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, Tweet struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - oprot.writeI32(struct.userId); - oprot.writeString(struct.userName); - oprot.writeString(struct.text); - BitSet optionals = new BitSet(); - if (struct.isSetLoc()) { - optionals.set(0); - } - if (struct.isSetTweetType()) { - optionals.set(1); - } - if (struct.isSetAge()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetLoc()) { - struct.loc.write(oprot); - } - if (struct.isSetTweetType()) { - oprot.writeI32(struct.tweetType.getValue()); - } - if (struct.isSetAge()) { - oprot.writeI32(struct.age); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, Tweet struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - struct.userId = iprot.readI32(); - struct.setUserIdIsSet(true); - struct.userName = iprot.readString(); - struct.setUserNameIsSet(true); - struct.text = iprot.readString(); - struct.setTextIsSet(true); - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.loc = new Location(); - struct.loc.read(iprot); - struct.setLocIsSet(true); - } - if (incoming.get(1)) { - struct.tweetType = com.meituan.dorado.test.thrift.apitwitter.TweetType.findByValue(iprot.readI32()); - struct.setTweetTypeIsSet(true); - } - if (incoming.get(2)) { - struct.age = iprot.readI32(); - struct.setAgeIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetSearchResult.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetSearchResult.java deleted file mode 100644 index c9981f9..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetSearchResult.java +++ /dev/null @@ -1,447 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-04") -public class TweetSearchResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TweetSearchResult"); - - private static final org.apache.thrift.protocol.TField TWEETS_FIELD_DESC = new org.apache.thrift.protocol.TField("tweets", org.apache.thrift.protocol.TType.LIST, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TweetSearchResultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TweetSearchResultTupleSchemeFactory()); - } - - public List tweets; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TWEETS((short)1, "tweets"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // TWEETS - return TWEETS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.TWEETS, new org.apache.thrift.meta_data.FieldMetaData("tweets", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.LIST , "TweetList"))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TweetSearchResult.class, metaDataMap); - } - - public TweetSearchResult() { - } - - public TweetSearchResult( - List tweets) - { - this(); - this.tweets = tweets; - } - - /** - * Performs a deep copy on other. - */ - public TweetSearchResult(TweetSearchResult other) { - if (other.isSetTweets()) { - this.tweets = other.tweets; - } - } - - public TweetSearchResult deepCopy() { - return new TweetSearchResult(this); - } - - @Override - public void clear() { - this.tweets = null; - } - - public int getTweetsSize() { - return (this.tweets == null) ? 0 : this.tweets.size(); - } - - public java.util.Iterator getTweetsIterator() { - return (this.tweets == null) ? null : this.tweets.iterator(); - } - - public void addToTweets(Tweet elem) { - if (this.tweets == null) { - this.tweets = new ArrayList(); - } - this.tweets.add(elem); - } - - public List getTweets() { - return this.tweets; - } - - public TweetSearchResult setTweets(List tweets) { - this.tweets = tweets; - return this; - } - - public void unsetTweets() { - this.tweets = null; - } - - /** Returns true if field tweets is set (has been assigned a value) and false otherwise */ - public boolean isSetTweets() { - return this.tweets != null; - } - - public void setTweetsIsSet(boolean value) { - if (!value) { - this.tweets = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case TWEETS: - if (value == null) { - unsetTweets(); - } else { - setTweets((List)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case TWEETS: - return getTweets(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case TWEETS: - return isSetTweets(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof TweetSearchResult) - return this.equals((TweetSearchResult)that); - return false; - } - - public boolean equals(TweetSearchResult that) { - if (that == null) - return false; - - boolean this_present_tweets = true && this.isSetTweets(); - boolean that_present_tweets = true && that.isSetTweets(); - if (this_present_tweets || that_present_tweets) { - if (!(this_present_tweets && that_present_tweets)) - return false; - if (!this.tweets.equals(that.tweets)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_tweets = true && (isSetTweets()); - list.add(present_tweets); - if (present_tweets) - list.add(tweets); - - return list.hashCode(); - } - - @Override - public int compareTo(TweetSearchResult other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetTweets()).compareTo(other.isSetTweets()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetTweets()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tweets, other.tweets); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("TweetSearchResult("); - boolean first = true; - - sb.append("tweets:"); - if (this.tweets == null) { - sb.append("null"); - } else { - sb.append(this.tweets); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class TweetSearchResultStandardSchemeFactory implements SchemeFactory { - public TweetSearchResultStandardScheme getScheme() { - return new TweetSearchResultStandardScheme(); - } - } - - private static class TweetSearchResultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, TweetSearchResult struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // TWEETS - if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { - { - org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); - struct.tweets = new ArrayList(_list0.size); - Tweet _elem1; - for (int _i2 = 0; _i2 < _list0.size; ++_i2) - { - _elem1 = new Tweet(); - _elem1.read(iprot); - struct.tweets.add(_elem1); - } - iprot.readListEnd(); - } - struct.setTweetsIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, TweetSearchResult struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.tweets != null) { - oprot.writeFieldBegin(TWEETS_FIELD_DESC); - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tweets.size())); - for (Tweet _iter3 : struct.tweets) - { - _iter3.write(oprot); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class TweetSearchResultTupleSchemeFactory implements SchemeFactory { - public TweetSearchResultTupleScheme getScheme() { - return new TweetSearchResultTupleScheme(); - } - } - - private static class TweetSearchResultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, TweetSearchResult struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetTweets()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetTweets()) { - { - oprot.writeI32(struct.tweets.size()); - for (Tweet _iter4 : struct.tweets) - { - _iter4.write(oprot); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, TweetSearchResult struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.tweets = new ArrayList(_list5.size); - Tweet _elem6; - for (int _i7 = 0; _i7 < _list5.size; ++_i7) - { - _elem6 = new Tweet(); - _elem6.read(iprot); - struct.tweets.add(_elem6); - } - } - struct.setTweetsIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetType.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetType.java deleted file mode 100644 index a57a7ef..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TweetType.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - - -import java.util.Map; -import java.util.HashMap; -import org.apache.thrift.TEnum; - -public enum TweetType implements org.apache.thrift.TEnum { - TWEET(0), - RETWEET(2), - DM(10), - REPLY(11); - - private final int value; - - private TweetType(int value) { - this.value = value; - } - - /** - * Get the integer value of this enum value, as defined in the Thrift IDL. - */ - public int getValue() { - return value; - } - - /** - * Find a the enum type by its integer value, as defined in the Thrift IDL. - * @return null if the value is not found. - */ - public static TweetType findByValue(int value) { - switch (value) { - case 0: - return TWEET; - case 2: - return RETWEET; - case 10: - return DM; - case 11: - return REPLY; - default: - return null; - } - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Twitter.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Twitter.java deleted file mode 100644 index 4ff361a..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/Twitter.java +++ /dev/null @@ -1,13029 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-04") -public class Twitter { - - public interface Iface { - - public boolean testBool(boolean b) throws org.apache.thrift.TException; - - public byte testByte(byte b) throws org.apache.thrift.TException; - - public short testI16(short i) throws org.apache.thrift.TException; - - public int testI32(int i) throws org.apache.thrift.TException; - - public long testI64(long i) throws org.apache.thrift.TException; - - public double testDouble(double d) throws org.apache.thrift.TException; - - public ByteBuffer testBinary(ByteBuffer b) throws org.apache.thrift.TException; - - public String testString(String s) throws org.apache.thrift.TException; - - public List testList(List l) throws org.apache.thrift.TException; - - public Set testSet(Set s) throws org.apache.thrift.TException; - - public Map testMap(Map m) throws org.apache.thrift.TException; - - public void testVoid() throws org.apache.thrift.TException; - - public String testReturnNull() throws org.apache.thrift.TException; - - public TweetSearchResult testStruct(String query) throws org.apache.thrift.TException; - - public String testException(Tweet tweet) throws TwitterUnavailable, org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void testBool(boolean b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testByte(byte b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testI16(short i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testI32(int i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testI64(long i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testDouble(double d, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testBinary(ByteBuffer b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testString(String s, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testList(List l, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testSet(Set s, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testMap(Map m, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testVoid(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testReturnNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testStruct(String query, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void testException(Tweet tweet, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public boolean testBool(boolean b) throws org.apache.thrift.TException - { - send_testBool(b); - return recv_testBool(); - } - - public void send_testBool(boolean b) throws org.apache.thrift.TException - { - testBool_args args = new testBool_args(); - args.setB(b); - sendBase("testBool", args); - } - - public boolean recv_testBool() throws org.apache.thrift.TException - { - testBool_result result = new testBool_result(); - receiveBase(result, "testBool"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testBool failed: unknown result"); - } - - public byte testByte(byte b) throws org.apache.thrift.TException - { - send_testByte(b); - return recv_testByte(); - } - - public void send_testByte(byte b) throws org.apache.thrift.TException - { - testByte_args args = new testByte_args(); - args.setB(b); - sendBase("testByte", args); - } - - public byte recv_testByte() throws org.apache.thrift.TException - { - testByte_result result = new testByte_result(); - receiveBase(result, "testByte"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testByte failed: unknown result"); - } - - public short testI16(short i) throws org.apache.thrift.TException - { - send_testI16(i); - return recv_testI16(); - } - - public void send_testI16(short i) throws org.apache.thrift.TException - { - testI16_args args = new testI16_args(); - args.setI(i); - sendBase("testI16", args); - } - - public short recv_testI16() throws org.apache.thrift.TException - { - testI16_result result = new testI16_result(); - receiveBase(result, "testI16"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testI16 failed: unknown result"); - } - - public int testI32(int i) throws org.apache.thrift.TException - { - send_testI32(i); - return recv_testI32(); - } - - public void send_testI32(int i) throws org.apache.thrift.TException - { - testI32_args args = new testI32_args(); - args.setI(i); - sendBase("testI32", args); - } - - public int recv_testI32() throws org.apache.thrift.TException - { - testI32_result result = new testI32_result(); - receiveBase(result, "testI32"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testI32 failed: unknown result"); - } - - public long testI64(long i) throws org.apache.thrift.TException - { - send_testI64(i); - return recv_testI64(); - } - - public void send_testI64(long i) throws org.apache.thrift.TException - { - testI64_args args = new testI64_args(); - args.setI(i); - sendBase("testI64", args); - } - - public long recv_testI64() throws org.apache.thrift.TException - { - testI64_result result = new testI64_result(); - receiveBase(result, "testI64"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testI64 failed: unknown result"); - } - - public double testDouble(double d) throws org.apache.thrift.TException - { - send_testDouble(d); - return recv_testDouble(); - } - - public void send_testDouble(double d) throws org.apache.thrift.TException - { - testDouble_args args = new testDouble_args(); - args.setD(d); - sendBase("testDouble", args); - } - - public double recv_testDouble() throws org.apache.thrift.TException - { - testDouble_result result = new testDouble_result(); - receiveBase(result, "testDouble"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testDouble failed: unknown result"); - } - - public ByteBuffer testBinary(ByteBuffer b) throws org.apache.thrift.TException - { - send_testBinary(b); - return recv_testBinary(); - } - - public void send_testBinary(ByteBuffer b) throws org.apache.thrift.TException - { - testBinary_args args = new testBinary_args(); - args.setB(b); - sendBase("testBinary", args); - } - - public ByteBuffer recv_testBinary() throws org.apache.thrift.TException - { - testBinary_result result = new testBinary_result(); - receiveBase(result, "testBinary"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testBinary failed: unknown result"); - } - - public String testString(String s) throws org.apache.thrift.TException - { - send_testString(s); - return recv_testString(); - } - - public void send_testString(String s) throws org.apache.thrift.TException - { - testString_args args = new testString_args(); - args.setS(s); - sendBase("testString", args); - } - - public String recv_testString() throws org.apache.thrift.TException - { - testString_result result = new testString_result(); - receiveBase(result, "testString"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testString failed: unknown result"); - } - - public List testList(List l) throws org.apache.thrift.TException - { - send_testList(l); - return recv_testList(); - } - - public void send_testList(List l) throws org.apache.thrift.TException - { - testList_args args = new testList_args(); - args.setL(l); - sendBase("testList", args); - } - - public List recv_testList() throws org.apache.thrift.TException - { - testList_result result = new testList_result(); - receiveBase(result, "testList"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testList failed: unknown result"); - } - - public Set testSet(Set s) throws org.apache.thrift.TException - { - send_testSet(s); - return recv_testSet(); - } - - public void send_testSet(Set s) throws org.apache.thrift.TException - { - testSet_args args = new testSet_args(); - args.setS(s); - sendBase("testSet", args); - } - - public Set recv_testSet() throws org.apache.thrift.TException - { - testSet_result result = new testSet_result(); - receiveBase(result, "testSet"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testSet failed: unknown result"); - } - - public Map testMap(Map m) throws org.apache.thrift.TException - { - send_testMap(m); - return recv_testMap(); - } - - public void send_testMap(Map m) throws org.apache.thrift.TException - { - testMap_args args = new testMap_args(); - args.setM(m); - sendBase("testMap", args); - } - - public Map recv_testMap() throws org.apache.thrift.TException - { - testMap_result result = new testMap_result(); - receiveBase(result, "testMap"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testMap failed: unknown result"); - } - - public void testVoid() throws org.apache.thrift.TException - { - send_testVoid(); - recv_testVoid(); - } - - public void send_testVoid() throws org.apache.thrift.TException - { - testVoid_args args = new testVoid_args(); - sendBase("testVoid", args); - } - - public void recv_testVoid() throws org.apache.thrift.TException - { - testVoid_result result = new testVoid_result(); - receiveBase(result, "testVoid"); - return; - } - - public String testReturnNull() throws org.apache.thrift.TException - { - send_testReturnNull(); - return recv_testReturnNull(); - } - - public void send_testReturnNull() throws org.apache.thrift.TException - { - testReturnNull_args args = new testReturnNull_args(); - sendBase("testReturnNull", args); - } - - public String recv_testReturnNull() throws org.apache.thrift.TException - { - testReturnNull_result result = new testReturnNull_result(); - receiveBase(result, "testReturnNull"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testReturnNull failed: unknown result"); - } - - public TweetSearchResult testStruct(String query) throws org.apache.thrift.TException - { - send_testStruct(query); - return recv_testStruct(); - } - - public void send_testStruct(String query) throws org.apache.thrift.TException - { - testStruct_args args = new testStruct_args(); - args.setQuery(query); - sendBase("testStruct", args); - } - - public TweetSearchResult recv_testStruct() throws org.apache.thrift.TException - { - testStruct_result result = new testStruct_result(); - receiveBase(result, "testStruct"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testStruct failed: unknown result"); - } - - public String testException(Tweet tweet) throws TwitterUnavailable, org.apache.thrift.TException - { - send_testException(tweet); - return recv_testException(); - } - - public void send_testException(Tweet tweet) throws org.apache.thrift.TException - { - testException_args args = new testException_args(); - args.setTweet(tweet); - sendBase("testException", args); - } - - public String recv_testException() throws TwitterUnavailable, org.apache.thrift.TException - { - testException_result result = new testException_result(); - receiveBase(result, "testException"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.unavailable != null) { - throw result.unavailable; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testException failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void testBool(boolean b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testBool_call method_call = new testBool_call(b, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testBool_call extends org.apache.thrift.async.TAsyncMethodCall { - private boolean b; - public testBool_call(boolean b, org.apache.thrift.async.AsyncMethodCallback 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); - this.b = b; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testBool", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testBool_args args = new testBool_args(); - args.setB(b); - args.write(prot); - prot.writeMessageEnd(); - } - - public boolean getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testBool(); - } - } - - public void testByte(byte b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testByte_call method_call = new testByte_call(b, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testByte_call extends org.apache.thrift.async.TAsyncMethodCall { - private byte b; - public testByte_call(byte b, org.apache.thrift.async.AsyncMethodCallback 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); - this.b = b; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testByte", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testByte_args args = new testByte_args(); - args.setB(b); - args.write(prot); - prot.writeMessageEnd(); - } - - public byte getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testByte(); - } - } - - public void testI16(short i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testI16_call method_call = new testI16_call(i, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testI16_call extends org.apache.thrift.async.TAsyncMethodCall { - private short i; - public testI16_call(short i, org.apache.thrift.async.AsyncMethodCallback 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); - this.i = i; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testI16", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testI16_args args = new testI16_args(); - args.setI(i); - args.write(prot); - prot.writeMessageEnd(); - } - - public short getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testI16(); - } - } - - public void testI32(int i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testI32_call method_call = new testI32_call(i, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testI32_call extends org.apache.thrift.async.TAsyncMethodCall { - private int i; - public testI32_call(int i, org.apache.thrift.async.AsyncMethodCallback 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); - this.i = i; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testI32", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testI32_args args = new testI32_args(); - args.setI(i); - args.write(prot); - prot.writeMessageEnd(); - } - - public int getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testI32(); - } - } - - public void testI64(long i, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testI64_call method_call = new testI64_call(i, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testI64_call extends org.apache.thrift.async.TAsyncMethodCall { - private long i; - public testI64_call(long i, org.apache.thrift.async.AsyncMethodCallback 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); - this.i = i; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testI64", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testI64_args args = new testI64_args(); - args.setI(i); - args.write(prot); - prot.writeMessageEnd(); - } - - public long getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testI64(); - } - } - - public void testDouble(double d, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testDouble_call method_call = new testDouble_call(d, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testDouble_call extends org.apache.thrift.async.TAsyncMethodCall { - private double d; - public testDouble_call(double d, org.apache.thrift.async.AsyncMethodCallback 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); - this.d = d; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testDouble", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testDouble_args args = new testDouble_args(); - args.setD(d); - args.write(prot); - prot.writeMessageEnd(); - } - - public double getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testDouble(); - } - } - - public void testBinary(ByteBuffer b, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testBinary_call method_call = new testBinary_call(b, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testBinary_call extends org.apache.thrift.async.TAsyncMethodCall { - private ByteBuffer b; - public testBinary_call(ByteBuffer b, org.apache.thrift.async.AsyncMethodCallback 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); - this.b = b; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testBinary", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testBinary_args args = new testBinary_args(); - args.setB(b); - args.write(prot); - prot.writeMessageEnd(); - } - - public ByteBuffer getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testBinary(); - } - } - - public void testString(String s, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testString_call method_call = new testString_call(s, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testString_call extends org.apache.thrift.async.TAsyncMethodCall { - private String s; - public testString_call(String s, org.apache.thrift.async.AsyncMethodCallback 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); - this.s = s; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testString", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testString_args args = new testString_args(); - args.setS(s); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testString(); - } - } - - public void testList(List l, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testList_call method_call = new testList_call(l, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testList_call extends org.apache.thrift.async.TAsyncMethodCall { - private List l; - public testList_call(List l, org.apache.thrift.async.AsyncMethodCallback 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); - this.l = l; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testList", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testList_args args = new testList_args(); - args.setL(l); - args.write(prot); - prot.writeMessageEnd(); - } - - public List getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testList(); - } - } - - public void testSet(Set s, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testSet_call method_call = new testSet_call(s, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testSet_call extends org.apache.thrift.async.TAsyncMethodCall { - private Set s; - public testSet_call(Set s, org.apache.thrift.async.AsyncMethodCallback 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); - this.s = s; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testSet", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testSet_args args = new testSet_args(); - args.setS(s); - args.write(prot); - prot.writeMessageEnd(); - } - - public Set getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testSet(); - } - } - - public void testMap(Map m, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testMap_call method_call = new testMap_call(m, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testMap_call extends org.apache.thrift.async.TAsyncMethodCall { - private Map m; - public testMap_call(Map m, org.apache.thrift.async.AsyncMethodCallback 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); - this.m = m; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testMap", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testMap_args args = new testMap_args(); - args.setM(m); - args.write(prot); - prot.writeMessageEnd(); - } - - public Map getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testMap(); - } - } - - public void testVoid(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testVoid_call method_call = new testVoid_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testVoid_call extends org.apache.thrift.async.TAsyncMethodCall { - public testVoid_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testVoid", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testVoid_args args = new testVoid_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public void getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - (new Client(prot)).recv_testVoid(); - } - } - - public void testReturnNull(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testReturnNull_call method_call = new testReturnNull_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testReturnNull_call extends org.apache.thrift.async.TAsyncMethodCall { - public testReturnNull_call(org.apache.thrift.async.AsyncMethodCallback 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); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testReturnNull", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testReturnNull_args args = new testReturnNull_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testReturnNull(); - } - } - - public void testStruct(String query, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testStruct_call method_call = new testStruct_call(query, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testStruct_call extends org.apache.thrift.async.TAsyncMethodCall { - private String query; - public testStruct_call(String query, org.apache.thrift.async.AsyncMethodCallback 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); - this.query = query; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testStruct", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testStruct_args args = new testStruct_args(); - args.setQuery(query); - args.write(prot); - prot.writeMessageEnd(); - } - - public TweetSearchResult getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testStruct(); - } - } - - public void testException(Tweet tweet, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - testException_call method_call = new testException_call(tweet, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class testException_call extends org.apache.thrift.async.TAsyncMethodCall { - private Tweet tweet; - public testException_call(Tweet tweet, org.apache.thrift.async.AsyncMethodCallback 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); - this.tweet = tweet; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testException", org.apache.thrift.protocol.TMessageType.CALL, 0)); - testException_args args = new testException_args(); - args.setTweet(tweet); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TwitterUnavailable, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_testException(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("testBool", new testBool()); - processMap.put("testByte", new testByte()); - processMap.put("testI16", new testI16()); - processMap.put("testI32", new testI32()); - processMap.put("testI64", new testI64()); - processMap.put("testDouble", new testDouble()); - processMap.put("testBinary", new testBinary()); - processMap.put("testString", new testString()); - processMap.put("testList", new testList()); - processMap.put("testSet", new testSet()); - processMap.put("testMap", new testMap()); - processMap.put("testVoid", new testVoid()); - processMap.put("testReturnNull", new testReturnNull()); - processMap.put("testStruct", new testStruct()); - processMap.put("testException", new testException()); - return processMap; - } - - public static class testBool extends org.apache.thrift.ProcessFunction { - public testBool() { - super("testBool"); - } - - public testBool_args getEmptyArgsInstance() { - return new testBool_args(); - } - - protected boolean isOneway() { - return false; - } - - public testBool_result getResult(I iface, testBool_args args) throws org.apache.thrift.TException { - testBool_result result = new testBool_result(); - result.success = iface.testBool(args.b); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testByte extends org.apache.thrift.ProcessFunction { - public testByte() { - super("testByte"); - } - - public testByte_args getEmptyArgsInstance() { - return new testByte_args(); - } - - protected boolean isOneway() { - return false; - } - - public testByte_result getResult(I iface, testByte_args args) throws org.apache.thrift.TException { - testByte_result result = new testByte_result(); - result.success = iface.testByte(args.b); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testI16 extends org.apache.thrift.ProcessFunction { - public testI16() { - super("testI16"); - } - - public testI16_args getEmptyArgsInstance() { - return new testI16_args(); - } - - protected boolean isOneway() { - return false; - } - - public testI16_result getResult(I iface, testI16_args args) throws org.apache.thrift.TException { - testI16_result result = new testI16_result(); - result.success = iface.testI16(args.i); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testI32 extends org.apache.thrift.ProcessFunction { - public testI32() { - super("testI32"); - } - - public testI32_args getEmptyArgsInstance() { - return new testI32_args(); - } - - protected boolean isOneway() { - return false; - } - - public testI32_result getResult(I iface, testI32_args args) throws org.apache.thrift.TException { - testI32_result result = new testI32_result(); - result.success = iface.testI32(args.i); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testI64 extends org.apache.thrift.ProcessFunction { - public testI64() { - super("testI64"); - } - - public testI64_args getEmptyArgsInstance() { - return new testI64_args(); - } - - protected boolean isOneway() { - return false; - } - - public testI64_result getResult(I iface, testI64_args args) throws org.apache.thrift.TException { - testI64_result result = new testI64_result(); - result.success = iface.testI64(args.i); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testDouble extends org.apache.thrift.ProcessFunction { - public testDouble() { - super("testDouble"); - } - - public testDouble_args getEmptyArgsInstance() { - return new testDouble_args(); - } - - protected boolean isOneway() { - return false; - } - - public testDouble_result getResult(I iface, testDouble_args args) throws org.apache.thrift.TException { - testDouble_result result = new testDouble_result(); - result.success = iface.testDouble(args.d); - result.setSuccessIsSet(true); - return result; - } - } - - public static class testBinary extends org.apache.thrift.ProcessFunction { - public testBinary() { - super("testBinary"); - } - - public testBinary_args getEmptyArgsInstance() { - return new testBinary_args(); - } - - protected boolean isOneway() { - return false; - } - - public testBinary_result getResult(I iface, testBinary_args args) throws org.apache.thrift.TException { - testBinary_result result = new testBinary_result(); - result.success = iface.testBinary(args.b); - return result; - } - } - - public static class testString extends org.apache.thrift.ProcessFunction { - public testString() { - super("testString"); - } - - public testString_args getEmptyArgsInstance() { - return new testString_args(); - } - - protected boolean isOneway() { - return false; - } - - public testString_result getResult(I iface, testString_args args) throws org.apache.thrift.TException { - testString_result result = new testString_result(); - result.success = iface.testString(args.s); - return result; - } - } - - public static class testList extends org.apache.thrift.ProcessFunction { - public testList() { - super("testList"); - } - - public testList_args getEmptyArgsInstance() { - return new testList_args(); - } - - protected boolean isOneway() { - return false; - } - - public testList_result getResult(I iface, testList_args args) throws org.apache.thrift.TException { - testList_result result = new testList_result(); - result.success = iface.testList(args.l); - return result; - } - } - - public static class testSet extends org.apache.thrift.ProcessFunction { - public testSet() { - super("testSet"); - } - - public testSet_args getEmptyArgsInstance() { - return new testSet_args(); - } - - protected boolean isOneway() { - return false; - } - - public testSet_result getResult(I iface, testSet_args args) throws org.apache.thrift.TException { - testSet_result result = new testSet_result(); - result.success = iface.testSet(args.s); - return result; - } - } - - public static class testMap extends org.apache.thrift.ProcessFunction { - public testMap() { - super("testMap"); - } - - public testMap_args getEmptyArgsInstance() { - return new testMap_args(); - } - - protected boolean isOneway() { - return false; - } - - public testMap_result getResult(I iface, testMap_args args) throws org.apache.thrift.TException { - testMap_result result = new testMap_result(); - result.success = iface.testMap(args.m); - return result; - } - } - - public static class testVoid extends org.apache.thrift.ProcessFunction { - public testVoid() { - super("testVoid"); - } - - public testVoid_args getEmptyArgsInstance() { - return new testVoid_args(); - } - - protected boolean isOneway() { - return false; - } - - public testVoid_result getResult(I iface, testVoid_args args) throws org.apache.thrift.TException { - testVoid_result result = new testVoid_result(); - iface.testVoid(); - return result; - } - } - - public static class testReturnNull extends org.apache.thrift.ProcessFunction { - public testReturnNull() { - super("testReturnNull"); - } - - public testReturnNull_args getEmptyArgsInstance() { - return new testReturnNull_args(); - } - - protected boolean isOneway() { - return false; - } - - public testReturnNull_result getResult(I iface, testReturnNull_args args) throws org.apache.thrift.TException { - testReturnNull_result result = new testReturnNull_result(); - result.success = iface.testReturnNull(); - return result; - } - } - - public static class testStruct extends org.apache.thrift.ProcessFunction { - public testStruct() { - super("testStruct"); - } - - public testStruct_args getEmptyArgsInstance() { - return new testStruct_args(); - } - - protected boolean isOneway() { - return false; - } - - public testStruct_result getResult(I iface, testStruct_args args) throws org.apache.thrift.TException { - testStruct_result result = new testStruct_result(); - result.success = iface.testStruct(args.query); - return result; - } - } - - public static class testException extends org.apache.thrift.ProcessFunction { - public testException() { - super("testException"); - } - - public testException_args getEmptyArgsInstance() { - return new testException_args(); - } - - protected boolean isOneway() { - return false; - } - - public testException_result getResult(I iface, testException_args args) throws org.apache.thrift.TException { - testException_result result = new testException_result(); - try { - result.success = iface.testException(args.tweet); - } catch (TwitterUnavailable unavailable) { - result.unavailable = unavailable; - } - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("testBool", new testBool()); - processMap.put("testByte", new testByte()); - processMap.put("testI16", new testI16()); - processMap.put("testI32", new testI32()); - processMap.put("testI64", new testI64()); - processMap.put("testDouble", new testDouble()); - processMap.put("testBinary", new testBinary()); - processMap.put("testString", new testString()); - processMap.put("testList", new testList()); - processMap.put("testSet", new testSet()); - processMap.put("testMap", new testMap()); - processMap.put("testVoid", new testVoid()); - processMap.put("testReturnNull", new testReturnNull()); - processMap.put("testStruct", new testStruct()); - processMap.put("testException", new testException()); - return processMap; - } - - public static class testBool extends org.apache.thrift.AsyncProcessFunction { - public testBool() { - super("testBool"); - } - - public testBool_args getEmptyArgsInstance() { - return new testBool_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Boolean o) { - testBool_result result = new testBool_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testBool_result result = new testBool_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testBool_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testBool(args.b,resultHandler); - } - } - - public static class testByte extends org.apache.thrift.AsyncProcessFunction { - public testByte() { - super("testByte"); - } - - public testByte_args getEmptyArgsInstance() { - return new testByte_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Byte o) { - testByte_result result = new testByte_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testByte_result result = new testByte_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testByte_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testByte(args.b,resultHandler); - } - } - - public static class testI16 extends org.apache.thrift.AsyncProcessFunction { - public testI16() { - super("testI16"); - } - - public testI16_args getEmptyArgsInstance() { - return new testI16_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Short o) { - testI16_result result = new testI16_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testI16_result result = new testI16_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testI16_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testI16(args.i,resultHandler); - } - } - - public static class testI32 extends org.apache.thrift.AsyncProcessFunction { - public testI32() { - super("testI32"); - } - - public testI32_args getEmptyArgsInstance() { - return new testI32_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Integer o) { - testI32_result result = new testI32_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testI32_result result = new testI32_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testI32_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testI32(args.i,resultHandler); - } - } - - public static class testI64 extends org.apache.thrift.AsyncProcessFunction { - public testI64() { - super("testI64"); - } - - public testI64_args getEmptyArgsInstance() { - return new testI64_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Long o) { - testI64_result result = new testI64_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testI64_result result = new testI64_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testI64_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testI64(args.i,resultHandler); - } - } - - public static class testDouble extends org.apache.thrift.AsyncProcessFunction { - public testDouble() { - super("testDouble"); - } - - public testDouble_args getEmptyArgsInstance() { - return new testDouble_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Double o) { - testDouble_result result = new testDouble_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testDouble_result result = new testDouble_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testDouble_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testDouble(args.d,resultHandler); - } - } - - public static class testBinary extends org.apache.thrift.AsyncProcessFunction { - public testBinary() { - super("testBinary"); - } - - public testBinary_args getEmptyArgsInstance() { - return new testBinary_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(ByteBuffer o) { - testBinary_result result = new testBinary_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testBinary_result result = new testBinary_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testBinary_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testBinary(args.b,resultHandler); - } - } - - public static class testString extends org.apache.thrift.AsyncProcessFunction { - public testString() { - super("testString"); - } - - public testString_args getEmptyArgsInstance() { - return new testString_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testString_result result = new testString_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testString_result result = new testString_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testString_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testString(args.s,resultHandler); - } - } - - public static class testList extends org.apache.thrift.AsyncProcessFunction> { - public testList() { - super("testList"); - } - - public testList_args getEmptyArgsInstance() { - return new testList_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(List o) { - testList_result result = new testList_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testList_result result = new testList_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testList_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.testList(args.l,resultHandler); - } - } - - public static class testSet extends org.apache.thrift.AsyncProcessFunction> { - public testSet() { - super("testSet"); - } - - public testSet_args getEmptyArgsInstance() { - return new testSet_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(Set o) { - testSet_result result = new testSet_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testSet_result result = new testSet_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testSet_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.testSet(args.s,resultHandler); - } - } - - public static class testMap extends org.apache.thrift.AsyncProcessFunction> { - public testMap() { - super("testMap"); - } - - public testMap_args getEmptyArgsInstance() { - return new testMap_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(Map o) { - testMap_result result = new testMap_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testMap_result result = new testMap_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testMap_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.testMap(args.m,resultHandler); - } - } - - public static class testVoid extends org.apache.thrift.AsyncProcessFunction { - public testVoid() { - super("testVoid"); - } - - public testVoid_args getEmptyArgsInstance() { - return new testVoid_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - testVoid_result result = new testVoid_result(); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testVoid_result result = new testVoid_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testVoid_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testVoid(resultHandler); - } - } - - public static class testReturnNull extends org.apache.thrift.AsyncProcessFunction { - public testReturnNull() { - super("testReturnNull"); - } - - public testReturnNull_args getEmptyArgsInstance() { - return new testReturnNull_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testReturnNull_result result = new testReturnNull_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testReturnNull_result result = new testReturnNull_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testReturnNull_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testReturnNull(resultHandler); - } - } - - public static class testStruct extends org.apache.thrift.AsyncProcessFunction { - public testStruct() { - super("testStruct"); - } - - public testStruct_args getEmptyArgsInstance() { - return new testStruct_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(TweetSearchResult o) { - testStruct_result result = new testStruct_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testStruct_result result = new testStruct_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testStruct_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testStruct(args.query,resultHandler); - } - } - - public static class testException extends org.apache.thrift.AsyncProcessFunction { - public testException() { - super("testException"); - } - - public testException_args getEmptyArgsInstance() { - return new testException_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - testException_result result = new testException_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - testException_result result = new testException_result(); - if (e instanceof TwitterUnavailable) { - result.unavailable = (TwitterUnavailable) e; - result.setUnavailableIsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, testException_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.testException(args.tweet,resultHandler); - } - } - - } - - public static class testBool_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBool_args"); - - private static final org.apache.thrift.protocol.TField B_FIELD_DESC = new org.apache.thrift.protocol.TField("b", org.apache.thrift.protocol.TType.BOOL, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBool_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBool_argsTupleSchemeFactory()); - } - - public boolean b; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - B((short)1, "b"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // B - return B; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __B_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.B, new org.apache.thrift.meta_data.FieldMetaData("b", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBool_args.class, metaDataMap); - } - - public testBool_args() { - } - - public testBool_args( - boolean b) - { - this(); - this.b = b; - setBIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testBool_args(testBool_args other) { - __isset_bitfield = other.__isset_bitfield; - this.b = other.b; - } - - public testBool_args deepCopy() { - return new testBool_args(this); - } - - @Override - public void clear() { - setBIsSet(false); - this.b = false; - } - - public boolean isB() { - return this.b; - } - - public testBool_args setB(boolean b) { - this.b = b; - setBIsSet(true); - return this; - } - - public void unsetB() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __B_ISSET_ID); - } - - /** Returns true if field b is set (has been assigned a value) and false otherwise */ - public boolean isSetB() { - return EncodingUtils.testBit(__isset_bitfield, __B_ISSET_ID); - } - - public void setBIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __B_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case B: - if (value == null) { - unsetB(); - } else { - setB((Boolean)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case B: - return isB(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case B: - return isSetB(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBool_args) - return this.equals((testBool_args)that); - return false; - } - - public boolean equals(testBool_args that) { - if (that == null) - return false; - - boolean this_present_b = true; - boolean that_present_b = true; - if (this_present_b || that_present_b) { - if (!(this_present_b && that_present_b)) - return false; - if (this.b != that.b) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_b = true; - list.add(present_b); - if (present_b) - list.add(b); - - return list.hashCode(); - } - - @Override - public int compareTo(testBool_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetB()).compareTo(other.isSetB()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetB()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.b, other.b); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBool_args("); - boolean first = true; - - sb.append("b:"); - sb.append(this.b); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testBool_argsStandardSchemeFactory implements SchemeFactory { - public testBool_argsStandardScheme getScheme() { - return new testBool_argsStandardScheme(); - } - } - - private static class testBool_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBool_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // B - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.b = iprot.readBool(); - struct.setBIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBool_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(B_FIELD_DESC); - oprot.writeBool(struct.b); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBool_argsTupleSchemeFactory implements SchemeFactory { - public testBool_argsTupleScheme getScheme() { - return new testBool_argsTupleScheme(); - } - } - - private static class testBool_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBool_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetB()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetB()) { - oprot.writeBool(struct.b); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBool_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.b = iprot.readBool(); - struct.setBIsSet(true); - } - } - } - - } - - public static class testBool_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBool_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBool_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBool_resultTupleSchemeFactory()); - } - - public boolean success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBool_result.class, metaDataMap); - } - - public testBool_result() { - } - - public testBool_result( - boolean success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testBool_result(testBool_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testBool_result deepCopy() { - return new testBool_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = false; - } - - public boolean isSuccess() { - return this.success; - } - - public testBool_result setSuccess(boolean success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Boolean)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return isSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBool_result) - return this.equals((testBool_result)that); - return false; - } - - public boolean equals(testBool_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testBool_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBool_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testBool_resultStandardSchemeFactory implements SchemeFactory { - public testBool_resultStandardScheme getScheme() { - return new testBool_resultStandardScheme(); - } - } - - private static class testBool_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBool_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBool_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBool(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBool_resultTupleSchemeFactory implements SchemeFactory { - public testBool_resultTupleScheme getScheme() { - return new testBool_resultTupleScheme(); - } - } - - private static class testBool_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBool_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeBool(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBool_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testByte_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testByte_args"); - - private static final org.apache.thrift.protocol.TField B_FIELD_DESC = new org.apache.thrift.protocol.TField("b", org.apache.thrift.protocol.TType.BYTE, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testByte_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testByte_argsTupleSchemeFactory()); - } - - public byte b; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - B((short)1, "b"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // B - return B; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __B_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.B, new org.apache.thrift.meta_data.FieldMetaData("b", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testByte_args.class, metaDataMap); - } - - public testByte_args() { - } - - public testByte_args( - byte b) - { - this(); - this.b = b; - setBIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testByte_args(testByte_args other) { - __isset_bitfield = other.__isset_bitfield; - this.b = other.b; - } - - public testByte_args deepCopy() { - return new testByte_args(this); - } - - @Override - public void clear() { - setBIsSet(false); - this.b = 0; - } - - public byte getB() { - return this.b; - } - - public testByte_args setB(byte b) { - this.b = b; - setBIsSet(true); - return this; - } - - public void unsetB() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __B_ISSET_ID); - } - - /** Returns true if field b is set (has been assigned a value) and false otherwise */ - public boolean isSetB() { - return EncodingUtils.testBit(__isset_bitfield, __B_ISSET_ID); - } - - public void setBIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __B_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case B: - if (value == null) { - unsetB(); - } else { - setB((Byte)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case B: - return getB(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case B: - return isSetB(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testByte_args) - return this.equals((testByte_args)that); - return false; - } - - public boolean equals(testByte_args that) { - if (that == null) - return false; - - boolean this_present_b = true; - boolean that_present_b = true; - if (this_present_b || that_present_b) { - if (!(this_present_b && that_present_b)) - return false; - if (this.b != that.b) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_b = true; - list.add(present_b); - if (present_b) - list.add(b); - - return list.hashCode(); - } - - @Override - public int compareTo(testByte_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetB()).compareTo(other.isSetB()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetB()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.b, other.b); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testByte_args("); - boolean first = true; - - sb.append("b:"); - sb.append(this.b); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testByte_argsStandardSchemeFactory implements SchemeFactory { - public testByte_argsStandardScheme getScheme() { - return new testByte_argsStandardScheme(); - } - } - - private static class testByte_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testByte_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // B - if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) { - struct.b = iprot.readByte(); - struct.setBIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testByte_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(B_FIELD_DESC); - oprot.writeByte(struct.b); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testByte_argsTupleSchemeFactory implements SchemeFactory { - public testByte_argsTupleScheme getScheme() { - return new testByte_argsTupleScheme(); - } - } - - private static class testByte_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testByte_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetB()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetB()) { - oprot.writeByte(struct.b); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testByte_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.b = iprot.readByte(); - struct.setBIsSet(true); - } - } - } - - } - - public static class testByte_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testByte_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BYTE, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testByte_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testByte_resultTupleSchemeFactory()); - } - - public byte success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testByte_result.class, metaDataMap); - } - - public testByte_result() { - } - - public testByte_result( - byte success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testByte_result(testByte_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testByte_result deepCopy() { - return new testByte_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - } - - public byte getSuccess() { - return this.success; - } - - public testByte_result setSuccess(byte success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Byte)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testByte_result) - return this.equals((testByte_result)that); - return false; - } - - public boolean equals(testByte_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testByte_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testByte_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testByte_resultStandardSchemeFactory implements SchemeFactory { - public testByte_resultStandardScheme getScheme() { - return new testByte_resultStandardScheme(); - } - } - - private static class testByte_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testByte_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) { - struct.success = iprot.readByte(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testByte_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeByte(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testByte_resultTupleSchemeFactory implements SchemeFactory { - public testByte_resultTupleScheme getScheme() { - return new testByte_resultTupleScheme(); - } - } - - private static class testByte_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testByte_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeByte(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testByte_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readByte(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testI16_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI16_args"); - - private static final org.apache.thrift.protocol.TField I_FIELD_DESC = new org.apache.thrift.protocol.TField("i", org.apache.thrift.protocol.TType.I16, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI16_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI16_argsTupleSchemeFactory()); - } - - public short i; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - I((short)1, "i"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // I - return I; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __I_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.I, new org.apache.thrift.meta_data.FieldMetaData("i", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI16_args.class, metaDataMap); - } - - public testI16_args() { - } - - public testI16_args( - short i) - { - this(); - this.i = i; - setIIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI16_args(testI16_args other) { - __isset_bitfield = other.__isset_bitfield; - this.i = other.i; - } - - public testI16_args deepCopy() { - return new testI16_args(this); - } - - @Override - public void clear() { - setIIsSet(false); - this.i = 0; - } - - public short getI() { - return this.i; - } - - public testI16_args setI(short i) { - this.i = i; - setIIsSet(true); - return this; - } - - public void unsetI() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __I_ISSET_ID); - } - - /** Returns true if field i is set (has been assigned a value) and false otherwise */ - public boolean isSetI() { - return EncodingUtils.testBit(__isset_bitfield, __I_ISSET_ID); - } - - public void setIIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __I_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case I: - if (value == null) { - unsetI(); - } else { - setI((Short)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case I: - return getI(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case I: - return isSetI(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI16_args) - return this.equals((testI16_args)that); - return false; - } - - public boolean equals(testI16_args that) { - if (that == null) - return false; - - boolean this_present_i = true; - boolean that_present_i = true; - if (this_present_i || that_present_i) { - if (!(this_present_i && that_present_i)) - return false; - if (this.i != that.i) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_i = true; - list.add(present_i); - if (present_i) - list.add(i); - - return list.hashCode(); - } - - @Override - public int compareTo(testI16_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetI()).compareTo(other.isSetI()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetI()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i, other.i); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI16_args("); - boolean first = true; - - sb.append("i:"); - sb.append(this.i); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI16_argsStandardSchemeFactory implements SchemeFactory { - public testI16_argsStandardScheme getScheme() { - return new testI16_argsStandardScheme(); - } - } - - private static class testI16_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI16_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // I - if (schemeField.type == org.apache.thrift.protocol.TType.I16) { - struct.i = iprot.readI16(); - struct.setIIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI16_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(I_FIELD_DESC); - oprot.writeI16(struct.i); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI16_argsTupleSchemeFactory implements SchemeFactory { - public testI16_argsTupleScheme getScheme() { - return new testI16_argsTupleScheme(); - } - } - - private static class testI16_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI16_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetI()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetI()) { - oprot.writeI16(struct.i); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI16_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.i = iprot.readI16(); - struct.setIIsSet(true); - } - } - } - - } - - public static class testI16_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI16_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I16, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI16_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI16_resultTupleSchemeFactory()); - } - - public short success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI16_result.class, metaDataMap); - } - - public testI16_result() { - } - - public testI16_result( - short success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI16_result(testI16_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testI16_result deepCopy() { - return new testI16_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - } - - public short getSuccess() { - return this.success; - } - - public testI16_result setSuccess(short success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Short)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI16_result) - return this.equals((testI16_result)that); - return false; - } - - public boolean equals(testI16_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testI16_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI16_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI16_resultStandardSchemeFactory implements SchemeFactory { - public testI16_resultStandardScheme getScheme() { - return new testI16_resultStandardScheme(); - } - } - - private static class testI16_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI16_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.I16) { - struct.success = iprot.readI16(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI16_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeI16(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI16_resultTupleSchemeFactory implements SchemeFactory { - public testI16_resultTupleScheme getScheme() { - return new testI16_resultTupleScheme(); - } - } - - private static class testI16_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI16_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeI16(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI16_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readI16(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testI32_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI32_args"); - - private static final org.apache.thrift.protocol.TField I_FIELD_DESC = new org.apache.thrift.protocol.TField("i", org.apache.thrift.protocol.TType.I32, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI32_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI32_argsTupleSchemeFactory()); - } - - public int i; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - I((short)1, "i"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // I - return I; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __I_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.I, new org.apache.thrift.meta_data.FieldMetaData("i", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI32_args.class, metaDataMap); - } - - public testI32_args() { - } - - public testI32_args( - int i) - { - this(); - this.i = i; - setIIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI32_args(testI32_args other) { - __isset_bitfield = other.__isset_bitfield; - this.i = other.i; - } - - public testI32_args deepCopy() { - return new testI32_args(this); - } - - @Override - public void clear() { - setIIsSet(false); - this.i = 0; - } - - public int getI() { - return this.i; - } - - public testI32_args setI(int i) { - this.i = i; - setIIsSet(true); - return this; - } - - public void unsetI() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __I_ISSET_ID); - } - - /** Returns true if field i is set (has been assigned a value) and false otherwise */ - public boolean isSetI() { - return EncodingUtils.testBit(__isset_bitfield, __I_ISSET_ID); - } - - public void setIIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __I_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case I: - if (value == null) { - unsetI(); - } else { - setI((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case I: - return getI(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case I: - return isSetI(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI32_args) - return this.equals((testI32_args)that); - return false; - } - - public boolean equals(testI32_args that) { - if (that == null) - return false; - - boolean this_present_i = true; - boolean that_present_i = true; - if (this_present_i || that_present_i) { - if (!(this_present_i && that_present_i)) - return false; - if (this.i != that.i) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_i = true; - list.add(present_i); - if (present_i) - list.add(i); - - return list.hashCode(); - } - - @Override - public int compareTo(testI32_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetI()).compareTo(other.isSetI()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetI()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i, other.i); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI32_args("); - boolean first = true; - - sb.append("i:"); - sb.append(this.i); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI32_argsStandardSchemeFactory implements SchemeFactory { - public testI32_argsStandardScheme getScheme() { - return new testI32_argsStandardScheme(); - } - } - - private static class testI32_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI32_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // I - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.i = iprot.readI32(); - struct.setIIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI32_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(I_FIELD_DESC); - oprot.writeI32(struct.i); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI32_argsTupleSchemeFactory implements SchemeFactory { - public testI32_argsTupleScheme getScheme() { - return new testI32_argsTupleScheme(); - } - } - - private static class testI32_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI32_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetI()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetI()) { - oprot.writeI32(struct.i); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI32_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.i = iprot.readI32(); - struct.setIIsSet(true); - } - } - } - - } - - public static class testI32_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI32_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI32_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI32_resultTupleSchemeFactory()); - } - - public int success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI32_result.class, metaDataMap); - } - - public testI32_result() { - } - - public testI32_result( - int success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI32_result(testI32_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testI32_result deepCopy() { - return new testI32_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - } - - public int getSuccess() { - return this.success; - } - - public testI32_result setSuccess(int success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI32_result) - return this.equals((testI32_result)that); - return false; - } - - public boolean equals(testI32_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testI32_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI32_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI32_resultStandardSchemeFactory implements SchemeFactory { - public testI32_resultStandardScheme getScheme() { - return new testI32_resultStandardScheme(); - } - } - - private static class testI32_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI32_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.success = iprot.readI32(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI32_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeI32(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI32_resultTupleSchemeFactory implements SchemeFactory { - public testI32_resultTupleScheme getScheme() { - return new testI32_resultTupleScheme(); - } - } - - private static class testI32_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI32_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeI32(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI32_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readI32(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testI64_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI64_args"); - - private static final org.apache.thrift.protocol.TField I_FIELD_DESC = new org.apache.thrift.protocol.TField("i", org.apache.thrift.protocol.TType.I64, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI64_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI64_argsTupleSchemeFactory()); - } - - public long i; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - I((short)1, "i"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // I - return I; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __I_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.I, new org.apache.thrift.meta_data.FieldMetaData("i", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI64_args.class, metaDataMap); - } - - public testI64_args() { - } - - public testI64_args( - long i) - { - this(); - this.i = i; - setIIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI64_args(testI64_args other) { - __isset_bitfield = other.__isset_bitfield; - this.i = other.i; - } - - public testI64_args deepCopy() { - return new testI64_args(this); - } - - @Override - public void clear() { - setIIsSet(false); - this.i = 0; - } - - public long getI() { - return this.i; - } - - public testI64_args setI(long i) { - this.i = i; - setIIsSet(true); - return this; - } - - public void unsetI() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __I_ISSET_ID); - } - - /** Returns true if field i is set (has been assigned a value) and false otherwise */ - public boolean isSetI() { - return EncodingUtils.testBit(__isset_bitfield, __I_ISSET_ID); - } - - public void setIIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __I_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case I: - if (value == null) { - unsetI(); - } else { - setI((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case I: - return getI(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case I: - return isSetI(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI64_args) - return this.equals((testI64_args)that); - return false; - } - - public boolean equals(testI64_args that) { - if (that == null) - return false; - - boolean this_present_i = true; - boolean that_present_i = true; - if (this_present_i || that_present_i) { - if (!(this_present_i && that_present_i)) - return false; - if (this.i != that.i) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_i = true; - list.add(present_i); - if (present_i) - list.add(i); - - return list.hashCode(); - } - - @Override - public int compareTo(testI64_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetI()).compareTo(other.isSetI()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetI()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i, other.i); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI64_args("); - boolean first = true; - - sb.append("i:"); - sb.append(this.i); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI64_argsStandardSchemeFactory implements SchemeFactory { - public testI64_argsStandardScheme getScheme() { - return new testI64_argsStandardScheme(); - } - } - - private static class testI64_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI64_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // I - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.i = iprot.readI64(); - struct.setIIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI64_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(I_FIELD_DESC); - oprot.writeI64(struct.i); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI64_argsTupleSchemeFactory implements SchemeFactory { - public testI64_argsTupleScheme getScheme() { - return new testI64_argsTupleScheme(); - } - } - - private static class testI64_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI64_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetI()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetI()) { - oprot.writeI64(struct.i); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI64_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.i = iprot.readI64(); - struct.setIIsSet(true); - } - } - } - - } - - public static class testI64_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testI64_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testI64_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testI64_resultTupleSchemeFactory()); - } - - public long success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testI64_result.class, metaDataMap); - } - - public testI64_result() { - } - - public testI64_result( - long success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testI64_result(testI64_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testI64_result deepCopy() { - return new testI64_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0; - } - - public long getSuccess() { - return this.success; - } - - public testI64_result setSuccess(long success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testI64_result) - return this.equals((testI64_result)that); - return false; - } - - public boolean equals(testI64_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testI64_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testI64_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testI64_resultStandardSchemeFactory implements SchemeFactory { - public testI64_resultStandardScheme getScheme() { - return new testI64_resultStandardScheme(); - } - } - - private static class testI64_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testI64_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.success = iprot.readI64(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testI64_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeI64(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testI64_resultTupleSchemeFactory implements SchemeFactory { - public testI64_resultTupleScheme getScheme() { - return new testI64_resultTupleScheme(); - } - } - - private static class testI64_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testI64_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeI64(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testI64_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readI64(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testDouble_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testDouble_args"); - - private static final org.apache.thrift.protocol.TField D_FIELD_DESC = new org.apache.thrift.protocol.TField("d", org.apache.thrift.protocol.TType.DOUBLE, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testDouble_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testDouble_argsTupleSchemeFactory()); - } - - public double d; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - D((short)1, "d"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // D - return D; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __D_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.D, new org.apache.thrift.meta_data.FieldMetaData("d", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testDouble_args.class, metaDataMap); - } - - public testDouble_args() { - } - - public testDouble_args( - double d) - { - this(); - this.d = d; - setDIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testDouble_args(testDouble_args other) { - __isset_bitfield = other.__isset_bitfield; - this.d = other.d; - } - - public testDouble_args deepCopy() { - return new testDouble_args(this); - } - - @Override - public void clear() { - setDIsSet(false); - this.d = 0.0; - } - - public double getD() { - return this.d; - } - - public testDouble_args setD(double d) { - this.d = d; - setDIsSet(true); - return this; - } - - public void unsetD() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __D_ISSET_ID); - } - - /** Returns true if field d is set (has been assigned a value) and false otherwise */ - public boolean isSetD() { - return EncodingUtils.testBit(__isset_bitfield, __D_ISSET_ID); - } - - public void setDIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __D_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case D: - if (value == null) { - unsetD(); - } else { - setD((Double)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case D: - return getD(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case D: - return isSetD(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testDouble_args) - return this.equals((testDouble_args)that); - return false; - } - - public boolean equals(testDouble_args that) { - if (that == null) - return false; - - boolean this_present_d = true; - boolean that_present_d = true; - if (this_present_d || that_present_d) { - if (!(this_present_d && that_present_d)) - return false; - if (this.d != that.d) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_d = true; - list.add(present_d); - if (present_d) - list.add(d); - - return list.hashCode(); - } - - @Override - public int compareTo(testDouble_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetD()).compareTo(other.isSetD()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetD()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.d, other.d); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testDouble_args("); - boolean first = true; - - sb.append("d:"); - sb.append(this.d); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testDouble_argsStandardSchemeFactory implements SchemeFactory { - public testDouble_argsStandardScheme getScheme() { - return new testDouble_argsStandardScheme(); - } - } - - private static class testDouble_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testDouble_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // D - if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { - struct.d = iprot.readDouble(); - struct.setDIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testDouble_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(D_FIELD_DESC); - oprot.writeDouble(struct.d); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testDouble_argsTupleSchemeFactory implements SchemeFactory { - public testDouble_argsTupleScheme getScheme() { - return new testDouble_argsTupleScheme(); - } - } - - private static class testDouble_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testDouble_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetD()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetD()) { - oprot.writeDouble(struct.d); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testDouble_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.d = iprot.readDouble(); - struct.setDIsSet(true); - } - } - } - - } - - public static class testDouble_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testDouble_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.DOUBLE, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testDouble_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testDouble_resultTupleSchemeFactory()); - } - - public double success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testDouble_result.class, metaDataMap); - } - - public testDouble_result() { - } - - public testDouble_result( - double success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public testDouble_result(testDouble_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public testDouble_result deepCopy() { - return new testDouble_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = 0.0; - } - - public double getSuccess() { - return this.success; - } - - public testDouble_result setSuccess(double success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Double)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testDouble_result) - return this.equals((testDouble_result)that); - return false; - } - - public boolean equals(testDouble_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true; - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testDouble_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testDouble_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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 { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - 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); - } - } - - private static class testDouble_resultStandardSchemeFactory implements SchemeFactory { - public testDouble_resultStandardScheme getScheme() { - return new testDouble_resultStandardScheme(); - } - } - - private static class testDouble_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testDouble_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { - struct.success = iprot.readDouble(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testDouble_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeDouble(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testDouble_resultTupleSchemeFactory implements SchemeFactory { - public testDouble_resultTupleScheme getScheme() { - return new testDouble_resultTupleScheme(); - } - } - - private static class testDouble_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testDouble_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeDouble(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testDouble_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readDouble(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testBinary_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBinary_args"); - - private static final org.apache.thrift.protocol.TField B_FIELD_DESC = new org.apache.thrift.protocol.TField("b", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBinary_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBinary_argsTupleSchemeFactory()); - } - - public ByteBuffer b; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - B((short)1, "b"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // B - return B; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.B, new org.apache.thrift.meta_data.FieldMetaData("b", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBinary_args.class, metaDataMap); - } - - public testBinary_args() { - } - - public testBinary_args( - ByteBuffer b) - { - this(); - this.b = org.apache.thrift.TBaseHelper.copyBinary(b); - } - - /** - * Performs a deep copy on other. - */ - public testBinary_args(testBinary_args other) { - if (other.isSetB()) { - this.b = org.apache.thrift.TBaseHelper.copyBinary(other.b); - } - } - - public testBinary_args deepCopy() { - return new testBinary_args(this); - } - - @Override - public void clear() { - this.b = null; - } - - public byte[] getB() { - setB(org.apache.thrift.TBaseHelper.rightSize(b)); - return b == null ? null : b.array(); - } - - public ByteBuffer bufferForB() { - return org.apache.thrift.TBaseHelper.copyBinary(b); - } - - public testBinary_args setB(byte[] b) { - this.b = b == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(b, b.length)); - return this; - } - - public testBinary_args setB(ByteBuffer b) { - this.b = org.apache.thrift.TBaseHelper.copyBinary(b); - return this; - } - - public void unsetB() { - this.b = null; - } - - /** Returns true if field b is set (has been assigned a value) and false otherwise */ - public boolean isSetB() { - return this.b != null; - } - - public void setBIsSet(boolean value) { - if (!value) { - this.b = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case B: - if (value == null) { - unsetB(); - } else { - setB((ByteBuffer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case B: - return getB(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case B: - return isSetB(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBinary_args) - return this.equals((testBinary_args)that); - return false; - } - - public boolean equals(testBinary_args that) { - if (that == null) - return false; - - boolean this_present_b = true && this.isSetB(); - boolean that_present_b = true && that.isSetB(); - if (this_present_b || that_present_b) { - if (!(this_present_b && that_present_b)) - return false; - if (!this.b.equals(that.b)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_b = true && (isSetB()); - list.add(present_b); - if (present_b) - list.add(b); - - return list.hashCode(); - } - - @Override - public int compareTo(testBinary_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetB()).compareTo(other.isSetB()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetB()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.b, other.b); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBinary_args("); - boolean first = true; - - sb.append("b:"); - if (this.b == null) { - sb.append("null"); - } else { - org.apache.thrift.TBaseHelper.toString(this.b, sb); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testBinary_argsStandardSchemeFactory implements SchemeFactory { - public testBinary_argsStandardScheme getScheme() { - return new testBinary_argsStandardScheme(); - } - } - - private static class testBinary_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBinary_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // B - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.b = iprot.readBinary(); - struct.setBIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBinary_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.b != null) { - oprot.writeFieldBegin(B_FIELD_DESC); - oprot.writeBinary(struct.b); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBinary_argsTupleSchemeFactory implements SchemeFactory { - public testBinary_argsTupleScheme getScheme() { - return new testBinary_argsTupleScheme(); - } - } - - private static class testBinary_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBinary_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetB()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetB()) { - oprot.writeBinary(struct.b); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBinary_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.b = iprot.readBinary(); - struct.setBIsSet(true); - } - } - } - - } - - public static class testBinary_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testBinary_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testBinary_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testBinary_resultTupleSchemeFactory()); - } - - public ByteBuffer success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testBinary_result.class, metaDataMap); - } - - public testBinary_result() { - } - - public testBinary_result( - ByteBuffer success) - { - this(); - this.success = org.apache.thrift.TBaseHelper.copyBinary(success); - } - - /** - * Performs a deep copy on other. - */ - public testBinary_result(testBinary_result other) { - if (other.isSetSuccess()) { - this.success = org.apache.thrift.TBaseHelper.copyBinary(other.success); - } - } - - public testBinary_result deepCopy() { - return new testBinary_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public byte[] getSuccess() { - setSuccess(org.apache.thrift.TBaseHelper.rightSize(success)); - return success == null ? null : success.array(); - } - - public ByteBuffer bufferForSuccess() { - return org.apache.thrift.TBaseHelper.copyBinary(success); - } - - public testBinary_result setSuccess(byte[] success) { - this.success = success == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(success, success.length)); - return this; - } - - public testBinary_result setSuccess(ByteBuffer success) { - this.success = org.apache.thrift.TBaseHelper.copyBinary(success); - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((ByteBuffer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testBinary_result) - return this.equals((testBinary_result)that); - return false; - } - - public boolean equals(testBinary_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testBinary_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testBinary_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - org.apache.thrift.TBaseHelper.toString(this.success, sb); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testBinary_resultStandardSchemeFactory implements SchemeFactory { - public testBinary_resultStandardScheme getScheme() { - return new testBinary_resultStandardScheme(); - } - } - - private static class testBinary_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testBinary_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readBinary(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testBinary_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBinary(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testBinary_resultTupleSchemeFactory implements SchemeFactory { - public testBinary_resultTupleScheme getScheme() { - return new testBinary_resultTupleScheme(); - } - } - - private static class testBinary_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testBinary_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeBinary(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testBinary_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readBinary(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testString_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testString_args"); - - private static final org.apache.thrift.protocol.TField S_FIELD_DESC = new org.apache.thrift.protocol.TField("s", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testString_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testString_argsTupleSchemeFactory()); - } - - public String s; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - S((short)1, "s"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // S - return S; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.S, new org.apache.thrift.meta_data.FieldMetaData("s", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testString_args.class, metaDataMap); - } - - public testString_args() { - } - - public testString_args( - String s) - { - this(); - this.s = s; - } - - /** - * Performs a deep copy on other. - */ - public testString_args(testString_args other) { - if (other.isSetS()) { - this.s = other.s; - } - } - - public testString_args deepCopy() { - return new testString_args(this); - } - - @Override - public void clear() { - this.s = null; - } - - public String getS() { - return this.s; - } - - public testString_args setS(String s) { - this.s = s; - return this; - } - - public void unsetS() { - this.s = null; - } - - /** Returns true if field s is set (has been assigned a value) and false otherwise */ - public boolean isSetS() { - return this.s != null; - } - - public void setSIsSet(boolean value) { - if (!value) { - this.s = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case S: - if (value == null) { - unsetS(); - } else { - setS((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case S: - return getS(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case S: - return isSetS(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testString_args) - return this.equals((testString_args)that); - return false; - } - - public boolean equals(testString_args that) { - if (that == null) - return false; - - boolean this_present_s = true && this.isSetS(); - boolean that_present_s = true && that.isSetS(); - if (this_present_s || that_present_s) { - if (!(this_present_s && that_present_s)) - return false; - if (!this.s.equals(that.s)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_s = true && (isSetS()); - list.add(present_s); - if (present_s) - list.add(s); - - return list.hashCode(); - } - - @Override - public int compareTo(testString_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetS()).compareTo(other.isSetS()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetS()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.s, other.s); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testString_args("); - boolean first = true; - - sb.append("s:"); - if (this.s == null) { - sb.append("null"); - } else { - sb.append(this.s); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testString_argsStandardSchemeFactory implements SchemeFactory { - public testString_argsStandardScheme getScheme() { - return new testString_argsStandardScheme(); - } - } - - private static class testString_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testString_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // S - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.s = iprot.readString(); - struct.setSIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testString_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.s != null) { - oprot.writeFieldBegin(S_FIELD_DESC); - oprot.writeString(struct.s); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testString_argsTupleSchemeFactory implements SchemeFactory { - public testString_argsTupleScheme getScheme() { - return new testString_argsTupleScheme(); - } - } - - private static class testString_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testString_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetS()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetS()) { - oprot.writeString(struct.s); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testString_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.s = iprot.readString(); - struct.setSIsSet(true); - } - } - } - - } - - public static class testString_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testString_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testString_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testString_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testString_result.class, metaDataMap); - } - - public testString_result() { - } - - public testString_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testString_result(testString_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public testString_result deepCopy() { - return new testString_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public testString_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testString_result) - return this.equals((testString_result)that); - return false; - } - - public boolean equals(testString_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testString_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testString_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testString_resultStandardSchemeFactory implements SchemeFactory { - public testString_resultStandardScheme getScheme() { - return new testString_resultStandardScheme(); - } - } - - private static class testString_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testString_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testString_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testString_resultTupleSchemeFactory implements SchemeFactory { - public testString_resultTupleScheme getScheme() { - return new testString_resultTupleScheme(); - } - } - - private static class testString_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testString_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testString_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testList_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testList_args"); - - private static final org.apache.thrift.protocol.TField L_FIELD_DESC = new org.apache.thrift.protocol.TField("l", org.apache.thrift.protocol.TType.LIST, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testList_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testList_argsTupleSchemeFactory()); - } - - public List l; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - L((short)1, "l"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // L - return L; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.L, new org.apache.thrift.meta_data.FieldMetaData("l", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testList_args.class, metaDataMap); - } - - public testList_args() { - } - - public testList_args( - List l) - { - this(); - this.l = l; - } - - /** - * Performs a deep copy on other. - */ - public testList_args(testList_args other) { - if (other.isSetL()) { - List __this__l = new ArrayList(other.l); - this.l = __this__l; - } - } - - public testList_args deepCopy() { - return new testList_args(this); - } - - @Override - public void clear() { - this.l = null; - } - - public int getLSize() { - return (this.l == null) ? 0 : this.l.size(); - } - - public java.util.Iterator getLIterator() { - return (this.l == null) ? null : this.l.iterator(); - } - - public void addToL(String elem) { - if (this.l == null) { - this.l = new ArrayList(); - } - this.l.add(elem); - } - - public List getL() { - return this.l; - } - - public testList_args setL(List l) { - this.l = l; - return this; - } - - public void unsetL() { - this.l = null; - } - - /** Returns true if field l is set (has been assigned a value) and false otherwise */ - public boolean isSetL() { - return this.l != null; - } - - public void setLIsSet(boolean value) { - if (!value) { - this.l = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case L: - if (value == null) { - unsetL(); - } else { - setL((List)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case L: - return getL(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case L: - return isSetL(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testList_args) - return this.equals((testList_args)that); - return false; - } - - public boolean equals(testList_args that) { - if (that == null) - return false; - - boolean this_present_l = true && this.isSetL(); - boolean that_present_l = true && that.isSetL(); - if (this_present_l || that_present_l) { - if (!(this_present_l && that_present_l)) - return false; - if (!this.l.equals(that.l)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_l = true && (isSetL()); - list.add(present_l); - if (present_l) - list.add(l); - - return list.hashCode(); - } - - @Override - public int compareTo(testList_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetL()).compareTo(other.isSetL()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetL()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.l, other.l); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testList_args("); - boolean first = true; - - sb.append("l:"); - if (this.l == null) { - sb.append("null"); - } else { - sb.append(this.l); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testList_argsStandardSchemeFactory implements SchemeFactory { - public testList_argsStandardScheme getScheme() { - return new testList_argsStandardScheme(); - } - } - - private static class testList_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testList_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // L - if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { - { - org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); - struct.l = new ArrayList(_list8.size); - String _elem9; - for (int _i10 = 0; _i10 < _list8.size; ++_i10) - { - _elem9 = iprot.readString(); - struct.l.add(_elem9); - } - iprot.readListEnd(); - } - struct.setLIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testList_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.l != null) { - oprot.writeFieldBegin(L_FIELD_DESC); - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.l.size())); - for (String _iter11 : struct.l) - { - oprot.writeString(_iter11); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testList_argsTupleSchemeFactory implements SchemeFactory { - public testList_argsTupleScheme getScheme() { - return new testList_argsTupleScheme(); - } - } - - private static class testList_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testList_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetL()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetL()) { - { - oprot.writeI32(struct.l.size()); - for (String _iter12 : struct.l) - { - oprot.writeString(_iter12); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testList_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.l = new ArrayList(_list13.size); - String _elem14; - for (int _i15 = 0; _i15 < _list13.size; ++_i15) - { - _elem14 = iprot.readString(); - struct.l.add(_elem14); - } - } - struct.setLIsSet(true); - } - } - } - - } - - public static class testList_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testList_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testList_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testList_resultTupleSchemeFactory()); - } - - public List success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testList_result.class, metaDataMap); - } - - public testList_result() { - } - - public testList_result( - List success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testList_result(testList_result other) { - if (other.isSetSuccess()) { - List __this__success = new ArrayList(other.success); - this.success = __this__success; - } - } - - public testList_result deepCopy() { - return new testList_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public int getSuccessSize() { - return (this.success == null) ? 0 : this.success.size(); - } - - public java.util.Iterator getSuccessIterator() { - return (this.success == null) ? null : this.success.iterator(); - } - - public void addToSuccess(String elem) { - if (this.success == null) { - this.success = new ArrayList(); - } - this.success.add(elem); - } - - public List getSuccess() { - return this.success; - } - - public testList_result setSuccess(List success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((List)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testList_result) - return this.equals((testList_result)that); - return false; - } - - public boolean equals(testList_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testList_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testList_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testList_resultStandardSchemeFactory implements SchemeFactory { - public testList_resultStandardScheme getScheme() { - return new testList_resultStandardScheme(); - } - } - - private static class testList_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testList_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { - { - org.apache.thrift.protocol.TList _list16 = iprot.readListBegin(); - struct.success = new ArrayList(_list16.size); - String _elem17; - for (int _i18 = 0; _i18 < _list16.size; ++_i18) - { - _elem17 = iprot.readString(); - struct.success.add(_elem17); - } - iprot.readListEnd(); - } - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testList_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter19 : struct.success) - { - oprot.writeString(_iter19); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testList_resultTupleSchemeFactory implements SchemeFactory { - public testList_resultTupleScheme getScheme() { - return new testList_resultTupleScheme(); - } - } - - private static class testList_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testList_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - { - oprot.writeI32(struct.success.size()); - for (String _iter20 : struct.success) - { - oprot.writeString(_iter20); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testList_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList(_list21.size); - String _elem22; - for (int _i23 = 0; _i23 < _list21.size; ++_i23) - { - _elem22 = iprot.readString(); - struct.success.add(_elem22); - } - } - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testSet_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testSet_args"); - - private static final org.apache.thrift.protocol.TField S_FIELD_DESC = new org.apache.thrift.protocol.TField("s", org.apache.thrift.protocol.TType.SET, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testSet_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testSet_argsTupleSchemeFactory()); - } - - public Set s; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - S((short)1, "s"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // S - return S; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.S, new org.apache.thrift.meta_data.FieldMetaData("s", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testSet_args.class, metaDataMap); - } - - public testSet_args() { - } - - public testSet_args( - Set s) - { - this(); - this.s = s; - } - - /** - * Performs a deep copy on other. - */ - public testSet_args(testSet_args other) { - if (other.isSetS()) { - Set __this__s = new HashSet(other.s); - this.s = __this__s; - } - } - - public testSet_args deepCopy() { - return new testSet_args(this); - } - - @Override - public void clear() { - this.s = null; - } - - public int getSSize() { - return (this.s == null) ? 0 : this.s.size(); - } - - public java.util.Iterator getSIterator() { - return (this.s == null) ? null : this.s.iterator(); - } - - public void addToS(String elem) { - if (this.s == null) { - this.s = new HashSet(); - } - this.s.add(elem); - } - - public Set getS() { - return this.s; - } - - public testSet_args setS(Set s) { - this.s = s; - return this; - } - - public void unsetS() { - this.s = null; - } - - /** Returns true if field s is set (has been assigned a value) and false otherwise */ - public boolean isSetS() { - return this.s != null; - } - - public void setSIsSet(boolean value) { - if (!value) { - this.s = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case S: - if (value == null) { - unsetS(); - } else { - setS((Set)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case S: - return getS(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case S: - return isSetS(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testSet_args) - return this.equals((testSet_args)that); - return false; - } - - public boolean equals(testSet_args that) { - if (that == null) - return false; - - boolean this_present_s = true && this.isSetS(); - boolean that_present_s = true && that.isSetS(); - if (this_present_s || that_present_s) { - if (!(this_present_s && that_present_s)) - return false; - if (!this.s.equals(that.s)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_s = true && (isSetS()); - list.add(present_s); - if (present_s) - list.add(s); - - return list.hashCode(); - } - - @Override - public int compareTo(testSet_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetS()).compareTo(other.isSetS()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetS()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.s, other.s); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testSet_args("); - boolean first = true; - - sb.append("s:"); - if (this.s == null) { - sb.append("null"); - } else { - sb.append(this.s); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testSet_argsStandardSchemeFactory implements SchemeFactory { - public testSet_argsStandardScheme getScheme() { - return new testSet_argsStandardScheme(); - } - } - - private static class testSet_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testSet_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // S - if (schemeField.type == org.apache.thrift.protocol.TType.SET) { - { - org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin(); - struct.s = new HashSet(2*_set24.size); - String _elem25; - for (int _i26 = 0; _i26 < _set24.size; ++_i26) - { - _elem25 = iprot.readString(); - struct.s.add(_elem25); - } - iprot.readSetEnd(); - } - struct.setSIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testSet_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.s != null) { - oprot.writeFieldBegin(S_FIELD_DESC); - { - oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.s.size())); - for (String _iter27 : struct.s) - { - oprot.writeString(_iter27); - } - oprot.writeSetEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testSet_argsTupleSchemeFactory implements SchemeFactory { - public testSet_argsTupleScheme getScheme() { - return new testSet_argsTupleScheme(); - } - } - - private static class testSet_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testSet_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetS()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetS()) { - { - oprot.writeI32(struct.s.size()); - for (String _iter28 : struct.s) - { - oprot.writeString(_iter28); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testSet_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.s = new HashSet(2*_set29.size); - String _elem30; - for (int _i31 = 0; _i31 < _set29.size; ++_i31) - { - _elem30 = iprot.readString(); - struct.s.add(_elem30); - } - } - struct.setSIsSet(true); - } - } - } - - } - - public static class testSet_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testSet_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.SET, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testSet_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testSet_resultTupleSchemeFactory()); - } - - public Set success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testSet_result.class, metaDataMap); - } - - public testSet_result() { - } - - public testSet_result( - Set success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testSet_result(testSet_result other) { - if (other.isSetSuccess()) { - Set __this__success = new HashSet(other.success); - this.success = __this__success; - } - } - - public testSet_result deepCopy() { - return new testSet_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public int getSuccessSize() { - return (this.success == null) ? 0 : this.success.size(); - } - - public java.util.Iterator getSuccessIterator() { - return (this.success == null) ? null : this.success.iterator(); - } - - public void addToSuccess(String elem) { - if (this.success == null) { - this.success = new HashSet(); - } - this.success.add(elem); - } - - public Set getSuccess() { - return this.success; - } - - public testSet_result setSuccess(Set success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Set)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testSet_result) - return this.equals((testSet_result)that); - return false; - } - - public boolean equals(testSet_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testSet_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testSet_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testSet_resultStandardSchemeFactory implements SchemeFactory { - public testSet_resultStandardScheme getScheme() { - return new testSet_resultStandardScheme(); - } - } - - private static class testSet_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testSet_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.SET) { - { - org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin(); - struct.success = new HashSet(2*_set32.size); - String _elem33; - for (int _i34 = 0; _i34 < _set32.size; ++_i34) - { - _elem33 = iprot.readString(); - struct.success.add(_elem33); - } - iprot.readSetEnd(); - } - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testSet_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - { - oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter35 : struct.success) - { - oprot.writeString(_iter35); - } - oprot.writeSetEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testSet_resultTupleSchemeFactory implements SchemeFactory { - public testSet_resultTupleScheme getScheme() { - return new testSet_resultTupleScheme(); - } - } - - private static class testSet_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testSet_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - { - oprot.writeI32(struct.success.size()); - for (String _iter36 : struct.success) - { - oprot.writeString(_iter36); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testSet_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashSet(2*_set37.size); - String _elem38; - for (int _i39 = 0; _i39 < _set37.size; ++_i39) - { - _elem38 = iprot.readString(); - struct.success.add(_elem38); - } - } - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testMap_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testMap_args"); - - private static final org.apache.thrift.protocol.TField M_FIELD_DESC = new org.apache.thrift.protocol.TField("m", org.apache.thrift.protocol.TType.MAP, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testMap_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testMap_argsTupleSchemeFactory()); - } - - public Map m; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - M((short)1, "m"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // M - return M; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.M, new org.apache.thrift.meta_data.FieldMetaData("m", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testMap_args.class, metaDataMap); - } - - public testMap_args() { - } - - public testMap_args( - Map m) - { - this(); - this.m = m; - } - - /** - * Performs a deep copy on other. - */ - public testMap_args(testMap_args other) { - if (other.isSetM()) { - Map __this__m = new HashMap(other.m); - this.m = __this__m; - } - } - - public testMap_args deepCopy() { - return new testMap_args(this); - } - - @Override - public void clear() { - this.m = null; - } - - public int getMSize() { - return (this.m == null) ? 0 : this.m.size(); - } - - public void putToM(String key, String val) { - if (this.m == null) { - this.m = new HashMap(); - } - this.m.put(key, val); - } - - public Map getM() { - return this.m; - } - - public testMap_args setM(Map m) { - this.m = m; - return this; - } - - public void unsetM() { - this.m = null; - } - - /** Returns true if field m is set (has been assigned a value) and false otherwise */ - public boolean isSetM() { - return this.m != null; - } - - public void setMIsSet(boolean value) { - if (!value) { - this.m = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case M: - if (value == null) { - unsetM(); - } else { - setM((Map)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case M: - return getM(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case M: - return isSetM(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testMap_args) - return this.equals((testMap_args)that); - return false; - } - - public boolean equals(testMap_args that) { - if (that == null) - return false; - - boolean this_present_m = true && this.isSetM(); - boolean that_present_m = true && that.isSetM(); - if (this_present_m || that_present_m) { - if (!(this_present_m && that_present_m)) - return false; - if (!this.m.equals(that.m)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_m = true && (isSetM()); - list.add(present_m); - if (present_m) - list.add(m); - - return list.hashCode(); - } - - @Override - public int compareTo(testMap_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetM()).compareTo(other.isSetM()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetM()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.m, other.m); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testMap_args("); - boolean first = true; - - sb.append("m:"); - if (this.m == null) { - sb.append("null"); - } else { - sb.append(this.m); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testMap_argsStandardSchemeFactory implements SchemeFactory { - public testMap_argsStandardScheme getScheme() { - return new testMap_argsStandardScheme(); - } - } - - private static class testMap_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testMap_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // M - if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map40 = iprot.readMapBegin(); - struct.m = new HashMap(2*_map40.size); - String _key41; - String _val42; - for (int _i43 = 0; _i43 < _map40.size; ++_i43) - { - _key41 = iprot.readString(); - _val42 = iprot.readString(); - struct.m.put(_key41, _val42); - } - iprot.readMapEnd(); - } - struct.setMIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testMap_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.m != null) { - oprot.writeFieldBegin(M_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.m.size())); - for (Map.Entry _iter44 : struct.m.entrySet()) - { - oprot.writeString(_iter44.getKey()); - oprot.writeString(_iter44.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testMap_argsTupleSchemeFactory implements SchemeFactory { - public testMap_argsTupleScheme getScheme() { - return new testMap_argsTupleScheme(); - } - } - - private static class testMap_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testMap_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetM()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetM()) { - { - oprot.writeI32(struct.m.size()); - for (Map.Entry _iter45 : struct.m.entrySet()) - { - oprot.writeString(_iter45.getKey()); - oprot.writeString(_iter45.getValue()); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testMap_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TMap _map46 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.m = new HashMap(2*_map46.size); - String _key47; - String _val48; - for (int _i49 = 0; _i49 < _map46.size; ++_i49) - { - _key47 = iprot.readString(); - _val48 = iprot.readString(); - struct.m.put(_key47, _val48); - } - } - struct.setMIsSet(true); - } - } - } - - } - - public static class testMap_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testMap_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testMap_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testMap_resultTupleSchemeFactory()); - } - - public Map success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testMap_result.class, metaDataMap); - } - - public testMap_result() { - } - - public testMap_result( - Map success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testMap_result(testMap_result other) { - if (other.isSetSuccess()) { - Map __this__success = new HashMap(other.success); - this.success = __this__success; - } - } - - public testMap_result deepCopy() { - return new testMap_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public int getSuccessSize() { - return (this.success == null) ? 0 : this.success.size(); - } - - public void putToSuccess(String key, String val) { - if (this.success == null) { - this.success = new HashMap(); - } - this.success.put(key, val); - } - - public Map getSuccess() { - return this.success; - } - - public testMap_result setSuccess(Map success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Map)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testMap_result) - return this.equals((testMap_result)that); - return false; - } - - public boolean equals(testMap_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testMap_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testMap_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testMap_resultStandardSchemeFactory implements SchemeFactory { - public testMap_resultStandardScheme getScheme() { - return new testMap_resultStandardScheme(); - } - } - - private static class testMap_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testMap_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map50 = iprot.readMapBegin(); - struct.success = new HashMap(2*_map50.size); - String _key51; - String _val52; - for (int _i53 = 0; _i53 < _map50.size; ++_i53) - { - _key51 = iprot.readString(); - _val52 = iprot.readString(); - struct.success.put(_key51, _val52); - } - iprot.readMapEnd(); - } - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testMap_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry _iter54 : struct.success.entrySet()) - { - oprot.writeString(_iter54.getKey()); - oprot.writeString(_iter54.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testMap_resultTupleSchemeFactory implements SchemeFactory { - public testMap_resultTupleScheme getScheme() { - return new testMap_resultTupleScheme(); - } - } - - private static class testMap_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testMap_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - { - oprot.writeI32(struct.success.size()); - for (Map.Entry _iter55 : struct.success.entrySet()) - { - oprot.writeString(_iter55.getKey()); - oprot.writeString(_iter55.getValue()); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testMap_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - { - org.apache.thrift.protocol.TMap _map56 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap(2*_map56.size); - String _key57; - String _val58; - for (int _i59 = 0; _i59 < _map56.size; ++_i59) - { - _key57 = iprot.readString(); - _val58 = iprot.readString(); - struct.success.put(_key57, _val58); - } - } - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testVoid_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testVoid_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testVoid_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testVoid_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testVoid_args.class, metaDataMap); - } - - public testVoid_args() { - } - - /** - * Performs a deep copy on other. - */ - public testVoid_args(testVoid_args other) { - } - - public testVoid_args deepCopy() { - return new testVoid_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testVoid_args) - return this.equals((testVoid_args)that); - return false; - } - - public boolean equals(testVoid_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testVoid_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testVoid_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testVoid_argsStandardSchemeFactory implements SchemeFactory { - public testVoid_argsStandardScheme getScheme() { - return new testVoid_argsStandardScheme(); - } - } - - private static class testVoid_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testVoid_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testVoid_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testVoid_argsTupleSchemeFactory implements SchemeFactory { - public testVoid_argsTupleScheme getScheme() { - return new testVoid_argsTupleScheme(); - } - } - - private static class testVoid_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testVoid_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testVoid_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testVoid_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testVoid_result"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testVoid_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testVoid_resultTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testVoid_result.class, metaDataMap); - } - - public testVoid_result() { - } - - /** - * Performs a deep copy on other. - */ - public testVoid_result(testVoid_result other) { - } - - public testVoid_result deepCopy() { - return new testVoid_result(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testVoid_result) - return this.equals((testVoid_result)that); - return false; - } - - public boolean equals(testVoid_result that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testVoid_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testVoid_result("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testVoid_resultStandardSchemeFactory implements SchemeFactory { - public testVoid_resultStandardScheme getScheme() { - return new testVoid_resultStandardScheme(); - } - } - - private static class testVoid_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testVoid_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testVoid_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testVoid_resultTupleSchemeFactory implements SchemeFactory { - public testVoid_resultTupleScheme getScheme() { - return new testVoid_resultTupleScheme(); - } - } - - private static class testVoid_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testVoid_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testVoid_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testReturnNull_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testReturnNull_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testReturnNull_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testReturnNull_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testReturnNull_args.class, metaDataMap); - } - - public testReturnNull_args() { - } - - /** - * Performs a deep copy on other. - */ - public testReturnNull_args(testReturnNull_args other) { - } - - public testReturnNull_args deepCopy() { - return new testReturnNull_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testReturnNull_args) - return this.equals((testReturnNull_args)that); - return false; - } - - public boolean equals(testReturnNull_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - return list.hashCode(); - } - - @Override - public int compareTo(testReturnNull_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testReturnNull_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testReturnNull_argsStandardSchemeFactory implements SchemeFactory { - public testReturnNull_argsStandardScheme getScheme() { - return new testReturnNull_argsStandardScheme(); - } - } - - private static class testReturnNull_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testReturnNull_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testReturnNull_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testReturnNull_argsTupleSchemeFactory implements SchemeFactory { - public testReturnNull_argsTupleScheme getScheme() { - return new testReturnNull_argsTupleScheme(); - } - } - - private static class testReturnNull_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testReturnNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testReturnNull_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class testReturnNull_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testReturnNull_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testReturnNull_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testReturnNull_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testReturnNull_result.class, metaDataMap); - } - - public testReturnNull_result() { - } - - public testReturnNull_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testReturnNull_result(testReturnNull_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public testReturnNull_result deepCopy() { - return new testReturnNull_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public testReturnNull_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testReturnNull_result) - return this.equals((testReturnNull_result)that); - return false; - } - - public boolean equals(testReturnNull_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testReturnNull_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testReturnNull_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testReturnNull_resultStandardSchemeFactory implements SchemeFactory { - public testReturnNull_resultStandardScheme getScheme() { - return new testReturnNull_resultStandardScheme(); - } - } - - private static class testReturnNull_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testReturnNull_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testReturnNull_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testReturnNull_resultTupleSchemeFactory implements SchemeFactory { - public testReturnNull_resultTupleScheme getScheme() { - return new testReturnNull_resultTupleScheme(); - } - } - - private static class testReturnNull_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testReturnNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testReturnNull_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testStruct_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testStruct_args"); - - private static final org.apache.thrift.protocol.TField QUERY_FIELD_DESC = new org.apache.thrift.protocol.TField("query", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testStruct_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testStruct_argsTupleSchemeFactory()); - } - - public String query; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - QUERY((short)1, "query"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // QUERY - return QUERY; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.QUERY, new org.apache.thrift.meta_data.FieldMetaData("query", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testStruct_args.class, metaDataMap); - } - - public testStruct_args() { - } - - public testStruct_args( - String query) - { - this(); - this.query = query; - } - - /** - * Performs a deep copy on other. - */ - public testStruct_args(testStruct_args other) { - if (other.isSetQuery()) { - this.query = other.query; - } - } - - public testStruct_args deepCopy() { - return new testStruct_args(this); - } - - @Override - public void clear() { - this.query = null; - } - - public String getQuery() { - return this.query; - } - - public testStruct_args setQuery(String query) { - this.query = query; - return this; - } - - public void unsetQuery() { - this.query = null; - } - - /** Returns true if field query is set (has been assigned a value) and false otherwise */ - public boolean isSetQuery() { - return this.query != null; - } - - public void setQueryIsSet(boolean value) { - if (!value) { - this.query = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case QUERY: - if (value == null) { - unsetQuery(); - } else { - setQuery((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case QUERY: - return getQuery(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case QUERY: - return isSetQuery(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testStruct_args) - return this.equals((testStruct_args)that); - return false; - } - - public boolean equals(testStruct_args that) { - if (that == null) - return false; - - boolean this_present_query = true && this.isSetQuery(); - boolean that_present_query = true && that.isSetQuery(); - if (this_present_query || that_present_query) { - if (!(this_present_query && that_present_query)) - return false; - if (!this.query.equals(that.query)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_query = true && (isSetQuery()); - list.add(present_query); - if (present_query) - list.add(query); - - return list.hashCode(); - } - - @Override - public int compareTo(testStruct_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetQuery()).compareTo(other.isSetQuery()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetQuery()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.query, other.query); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testStruct_args("); - boolean first = true; - - sb.append("query:"); - if (this.query == null) { - sb.append("null"); - } else { - sb.append(this.query); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testStruct_argsStandardSchemeFactory implements SchemeFactory { - public testStruct_argsStandardScheme getScheme() { - return new testStruct_argsStandardScheme(); - } - } - - private static class testStruct_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testStruct_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // QUERY - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.query = iprot.readString(); - struct.setQueryIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testStruct_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.query != null) { - oprot.writeFieldBegin(QUERY_FIELD_DESC); - oprot.writeString(struct.query); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testStruct_argsTupleSchemeFactory implements SchemeFactory { - public testStruct_argsTupleScheme getScheme() { - return new testStruct_argsTupleScheme(); - } - } - - private static class testStruct_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testStruct_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetQuery()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetQuery()) { - oprot.writeString(struct.query); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testStruct_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.query = iprot.readString(); - struct.setQueryIsSet(true); - } - } - } - - } - - public static class testStruct_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testStruct_result"); - - 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); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testStruct_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testStruct_resultTupleSchemeFactory()); - } - - public TweetSearchResult success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TweetSearchResult.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testStruct_result.class, metaDataMap); - } - - public testStruct_result() { - } - - public testStruct_result( - TweetSearchResult success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public testStruct_result(testStruct_result other) { - if (other.isSetSuccess()) { - this.success = new TweetSearchResult(other.success); - } - } - - public testStruct_result deepCopy() { - return new testStruct_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public TweetSearchResult getSuccess() { - return this.success; - } - - public testStruct_result setSuccess(TweetSearchResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((TweetSearchResult)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testStruct_result) - return this.equals((testStruct_result)that); - return false; - } - - public boolean equals(testStruct_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(testStruct_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testStruct_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - 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); - } - } - - private static class testStruct_resultStandardSchemeFactory implements SchemeFactory { - public testStruct_resultStandardScheme getScheme() { - return new testStruct_resultStandardScheme(); - } - } - - private static class testStruct_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testStruct_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new TweetSearchResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testStruct_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testStruct_resultTupleSchemeFactory implements SchemeFactory { - public testStruct_resultTupleScheme getScheme() { - return new testStruct_resultTupleScheme(); - } - } - - private static class testStruct_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testStruct_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testStruct_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = new TweetSearchResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class testException_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testException_args"); - - private static final org.apache.thrift.protocol.TField TWEET_FIELD_DESC = new org.apache.thrift.protocol.TField("tweet", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testException_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testException_argsTupleSchemeFactory()); - } - - public Tweet tweet; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TWEET((short)1, "tweet"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // TWEET - return TWEET; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.TWEET, new org.apache.thrift.meta_data.FieldMetaData("tweet", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Tweet.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testException_args.class, metaDataMap); - } - - public testException_args() { - } - - public testException_args( - Tweet tweet) - { - this(); - this.tweet = tweet; - } - - /** - * Performs a deep copy on other. - */ - public testException_args(testException_args other) { - if (other.isSetTweet()) { - this.tweet = new Tweet(other.tweet); - } - } - - public testException_args deepCopy() { - return new testException_args(this); - } - - @Override - public void clear() { - this.tweet = null; - } - - public Tweet getTweet() { - return this.tweet; - } - - public testException_args setTweet(Tweet tweet) { - this.tweet = tweet; - return this; - } - - public void unsetTweet() { - this.tweet = null; - } - - /** Returns true if field tweet is set (has been assigned a value) and false otherwise */ - public boolean isSetTweet() { - return this.tweet != null; - } - - public void setTweetIsSet(boolean value) { - if (!value) { - this.tweet = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case TWEET: - if (value == null) { - unsetTweet(); - } else { - setTweet((Tweet)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case TWEET: - return getTweet(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case TWEET: - return isSetTweet(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testException_args) - return this.equals((testException_args)that); - return false; - } - - public boolean equals(testException_args that) { - if (that == null) - return false; - - boolean this_present_tweet = true && this.isSetTweet(); - boolean that_present_tweet = true && that.isSetTweet(); - if (this_present_tweet || that_present_tweet) { - if (!(this_present_tweet && that_present_tweet)) - return false; - if (!this.tweet.equals(that.tweet)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_tweet = true && (isSetTweet()); - list.add(present_tweet); - if (present_tweet) - list.add(tweet); - - return list.hashCode(); - } - - @Override - public int compareTo(testException_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetTweet()).compareTo(other.isSetTweet()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetTweet()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tweet, other.tweet); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testException_args("); - boolean first = true; - - sb.append("tweet:"); - if (this.tweet == null) { - sb.append("null"); - } else { - sb.append(this.tweet); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (tweet != null) { - tweet.validate(); - } - } - - 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); - } - } - - private static class testException_argsStandardSchemeFactory implements SchemeFactory { - public testException_argsStandardScheme getScheme() { - return new testException_argsStandardScheme(); - } - } - - private static class testException_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testException_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // TWEET - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.tweet = new Tweet(); - struct.tweet.read(iprot); - struct.setTweetIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testException_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.tweet != null) { - oprot.writeFieldBegin(TWEET_FIELD_DESC); - struct.tweet.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testException_argsTupleSchemeFactory implements SchemeFactory { - public testException_argsTupleScheme getScheme() { - return new testException_argsTupleScheme(); - } - } - - private static class testException_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testException_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetTweet()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetTweet()) { - struct.tweet.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testException_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.tweet = new Tweet(); - struct.tweet.read(iprot); - struct.setTweetIsSet(true); - } - } - } - - } - - public static class testException_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testException_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - private static final org.apache.thrift.protocol.TField UNAVAILABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("unavailable", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new testException_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new testException_resultTupleSchemeFactory()); - } - - public String success; // required - public TwitterUnavailable unavailable; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - UNAVAILABLE((short)1, "unavailable"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // UNAVAILABLE - return UNAVAILABLE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.UNAVAILABLE, new org.apache.thrift.meta_data.FieldMetaData("unavailable", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(testException_result.class, metaDataMap); - } - - public testException_result() { - } - - public testException_result( - String success, - TwitterUnavailable unavailable) - { - this(); - this.success = success; - this.unavailable = unavailable; - } - - /** - * Performs a deep copy on other. - */ - public testException_result(testException_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - if (other.isSetUnavailable()) { - this.unavailable = new TwitterUnavailable(other.unavailable); - } - } - - public testException_result deepCopy() { - return new testException_result(this); - } - - @Override - public void clear() { - this.success = null; - this.unavailable = null; - } - - public String getSuccess() { - return this.success; - } - - public testException_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public TwitterUnavailable getUnavailable() { - return this.unavailable; - } - - public testException_result setUnavailable(TwitterUnavailable unavailable) { - this.unavailable = unavailable; - return this; - } - - public void unsetUnavailable() { - this.unavailable = null; - } - - /** Returns true if field unavailable is set (has been assigned a value) and false otherwise */ - public boolean isSetUnavailable() { - return this.unavailable != null; - } - - public void setUnavailableIsSet(boolean value) { - if (!value) { - this.unavailable = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - case UNAVAILABLE: - if (value == null) { - unsetUnavailable(); - } else { - setUnavailable((TwitterUnavailable)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case UNAVAILABLE: - return getUnavailable(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case UNAVAILABLE: - return isSetUnavailable(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof testException_result) - return this.equals((testException_result)that); - return false; - } - - public boolean equals(testException_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_unavailable = true && this.isSetUnavailable(); - boolean that_present_unavailable = true && that.isSetUnavailable(); - if (this_present_unavailable || that_present_unavailable) { - if (!(this_present_unavailable && that_present_unavailable)) - return false; - if (!this.unavailable.equals(that.unavailable)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - boolean present_unavailable = true && (isSetUnavailable()); - list.add(present_unavailable); - if (present_unavailable) - list.add(unavailable); - - return list.hashCode(); - } - - @Override - public int compareTo(testException_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetUnavailable()).compareTo(other.isSetUnavailable()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUnavailable()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unavailable, other.unavailable); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("testException_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("unavailable:"); - if (this.unavailable == null) { - sb.append("null"); - } else { - sb.append(this.unavailable); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class testException_resultStandardSchemeFactory implements SchemeFactory { - public testException_resultStandardScheme getScheme() { - return new testException_resultStandardScheme(); - } - } - - private static class testException_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, testException_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // UNAVAILABLE - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.unavailable = new TwitterUnavailable(); - struct.unavailable.read(iprot); - struct.setUnavailableIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, testException_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - if (struct.unavailable != null) { - oprot.writeFieldBegin(UNAVAILABLE_FIELD_DESC); - struct.unavailable.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class testException_resultTupleSchemeFactory implements SchemeFactory { - public testException_resultTupleScheme getScheme() { - return new testException_resultTupleScheme(); - } - } - - private static class testException_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, testException_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetUnavailable()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - if (struct.isSetUnavailable()) { - struct.unavailable.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, testException_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.unavailable = new TwitterUnavailable(); - struct.unavailable.read(iprot); - struct.setUnavailableIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterImpl.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterImpl.java deleted file mode 100644 index b2b6d42..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.TException; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class TwitterImpl implements Twitter.Iface { - - - @Override - public boolean testBool(boolean b) throws TException { - return b; - } - - @Override - public byte testByte(byte b) throws TException { - return b; - } - - @Override - public short testI16(short i) throws TException { - return i; - } - - @Override - public int testI32(int i) throws TException { - return i; - } - - @Override - public long testI64(long i) throws TException { - return i; - } - - @Override - public double testDouble(double d) throws TException { - return d; - } - - @Override - public ByteBuffer testBinary(ByteBuffer b) throws TException { - return b; - } - - @Override - public String testString(String s) throws TException { - try { - Thread.sleep(1000L); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return s; - } - - @Override - public List testList(List l) throws TException { - return l; - } - - @Override - public Set testSet(Set s) throws TException { - return s; - } - - @Override - public Map testMap(Map m) throws TException { - return m; - } - - @Override - public void testVoid() throws TException { - - } - - @Override - public String testReturnNull() throws TException { - return null; - } - - @Override - public TweetSearchResult testStruct(String query) throws TException { - List tweets = new ArrayList(); - tweets.add(new Tweet(1, "1", "1")); - tweets.add(new Tweet(2, "2", "2")); - tweets.add(new Tweet(3, "3", "3")); - TweetSearchResult result = new TweetSearchResult(tweets); - return result; - } - - @Override - public String testException(Tweet tweet) throws TwitterUnavailable, TException { - throw new TwitterUnavailable("mock twitter exception."); - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterUnavailable.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterUnavailable.java deleted file mode 100644 index 468c278..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/apitwitter/TwitterUnavailable.java +++ /dev/null @@ -1,398 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.apitwitter; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-10-04") -public class TwitterUnavailable extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TwitterUnavailable"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TwitterUnavailableStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TwitterUnavailableTupleSchemeFactory()); - } - - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TwitterUnavailable.class, metaDataMap); - } - - public TwitterUnavailable() { - } - - public TwitterUnavailable( - String message) - { - this(); - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public TwitterUnavailable(TwitterUnavailable other) { - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public TwitterUnavailable deepCopy() { - return new TwitterUnavailable(this); - } - - @Override - public void clear() { - this.message = null; - } - - public String getMessage() { - return this.message; - } - - public TwitterUnavailable setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof TwitterUnavailable) - return this.equals((TwitterUnavailable)that); - return false; - } - - public boolean equals(TwitterUnavailable that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - return list.hashCode(); - } - - @Override - public int compareTo(TwitterUnavailable other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("TwitterUnavailable("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class TwitterUnavailableStandardSchemeFactory implements SchemeFactory { - public TwitterUnavailableStandardScheme getScheme() { - return new TwitterUnavailableStandardScheme(); - } - } - - private static class TwitterUnavailableStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, TwitterUnavailable struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, TwitterUnavailable struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class TwitterUnavailableTupleSchemeFactory implements SchemeFactory { - public TwitterUnavailableTupleScheme getScheme() { - return new TwitterUnavailableTupleScheme(); - } - } - - private static class TwitterUnavailableTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, TwitterUnavailable struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, TwitterUnavailable struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/directconn/DirectConnTest.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/directconn/DirectConnTest.java deleted file mode 100644 index 7b5eba4..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/directconn/DirectConnTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.meituan.dorado.test.thrift.directconn; - -import com.meituan.dorado.common.exception.TimeoutException; -import com.meituan.dorado.test.thrift.api.Echo2; -import com.meituan.dorado.test.thrift.api.HelloService; -import com.meituan.dorado.test.thrift.filter.ClientQpsLimitFilter; -import com.meituan.dorado.test.thrift.filter.ServerQpsLimitFilter; -import org.apache.thrift.TException; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class DirectConnTest { - ClassPathXmlApplicationContext clientBean; - ClassPathXmlApplicationContext serverBean; - - @Before - public void init() { - serverBean = new ClassPathXmlApplicationContext("thrift/direconn/thrift-provider.xml"); - clientBean = new ClassPathXmlApplicationContext("thrift/direconn/thrift-consumer.xml"); - ClientQpsLimitFilter.disable(); - ServerQpsLimitFilter.disable(); - } - - @Test - public void test() { - HelloService.Iface oriThriftClient = (HelloService.Iface) clientBean.getBean("oriThriftClient"); - HelloService.Iface octoProtocolClient = (HelloService.Iface) clientBean.getBean("octoProtocolClient"); - - try { - String ret1 = oriThriftClient.sayHello("Dorado"); - String ret2 = octoProtocolClient.sayHello("Dorado"); - Assert.assertEquals(ret1, ret2); - } catch (Exception e) { - Assert.fail(e.getMessage()); - } - } - - @After - public void stop() { - clientBean.destroy(); - serverBean.destroy(); - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolClientTest.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolClientTest.java deleted file mode 100644 index c9de080..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolClientTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.exception; - -import org.junit.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * 测试调用端IDL类和服务端不一致的情况 - */ -@Ignore -public class ProtocolClientTest { - - private static final Logger logger = LoggerFactory.getLogger(ProtocolClientTest.class); - - private static ClassPathXmlApplicationContext clientBeanFactory; - private static com.meituan.dorado.test.thrift.exception.api1.ApiVersion1.Iface client; - private static com.meituan.dorado.test.thrift.exception.api2.ApiVersion1.Iface client2; - - - @BeforeClass - public static void start() { - clientBeanFactory = new ClassPathXmlApplicationContext("thrift/exception/protocolClient/thrift-consumer.xml"); - client = (com.meituan.dorado.test.thrift.exception.api1.ApiVersion1.Iface) clientBeanFactory.getBean("clientProxy"); - client2 = (com.meituan.dorado.test.thrift.exception.api2.ApiVersion1.Iface) clientBeanFactory.getBean("clientProxy2"); - } - - @AfterClass - public static void stop() { - clientBeanFactory.destroy(); - } - - @Test - public void testClient() { - try { - com.meituan.dorado.test.thrift.exception.api1.Result result = client.send("message", "param"); - logger.info("EchoResult: " + result); - } catch (Exception e) { - Assert.fail(); - } - } - - @Test - public void testClient2() { - try { - com.meituan.dorado.test.thrift.exception.api2.Result result = client2.send("message", "param"); - logger.info("EchoResult2: " + result); - } catch(Exception e) { - Assert.fail(); - } - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolExceptionTest.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolExceptionTest.java deleted file mode 100644 index c2d364f..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/ProtocolExceptionTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.exception; - -import com.meituan.dorado.common.exception.TimeoutException; -import com.meituan.dorado.test.thrift.api2.TestService; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class ProtocolExceptionTest { - - private static final Logger logger = LoggerFactory.getLogger(ProtocolExceptionTest.class); - - private static ClassPathXmlApplicationContext clientBeanFactory; - private static ClassPathXmlApplicationContext serverBeanFactory; - private static TestService.Iface client; - - - @BeforeClass - public static void start() throws InterruptedException { - serverBeanFactory = new ClassPathXmlApplicationContext("thrift/exception/protocol/thrift-provider.xml"); - clientBeanFactory = new ClassPathXmlApplicationContext("thrift/exception/protocol/thrift-consumer.xml"); - client = (TestService.Iface) clientBeanFactory.getBean("clientProxy"); - Thread.sleep(5000); - } - - @AfterClass - public static void stop() { - clientBeanFactory.destroy(); - serverBeanFactory.destroy(); - } - - // 服务端在业务逻辑中抛出ProtocolException,调用端显示TimeoutException - @Test - public void testProtocolMisMatch() { - try { - client.testProtocolMisMatch(); - } catch (Exception e) { - Assert.assertTrue(e instanceof TimeoutException); - } - } - - // IDL类文件中testLong_args的enum类的fieldId错误 - @Test - public void testProtocolException() { - try { - client.testLong(1L); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/TransportExceptionTest.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/TransportExceptionTest.java deleted file mode 100644 index ac1aa9d..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/TransportExceptionTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.thrift.exception; - -import com.meituan.dorado.common.exception.RemoteException; -import com.meituan.dorado.test.thrift.api2.TestService; -import com.meituan.dorado.test.thrift.exception.client.EmptyChannelTest; -import org.apache.thrift.transport.TTransportException; -import org.junit.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TransportExceptionTest { - - private static final Logger logger = LoggerFactory.getLogger(EmptyChannelTest.class); - - private static ClassPathXmlApplicationContext clientBeanFactory; - private static ClassPathXmlApplicationContext serverBeanFactory; - private static TestService.Iface client; - - @BeforeClass - public static void start() throws InterruptedException { - serverBeanFactory = new ClassPathXmlApplicationContext("thrift/exception/transport/thrift-provider.xml"); - clientBeanFactory = new ClassPathXmlApplicationContext("thrift/exception/transport/thrift-consumer.xml"); - client = (TestService.Iface) clientBeanFactory.getBean("clientProxy"); - Thread.sleep(5000); - } - - @AfterClass - public static void stop() { - clientBeanFactory.destroy(); - serverBeanFactory.destroy(); - } - - // 服务端在业务逻辑模拟抛出TTransportException - @Test - public void test() { - try { - client.testTransportException(); - } catch (Exception e) { - Assert.assertTrue(e instanceof RemoteException); - Assert.assertTrue(e.getCause() instanceof TTransportException); - } - } -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/Echo.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/Echo.java deleted file mode 100644 index 6e722e0..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/Echo.java +++ /dev/null @@ -1,1088 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-11-20") -public class Echo { - - public interface Iface { - - public EchoResult echo(String message, String param) throws TException; - - } - - public interface AsyncIface { - - public void echo(String message, String param, AsyncMethodCallback resultHandler) throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public EchoResult echo(String message, String param) throws TException - { - send_echo(message, param); - return recv_echo(); - } - - public void send_echo(String message, String param) throws TException - { - echo_args args = new echo_args(); - args.setMessage(message); - args.setParam(param); - sendBase("echo", args); - } - - public EchoResult recv_echo() throws TException - { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "echo failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void echo(String message, String param, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - echo_call method_call = new echo_call(message, param, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String message; - private String param; - public echo_call(String message, String param, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.message = message; - this.param = param; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, 0)); - echo_args args = new echo_args(); - args.setMessage(message); - args.setParam(param); - args.write(prot); - prot.writeMessageEnd(); - } - - public EchoResult getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.message, args.param); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(EchoResult o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.message, args.param,resultHandler); - } - } - - } - - public static class echo_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_args"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAM_FIELD_DESC = new org.apache.thrift.protocol.TField("param", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - public String message; // required - public String param; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"), - PARAM((short)2, "param"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - case 2: // PARAM - return PARAM; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAM, new org.apache.thrift.meta_data.FieldMetaData("param", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public echo_args() { - } - - public echo_args( - String message, - String param) - { - this(); - this.message = message; - this.param = param; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessage()) { - this.message = other.message; - } - if (other.isSetParam()) { - this.param = other.param; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.message = null; - this.param = null; - } - - public String getMessage() { - return this.message; - } - - public echo_args setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public String getParam() { - return this.param; - } - - public echo_args setParam(String param) { - this.param = param; - return this; - } - - public void unsetParam() { - this.param = null; - } - - /** Returns true if field param is set (has been assigned a value) and false otherwise */ - public boolean isSetParam() { - return this.param != null; - } - - public void setParamIsSet(boolean value) { - if (!value) { - this.param = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - case PARAM: - if (value == null) { - unsetParam(); - } else { - setParam((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - case PARAM: - return getParam(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - case PARAM: - return isSetParam(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args)that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - boolean this_present_param = true && this.isSetParam(); - boolean that_present_param = true && that.isSetParam(); - if (this_present_param || that_present_param) { - if (!(this_present_param && that_present_param)) - return false; - if (!this.param.equals(that.param)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - boolean present_param = true && (isSetParam()); - list.add(present_param); - if (present_param) - list.add(param); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetParam()).compareTo(other.isSetParam()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParam()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.param, other.param); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - if (!first) sb.append(", "); - sb.append("param:"); - if (this.param == null) { - sb.append("null"); - } else { - sb.append(this.param); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAM - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - if (struct.param != null) { - oprot.writeFieldBegin(PARAM_FIELD_DESC); - oprot.writeString(struct.param); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - if (struct.isSetParam()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - if (struct.isSetParam()) { - oprot.writeString(struct.param); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - if (incoming.get(1)) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } - } - } - - } - - public static class echo_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_result"); - - 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); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - public EchoResult success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, EchoResult.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public echo_result() { - } - - public echo_result( - EchoResult success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = new EchoResult(other.success); - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public EchoResult getSuccess() { - return this.success; - } - - public echo_result setSuccess(EchoResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((EchoResult)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result)that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new EchoResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = new EchoResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/EchoResult.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/EchoResult.java deleted file mode 100644 index 0326959..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api/EchoResult.java +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-11-20") -public class EchoResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("EchoResult"); - - private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I32, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new EchoResultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new EchoResultTupleSchemeFactory()); - } - - public String result; // required - public int id; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - RESULT((short)1, "result"), - ID((short)2, "id"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // RESULT - return RESULT; - case 2: // ID - return ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __ID_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.RESULT, new org.apache.thrift.meta_data.FieldMetaData("result", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EchoResult.class, metaDataMap); - } - - public EchoResult() { - } - - public EchoResult( - String result, - int id) - { - this(); - this.result = result; - this.id = id; - setIdIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public EchoResult(EchoResult other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetResult()) { - this.result = other.result; - } - this.id = other.id; - } - - public EchoResult deepCopy() { - return new EchoResult(this); - } - - @Override - public void clear() { - this.result = null; - setIdIsSet(false); - this.id = 0; - } - - public String getResult() { - return this.result; - } - - public EchoResult setResult(String result) { - this.result = result; - return this; - } - - public void unsetResult() { - this.result = null; - } - - /** Returns true if field result is set (has been assigned a value) and false otherwise */ - public boolean isSetResult() { - return this.result != null; - } - - public void setResultIsSet(boolean value) { - if (!value) { - this.result = null; - } - } - - public int getId() { - return this.id; - } - - public EchoResult setId(int id) { - this.id = id; - setIdIsSet(true); - return this; - } - - public void unsetId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); - } - - /** Returns true if field id is set (has been assigned a value) and false otherwise */ - public boolean isSetId() { - return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); - } - - public void setIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case RESULT: - if (value == null) { - unsetResult(); - } else { - setResult((String)value); - } - break; - - case ID: - if (value == null) { - unsetId(); - } else { - setId((Integer)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case RESULT: - return getResult(); - - case ID: - return Integer.valueOf(getId()); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case RESULT: - return isSetResult(); - case ID: - return isSetId(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof EchoResult) - return this.equals((EchoResult)that); - return false; - } - - public boolean equals(EchoResult that) { - if (that == null) - return false; - - boolean this_present_result = true && this.isSetResult(); - boolean that_present_result = true && that.isSetResult(); - if (this_present_result || that_present_result) { - if (!(this_present_result && that_present_result)) - return false; - if (!this.result.equals(that.result)) - return false; - } - - boolean this_present_id = true; - boolean that_present_id = true; - if (this_present_id || that_present_id) { - if (!(this_present_id && that_present_id)) - return false; - if (this.id != that.id) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_result = true && (isSetResult()); - list.add(present_result); - if (present_result) - list.add(result); - - boolean present_id = true; - list.add(present_id); - if (present_id) - list.add(id); - - return list.hashCode(); - } - - @Override - public int compareTo(EchoResult other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetResult()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("EchoResult("); - boolean first = true; - - sb.append("result:"); - if (this.result == null) { - sb.append("null"); - } else { - sb.append(this.result); - } - first = false; - if (!first) sb.append(", "); - sb.append("id:"); - sb.append(this.id); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (TException te) { - throw new java.io.IOException(te); - } - } - - private static class EchoResultStandardSchemeFactory implements SchemeFactory { - public EchoResultStandardScheme getScheme() { - return new EchoResultStandardScheme(); - } - } - - private static class EchoResultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, EchoResult struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // RESULT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, EchoResult struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.result != null) { - oprot.writeFieldBegin(RESULT_FIELD_DESC); - oprot.writeString(struct.result); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(ID_FIELD_DESC); - oprot.writeI32(struct.id); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class EchoResultTupleSchemeFactory implements SchemeFactory { - public EchoResultTupleScheme getScheme() { - return new EchoResultTupleScheme(); - } - } - - private static class EchoResultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, EchoResult struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetResult()) { - optionals.set(0); - } - if (struct.isSetId()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetResult()) { - oprot.writeString(struct.result); - } - if (struct.isSetId()) { - oprot.writeI32(struct.id); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, EchoResult struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } - if (incoming.get(1)) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/Echo.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/Echo.java deleted file mode 100644 index 8ee7677..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/Echo.java +++ /dev/null @@ -1,1088 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-11-20") -public class Echo { - - public interface Iface { - - public EchoResult echo(String message, String param) throws TException; - - } - - public interface AsyncIface { - - public void echo(String message, String param, AsyncMethodCallback resultHandler) throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public EchoResult echo(String message, String param) throws TException - { - send_echo(message, param); - return recv_echo(); - } - - public void send_echo(String message, String param) throws TException - { - echo_args args = new echo_args(); - args.setMessage(message); - args.setParam(param); - sendBase("echo", args); - } - - public EchoResult recv_echo() throws TException - { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "echo failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void echo(String message, String param, AsyncMethodCallback resultHandler) throws TException { - checkReady(); - echo_call method_call = new echo_call(message, param, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String message; - private String param; - public echo_call(String message, String param, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.message = message; - this.param = param; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, 0)); - echo_args args = new echo_args(); - args.setMessage(message); - args.setParam(param); - args.write(prot); - prot.writeMessageEnd(); - } - - public EchoResult getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.message, args.param); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(EchoResult o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.message, args.param,resultHandler); - } - } - - } - - public static class echo_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_args"); - - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PARAM_FIELD_DESC = new org.apache.thrift.protocol.TField("param", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - public String message; // required - public String param; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSAGE((short)1, "message"), - PARAM((short)2, "param"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // MESSAGE - return MESSAGE; - case 2: // PARAM - return PARAM; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PARAM, new org.apache.thrift.meta_data.FieldMetaData("param", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public echo_args() { - } - - public echo_args( - String message, - String param) - { - this(); - this.message = message; - this.param = param; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessage()) { - this.message = other.message; - } - if (other.isSetParam()) { - this.param = other.param; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.message = null; - this.param = null; - } - - public String getMessage() { - return this.message; - } - - public echo_args setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public String getParam() { - return this.param; - } - - public echo_args setParam(String param) { - this.param = param; - return this; - } - - public void unsetParam() { - this.param = null; - } - - /** Returns true if field param is set (has been assigned a value) and false otherwise */ - public boolean isSetParam() { - return this.param != null; - } - - public void setParamIsSet(boolean value) { - if (!value) { - this.param = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - case PARAM: - if (value == null) { - unsetParam(); - } else { - setParam((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSAGE: - return getMessage(); - - case PARAM: - return getParam(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSAGE: - return isSetMessage(); - case PARAM: - return isSetParam(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args)that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - boolean this_present_param = true && this.isSetParam(); - boolean that_present_param = true && that.isSetParam(); - if (this_present_param || that_present_param) { - if (!(this_present_param && that_present_param)) - return false; - if (!this.param.equals(that.param)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - boolean present_param = true && (isSetParam()); - list.add(present_param); - if (present_param) - list.add(param); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetParam()).compareTo(other.isSetParam()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetParam()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.param, other.param); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - if (!first) sb.append(", "); - sb.append("param:"); - if (this.param == null) { - sb.append("null"); - } else { - sb.append(this.param); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PARAM - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - if (struct.param != null) { - oprot.writeFieldBegin(PARAM_FIELD_DESC); - oprot.writeString(struct.param); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessage()) { - optionals.set(0); - } - if (struct.isSetParam()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - if (struct.isSetParam()) { - oprot.writeString(struct.param); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - if (incoming.get(1)) { - struct.param = iprot.readString(); - struct.setParamIsSet(true); - } - } - } - - } - - public static class echo_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_result"); - - 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); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - public EchoResult success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, EchoResult.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public echo_result() { - } - - public echo_result( - EchoResult success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = new EchoResult(other.success); - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public EchoResult getSuccess() { - return this.success; - } - - public echo_result setSuccess(EchoResult success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((EchoResult)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result)that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new EchoResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = new EchoResult(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/EchoResult.java b/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/EchoResult.java deleted file mode 100644 index e48fa8c..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/java/com/meituan/dorado/test/thrift/exception/api2/EchoResult.java +++ /dev/null @@ -1,606 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.thrift.exception.api2; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-11-20") -public class EchoResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("EchoResult"); - - private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I32, (short)2); - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)3); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new EchoResultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new EchoResultTupleSchemeFactory()); - } - - public String result; // required - public int id; // required - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - RESULT((short)1, "result"), - ID((short)2, "id"), - MESSAGE((short)3, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // RESULT - return RESULT; - case 2: // ID - return ID; - case 3: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __ID_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.RESULT, new org.apache.thrift.meta_data.FieldMetaData("result", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EchoResult.class, metaDataMap); - } - - public EchoResult() { - } - - public EchoResult( - String result, - int id, - String message) - { - this(); - this.result = result; - this.id = id; - setIdIsSet(true); - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public EchoResult(EchoResult other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetResult()) { - this.result = other.result; - } - this.id = other.id; - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public EchoResult deepCopy() { - return new EchoResult(this); - } - - @Override - public void clear() { - this.result = null; - setIdIsSet(false); - this.id = 0; - this.message = null; - } - - public String getResult() { - return this.result; - } - - public EchoResult setResult(String result) { - this.result = result; - return this; - } - - public void unsetResult() { - this.result = null; - } - - /** Returns true if field result is set (has been assigned a value) and false otherwise */ - public boolean isSetResult() { - return this.result != null; - } - - public void setResultIsSet(boolean value) { - if (!value) { - this.result = null; - } - } - - public int getId() { - return this.id; - } - - public EchoResult setId(int id) { - this.id = id; - setIdIsSet(true); - return this; - } - - public void unsetId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); - } - - /** Returns true if field id is set (has been assigned a value) and false otherwise */ - public boolean isSetId() { - return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); - } - - public void setIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); - } - - public String getMessage() { - return this.message; - } - - public EchoResult setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case RESULT: - if (value == null) { - unsetResult(); - } else { - setResult((String)value); - } - break; - - case ID: - if (value == null) { - unsetId(); - } else { - setId((Integer)value); - } - break; - - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case RESULT: - return getResult(); - - case ID: - return Integer.valueOf(getId()); - - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case RESULT: - return isSetResult(); - case ID: - return isSetId(); - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof EchoResult) - return this.equals((EchoResult)that); - return false; - } - - public boolean equals(EchoResult that) { - if (that == null) - return false; - - boolean this_present_result = true && this.isSetResult(); - boolean that_present_result = true && that.isSetResult(); - if (this_present_result || that_present_result) { - if (!(this_present_result && that_present_result)) - return false; - if (!this.result.equals(that.result)) - return false; - } - - boolean this_present_id = true; - boolean that_present_id = true; - if (this_present_id || that_present_id) { - if (!(this_present_id && that_present_id)) - return false; - if (this.id != that.id) - return false; - } - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_result = true && (isSetResult()); - list.add(present_result); - if (present_result) - list.add(result); - - boolean present_id = true; - list.add(present_id); - if (present_id) - list.add(id); - - boolean present_message = true && (isSetMessage()); - list.add(present_message); - if (present_message) - list.add(message); - - return list.hashCode(); - } - - @Override - public int compareTo(EchoResult other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetResult()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("EchoResult("); - boolean first = true; - - sb.append("result:"); - if (this.result == null) { - sb.append("null"); - } else { - sb.append(this.result); - } - first = false; - if (!first) sb.append(", "); - sb.append("id:"); - sb.append(this.id); - first = false; - if (!first) sb.append(", "); - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (TException te) { - throw new java.io.IOException(te); - } - } - - private static class EchoResultStandardSchemeFactory implements SchemeFactory { - public EchoResultStandardScheme getScheme() { - return new EchoResultStandardScheme(); - } - } - - private static class EchoResultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, EchoResult struct) throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // RESULT - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // ID - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, EchoResult struct) throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.result != null) { - oprot.writeFieldBegin(RESULT_FIELD_DESC); - oprot.writeString(struct.result); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(ID_FIELD_DESC); - oprot.writeI32(struct.id); - oprot.writeFieldEnd(); - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class EchoResultTupleSchemeFactory implements SchemeFactory { - public EchoResultTupleScheme getScheme() { - return new EchoResultTupleScheme(); - } - } - - private static class EchoResultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, EchoResult struct) throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetResult()) { - optionals.set(0); - } - if (struct.isSetId()) { - optionals.set(1); - } - if (struct.isSetMessage()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetResult()) { - oprot.writeString(struct.result); - } - if (struct.isSetId()) { - oprot.writeI32(struct.id); - } - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, EchoResult struct) throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.result = iprot.readString(); - struct.setResultIsSet(true); - } - if (incoming.get(1)) { - struct.id = iprot.readI32(); - struct.setIdIsSet(true); - } - if (incoming.get(2)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/TestSuite.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/TestSuite.thrift deleted file mode 100644 index bfb4c06..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/TestSuite.thrift +++ /dev/null @@ -1,20 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.api2 - -exception MyException { -1: string message -} - -service TestService{ -string testMock(1: string str) -i64 testLong(2: i64 n) -//协议异常 -void testProtocolMisMatch() -//网络异常 -void testTransportException() -void testTimeout() -//业务异常 -string testReturnNull(); // -string testNull() // NPE -string testException() throws(1:MyException myException) -i32 testBaseTypeException() throws(1:MyException myException) -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/ThriftTest.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/ThriftTest.thrift deleted file mode 100644 index 8b27af9..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/ThriftTest.thrift +++ /dev/null @@ -1,58 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.apitwitter - -enum TweetType { - TWEET, - RETWEET = 2, - DM = 0xa, - REPLY -} - -const i32 DEFAULT_AGE = 18; - -struct Location { - 1: required double latitude; - 2: required double longitude; -} - -struct Tweet { - 1: required i32 userId; - 2: required string userName; - 3: required string text; - 4: optional Location loc; - 5: optional TweetType tweetType = TweetType.TWEET; - 16: optional i32 age = DEFAULT_AGE; -} - -typedef list TweetList - -struct TweetSearchResult { - 1: TweetList tweets; -} - -exception TwitterUnavailable { - 1: string message; -} - -service Twitter { - - //Base Type - bool testBool(1:bool b); - byte testByte(1:byte b); - i16 testI16(1:i16 i); - i32 testI32(1:i32 i); - i64 testI64(1:i64 i); - double testDouble(1:double d); - binary testBinary(1:binary b); - string testString(1:string s); - - //Containers - list testList(1:list l); - set testSet(1:set s); - map testMap(1:map m); - - //Other - void testVoid(); - string testReturnNull(); - TweetSearchResult testStruct(1:string query); - string testException(1:Tweet tweet) throws (1:TwitterUnavailable unavailable); -} \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-consumer.xml b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-consumer.xml deleted file mode 100644 index ce50d14..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-consumer.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-provider.xml b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-provider.xml deleted file mode 100644 index b3a4260..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/direconn/thrift-provider.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/echo.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/echo.thrift deleted file mode 100644 index ce75bd0..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/echo.thrift +++ /dev/null @@ -1,4 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.api -service Echo { - string echo(1:string messge) -} \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo.thrift deleted file mode 100644 index e8ce947..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo.thrift +++ /dev/null @@ -1,11 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.exception.api2 - -struct EchoResult { - 1: string result; - 2: i32 id; -} - -service Echo { - EchoResult echo(1:string message, 2:string param) -} - diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo2.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo2.thrift deleted file mode 100644 index 1292162..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/echo2.thrift +++ /dev/null @@ -1,11 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.exception.api2 - -struct EchoResult { - 1: string result; - 2: i32 id; - 3: string message; -} - -service Echo { - EchoResult echo(1:string message, 2:string param) -} \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/protocolClient/thrift-consumer.xml b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/protocolClient/thrift-consumer.xml deleted file mode 100644 index 3645cb0..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/protocolClient/thrift-consumer.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/hello.thrift b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/hello.thrift deleted file mode 100644 index c7d7daf..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/hello.thrift +++ /dev/null @@ -1,6 +0,0 @@ -namespace java com.meituan.dorado.test.thrift.api -service HelloService -{ - string sayHello(1:string username) - string sayBye(1:string username) -} diff --git a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/thrift-mistake-interface.xml b/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/thrift-mistake-interface.xml deleted file mode 100644 index 6754924..0000000 --- a/dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/thrift-mistake-interface.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/Echo.java b/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/Echo.java deleted file mode 100644 index 139eda0..0000000 --- a/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/Echo.java +++ /dev/null @@ -1,984 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed 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 Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package com.meituan.dorado.test.echo; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-11-23") -public class Echo { - - public interface Iface { - - public String echo(String arg) throws org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String arg) throws org.apache.thrift.TException - { - send_echo(arg); - return recv_echo(); - } - - public void send_echo(String arg) throws org.apache.thrift.TException - { - echo_args args = new echo_args(); - args.setArg(arg); - sendBase("echozk", args); - } - - public String recv_echo() throws org.apache.thrift.TException - { - echo_result result = new echo_result(); - receiveBase(result, "echozk"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "echo failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, 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); - } - - public void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - echo_call method_call = new echo_call(arg, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String arg; - public echo_call(String arg, org.apache.thrift.async.AsyncMethodCallback 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); - this.arg = arg; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("echozk", org.apache.thrift.protocol.TMessageType.CALL, 0)); - echo_args args = new echo_args(); - args.setArg(arg); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echozk", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echozk"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws org.apache.thrift.TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.arg); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("echozk", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echozk"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.arg,resultHandler); - } - } - - } - - public static class echo_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_args"); - - private static final org.apache.thrift.protocol.TField ARG_FIELD_DESC = new org.apache.thrift.protocol.TField("arg", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - public String arg; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - ARG((short)1, "arg"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // ARG - return ARG; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.ARG, new org.apache.thrift.meta_data.FieldMetaData("arg", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public echo_args() { - } - - public echo_args( - String arg) - { - this(); - this.arg = arg; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetArg()) { - this.arg = other.arg; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.arg = null; - } - - public String getArg() { - return this.arg; - } - - public echo_args setArg(String arg) { - this.arg = arg; - return this; - } - - public void unsetArg() { - this.arg = null; - } - - /** Returns true if field arg is set (has been assigned a value) and false otherwise */ - public boolean isSetArg() { - return this.arg != null; - } - - public void setArgIsSet(boolean value) { - if (!value) { - this.arg = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case ARG: - if (value == null) { - unsetArg(); - } else { - setArg((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case ARG: - return getArg(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case ARG: - return isSetArg(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args)that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_arg = true && this.isSetArg(); - boolean that_present_arg = true && that.isSetArg(); - if (this_present_arg || that_present_arg) { - if (!(this_present_arg && that_present_arg)) - return false; - if (!this.arg.equals(that.arg)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_arg = true && (isSetArg()); - list.add(present_arg); - if (present_arg) - list.add(arg); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetArg()).compareTo(other.isSetArg()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetArg()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arg, other.arg); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("arg:"); - if (this.arg == null) { - sb.append("null"); - } else { - sb.append(this.arg); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // ARG - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.arg = iprot.readString(); - struct.setArgIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.arg != null) { - oprot.writeFieldBegin(ARG_FIELD_DESC); - oprot.writeString(struct.arg); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetArg()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetArg()) { - oprot.writeString(struct.arg); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.arg = iprot.readString(); - struct.setArgIsSet(true); - } - } - } - - } - - public static class echo_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("echo_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - public String success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public echo_result() { - } - - public echo_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result)that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - 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); - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/EchoImpl.java b/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/EchoImpl.java deleted file mode 100644 index 64e6cbe..0000000 --- a/dorado/dorado-test/dorado-test-server/src/main/java/com/meituan/dorado/test/echo/EchoImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.test.echo; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - - @Override - public String echo(String str) throws TException { - return "Hahah I am dorado, I have got your message: " + str; - } -} diff --git a/dorado/dorado-test/dorado-test-server/src/main/resources/thriftidl/echo.thrift b/dorado/dorado-test/dorado-test-server/src/main/resources/thriftidl/echo.thrift deleted file mode 100644 index 0c0a5a9..0000000 --- a/dorado/dorado-test/dorado-test-server/src/main/resources/thriftidl/echo.thrift +++ /dev/null @@ -1,9 +0,0 @@ -namespace cpp echo -namespace py echo -namespace java echo - -service Echo -{ - string echo(1: string arg); -} - diff --git a/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/Echo.java b/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/Echo.java deleted file mode 100644 index 60eaf12..0000000 --- a/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/Echo.java +++ /dev/null @@ -1,1020 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.3) - *

- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated - */ -package com.meituan.dorado.trace.cat.api; - -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Generated; -import java.util.*; - -@SuppressWarnings({ "cast", "rawtypes", "serial", - "unchecked" }) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-11-29") public class Echo { - - public interface Iface { - - public String echo(String messge) throws TException; - - } - - public interface AsyncIface { - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public Client(org.apache.thrift.protocol.TProtocol prot) { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public String echo(String messge) throws TException { - send_echo(messge); - return recv_echo(); - } - - public void send_echo(String messge) throws TException { - echo_args args = new echo_args(); - args.setMessge(messge); - sendBase("echo", args); - } - - public String recv_echo() throws TException { - echo_result result = new echo_result(); - receiveBase(result, "echo"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, - "echo failed: unknown result"); - } - - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() { - } - - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, - org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - } - - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void echo(String messge, AsyncMethodCallback resultHandler) - throws TException { - checkReady(); - echo_call method_call = new echo_call(messge, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, - org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public static class echo_call extends org.apache.thrift.async.TAsyncMethodCall { - private String messge; - - public echo_call(String messge, AsyncMethodCallback resultHandler, - org.apache.thrift.async.TAsyncClient client, - org.apache.thrift.protocol.TProtocolFactory protocolFactory, - org.apache.thrift.transport.TNonblockingTransport transport) throws TException { - super(client, protocolFactory, transport, resultHandler, false); - this.messge = messge; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { - prot.writeMessageBegin( - new org.apache.thrift.protocol.TMessage("echo", org.apache.thrift.protocol.TMessageType.CALL, - 0)); - echo_args args = new echo_args(); - args.setMessge(messge); - args.write(prot); - prot.writeMessageEnd(); - } - - public String getResult() throws TException { - if (getState() != State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport( - getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_echo(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor - implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - - public Processor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected Processor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo extends org.apache.thrift.ProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - protected boolean isOneway() { - return false; - } - - public echo_result getResult(I iface, echo_args args) throws TException { - echo_result result = new echo_result(); - result.success = iface.echo(args.messge); - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - - public AsyncProcessor(I iface) { - super(iface, getProcessMap( - new HashMap>())); - } - - protected AsyncProcessor(I iface, - Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap( - Map> processMap) { - processMap.put("echo", new echo()); - return processMap; - } - - public static class echo - extends org.apache.thrift.AsyncProcessFunction { - public echo() { - super("echo"); - } - - public echo_args getEmptyArgsInstance() { - return new echo_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(String o) { - echo_result result = new echo_result(); - result.success = o; - try { - fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - echo_result result = new echo_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException( - org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb, msg, msgType, seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, echo_args args, - AsyncMethodCallback resultHandler) throws TException { - iface.echo(args.messge, resultHandler); - } - } - - } - - public static class echo_args - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_args"); - private static final org.apache.thrift.protocol.TField MESSGE_FIELD_DESC = new org.apache.thrift.protocol.TField( - "messge", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_argsTupleSchemeFactory()); - } - - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>( - _Fields.class); - tmpMap.put(_Fields.MESSGE, new org.apache.thrift.meta_data.FieldMetaData("messge", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_args.class, metaDataMap); - } - - public String messge; // required - - public echo_args() { - } - - public echo_args(String messge) { - this(); - this.messge = messge; - } - - /** - * Performs a deep copy on other. - */ - public echo_args(echo_args other) { - if (other.isSetMessge()) { - this.messge = other.messge; - } - } - - public echo_args deepCopy() { - return new echo_args(this); - } - - @Override - public void clear() { - this.messge = null; - } - - public String getMessge() { - return this.messge; - } - - public echo_args setMessge(String messge) { - this.messge = messge; - return this; - } - - public void unsetMessge() { - this.messge = null; - } - - /** - * Returns true if field messge is set (has been assigned a value) and false otherwise - */ - public boolean isSetMessge() { - return this.messge != null; - } - - public void setMessgeIsSet(boolean value) { - if (!value) { - this.messge = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case MESSGE: - if (value == null) { - unsetMessge(); - } else { - setMessge((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case MESSGE: - return getMessge(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case MESSGE: - return isSetMessge(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_args) - return this.equals((echo_args) that); - return false; - } - - public boolean equals(echo_args that) { - if (that == null) - return false; - - boolean this_present_messge = true && this.isSetMessge(); - boolean that_present_messge = true && that.isSetMessge(); - if (this_present_messge || that_present_messge) { - if (!(this_present_messge && that_present_messge)) - return false; - if (!this.messge.equals(that.messge)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_messge = true && (isSetMessge()); - list.add(present_messge); - if (present_messge) - list.add(messge); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetMessge()).compareTo(other.isSetMessge()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessge()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messge, other.messge); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_args("); - boolean first = true; - - sb.append("messge:"); - if (this.messge == null) { - sb.append("null"); - } else { - sb.append(this.messge); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - MESSGE((short) 1, "messge"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 1: // MESSGE - return MESSGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_argsStandardSchemeFactory implements SchemeFactory { - public echo_argsStandardScheme getScheme() { - return new echo_argsStandardScheme(); - } - } - - private static class echo_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_args struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // MESSGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_args struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.messge != null) { - oprot.writeFieldBegin(MESSGE_FIELD_DESC); - oprot.writeString(struct.messge); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_argsTupleSchemeFactory implements SchemeFactory { - public echo_argsTupleScheme getScheme() { - return new echo_argsTupleScheme(); - } - } - - private static class echo_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetMessge()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetMessge()) { - oprot.writeString(struct.messge); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_args struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.messge = iprot.readString(); - struct.setMessgeIsSet(true); - } - } - } - - } - - public static class echo_result - implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, - Comparable { - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( - "echo_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField( - "success", org.apache.thrift.protocol.TType.STRING, (short) 0); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, new echo_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new echo_resultTupleSchemeFactory()); - } - - static { - 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 org.apache.thrift.meta_data.FieldMetaData("success", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(echo_result.class, metaDataMap); - } - - public String success; // required - - public echo_result() { - } - - public echo_result(String success) { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public echo_result(echo_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public echo_result deepCopy() { - return new echo_result(this); - } - - @Override - public void clear() { - this.success = null; - } - - public String getSuccess() { - return this.success; - } - - public echo_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String) value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof echo_result) - return this.equals((echo_result) that); - return false; - } - - public boolean equals(echo_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List list = new ArrayList(); - - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); - - return list.hashCode(); - } - - @Override - public int compareTo(echo_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("echo_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check for sub-struct validity - } - - 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 (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 (TException te) { - throw new java.io.IOException(te); - } - } - - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - private static class echo_resultStandardSchemeFactory implements SchemeFactory { - public echo_resultStandardScheme getScheme() { - return new echo_resultStandardScheme(); - } - } - - private static class echo_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, echo_result struct) - throws TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, echo_result struct) - throws TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class echo_resultTupleSchemeFactory implements SchemeFactory { - public echo_resultTupleScheme getScheme() { - return new echo_resultTupleScheme(); - } - } - - private static class echo_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeString(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, echo_result struct) - throws TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readString(); - struct.setSuccessIsSet(true); - } - } - } - - } - -} diff --git a/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/EchoImpl.java b/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/EchoImpl.java deleted file mode 100644 index 0d3cdad..0000000 --- a/dorado/dorado-trace/dorado-trace-cat/src/test/java/com/meituan/dorado/trace/cat/api/EchoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2018 Meituan Dianping. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.meituan.dorado.trace.cat.api; - -import org.apache.thrift.TException; - -public class EchoImpl implements Echo.Iface { - @Override - public String echo(String messge) throws TException { - return "echo: " + messge; - } - - -} diff --git a/dorado/pom.xml b/dorado/pom.xml index 2481a61..fc6b981 100644 --- a/dorado/pom.xml +++ b/dorado/pom.xml @@ -50,7 +50,7 @@ 1.7.25 2.11.0 4.3.20.RELEASE - 2.9.3 + 2.9.9 3.4.12 4.0.1 2.12.0