Rev 764 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*** Autogenerated by Thrift** DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING*/package in.shop2020.datalogger;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.util.Arrays;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.apache.thrift.*;import org.apache.thrift.meta_data.*;import org.apache.thrift.protocol.*;public class DataLogger {public interface Iface {public void closeSession() throws TException;public void log(MsgType messageType, String message) throws TException;}public static class Client implements Iface {public Client(TProtocol prot){this(prot, prot);}public Client(TProtocol iprot, TProtocol oprot){iprot_ = iprot;oprot_ = oprot;}protected TProtocol iprot_;protected TProtocol oprot_;protected int seqid_;public TProtocol getInputProtocol(){return this.iprot_;}public TProtocol getOutputProtocol(){return this.oprot_;}public void closeSession() throws TException{send_closeSession();recv_closeSession();}public void send_closeSession() throws TException{oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));closeSession_args args = new closeSession_args();args.write(oprot_);oprot_.writeMessageEnd();oprot_.getTransport().flush();}public void recv_closeSession() throws TException{TMessage msg = iprot_.readMessageBegin();if (msg.type == TMessageType.EXCEPTION) {TApplicationException x = TApplicationException.read(iprot_);iprot_.readMessageEnd();throw x;}closeSession_result result = new closeSession_result();result.read(iprot_);iprot_.readMessageEnd();return;}public void log(MsgType messageType, String message) throws TException{send_log(messageType, message);recv_log();}public void send_log(MsgType messageType, String message) throws TException{oprot_.writeMessageBegin(new TMessage("log", TMessageType.CALL, seqid_));log_args args = new log_args();args.messageType = messageType;args.message = message;args.write(oprot_);oprot_.writeMessageEnd();oprot_.getTransport().flush();}public void recv_log() throws TException{TMessage msg = iprot_.readMessageBegin();if (msg.type == TMessageType.EXCEPTION) {TApplicationException x = TApplicationException.read(iprot_);iprot_.readMessageEnd();throw x;}log_result result = new log_result();result.read(iprot_);iprot_.readMessageEnd();return;}}public static class Processor implements TProcessor {private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());public Processor(Iface iface){iface_ = iface;processMap_.put("closeSession", new closeSession());processMap_.put("log", new log());}protected static interface ProcessFunction {public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;}private Iface iface_;protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();public boolean process(TProtocol iprot, TProtocol oprot) throws TException{TMessage msg = iprot.readMessageBegin();ProcessFunction fn = processMap_.get(msg.name);if (fn == null) {TProtocolUtil.skip(iprot, TType.STRUCT);iprot.readMessageEnd();TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));x.write(oprot);oprot.writeMessageEnd();oprot.getTransport().flush();return true;}fn.process(msg.seqid, iprot, oprot);return true;}private class closeSession implements ProcessFunction {public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException{closeSession_args args = new closeSession_args();args.read(iprot);iprot.readMessageEnd();closeSession_result result = new closeSession_result();iface_.closeSession();oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));result.write(oprot);oprot.writeMessageEnd();oprot.getTransport().flush();}}private class log implements ProcessFunction {public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException{log_args args = new log_args();args.read(iprot);iprot.readMessageEnd();log_result result = new log_result();iface_.log(args.messageType, args.message);oprot.writeMessageBegin(new TMessage("log", TMessageType.REPLY, seqid));result.write(oprot);oprot.writeMessageEnd();oprot.getTransport().flush();}}}public static class closeSession_args implements TBase<closeSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_args> {private static final TStruct STRUCT_DESC = new TStruct("closeSession_args");/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {;private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** 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, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{}});static {FieldMetaData.addStructMetaDataMap(closeSession_args.class, metaDataMap);}public closeSession_args() {}/*** Performs a deep copy on <i>other</i>.*/public closeSession_args(closeSession_args other) {}public closeSession_args deepCopy() {return new closeSession_args(this);}@Deprecatedpublic closeSession_args clone() {return new closeSession_args(this);}public void setFieldValue(_Fields field, Object value) {switch (field) {}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof closeSession_args)return this.equals((closeSession_args)that);return false;}public boolean equals(closeSession_args that) {if (that == null)return false;return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(closeSession_args other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;closeSession_args typedOther = (closeSession_args)other;return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {validate();oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("closeSession_args(");boolean first = true;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}public static class closeSession_result implements TBase<closeSession_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_result> {private static final TStruct STRUCT_DESC = new TStruct("closeSession_result");/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {;private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** 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, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{}});static {FieldMetaData.addStructMetaDataMap(closeSession_result.class, metaDataMap);}public closeSession_result() {}/*** Performs a deep copy on <i>other</i>.*/public closeSession_result(closeSession_result other) {}public closeSession_result deepCopy() {return new closeSession_result(this);}@Deprecatedpublic closeSession_result clone() {return new closeSession_result(this);}public void setFieldValue(_Fields field, Object value) {switch (field) {}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof closeSession_result)return this.equals((closeSession_result)that);return false;}public boolean equals(closeSession_result that) {if (that == null)return false;return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(closeSession_result other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;closeSession_result typedOther = (closeSession_result)other;return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("closeSession_result(");boolean first = true;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}public static class log_args implements TBase<log_args._Fields>, java.io.Serializable, Cloneable, Comparable<log_args> {private static final TStruct STRUCT_DESC = new TStruct("log_args");private static final TField MESSAGE_TYPE_FIELD_DESC = new TField("messageType", TType.I32, (short)1);private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)2);private MsgType messageType;private String message;/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {/**** @see MsgType*/MESSAGE_TYPE((short)1, "messageType"),MESSAGE((short)2, "message");private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** 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 assignmentspublic static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{put(_Fields.MESSAGE_TYPE, new FieldMetaData("messageType", TFieldRequirementType.DEFAULT,new EnumMetaData(TType.ENUM, MsgType.class)));put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.STRING)));}});static {FieldMetaData.addStructMetaDataMap(log_args.class, metaDataMap);}public log_args() {}public log_args(MsgType messageType,String message){this();this.messageType = messageType;this.message = message;}/*** Performs a deep copy on <i>other</i>.*/public log_args(log_args other) {if (other.isSetMessageType()) {this.messageType = other.messageType;}if (other.isSetMessage()) {this.message = other.message;}}public log_args deepCopy() {return new log_args(this);}@Deprecatedpublic log_args clone() {return new log_args(this);}/**** @see MsgType*/public MsgType getMessageType() {return this.messageType;}/**** @see MsgType*/public log_args setMessageType(MsgType messageType) {this.messageType = messageType;return this;}public void unsetMessageType() {this.messageType = null;}/** Returns true if field messageType is set (has been asigned a value) and false otherwise */public boolean isSetMessageType() {return this.messageType != null;}public void setMessageTypeIsSet(boolean value) {if (!value) {this.messageType = null;}}public String getMessage() {return this.message;}public log_args setMessage(String message) {this.message = message;return this;}public void unsetMessage() {this.message = null;}/** Returns true if field message is set (has been asigned 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_TYPE:if (value == null) {unsetMessageType();} else {setMessageType((MsgType)value);}break;case MESSAGE:if (value == null) {unsetMessage();} else {setMessage((String)value);}break;}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {case MESSAGE_TYPE:return getMessageType();case MESSAGE:return getMessage();}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {case MESSAGE_TYPE:return isSetMessageType();case MESSAGE:return isSetMessage();}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof log_args)return this.equals((log_args)that);return false;}public boolean equals(log_args that) {if (that == null)return false;boolean this_present_messageType = true && this.isSetMessageType();boolean that_present_messageType = true && that.isSetMessageType();if (this_present_messageType || that_present_messageType) {if (!(this_present_messageType && that_present_messageType))return false;if (!this.messageType.equals(that.messageType))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;}@Overridepublic int hashCode() {return 0;}public int compareTo(log_args other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;log_args typedOther = (log_args)other;lastComparison = Boolean.valueOf(isSetMessageType()).compareTo(isSetMessageType());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(messageType, typedOther.messageType);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(message, typedOther.message);if (lastComparison != 0) {return lastComparison;}return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {case MESSAGE_TYPE:if (field.type == TType.I32) {this.messageType = MsgType.findByValue(iprot.readI32());} else {TProtocolUtil.skip(iprot, field.type);}break;case MESSAGE:if (field.type == TType.STRING) {this.message = iprot.readString();} else {TProtocolUtil.skip(iprot, field.type);}break;}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {validate();oprot.writeStructBegin(STRUCT_DESC);if (this.messageType != null) {oprot.writeFieldBegin(MESSAGE_TYPE_FIELD_DESC);oprot.writeI32(this.messageType.getValue());oprot.writeFieldEnd();}if (this.message != null) {oprot.writeFieldBegin(MESSAGE_FIELD_DESC);oprot.writeString(this.message);oprot.writeFieldEnd();}oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("log_args(");boolean first = true;sb.append("messageType:");if (this.messageType == null) {sb.append("null");} else {String messageType_name = messageType.name();if (messageType_name != null) {sb.append(messageType_name);sb.append(" (");}sb.append(this.messageType);if (messageType_name != null) {sb.append(")");}}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}}public static class log_result implements TBase<log_result._Fields>, java.io.Serializable, Cloneable, Comparable<log_result> {private static final TStruct STRUCT_DESC = new TStruct("log_result");/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements TFieldIdEnum {;private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byId.put((int)field._thriftId, field);byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {return byId.get(fieldId);}/*** 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, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{}});static {FieldMetaData.addStructMetaDataMap(log_result.class, metaDataMap);}public log_result() {}/*** Performs a deep copy on <i>other</i>.*/public log_result(log_result other) {}public log_result deepCopy() {return new log_result(this);}@Deprecatedpublic log_result clone() {return new log_result(this);}public void setFieldValue(_Fields field, Object value) {switch (field) {}}public void setFieldValue(int fieldID, Object value) {setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);}public Object getFieldValue(_Fields field) {switch (field) {}throw new IllegalStateException();}public Object getFieldValue(int fieldId) {return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));}/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */public boolean isSet(_Fields field) {switch (field) {}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof log_result)return this.equals((log_result)that);return false;}public boolean equals(log_result that) {if (that == null)return false;return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(log_result other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;log_result typedOther = (log_result)other;return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {}iprot.readFieldEnd();}}iprot.readStructEnd();validate();}public void write(TProtocol oprot) throws TException {oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("log_result(");boolean first = true;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}}