diff --git a/pom.xml b/pom.xml index 4c432c421..9abc30e4f 100644 --- a/pom.xml +++ b/pom.xml @@ -181,6 +181,9 @@ generate-sources + + --> + @@ -203,6 +206,20 @@ + + + + + + + + + + + + + + diff --git a/src/main/java/com/profiler/dto/Constants.java b/src/main/java/com/profiler/dto/Constants.java new file mode 100644 index 000000000..eac5f69b5 --- /dev/null +++ b/src/main/java/com/profiler/dto/Constants.java @@ -0,0 +1,38 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package com.profiler.dto; + +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 Constants { + + public static final short TYPE_JVM_INFO_DATA = (short)10; + + public static final short TYPE_REQUEST_DATA = (short)20; + + public static final short TYPE_REQUEST = (short)30; + +} diff --git a/src/main/java/com/profiler/dto/Header.java b/src/main/java/com/profiler/dto/Header.java new file mode 100644 index 000000000..6e809d591 --- /dev/null +++ b/src/main/java/com/profiler/dto/Header.java @@ -0,0 +1,556 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package com.profiler.dto; + +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 Header implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Header"); + + private static final org.apache.thrift.protocol.TField SIGNATURE_FIELD_DESC = new org.apache.thrift.protocol.TField("signature", org.apache.thrift.protocol.TType.BYTE, (short)1); + private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.BYTE, (short)2); + private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I16, (short)3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new HeaderStandardSchemeFactory()); + schemes.put(TupleScheme.class, new HeaderTupleSchemeFactory()); + } + + private byte signature; // required + private byte version; // required + private short type; // 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 { + SIGNATURE((short)1, "signature"), + VERSION((short)2, "version"), + TYPE((short)3, "type"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // SIGNATURE + return SIGNATURE; + case 2: // VERSION + return VERSION; + case 3: // TYPE + return TYPE; + 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 __SIGNATURE_ISSET_ID = 0; + private static final int __VERSION_ISSET_ID = 1; + private static final int __TYPE_ISSET_ID = 2; + private BitSet __isset_bit_vector = new BitSet(3); + 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.SIGNATURE, new org.apache.thrift.meta_data.FieldMetaData("signature", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE))); + tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE))); + tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Header.class, metaDataMap); + } + + public Header() { + this.signature = (byte)239; + + this.version = (byte)16; + + } + + public Header( + byte signature, + byte version, + short type) + { + this(); + this.signature = signature; + setSignatureIsSet(true); + this.version = version; + setVersionIsSet(true); + this.type = type; + setTypeIsSet(true); + } + + /** + * Performs a deep copy on other. + */ + public Header(Header other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.signature = other.signature; + this.version = other.version; + this.type = other.type; + } + + public Header deepCopy() { + return new Header(this); + } + + @Override + public void clear() { + this.signature = (byte)239; + + this.version = (byte)16; + + setTypeIsSet(false); + this.type = 0; + } + + public byte getSignature() { + return this.signature; + } + + public void setSignature(byte signature) { + this.signature = signature; + setSignatureIsSet(true); + } + + public void unsetSignature() { + __isset_bit_vector.clear(__SIGNATURE_ISSET_ID); + } + + /** Returns true if field signature is set (has been assigned a value) and false otherwise */ + public boolean isSetSignature() { + return __isset_bit_vector.get(__SIGNATURE_ISSET_ID); + } + + public void setSignatureIsSet(boolean value) { + __isset_bit_vector.set(__SIGNATURE_ISSET_ID, value); + } + + public byte getVersion() { + return this.version; + } + + public void setVersion(byte version) { + this.version = version; + setVersionIsSet(true); + } + + public void unsetVersion() { + __isset_bit_vector.clear(__VERSION_ISSET_ID); + } + + /** Returns true if field version is set (has been assigned a value) and false otherwise */ + public boolean isSetVersion() { + return __isset_bit_vector.get(__VERSION_ISSET_ID); + } + + public void setVersionIsSet(boolean value) { + __isset_bit_vector.set(__VERSION_ISSET_ID, value); + } + + public short getType() { + return this.type; + } + + public void setType(short type) { + this.type = type; + setTypeIsSet(true); + } + + public void unsetType() { + __isset_bit_vector.clear(__TYPE_ISSET_ID); + } + + /** Returns true if field type is set (has been assigned a value) and false otherwise */ + public boolean isSetType() { + return __isset_bit_vector.get(__TYPE_ISSET_ID); + } + + public void setTypeIsSet(boolean value) { + __isset_bit_vector.set(__TYPE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SIGNATURE: + if (value == null) { + unsetSignature(); + } else { + setSignature((Byte)value); + } + break; + + case VERSION: + if (value == null) { + unsetVersion(); + } else { + setVersion((Byte)value); + } + break; + + case TYPE: + if (value == null) { + unsetType(); + } else { + setType((Short)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SIGNATURE: + return Byte.valueOf(getSignature()); + + case VERSION: + return Byte.valueOf(getVersion()); + + case TYPE: + return Short.valueOf(getType()); + + } + 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 SIGNATURE: + return isSetSignature(); + case VERSION: + return isSetVersion(); + case TYPE: + return isSetType(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof Header) + return this.equals((Header)that); + return false; + } + + public boolean equals(Header that) { + if (that == null) + return false; + + boolean this_present_signature = true; + boolean that_present_signature = true; + if (this_present_signature || that_present_signature) { + if (!(this_present_signature && that_present_signature)) + return false; + if (this.signature != that.signature) + return false; + } + + boolean this_present_version = true; + boolean that_present_version = true; + if (this_present_version || that_present_version) { + if (!(this_present_version && that_present_version)) + return false; + if (this.version != that.version) + return false; + } + + boolean this_present_type = true; + boolean that_present_type = true; + if (this_present_type || that_present_type) { + if (!(this_present_type && that_present_type)) + return false; + if (this.type != that.type) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Header other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Header typedOther = (Header)other; + + lastComparison = Boolean.valueOf(isSetSignature()).compareTo(typedOther.isSetSignature()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSignature()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.signature, typedOther.signature); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetVersion()).compareTo(typedOther.isSetVersion()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetVersion()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, typedOther.version); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type); + 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("Header("); + boolean first = true; + + sb.append("signature:"); + sb.append(this.signature); + first = false; + if (!first) sb.append(", "); + sb.append("version:"); + sb.append(this.version); + first = false; + if (!first) sb.append(", "); + sb.append("type:"); + sb.append(this.type); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetSignature()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'signature' is unset! Struct:" + toString()); + } + + if (!isSetVersion()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'version' is unset! Struct:" + toString()); + } + + if (!isSetType()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString()); + } + + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // 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 HeaderStandardSchemeFactory implements SchemeFactory { + public HeaderStandardScheme getScheme() { + return new HeaderStandardScheme(); + } + } + + private static class HeaderStandardScheme extends StandardScheme
{ + + public void read(org.apache.thrift.protocol.TProtocol iprot, Header 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: // SIGNATURE + if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) { + struct.signature = iprot.readByte(); + struct.setSignatureIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // VERSION + if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) { + struct.version = iprot.readByte(); + struct.setVersionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I16) { + struct.type = iprot.readI16(); + struct.setTypeIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Header struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(SIGNATURE_FIELD_DESC); + oprot.writeByte(struct.signature); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(VERSION_FIELD_DESC); + oprot.writeByte(struct.version); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(TYPE_FIELD_DESC); + oprot.writeI16(struct.type); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class HeaderTupleSchemeFactory implements SchemeFactory { + public HeaderTupleScheme getScheme() { + return new HeaderTupleScheme(); + } + } + + private static class HeaderTupleScheme extends TupleScheme
{ + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Header struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeByte(struct.signature); + oprot.writeByte(struct.version); + oprot.writeI16(struct.type); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Header struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.signature = iprot.readByte(); + struct.setSignatureIsSet(true); + struct.version = iprot.readByte(); + struct.setVersionIsSet(true); + struct.type = iprot.readI16(); + struct.setTypeIsSet(true); + } + } + +} + diff --git a/src/main/java/com/profiler/dto/JVMInfoData.java b/src/main/java/com/profiler/dto/JVMInfoData.java new file mode 100644 index 000000000..5c57561aa --- /dev/null +++ b/src/main/java/com/profiler/dto/JVMInfoData.java @@ -0,0 +1,482 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package com.profiler.dto; + +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 JVMInfoData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JVMInfoData"); + + private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField JVM_INFO_THRIFT_DTO_FIELD_DESC = new org.apache.thrift.protocol.TField("jvmInfoThriftDTO", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JVMInfoDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JVMInfoDataTupleSchemeFactory()); + } + + private com.profiler.dto.Header header; // required + private com.profiler.dto.JVMInfoThriftDTO jvmInfoThriftDTO; // 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 { + HEADER((short)1, "header"), + JVM_INFO_THRIFT_DTO((short)2, "jvmInfoThriftDTO"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // HEADER + return HEADER; + case 2: // JVM_INFO_THRIFT_DTO + return JVM_INFO_THRIFT_DTO; + 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.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.Header.class))); + tmpMap.put(_Fields.JVM_INFO_THRIFT_DTO, new org.apache.thrift.meta_data.FieldMetaData("jvmInfoThriftDTO", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.JVMInfoThriftDTO.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JVMInfoData.class, metaDataMap); + } + + public JVMInfoData() { + } + + public JVMInfoData( + com.profiler.dto.Header header, + com.profiler.dto.JVMInfoThriftDTO jvmInfoThriftDTO) + { + this(); + this.header = header; + this.jvmInfoThriftDTO = jvmInfoThriftDTO; + } + + /** + * Performs a deep copy on other. + */ + public JVMInfoData(JVMInfoData other) { + if (other.isSetHeader()) { + this.header = new com.profiler.dto.Header(other.header); + } + if (other.isSetJvmInfoThriftDTO()) { + this.jvmInfoThriftDTO = new com.profiler.dto.JVMInfoThriftDTO(other.jvmInfoThriftDTO); + } + } + + public JVMInfoData deepCopy() { + return new JVMInfoData(this); + } + + @Override + public void clear() { + this.header = null; + this.jvmInfoThriftDTO = null; + } + + public com.profiler.dto.Header getHeader() { + return this.header; + } + + public void setHeader(com.profiler.dto.Header header) { + this.header = header; + } + + public void unsetHeader() { + this.header = null; + } + + /** Returns true if field header is set (has been assigned a value) and false otherwise */ + public boolean isSetHeader() { + return this.header != null; + } + + public void setHeaderIsSet(boolean value) { + if (!value) { + this.header = null; + } + } + + public com.profiler.dto.JVMInfoThriftDTO getJvmInfoThriftDTO() { + return this.jvmInfoThriftDTO; + } + + public void setJvmInfoThriftDTO(com.profiler.dto.JVMInfoThriftDTO jvmInfoThriftDTO) { + this.jvmInfoThriftDTO = jvmInfoThriftDTO; + } + + public void unsetJvmInfoThriftDTO() { + this.jvmInfoThriftDTO = null; + } + + /** Returns true if field jvmInfoThriftDTO is set (has been assigned a value) and false otherwise */ + public boolean isSetJvmInfoThriftDTO() { + return this.jvmInfoThriftDTO != null; + } + + public void setJvmInfoThriftDTOIsSet(boolean value) { + if (!value) { + this.jvmInfoThriftDTO = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HEADER: + if (value == null) { + unsetHeader(); + } else { + setHeader((com.profiler.dto.Header)value); + } + break; + + case JVM_INFO_THRIFT_DTO: + if (value == null) { + unsetJvmInfoThriftDTO(); + } else { + setJvmInfoThriftDTO((com.profiler.dto.JVMInfoThriftDTO)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HEADER: + return getHeader(); + + case JVM_INFO_THRIFT_DTO: + return getJvmInfoThriftDTO(); + + } + 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 HEADER: + return isSetHeader(); + case JVM_INFO_THRIFT_DTO: + return isSetJvmInfoThriftDTO(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JVMInfoData) + return this.equals((JVMInfoData)that); + return false; + } + + public boolean equals(JVMInfoData that) { + if (that == null) + return false; + + boolean this_present_header = true && this.isSetHeader(); + boolean that_present_header = true && that.isSetHeader(); + if (this_present_header || that_present_header) { + if (!(this_present_header && that_present_header)) + return false; + if (!this.header.equals(that.header)) + return false; + } + + boolean this_present_jvmInfoThriftDTO = true && this.isSetJvmInfoThriftDTO(); + boolean that_present_jvmInfoThriftDTO = true && that.isSetJvmInfoThriftDTO(); + if (this_present_jvmInfoThriftDTO || that_present_jvmInfoThriftDTO) { + if (!(this_present_jvmInfoThriftDTO && that_present_jvmInfoThriftDTO)) + return false; + if (!this.jvmInfoThriftDTO.equals(that.jvmInfoThriftDTO)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(JVMInfoData other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + JVMInfoData typedOther = (JVMInfoData)other; + + lastComparison = Boolean.valueOf(isSetHeader()).compareTo(typedOther.isSetHeader()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHeader()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, typedOther.header); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetJvmInfoThriftDTO()).compareTo(typedOther.isSetJvmInfoThriftDTO()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJvmInfoThriftDTO()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jvmInfoThriftDTO, typedOther.jvmInfoThriftDTO); + 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("JVMInfoData("); + boolean first = true; + + sb.append("header:"); + if (this.header == null) { + sb.append("null"); + } else { + sb.append(this.header); + } + first = false; + if (!first) sb.append(", "); + sb.append("jvmInfoThriftDTO:"); + if (this.jvmInfoThriftDTO == null) { + sb.append("null"); + } else { + sb.append(this.jvmInfoThriftDTO); + } + 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 JVMInfoDataStandardSchemeFactory implements SchemeFactory { + public JVMInfoDataStandardScheme getScheme() { + return new JVMInfoDataStandardScheme(); + } + } + + private static class JVMInfoDataStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JVMInfoData 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: // HEADER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // JVM_INFO_THRIFT_DTO + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.jvmInfoThriftDTO = new com.profiler.dto.JVMInfoThriftDTO(); + struct.jvmInfoThriftDTO.read(iprot); + struct.setJvmInfoThriftDTOIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, JVMInfoData struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.header != null) { + oprot.writeFieldBegin(HEADER_FIELD_DESC); + struct.header.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.jvmInfoThriftDTO != null) { + oprot.writeFieldBegin(JVM_INFO_THRIFT_DTO_FIELD_DESC); + struct.jvmInfoThriftDTO.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JVMInfoDataTupleSchemeFactory implements SchemeFactory { + public JVMInfoDataTupleScheme getScheme() { + return new JVMInfoDataTupleScheme(); + } + } + + private static class JVMInfoDataTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JVMInfoData struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHeader()) { + optionals.set(0); + } + if (struct.isSetJvmInfoThriftDTO()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetHeader()) { + struct.header.write(oprot); + } + if (struct.isSetJvmInfoThriftDTO()) { + struct.jvmInfoThriftDTO.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JVMInfoData struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } + if (incoming.get(1)) { + struct.jvmInfoThriftDTO = new com.profiler.dto.JVMInfoThriftDTO(); + struct.jvmInfoThriftDTO.read(iprot); + struct.setJvmInfoThriftDTOIsSet(true); + } + } + } + +} + diff --git a/src/main/java/com/profiler/dto/Request.java b/src/main/java/com/profiler/dto/Request.java new file mode 100644 index 000000000..a6a36b221 --- /dev/null +++ b/src/main/java/com/profiler/dto/Request.java @@ -0,0 +1,482 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package com.profiler.dto; + +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 Request implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Request"); + + private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RequestStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RequestTupleSchemeFactory()); + } + + private com.profiler.dto.Header header; // required + private com.profiler.dto.RequestThriftDTO request; // 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 { + HEADER((short)1, "header"), + REQUEST((short)2, "request"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // HEADER + return HEADER; + case 2: // REQUEST + return REQUEST; + 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.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.Header.class))); + tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.RequestThriftDTO.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Request.class, metaDataMap); + } + + public Request() { + } + + public Request( + com.profiler.dto.Header header, + com.profiler.dto.RequestThriftDTO request) + { + this(); + this.header = header; + this.request = request; + } + + /** + * Performs a deep copy on other. + */ + public Request(Request other) { + if (other.isSetHeader()) { + this.header = new com.profiler.dto.Header(other.header); + } + if (other.isSetRequest()) { + this.request = new com.profiler.dto.RequestThriftDTO(other.request); + } + } + + public Request deepCopy() { + return new Request(this); + } + + @Override + public void clear() { + this.header = null; + this.request = null; + } + + public com.profiler.dto.Header getHeader() { + return this.header; + } + + public void setHeader(com.profiler.dto.Header header) { + this.header = header; + } + + public void unsetHeader() { + this.header = null; + } + + /** Returns true if field header is set (has been assigned a value) and false otherwise */ + public boolean isSetHeader() { + return this.header != null; + } + + public void setHeaderIsSet(boolean value) { + if (!value) { + this.header = null; + } + } + + public com.profiler.dto.RequestThriftDTO getRequest() { + return this.request; + } + + public void setRequest(com.profiler.dto.RequestThriftDTO request) { + this.request = request; + } + + public void unsetRequest() { + this.request = null; + } + + /** Returns true if field request is set (has been assigned a value) and false otherwise */ + public boolean isSetRequest() { + return this.request != null; + } + + public void setRequestIsSet(boolean value) { + if (!value) { + this.request = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HEADER: + if (value == null) { + unsetHeader(); + } else { + setHeader((com.profiler.dto.Header)value); + } + break; + + case REQUEST: + if (value == null) { + unsetRequest(); + } else { + setRequest((com.profiler.dto.RequestThriftDTO)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HEADER: + return getHeader(); + + case REQUEST: + return getRequest(); + + } + 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 HEADER: + return isSetHeader(); + case REQUEST: + return isSetRequest(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof Request) + return this.equals((Request)that); + return false; + } + + public boolean equals(Request that) { + if (that == null) + return false; + + boolean this_present_header = true && this.isSetHeader(); + boolean that_present_header = true && that.isSetHeader(); + if (this_present_header || that_present_header) { + if (!(this_present_header && that_present_header)) + return false; + if (!this.header.equals(that.header)) + return false; + } + + boolean this_present_request = true && this.isSetRequest(); + boolean that_present_request = true && that.isSetRequest(); + if (this_present_request || that_present_request) { + if (!(this_present_request && that_present_request)) + return false; + if (!this.request.equals(that.request)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Request other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Request typedOther = (Request)other; + + lastComparison = Boolean.valueOf(isSetHeader()).compareTo(typedOther.isSetHeader()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHeader()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, typedOther.header); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequest()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request); + 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("Request("); + boolean first = true; + + sb.append("header:"); + if (this.header == null) { + sb.append("null"); + } else { + sb.append(this.header); + } + first = false; + if (!first) sb.append(", "); + sb.append("request:"); + if (this.request == null) { + sb.append("null"); + } else { + sb.append(this.request); + } + 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 RequestStandardSchemeFactory implements SchemeFactory { + public RequestStandardScheme getScheme() { + return new RequestStandardScheme(); + } + } + + private static class RequestStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Request 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: // HEADER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REQUEST + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.request = new com.profiler.dto.RequestThriftDTO(); + struct.request.read(iprot); + struct.setRequestIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Request struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.header != null) { + oprot.writeFieldBegin(HEADER_FIELD_DESC); + struct.header.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.request != null) { + oprot.writeFieldBegin(REQUEST_FIELD_DESC); + struct.request.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RequestTupleSchemeFactory implements SchemeFactory { + public RequestTupleScheme getScheme() { + return new RequestTupleScheme(); + } + } + + private static class RequestTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Request struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHeader()) { + optionals.set(0); + } + if (struct.isSetRequest()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetHeader()) { + struct.header.write(oprot); + } + if (struct.isSetRequest()) { + struct.request.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Request struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } + if (incoming.get(1)) { + struct.request = new com.profiler.dto.RequestThriftDTO(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } + } + } + +} + diff --git a/src/main/java/com/profiler/dto/RequestDataList.java b/src/main/java/com/profiler/dto/RequestDataList.java new file mode 100644 index 000000000..7c529d058 --- /dev/null +++ b/src/main/java/com/profiler/dto/RequestDataList.java @@ -0,0 +1,482 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package com.profiler.dto; + +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 RequestDataList implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RequestDataList"); + + private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField REQUEST_DATA_LIST_THRIFT_DTO_FIELD_DESC = new org.apache.thrift.protocol.TField("requestDataListThriftDTO", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RequestDataListStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RequestDataListTupleSchemeFactory()); + } + + private com.profiler.dto.Header header; // required + private com.profiler.dto.RequestDataListThriftDTO requestDataListThriftDTO; // 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 { + HEADER((short)1, "header"), + REQUEST_DATA_LIST_THRIFT_DTO((short)2, "requestDataListThriftDTO"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // HEADER + return HEADER; + case 2: // REQUEST_DATA_LIST_THRIFT_DTO + return REQUEST_DATA_LIST_THRIFT_DTO; + 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.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.Header.class))); + tmpMap.put(_Fields.REQUEST_DATA_LIST_THRIFT_DTO, new org.apache.thrift.meta_data.FieldMetaData("requestDataListThriftDTO", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.profiler.dto.RequestDataListThriftDTO.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestDataList.class, metaDataMap); + } + + public RequestDataList() { + } + + public RequestDataList( + com.profiler.dto.Header header, + com.profiler.dto.RequestDataListThriftDTO requestDataListThriftDTO) + { + this(); + this.header = header; + this.requestDataListThriftDTO = requestDataListThriftDTO; + } + + /** + * Performs a deep copy on other. + */ + public RequestDataList(RequestDataList other) { + if (other.isSetHeader()) { + this.header = new com.profiler.dto.Header(other.header); + } + if (other.isSetRequestDataListThriftDTO()) { + this.requestDataListThriftDTO = new com.profiler.dto.RequestDataListThriftDTO(other.requestDataListThriftDTO); + } + } + + public RequestDataList deepCopy() { + return new RequestDataList(this); + } + + @Override + public void clear() { + this.header = null; + this.requestDataListThriftDTO = null; + } + + public com.profiler.dto.Header getHeader() { + return this.header; + } + + public void setHeader(com.profiler.dto.Header header) { + this.header = header; + } + + public void unsetHeader() { + this.header = null; + } + + /** Returns true if field header is set (has been assigned a value) and false otherwise */ + public boolean isSetHeader() { + return this.header != null; + } + + public void setHeaderIsSet(boolean value) { + if (!value) { + this.header = null; + } + } + + public com.profiler.dto.RequestDataListThriftDTO getRequestDataListThriftDTO() { + return this.requestDataListThriftDTO; + } + + public void setRequestDataListThriftDTO(com.profiler.dto.RequestDataListThriftDTO requestDataListThriftDTO) { + this.requestDataListThriftDTO = requestDataListThriftDTO; + } + + public void unsetRequestDataListThriftDTO() { + this.requestDataListThriftDTO = null; + } + + /** Returns true if field requestDataListThriftDTO is set (has been assigned a value) and false otherwise */ + public boolean isSetRequestDataListThriftDTO() { + return this.requestDataListThriftDTO != null; + } + + public void setRequestDataListThriftDTOIsSet(boolean value) { + if (!value) { + this.requestDataListThriftDTO = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HEADER: + if (value == null) { + unsetHeader(); + } else { + setHeader((com.profiler.dto.Header)value); + } + break; + + case REQUEST_DATA_LIST_THRIFT_DTO: + if (value == null) { + unsetRequestDataListThriftDTO(); + } else { + setRequestDataListThriftDTO((com.profiler.dto.RequestDataListThriftDTO)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HEADER: + return getHeader(); + + case REQUEST_DATA_LIST_THRIFT_DTO: + return getRequestDataListThriftDTO(); + + } + 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 HEADER: + return isSetHeader(); + case REQUEST_DATA_LIST_THRIFT_DTO: + return isSetRequestDataListThriftDTO(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof RequestDataList) + return this.equals((RequestDataList)that); + return false; + } + + public boolean equals(RequestDataList that) { + if (that == null) + return false; + + boolean this_present_header = true && this.isSetHeader(); + boolean that_present_header = true && that.isSetHeader(); + if (this_present_header || that_present_header) { + if (!(this_present_header && that_present_header)) + return false; + if (!this.header.equals(that.header)) + return false; + } + + boolean this_present_requestDataListThriftDTO = true && this.isSetRequestDataListThriftDTO(); + boolean that_present_requestDataListThriftDTO = true && that.isSetRequestDataListThriftDTO(); + if (this_present_requestDataListThriftDTO || that_present_requestDataListThriftDTO) { + if (!(this_present_requestDataListThriftDTO && that_present_requestDataListThriftDTO)) + return false; + if (!this.requestDataListThriftDTO.equals(that.requestDataListThriftDTO)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(RequestDataList other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + RequestDataList typedOther = (RequestDataList)other; + + lastComparison = Boolean.valueOf(isSetHeader()).compareTo(typedOther.isSetHeader()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHeader()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, typedOther.header); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestDataListThriftDTO()).compareTo(typedOther.isSetRequestDataListThriftDTO()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestDataListThriftDTO()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestDataListThriftDTO, typedOther.requestDataListThriftDTO); + 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("RequestDataList("); + boolean first = true; + + sb.append("header:"); + if (this.header == null) { + sb.append("null"); + } else { + sb.append(this.header); + } + first = false; + if (!first) sb.append(", "); + sb.append("requestDataListThriftDTO:"); + if (this.requestDataListThriftDTO == null) { + sb.append("null"); + } else { + sb.append(this.requestDataListThriftDTO); + } + 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 RequestDataListStandardSchemeFactory implements SchemeFactory { + public RequestDataListStandardScheme getScheme() { + return new RequestDataListStandardScheme(); + } + } + + private static class RequestDataListStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, RequestDataList 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: // HEADER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REQUEST_DATA_LIST_THRIFT_DTO + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.requestDataListThriftDTO = new com.profiler.dto.RequestDataListThriftDTO(); + struct.requestDataListThriftDTO.read(iprot); + struct.setRequestDataListThriftDTOIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, RequestDataList struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.header != null) { + oprot.writeFieldBegin(HEADER_FIELD_DESC); + struct.header.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.requestDataListThriftDTO != null) { + oprot.writeFieldBegin(REQUEST_DATA_LIST_THRIFT_DTO_FIELD_DESC); + struct.requestDataListThriftDTO.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RequestDataListTupleSchemeFactory implements SchemeFactory { + public RequestDataListTupleScheme getScheme() { + return new RequestDataListTupleScheme(); + } + } + + private static class RequestDataListTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, RequestDataList struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHeader()) { + optionals.set(0); + } + if (struct.isSetRequestDataListThriftDTO()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetHeader()) { + struct.header.write(oprot); + } + if (struct.isSetRequestDataListThriftDTO()) { + struct.requestDataListThriftDTO.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, RequestDataList struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.header = new com.profiler.dto.Header(); + struct.header.read(iprot); + struct.setHeaderIsSet(true); + } + if (incoming.get(1)) { + struct.requestDataListThriftDTO = new com.profiler.dto.RequestDataListThriftDTO(); + struct.requestDataListThriftDTO.read(iprot); + struct.setRequestDataListThriftDTOIsSet(true); + } + } + } + +} + diff --git a/src/test/java/com/profiler/dto/HeaderTest.java b/src/test/java/com/profiler/dto/HeaderTest.java new file mode 100644 index 000000000..4a9c383d5 --- /dev/null +++ b/src/test/java/com/profiler/dto/HeaderTest.java @@ -0,0 +1,15 @@ +package com.profiler.dto; + +import org.junit.Test; + +public class HeaderTest { + @Test + public void testGetSignature() throws Exception { + Header header = new Header(); + byte signature = header.getSignature(); + System.out.println(signature); + short type = header.getType(); + byte version = header.getVersion(); + System.out.println(version); + } +} diff --git a/thrift/Header.thrift b/thrift/Header.thrift new file mode 100644 index 000000000..0f1944f09 --- /dev/null +++ b/thrift/Header.thrift @@ -0,0 +1,9 @@ +namespace java com.profiler.dto + +const byte SIGNATURE = 0xef; + +struct Header { + 1: required byte signature = SIGNATURE, + 2: required byte version = 0x10, + 3: required i16 type +} diff --git a/thrift/MulplexedDTO.thrift b/thrift/MulplexedDTO.thrift new file mode 100644 index 000000000..1f7677e14 --- /dev/null +++ b/thrift/MulplexedDTO.thrift @@ -0,0 +1,31 @@ +include "Header.thrift" +include "JVMInfoThriftDTO.thrift" +include "RequestDataThriftDTO.thrift" +include "RequestThriftDTO.thrift" + +namespace java com.profiler.dto + +const i16 TYPE_JVM_INFO_DATA = 10; +struct JVMInfoData { + 1: Header.Header header, + 2: JVMInfoThriftDTO.JVMInfoThriftDTO jvmInfoThriftDTO +} + +const i16 TYPE_REQUEST_DATA = 20; + +struct RequestDataList { + 1: Header.Header header, + 2: RequestDataThriftDTO.RequestDataListThriftDTO requestDataListThriftDTO +} + +const i16 TYPE_REQUEST = 30; +struct Request { + 1: Header.Header header, + 2: RequestThriftDTO.RequestThriftDTO request +} + + + + + + diff --git a/thrift/RequestDataThriftDTO.thrift b/thrift/RequestDataThriftDTO.thrift index 349ac7fc1..f36cc921b 100644 --- a/thrift/RequestDataThriftDTO.thrift +++ b/thrift/RequestDataThriftDTO.thrift @@ -14,6 +14,7 @@ struct RequestDataThriftDTO { 12: optional i64 extraLong2, 13: optional i64 extraLong3 } + struct RequestDataListThriftDTO { 1: i32 hostHashCode, 2: i32 requestHashCode,