/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.wso2.carbon.cloud.gateway.common.thrift.gen;
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 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CloudGatewayService {
public interface Iface {
public String login(String userName, String password, String queueName) throws NotAuthorizedException, org.apache.thrift.TException;
public List<Message> exchange(List<Message> src, int size, String token) throws NotAuthorizedException, org.apache.thrift.TException;
}
public interface AsyncIface {
public void login(String userName, String password, String queueName, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.login_call> resultHandler) throws org.apache.thrift.TException;
public void exchange(List<Message> src, int size, String token, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.exchange_call> 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<Client> {
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 login(String userName, String password, String queueName) throws NotAuthorizedException, org.apache.thrift.TException
{
send_login(userName, password, queueName);
return recv_login();
}
public void send_login(String userName, String password, String queueName) throws org.apache.thrift.TException
{
login_args args = new login_args();
args.setUserName(userName);
args.setPassword(password);
args.setQueueName(queueName);
sendBase("login", args);
}
public String recv_login() throws NotAuthorizedException, org.apache.thrift.TException
{
login_result result = new login_result();
receiveBase(result, "login");
if (result.isSetSuccess()) {
return result.success;
}
if (result.e != null) {
throw result.e;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "login failed: unknown result");
}
public List<Message> exchange(List<Message> src, int size, String token) throws NotAuthorizedException, org.apache.thrift.TException
{
send_exchange(src, size, token);
return recv_exchange();
}
public void send_exchange(List<Message> src, int size, String token) throws org.apache.thrift.TException
{
exchange_args args = new exchange_args();
args.setSrc(src);
args.setSize(size);
args.setToken(token);
sendBase("exchange", args);
}
public List<Message> recv_exchange() throws NotAuthorizedException, org.apache.thrift.TException
{
exchange_result result = new exchange_result();
receiveBase(result, "exchange");
if (result.isSetSuccess()) {
return result.success;
}
if (result.e != null) {
throw result.e;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "exchange 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<AsyncClient> {
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 login(String userName, String password, String queueName, org.apache.thrift.async.AsyncMethodCallback<login_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
login_call method_call = new login_call(userName, password, queueName, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class login_call extends org.apache.thrift.async.TAsyncMethodCall {
private String userName;
private String password;
private String queueName;
public login_call(String userName, String password, String queueName, org.apache.thrift.async.AsyncMethodCallback<login_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.userName = userName;
this.password = password;
this.queueName = queueName;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("login", org.apache.thrift.protocol.TMessageType.CALL, 0));
login_args args = new login_args();
args.setUserName(userName);
args.setPassword(password);
args.setQueueName(queueName);
args.write(prot);
prot.writeMessageEnd();
}
public String getResult() throws NotAuthorizedException, 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_login();
}
}
public void exchange(List<Message> src, int size, String token, org.apache.thrift.async.AsyncMethodCallback<exchange_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
exchange_call method_call = new exchange_call(src, size, token, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class exchange_call extends org.apache.thrift.async.TAsyncMethodCall {
private List<Message> src;
private int size;
private String token;
public exchange_call(List<Message> src, int size, String token, org.apache.thrift.async.AsyncMethodCallback<exchange_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.src = src;
this.size = size;
this.token = token;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("exchange", org.apache.thrift.protocol.TMessageType.CALL, 0));
exchange_args args = new exchange_args();
args.setSrc(src);
args.setSize(size);
args.setToken(token);
args.write(prot);
prot.writeMessageEnd();
}
public List<Message> getResult() throws NotAuthorizedException, 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_exchange();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("login", new login());
processMap.put("exchange", new exchange());
return processMap;
}
private static class login<I extends Iface> extends org.apache.thrift.ProcessFunction<I, login_args> {
public login() {
super("login");
}
protected login_args getEmptyArgsInstance() {
return new login_args();
}
protected login_result getResult(I iface, login_args args) throws org.apache.thrift.TException {
login_result result = new login_result();
try {
result.success = iface.login(args.userName, args.password, args.queueName);
} catch (NotAuthorizedException e) {
result.e = e;
}
return result;
}
}
private static class exchange<I extends Iface> extends org.apache.thrift.ProcessFunction<I, exchange_args> {
public exchange() {
super("exchange");
}
protected exchange_args getEmptyArgsInstance() {
return new exchange_args();
}
protected exchange_result getResult(I iface, exchange_args args) throws org.apache.thrift.TException {
exchange_result result = new exchange_result();
try {
result.success = iface.exchange(args.src, args.size, args.token);
} catch (NotAuthorizedException e) {
result.e = e;
}
return result;
}
}
}
public static class login_args implements org.apache.thrift.TBase<login_args, login_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("login_args");
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)1);
private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("queueName", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new login_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new login_argsTupleSchemeFactory());
}
public String userName; // required
public String password; // required
public String queueName; // 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 {
USER_NAME((short)1, "userName"),
PASSWORD((short)2, "password"),
QUEUE_NAME((short)3, "queueName");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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_NAME
return USER_NAME;
case 2: // PASSWORD
return PASSWORD;
case 3: // QUEUE_NAME
return QUEUE_NAME;
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.USER_NAME, 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)));
tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("queueName", 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(login_args.class, metaDataMap);
}
public login_args() {
}
public login_args(
String userName,
String password,
String queueName)
{
this();
this.userName = userName;
this.password = password;
this.queueName = queueName;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public login_args(login_args other) {
if (other.isSetUserName()) {
this.userName = other.userName;
}
if (other.isSetPassword()) {
this.password = other.password;
}
if (other.isSetQueueName()) {
this.queueName = other.queueName;
}
}
public login_args deepCopy() {
return new login_args(this);
}
@Override
public void clear() {
this.userName = null;
this.password = null;
this.queueName = null;
}
public String getUserName() {
return this.userName;
}
public login_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 String getPassword() {
return this.password;
}
public login_args setPassword(String password) {
this.password = password;
return this;
}
public void unsetPassword() {
this.password = null;
}
/** Returns true if field password is set (has been assigned a value) and false otherwise */
public boolean isSetPassword() {
return this.password != null;
}
public void setPasswordIsSet(boolean value) {
if (!value) {
this.password = null;
}
}
public String getQueueName() {
return this.queueName;
}
public login_args setQueueName(String queueName) {
this.queueName = queueName;
return this;
}
public void unsetQueueName() {
this.queueName = null;
}
/** Returns true if field queueName is set (has been assigned a value) and false otherwise */
public boolean isSetQueueName() {
return this.queueName != null;
}
public void setQueueNameIsSet(boolean value) {
if (!value) {
this.queueName = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case USER_NAME:
if (value == null) {
unsetUserName();
} else {
setUserName((String)value);
}
break;
case PASSWORD:
if (value == null) {
unsetPassword();
} else {
setPassword((String)value);
}
break;
case QUEUE_NAME:
if (value == null) {
unsetQueueName();
} else {
setQueueName((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case USER_NAME:
return getUserName();
case PASSWORD:
return getPassword();
case QUEUE_NAME:
return getQueueName();
}
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_NAME:
return isSetUserName();
case PASSWORD:
return isSetPassword();
case QUEUE_NAME:
return isSetQueueName();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof login_args)
return this.equals((login_args)that);
return false;
}
public boolean equals(login_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;
}
boolean this_present_password = true && this.isSetPassword();
boolean that_present_password = true && that.isSetPassword();
if (this_present_password || that_present_password) {
if (!(this_present_password && that_present_password))
return false;
if (!this.password.equals(that.password))
return false;
}
boolean this_present_queueName = true && this.isSetQueueName();
boolean that_present_queueName = true && that.isSetQueueName();
if (this_present_queueName || that_present_queueName) {
if (!(this_present_queueName && that_present_queueName))
return false;
if (!this.queueName.equals(that.queueName))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(login_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
login_args typedOther = (login_args)other;
lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.userName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPassword()).compareTo(typedOther.isSetPassword());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPassword()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, typedOther.password);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetQueueName()).compareTo(typedOther.isSetQueueName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetQueueName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueName, typedOther.queueName);
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("login_args(");
boolean first = true;
sb.append("userName:");
if (this.userName == null) {
sb.append("null");
} else {
sb.append(this.userName);
}
first = false;
if (!first) sb.append(", ");
sb.append("password:");
if (this.password == null) {
sb.append("null");
} else {
sb.append(this.password);
}
first = false;
if (!first) sb.append(", ");
sb.append("queueName:");
if (this.queueName == null) {
sb.append("null");
} else {
sb.append(this.queueName);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class login_argsStandardSchemeFactory implements SchemeFactory {
public login_argsStandardScheme getScheme() {
return new login_argsStandardScheme();
}
}
private static class login_argsStandardScheme extends StandardScheme<login_args> {
public void read(org.apache.thrift.protocol.TProtocol iprot, login_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: // 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 2: // PASSWORD
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.password = iprot.readString();
struct.setPasswordIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // QUEUE_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.queueName = iprot.readString();
struct.setQueueNameIsSet(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, login_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.userName != null) {
oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
oprot.writeString(struct.userName);
oprot.writeFieldEnd();
}
if (struct.password != null) {
oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
oprot.writeString(struct.password);
oprot.writeFieldEnd();
}
if (struct.queueName != null) {
oprot.writeFieldBegin(QUEUE_NAME_FIELD_DESC);
oprot.writeString(struct.queueName);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class login_argsTupleSchemeFactory implements SchemeFactory {
public login_argsTupleScheme getScheme() {
return new login_argsTupleScheme();
}
}
private static class login_argsTupleScheme extends TupleScheme<login_args> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, login_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetUserName()) {
optionals.set(0);
}
if (struct.isSetPassword()) {
optionals.set(1);
}
if (struct.isSetQueueName()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetUserName()) {
oprot.writeString(struct.userName);
}
if (struct.isSetPassword()) {
oprot.writeString(struct.password);
}
if (struct.isSetQueueName()) {
oprot.writeString(struct.queueName);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, login_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.userName = iprot.readString();
struct.setUserNameIsSet(true);
}
if (incoming.get(1)) {
struct.password = iprot.readString();
struct.setPasswordIsSet(true);
}
if (incoming.get(2)) {
struct.queueName = iprot.readString();
struct.setQueueNameIsSet(true);
}
}
}
}
public static class login_result implements org.apache.thrift.TBase<login_result, login_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("login_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 E_FIELD_DESC = new org.apache.thrift.protocol.TField("e", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new login_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new login_resultTupleSchemeFactory());
}
public String success; // required
public NotAuthorizedException e; // 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"),
E((short)1, "e");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // E
return E;
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.E, new org.apache.thrift.meta_data.FieldMetaData("e", 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(login_result.class, metaDataMap);
}
public login_result() {
}
public login_result(
String success,
NotAuthorizedException e)
{
this();
this.success = success;
this.e = e;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public login_result(login_result other) {
if (other.isSetSuccess()) {
this.success = other.success;
}
if (other.isSetE()) {
this.e = new NotAuthorizedException(other.e);
}
}
public login_result deepCopy() {
return new login_result(this);
}
@Override
public void clear() {
this.success = null;
this.e = null;
}
public String getSuccess() {
return this.success;
}
public login_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 NotAuthorizedException getE() {
return this.e;
}
public login_result setE(NotAuthorizedException e) {
this.e = e;
return this;
}
public void unsetE() {
this.e = null;
}
/** Returns true if field e is set (has been assigned a value) and false otherwise */
public boolean isSetE() {
return this.e != null;
}
public void setEIsSet(boolean value) {
if (!value) {
this.e = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((String)value);
}
break;
case E:
if (value == null) {
unsetE();
} else {
setE((NotAuthorizedException)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return getSuccess();
case E:
return getE();
}
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 E:
return isSetE();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof login_result)
return this.equals((login_result)that);
return false;
}
public boolean equals(login_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_e = true && this.isSetE();
boolean that_present_e = true && that.isSetE();
if (this_present_e || that_present_e) {
if (!(this_present_e && that_present_e))
return false;
if (!this.e.equals(that.e))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(login_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
login_result typedOther = (login_result)other;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetE()).compareTo(typedOther.isSetE());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetE()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.e, typedOther.e);
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("login_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("e:");
if (this.e == null) {
sb.append("null");
} else {
sb.append(this.e);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class login_resultStandardSchemeFactory implements SchemeFactory {
public login_resultStandardScheme getScheme() {
return new login_resultStandardScheme();
}
}
private static class login_resultStandardScheme extends StandardScheme<login_result> {
public void read(org.apache.thrift.protocol.TProtocol iprot, login_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: // E
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.e = new NotAuthorizedException();
struct.e.read(iprot);
struct.setEIsSet(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, login_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.e != null) {
oprot.writeFieldBegin(E_FIELD_DESC);
struct.e.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class login_resultTupleSchemeFactory implements SchemeFactory {
public login_resultTupleScheme getScheme() {
return new login_resultTupleScheme();
}
}
private static class login_resultTupleScheme extends TupleScheme<login_result> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, login_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
if (struct.isSetE()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetSuccess()) {
oprot.writeString(struct.success);
}
if (struct.isSetE()) {
struct.e.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, login_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.e = new NotAuthorizedException();
struct.e.read(iprot);
struct.setEIsSet(true);
}
}
}
}
public static class exchange_args implements org.apache.thrift.TBase<exchange_args, exchange_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("exchange_args");
private static final org.apache.thrift.protocol.TField SRC_FIELD_DESC = new org.apache.thrift.protocol.TField("src", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("size", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new exchange_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new exchange_argsTupleSchemeFactory());
}
public List<Message> src; // required
public int size; // required
public String token; // 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 {
SRC((short)1, "src"),
SIZE((short)2, "size"),
TOKEN((short)3, "token");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // SRC
return SRC;
case 2: // SIZE
return SIZE;
case 3: // TOKEN
return TOKEN;
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 __SIZE_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
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.SRC, new org.apache.thrift.meta_data.FieldMetaData("src", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Message.class))));
tmpMap.put(_Fields.SIZE, new org.apache.thrift.meta_data.FieldMetaData("size", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", 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(exchange_args.class, metaDataMap);
}
public exchange_args() {
}
public exchange_args(
List<Message> src,
int size,
String token)
{
this();
this.src = src;
this.size = size;
setSizeIsSet(true);
this.token = token;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public exchange_args(exchange_args other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetSrc()) {
List<Message> __this__src = new ArrayList<Message>();
for (Message other_element : other.src) {
__this__src.add(new Message(other_element));
}
this.src = __this__src;
}
this.size = other.size;
if (other.isSetToken()) {
this.token = other.token;
}
}
public exchange_args deepCopy() {
return new exchange_args(this);
}
@Override
public void clear() {
this.src = null;
setSizeIsSet(false);
this.size = 0;
this.token = null;
}
public int getSrcSize() {
return (this.src == null) ? 0 : this.src.size();
}
public java.util.Iterator<Message> getSrcIterator() {
return (this.src == null) ? null : this.src.iterator();
}
public void addToSrc(Message elem) {
if (this.src == null) {
this.src = new ArrayList<Message>();
}
this.src.add(elem);
}
public List<Message> getSrc() {
return this.src;
}
public exchange_args setSrc(List<Message> src) {
this.src = src;
return this;
}
public void unsetSrc() {
this.src = null;
}
/** Returns true if field src is set (has been assigned a value) and false otherwise */
public boolean isSetSrc() {
return this.src != null;
}
public void setSrcIsSet(boolean value) {
if (!value) {
this.src = null;
}
}
public int getSize() {
return this.size;
}
public exchange_args setSize(int size) {
this.size = size;
setSizeIsSet(true);
return this;
}
public void unsetSize() {
__isset_bit_vector.clear(__SIZE_ISSET_ID);
}
/** Returns true if field size is set (has been assigned a value) and false otherwise */
public boolean isSetSize() {
return __isset_bit_vector.get(__SIZE_ISSET_ID);
}
public void setSizeIsSet(boolean value) {
__isset_bit_vector.set(__SIZE_ISSET_ID, value);
}
public String getToken() {
return this.token;
}
public exchange_args setToken(String token) {
this.token = token;
return this;
}
public void unsetToken() {
this.token = null;
}
/** Returns true if field token is set (has been assigned a value) and false otherwise */
public boolean isSetToken() {
return this.token != null;
}
public void setTokenIsSet(boolean value) {
if (!value) {
this.token = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SRC:
if (value == null) {
unsetSrc();
} else {
setSrc((List<Message>)value);
}
break;
case SIZE:
if (value == null) {
unsetSize();
} else {
setSize((Integer)value);
}
break;
case TOKEN:
if (value == null) {
unsetToken();
} else {
setToken((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SRC:
return getSrc();
case SIZE:
return Integer.valueOf(getSize());
case TOKEN:
return getToken();
}
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 SRC:
return isSetSrc();
case SIZE:
return isSetSize();
case TOKEN:
return isSetToken();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof exchange_args)
return this.equals((exchange_args)that);
return false;
}
public boolean equals(exchange_args that) {
if (that == null)
return false;
boolean this_present_src = true && this.isSetSrc();
boolean that_present_src = true && that.isSetSrc();
if (this_present_src || that_present_src) {
if (!(this_present_src && that_present_src))
return false;
if (!this.src.equals(that.src))
return false;
}
boolean this_present_size = true;
boolean that_present_size = true;
if (this_present_size || that_present_size) {
if (!(this_present_size && that_present_size))
return false;
if (this.size != that.size)
return false;
}
boolean this_present_token = true && this.isSetToken();
boolean that_present_token = true && that.isSetToken();
if (this_present_token || that_present_token) {
if (!(this_present_token && that_present_token))
return false;
if (!this.token.equals(that.token))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(exchange_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
exchange_args typedOther = (exchange_args)other;
lastComparison = Boolean.valueOf(isSetSrc()).compareTo(typedOther.isSetSrc());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSrc()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.src, typedOther.src);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSize()).compareTo(typedOther.isSetSize());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSize()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.size, typedOther.size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetToken()).compareTo(typedOther.isSetToken());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetToken()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, typedOther.token);
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("exchange_args(");
boolean first = true;
sb.append("src:");
if (this.src == null) {
sb.append("null");
} else {
sb.append(this.src);
}
first = false;
if (!first) sb.append(", ");
sb.append("size:");
sb.append(this.size);
first = false;
if (!first) sb.append(", ");
sb.append("token:");
if (this.token == null) {
sb.append("null");
} else {
sb.append(this.token);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
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 exchange_argsStandardSchemeFactory implements SchemeFactory {
public exchange_argsStandardScheme getScheme() {
return new exchange_argsStandardScheme();
}
}
private static class exchange_argsStandardScheme extends StandardScheme<exchange_args> {
public void read(org.apache.thrift.protocol.TProtocol iprot, exchange_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: // SRC
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list10 = iprot.readListBegin();
struct.src = new ArrayList<Message>(_list10.size);
for (int _i11 = 0; _i11 < _list10.size; ++_i11)
{
Message _elem12; // required
_elem12 = new Message();
_elem12.read(iprot);
struct.src.add(_elem12);
}
iprot.readListEnd();
}
struct.setSrcIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SIZE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.size = iprot.readI32();
struct.setSizeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // TOKEN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.token = iprot.readString();
struct.setTokenIsSet(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, exchange_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.src != null) {
oprot.writeFieldBegin(SRC_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.src.size()));
for (Message _iter13 : struct.src)
{
_iter13.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(SIZE_FIELD_DESC);
oprot.writeI32(struct.size);
oprot.writeFieldEnd();
if (struct.token != null) {
oprot.writeFieldBegin(TOKEN_FIELD_DESC);
oprot.writeString(struct.token);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class exchange_argsTupleSchemeFactory implements SchemeFactory {
public exchange_argsTupleScheme getScheme() {
return new exchange_argsTupleScheme();
}
}
private static class exchange_argsTupleScheme extends TupleScheme<exchange_args> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, exchange_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSrc()) {
optionals.set(0);
}
if (struct.isSetSize()) {
optionals.set(1);
}
if (struct.isSetToken()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetSrc()) {
{
oprot.writeI32(struct.src.size());
for (Message _iter14 : struct.src)
{
_iter14.write(oprot);
}
}
}
if (struct.isSetSize()) {
oprot.writeI32(struct.size);
}
if (struct.isSetToken()) {
oprot.writeString(struct.token);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, exchange_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.src = new ArrayList<Message>(_list15.size);
for (int _i16 = 0; _i16 < _list15.size; ++_i16)
{
Message _elem17; // required
_elem17 = new Message();
_elem17.read(iprot);
struct.src.add(_elem17);
}
}
struct.setSrcIsSet(true);
}
if (incoming.get(1)) {
struct.size = iprot.readI32();
struct.setSizeIsSet(true);
}
if (incoming.get(2)) {
struct.token = iprot.readString();
struct.setTokenIsSet(true);
}
}
}
}
public static class exchange_result implements org.apache.thrift.TBase<exchange_result, exchange_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("exchange_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 org.apache.thrift.protocol.TField E_FIELD_DESC = new org.apache.thrift.protocol.TField("e", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new exchange_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new exchange_resultTupleSchemeFactory());
}
public List<Message> success; // required
public NotAuthorizedException e; // 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"),
E((short)1, "e");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // E
return E;
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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Message.class))));
tmpMap.put(_Fields.E, new org.apache.thrift.meta_data.FieldMetaData("e", 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(exchange_result.class, metaDataMap);
}
public exchange_result() {
}
public exchange_result(
List<Message> success,
NotAuthorizedException e)
{
this();
this.success = success;
this.e = e;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public exchange_result(exchange_result other) {
if (other.isSetSuccess()) {
List<Message> __this__success = new ArrayList<Message>();
for (Message other_element : other.success) {
__this__success.add(new Message(other_element));
}
this.success = __this__success;
}
if (other.isSetE()) {
this.e = new NotAuthorizedException(other.e);
}
}
public exchange_result deepCopy() {
return new exchange_result(this);
}
@Override
public void clear() {
this.success = null;
this.e = null;
}
public int getSuccessSize() {
return (this.success == null) ? 0 : this.success.size();
}
public java.util.Iterator<Message> getSuccessIterator() {
return (this.success == null) ? null : this.success.iterator();
}
public void addToSuccess(Message elem) {
if (this.success == null) {
this.success = new ArrayList<Message>();
}
this.success.add(elem);
}
public List<Message> getSuccess() {
return this.success;
}
public exchange_result setSuccess(List<Message> 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 NotAuthorizedException getE() {
return this.e;
}
public exchange_result setE(NotAuthorizedException e) {
this.e = e;
return this;
}
public void unsetE() {
this.e = null;
}
/** Returns true if field e is set (has been assigned a value) and false otherwise */
public boolean isSetE() {
return this.e != null;
}
public void setEIsSet(boolean value) {
if (!value) {
this.e = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((List<Message>)value);
}
break;
case E:
if (value == null) {
unsetE();
} else {
setE((NotAuthorizedException)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return getSuccess();
case E:
return getE();
}
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 E:
return isSetE();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof exchange_result)
return this.equals((exchange_result)that);
return false;
}
public boolean equals(exchange_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_e = true && this.isSetE();
boolean that_present_e = true && that.isSetE();
if (this_present_e || that_present_e) {
if (!(this_present_e && that_present_e))
return false;
if (!this.e.equals(that.e))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(exchange_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
exchange_result typedOther = (exchange_result)other;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetE()).compareTo(typedOther.isSetE());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetE()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.e, typedOther.e);
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("exchange_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("e:");
if (this.e == null) {
sb.append("null");
} else {
sb.append(this.e);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class exchange_resultStandardSchemeFactory implements SchemeFactory {
public exchange_resultStandardScheme getScheme() {
return new exchange_resultStandardScheme();
}
}
private static class exchange_resultStandardScheme extends StandardScheme<exchange_result> {
public void read(org.apache.thrift.protocol.TProtocol iprot, exchange_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 _list18 = iprot.readListBegin();
struct.success = new ArrayList<Message>(_list18.size);
for (int _i19 = 0; _i19 < _list18.size; ++_i19)
{
Message _elem20; // required
_elem20 = new Message();
_elem20.read(iprot);
struct.success.add(_elem20);
}
iprot.readListEnd();
}
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 1: // E
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.e = new NotAuthorizedException();
struct.e.read(iprot);
struct.setEIsSet(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, exchange_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.STRUCT, struct.success.size()));
for (Message _iter21 : struct.success)
{
_iter21.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.e != null) {
oprot.writeFieldBegin(E_FIELD_DESC);
struct.e.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class exchange_resultTupleSchemeFactory implements SchemeFactory {
public exchange_resultTupleScheme getScheme() {
return new exchange_resultTupleScheme();
}
}
private static class exchange_resultTupleScheme extends TupleScheme<exchange_result> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, exchange_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
if (struct.isSetE()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetSuccess()) {
{
oprot.writeI32(struct.success.size());
for (Message _iter22 : struct.success)
{
_iter22.write(oprot);
}
}
}
if (struct.isSetE()) {
struct.e.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, exchange_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.success = new ArrayList<Message>(_list23.size);
for (int _i24 = 0; _i24 < _list23.size; ++_i24)
{
Message _elem25; // required
_elem25 = new Message();
_elem25.read(iprot);
struct.success.add(_elem25);
}
}
struct.setSuccessIsSet(true);
}
if (incoming.get(1)) {
struct.e = new NotAuthorizedException();
struct.e.read(iprot);
struct.setEIsSet(true);
}
}
}
}
}