Modified: accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java?rev=1357829&r1=1357828&r2=1357829&view=diff ============================================================================== --- accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java (original) +++ accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java Thu Jul 5 19:39:03 2012 @@ -1,29 +1,56 @@ /** - * Autogenerated by Thrift + * Autogenerated by Thrift Compiler (0.8.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package org.apache.accumulo.cloudtrace.thrift; -public class TInfo implements org.apache.thrift.TBase<TInfo, TInfo._Fields>, java.io.Serializable, Cloneable { -private static final long serialVersionUID = 1L; +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; + +@SuppressWarnings("all") public class TInfo implements org.apache.thrift.TBase<TInfo, TInfo._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TInfo"); private static final org.apache.thrift.protocol.TField TRACE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("traceId", org.apache.thrift.protocol.TType.I64, (short)1); private static final org.apache.thrift.protocol.TField PARENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("parentId", org.apache.thrift.protocol.TType.I64, (short)2); - public long traceId; - public long parentId; + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TInfoStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TInfoTupleSchemeFactory()); + } + + public long traceId; // required + public long parentId; // 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 { TRACE_ID((short)1, "traceId"), PARENT_ID((short)2, "parentId"); - private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>(); + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -79,16 +106,15 @@ private static final long serialVersionU // isset id assignments private static final int __TRACEID_ISSET_ID = 0; private static final int __PARENTID_ISSET_ID = 1; - private java.util.BitSet __isset_bit_vector = new java.util.BitSet(2); - - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + private BitSet __isset_bit_vector = new BitSet(2); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TRACE_ID, new org.apache.thrift.meta_data.FieldMetaData("traceId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.PARENT_ID, new org.apache.thrift.meta_data.FieldMetaData("parentId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TInfo.class, metaDataMap); } @@ -198,10 +224,10 @@ private static final long serialVersionU public Object getFieldValue(_Fields field) { switch (field) { case TRACE_ID: - return new Long(getTraceId()); + return Long.valueOf(getTraceId()); case PARENT_ID: - return new Long(getParentId()); + return Long.valueOf(getParentId()); } throw new IllegalStateException(); @@ -297,54 +323,11 @@ private static final long serialVersionU } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // TRACE_ID - if (field.type == org.apache.thrift.protocol.TType.I64) { - this.traceId = iprot.readI64(); - setTraceIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // PARENT_ID - if (field.type == org.apache.thrift.protocol.TType.I64) { - this.parentId = iprot.readI64(); - setParentIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(TRACE_ID_FIELD_DESC); - oprot.writeI64(this.traceId); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(PARENT_ID_FIELD_DESC); - oprot.writeI64(this.parentId); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -378,12 +361,115 @@ private static final long serialVersionU 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 java.util.BitSet(1); + __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 TInfoStandardSchemeFactory implements SchemeFactory { + public TInfoStandardScheme getScheme() { + return new TInfoStandardScheme(); + } + } + + private static class TInfoStandardScheme extends StandardScheme<TInfo> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TInfo 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: // TRACE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.traceId = iprot.readI64(); + struct.setTraceIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PARENT_ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.parentId = iprot.readI64(); + struct.setParentIdIsSet(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, TInfo struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(TRACE_ID_FIELD_DESC); + oprot.writeI64(struct.traceId); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(PARENT_ID_FIELD_DESC); + oprot.writeI64(struct.parentId); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TInfoTupleSchemeFactory implements SchemeFactory { + public TInfoTupleScheme getScheme() { + return new TInfoTupleScheme(); + } + } + + private static class TInfoTupleScheme extends TupleScheme<TInfo> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TInfo struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTraceId()) { + optionals.set(0); + } + if (struct.isSetParentId()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetTraceId()) { + oprot.writeI64(struct.traceId); + } + if (struct.isSetParentId()) { + oprot.writeI64(struct.parentId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TInfo struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.traceId = iprot.readI64(); + struct.setTraceIdIsSet(true); + } + if (incoming.get(1)) { + struct.parentId = iprot.readI64(); + struct.setParentIdIsSet(true); + } + } + } + }
Modified: accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TestService.java URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TestService.java?rev=1357829&r1=1357828&r2=1357829&view=diff ============================================================================== --- accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TestService.java (original) +++ accumulo/branches/ACCUMULO-672/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TestService.java Thu Jul 5 19:39:03 2012 @@ -1,11 +1,33 @@ /** - * Autogenerated by Thrift + * Autogenerated by Thrift Compiler (0.8.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package org.apache.accumulo.cloudtrace.thrift; -public class TestService { +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; + +@SuppressWarnings("all") public class TestService { public interface Iface { @@ -19,7 +41,7 @@ public class TestService { } - public static class Client implements org.apache.thrift.TServiceClient, Iface { + 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) { @@ -32,28 +54,11 @@ public class TestService { public Client(org.apache.thrift.protocol.TProtocol prot) { - this(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) - { - iprot_ = iprot; - oprot_ = oprot; - } - - protected org.apache.thrift.protocol.TProtocol iprot_; - protected org.apache.thrift.protocol.TProtocol oprot_; - - protected int seqid_; - - public org.apache.thrift.protocol.TProtocol getInputProtocol() - { - return this.iprot_; + super(prot, prot); } - public org.apache.thrift.protocol.TProtocol getOutputProtocol() - { - return this.oprot_; + public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); } public boolean checkTrace(TInfo tinfo, String message) throws org.apache.thrift.TException @@ -64,29 +69,16 @@ public class TestService { public void send_checkTrace(TInfo tinfo, String message) throws org.apache.thrift.TException { - oprot_.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkTrace", org.apache.thrift.protocol.TMessageType.CALL, ++seqid_)); checkTrace_args args = new checkTrace_args(); args.setTinfo(tinfo); args.setMessage(message); - args.write(oprot_); - oprot_.writeMessageEnd(); - oprot_.getTransport().flush(); + sendBase("checkTrace", args); } public boolean recv_checkTrace() throws org.apache.thrift.TException { - org.apache.thrift.protocol.TMessage msg = iprot_.readMessageBegin(); - if (msg.type == org.apache.thrift.protocol.TMessageType.EXCEPTION) { - org.apache.thrift.TApplicationException x = org.apache.thrift.TApplicationException.read(iprot_); - iprot_.readMessageEnd(); - throw x; - } - if (msg.seqid != seqid_) { - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.BAD_SEQUENCE_ID, "checkTrace failed: out of sequence response"); - } checkTrace_result result = new checkTrace_result(); - result.read(iprot_); - iprot_.readMessageEnd(); + receiveBase(result, "checkTrace"); if (result.isSetSuccess()) { return result.success; } @@ -113,16 +105,14 @@ public class TestService { public void checkTrace(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback<checkTrace_call> resultHandler) throws org.apache.thrift.TException { checkReady(); - checkTrace_call method_call = new checkTrace_call(tinfo, message, resultHandler, this, protocolFactory, transport); - this.currentMethod = method_call; - manager.call(method_call); + checkTrace_call method_call = new checkTrace_call(tinfo, message, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); } - @SuppressWarnings("rawtypes") public static class checkTrace_call extends org.apache.thrift.async.TAsyncMethodCall { private TInfo tinfo; private String message; - @SuppressWarnings("unchecked") public checkTrace_call(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback<checkTrace_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.tinfo = tinfo; @@ -142,7 +132,7 @@ public class TestService { 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.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_checkTrace(); } @@ -150,87 +140,64 @@ public class TestService { } - public static class Processor implements org.apache.thrift.TProcessor { - private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); - public Processor(Iface iface) - { - iface_ = iface; - processMap_.put("checkTrace", new checkTrace()); + 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 static interface ProcessFunction { - public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException; + protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + super(iface, getProcessMap(processMap)); } - private Iface iface_; - protected final java.util.HashMap<String,ProcessFunction> processMap_ = new java.util.HashMap<String,ProcessFunction>(); + 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("checkTrace", new checkTrace()); + return processMap; + } - public boolean process(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException - { - org.apache.thrift.protocol.TMessage msg = iprot.readMessageBegin(); - ProcessFunction fn = processMap_.get(msg.name); - if (fn == null) { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, org.apache.thrift.protocol.TType.STRUCT); - iprot.readMessageEnd(); - org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'"); - oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage(msg.name, org.apache.thrift.protocol.TMessageType.EXCEPTION, msg.seqid)); - x.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - return true; + private static class checkTrace<I extends Iface> extends org.apache.thrift.ProcessFunction<I, checkTrace_args> { + public checkTrace() { + super("checkTrace"); } - fn.process(msg.seqid, iprot, oprot); - return true; - } - private class checkTrace implements ProcessFunction { - public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException - { - checkTrace_args args = new checkTrace_args(); - try { - args.read(iprot); - } catch (org.apache.thrift.protocol.TProtocolException e) { - iprot.readMessageEnd(); - org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.PROTOCOL_ERROR, e.getMessage()); - oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkTrace", org.apache.thrift.protocol.TMessageType.EXCEPTION, seqid)); - x.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - return; - } - iprot.readMessageEnd(); + protected checkTrace_args getEmptyArgsInstance() { + return new checkTrace_args(); + } + + protected checkTrace_result getResult(I iface, checkTrace_args args) throws org.apache.thrift.TException { checkTrace_result result = new checkTrace_result(); - result.success = iface_.checkTrace(args.tinfo, args.message); + result.success = iface.checkTrace(args.tinfo, args.message); result.setSuccessIsSet(true); - oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkTrace", org.apache.thrift.protocol.TMessageType.REPLY, seqid)); - result.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); + return result; } - } } public static class checkTrace_args implements org.apache.thrift.TBase<checkTrace_args, checkTrace_args._Fields>, java.io.Serializable, Cloneable { -private static final long serialVersionUID = 1L; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTrace_args"); private static final org.apache.thrift.protocol.TField TINFO_FIELD_DESC = new org.apache.thrift.protocol.TField("tinfo", org.apache.thrift.protocol.TType.STRUCT, (short)1); 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)2); - public TInfo tinfo; - public String message; + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new checkTrace_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new checkTrace_argsTupleSchemeFactory()); + } + + public TInfo tinfo; // 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 { TINFO((short)1, "tinfo"), MESSAGE((short)2, "message"); - private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>(); + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -284,15 +251,14 @@ private static final long serialVersionU } // isset id assignments - - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TINFO, new org.apache.thrift.meta_data.FieldMetaData("tinfo", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TInfo.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 = java.util.Collections.unmodifiableMap(tmpMap); + metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(checkTrace_args.class, metaDataMap); } @@ -501,57 +467,11 @@ private static final long serialVersionU } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // TINFO - if (field.type == org.apache.thrift.protocol.TType.STRUCT) { - this.tinfo = new TInfo(); - this.tinfo.read(iprot); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // MESSAGE - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.message = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.tinfo != null) { - oprot.writeFieldBegin(TINFO_FIELD_DESC); - this.tinfo.write(oprot); - oprot.writeFieldEnd(); - } - if (this.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(this.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -598,24 +518,138 @@ private static final long serialVersionU } } + private static class checkTrace_argsStandardSchemeFactory implements SchemeFactory { + public checkTrace_argsStandardScheme getScheme() { + return new checkTrace_argsStandardScheme(); + } + } + + private static class checkTrace_argsStandardScheme extends StandardScheme<checkTrace_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, checkTrace_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: // TINFO + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.tinfo = new TInfo(); + struct.tinfo.read(iprot); + struct.setTinfoIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // 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, checkTrace_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.tinfo != null) { + oprot.writeFieldBegin(TINFO_FIELD_DESC); + struct.tinfo.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class checkTrace_argsTupleSchemeFactory implements SchemeFactory { + public checkTrace_argsTupleScheme getScheme() { + return new checkTrace_argsTupleScheme(); + } + } + + private static class checkTrace_argsTupleScheme extends TupleScheme<checkTrace_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, checkTrace_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTinfo()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetTinfo()) { + struct.tinfo.write(oprot); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, checkTrace_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.tinfo = new TInfo(); + struct.tinfo.read(iprot); + struct.setTinfoIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + } public static class checkTrace_result implements org.apache.thrift.TBase<checkTrace_result, checkTrace_result._Fields>, java.io.Serializable, Cloneable { -private static final long serialVersionUID = 1L; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTrace_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); - public boolean success; + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new checkTrace_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new checkTrace_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 java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>(); + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -668,14 +702,13 @@ private static final long serialVersionU // isset id assignments private static final int __SUCCESS_ISSET_ID = 0; - private java.util.BitSet __isset_bit_vector = new java.util.BitSet(1); - - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + private BitSet __isset_bit_vector = new BitSet(1); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new 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 = java.util.Collections.unmodifiableMap(tmpMap); + metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(checkTrace_result.class, metaDataMap); } @@ -748,7 +781,7 @@ private static final long serialVersionU public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: - return new Boolean(isSuccess()); + return Boolean.valueOf(isSuccess()); } throw new IllegalStateException(); @@ -823,51 +856,21 @@ private static final long serialVersionU } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 0: // SUCCESS - if (field.type == org.apache.thrift.protocol.TType.BOOL) { - this.success = iprot.readBool(); - setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - oprot.writeStructBegin(STRUCT_DESC); - - if (this.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBool(this.success); - oprot.writeFieldEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } @Override public String toString() { StringBuilder sb = new StringBuilder("checkTrace_result("); + boolean first = true; + sb.append("success:"); sb.append(this.success); + first = false; sb.append(")"); return sb.toString(); } @@ -892,6 +895,88 @@ private static final long serialVersionU } } + private static class checkTrace_resultStandardSchemeFactory implements SchemeFactory { + public checkTrace_resultStandardScheme getScheme() { + return new checkTrace_resultStandardScheme(); + } + } + + private static class checkTrace_resultStandardScheme extends StandardScheme<checkTrace_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, checkTrace_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, checkTrace_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class checkTrace_resultTupleSchemeFactory implements SchemeFactory { + public checkTrace_resultTupleScheme getScheme() { + return new checkTrace_resultTupleScheme(); + } + } + + private static class checkTrace_resultTupleScheme extends TupleScheme<checkTrace_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, checkTrace_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, checkTrace_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); + } + } + } + } }