diff --git a/runscript/logging.properties b/runscript/logging.properties new file mode 100644 index 000000000..2a863b4e2 --- /dev/null +++ b/runscript/logging.properties @@ -0,0 +1,11 @@ + +handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler + +.level=ALL + +java.util.logging.ConsoleHandler.level=ALL +java.util.logging.FileHandler.level=ALL + +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.FileHandler.pattern=hippo-agent-%u.log \ No newline at end of file diff --git a/src/main/java/com/profiler/Logger.java b/src/main/java/com/profiler/Logger.java deleted file mode 100644 index ed5e51976..000000000 --- a/src/main/java/com/profiler/Logger.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.profiler; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import com.profiler.config.TomcatProfilerConfig; - -public abstract class Logger { - - protected final String name; - - protected final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - - public Logger(String name) { - this.name = name; - } - - public enum LogLevel { - INFO(0), DEBUG(1), WARN(2), ERROR(3), FATAL(4); - - private int priority; - - LogLevel(int priority) { - this.priority = priority; - } - } - - public static Logger getLogger(Class clazz) { - return new Logger(clazz.getName()) { - @Override - public void info(String message, Object... args) { - if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.INFO.priority) { - System.out.printf("[HIPPO] %s [INFO] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); - } - } - - @Override - public void debug(String message, Object... args) { - if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.DEBUG.priority) { - System.out.printf("[HIPPO] %s [DEBUG] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); - } - } - - @Override - public void warn(String message, Object... args) { - if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.WARN.priority) { - System.out.printf("[HIPPO] %s [WARN] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); - } - } - - @Override - public void error(String message, Object... args) { - if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.ERROR.priority) { - System.out.printf("[HIPPO] %s [ERROR] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); - } - } - - @Override - public void fatal(String message, Object... args) { - if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.FATAL.priority) { - System.out.printf("[HIPPO] %s [FATAL] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); - } - } - }; - } - - public abstract void info(String message, Object... args); - - public abstract void debug(String message, Object... args); - - public abstract void warn(String message, Object... args); - - public abstract void error(String message, Object... args); - - public abstract void fatal(String message, Object... args); - -} diff --git a/src/main/java/com/profiler/TomcatProfiler.java b/src/main/java/com/profiler/TomcatProfiler.java index 45fff63c6..c9b7b4007 100644 --- a/src/main/java/com/profiler/TomcatProfiler.java +++ b/src/main/java/com/profiler/TomcatProfiler.java @@ -11,6 +11,7 @@ import javassist.ClassPool; import javassist.NotFoundException; import com.profiler.config.TomcatProfilerConfig; +import com.profiler.logging.Logger; import com.profiler.modifier.db.cubrid.CubridPreparedStatementModifier; import com.profiler.modifier.db.cubrid.CubridResultSetModifier; import com.profiler.modifier.db.cubrid.CubridStatementModifier; @@ -109,7 +110,6 @@ public class TomcatProfiler implements ClassFileTransformer { if (result != null) return result; } - } else if (className.startsWith("net/sourceforge/jtds/jdbc")) { // MSSQL !!!!!!!!!! String javassistClassName = className.replace('/', '.'); @@ -201,13 +201,6 @@ public class TomcatProfiler implements ClassFileTransformer { } } } - // else if(className.startsWith("java/sql")) { - // String javassistClassName = className.replace('/', '.'); - // System.out.println("***** Changing "+javassistClassName); - // byte[] result=AbstractModifier.addBeforeAfterLogics(classPool, - // javassistClassName); - // if(result!=null) return result; - // } return null; } diff --git a/src/main/java/com/profiler/config/TomcatProfilerConfig.java b/src/main/java/com/profiler/config/TomcatProfilerConfig.java index 79039e20a..277ea4a3f 100644 --- a/src/main/java/com/profiler/config/TomcatProfilerConfig.java +++ b/src/main/java/com/profiler/config/TomcatProfilerConfig.java @@ -4,8 +4,8 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Properties; -import com.profiler.Logger; -import com.profiler.Logger.LogLevel; +import com.profiler.logging.LogLevel; +import com.profiler.logging.Logger; public class TomcatProfilerConfig { diff --git a/src/main/java/com/profiler/config/TomcatProfilerConstant.java b/src/main/java/com/profiler/config/TomcatProfilerConstant.java index bfd960d13..c47bd35c3 100644 --- a/src/main/java/com/profiler/config/TomcatProfilerConstant.java +++ b/src/main/java/com/profiler/config/TomcatProfilerConstant.java @@ -4,39 +4,38 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; public class TomcatProfilerConstant { - public final static DateFormat DATE_FORMAT_YMD_HMS=new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); - public final static DateFormat DATE_FORMAT_HMS_MS=new SimpleDateFormat("HH:mm:ss,SSS"); - public static final long DATA_FETCH_INTERVAL=2000; -// public static final String ID_ACTIVE_THREAD_COUNT="ATC"; -// public static final String ID_HOST_INFO="HI"; -// public static final String ID_GC_STAT="GS"; -// public static final String ID_HEAP_MEMORY_USAGE_STAT="HMU"; -// public static final String ID_NON_HEAP_MEMORY_USAGE_STAT="NHMU"; - - - public static final int DATA_TYPE_REQUEST=1; - public static final int DATA_TYPE_RESPONSE=2; - public static final int DATA_TYPE_UNCAUGHT_EXCEPTION=11; - -// public static final int DATA_TYPE_HOST_INFO=1000; -// public static final int DATA_TYPE_ACTIVE_THREAD_COUNT=1100; -// public static final int DATA_TYPE_GC_STAT=1500; -// public static final int DATA_TYPE_HEAP_MEMORY_STAT=1510; -// public static final int DATA_TYPE_NON_HEAP_MEMORY_STAT=1520; - - public static final String CLASS_NAME_REQUEST_TRACER="com.profiler.trace.RequestTransactionTracer"; - public static final String CLASS_NAME_REQUEST_THRIFT_DTO="com.profiler.dto.RequestThriftDTO"; - public static final String CLASS_NAME_REQUEST_DATA_TRACER="com.profiler.trace.RequestDataTracer"; - public static final String CLASS_NAME_AGENT_STATE_MANAGER="com.profiler.thread.AgentStateManager"; - - public static final int REQ_DATA_TYPE_DB_GET_CONNECTION=1; - public static final int REQ_DATA_TYPE_DB_CREATE_STATEMENT=11; - public static final int REQ_DATA_TYPE_DB_GET_PREPARED_STATEMENT=12; - public static final int REQ_DATA_TYPE_DB_QUERY=21; - public static final int REQ_DATA_TYPE_DB_EXECUTE_QUERY=31; - public static final int REQ_DATA_TYPE_DB_EXECUTE_UPDATE=32; - public static final int REQ_DATA_TYPE_DB_FETCH=41; - public static final int REQ_DATA_TYPE_DB_RESULTSET_CLOSE=42; - public static final int REQ_DATA_TYPE_DB_PREPARED_STATEMENT_PARAM=51; - public static final int REQ_DATA_TYPE_DB_CLOSE_CONNECTION=99; + public final static DateFormat DATE_FORMAT_YMD_HMS = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); + public final static DateFormat DATE_FORMAT_HMS_MS = new SimpleDateFormat("HH:mm:ss,SSS"); + public static final long DATA_FETCH_INTERVAL = 2000; + // public static final String ID_ACTIVE_THREAD_COUNT="ATC"; + // public static final String ID_HOST_INFO="HI"; + // public static final String ID_GC_STAT="GS"; + // public static final String ID_HEAP_MEMORY_USAGE_STAT="HMU"; + // public static final String ID_NON_HEAP_MEMORY_USAGE_STAT="NHMU"; + + public static final int DATA_TYPE_REQUEST = 1; + public static final int DATA_TYPE_RESPONSE = 2; + public static final int DATA_TYPE_UNCAUGHT_EXCEPTION = 11; + + // public static final int DATA_TYPE_HOST_INFO=1000; + // public static final int DATA_TYPE_ACTIVE_THREAD_COUNT=1100; + // public static final int DATA_TYPE_GC_STAT=1500; + // public static final int DATA_TYPE_HEAP_MEMORY_STAT=1510; + // public static final int DATA_TYPE_NON_HEAP_MEMORY_STAT=1520; + + public static final String CLASS_NAME_REQUEST_TRACER = "com.profiler.trace.RequestTransactionTracer"; + public static final String CLASS_NAME_REQUEST_THRIFT_DTO = "com.profiler.dto.RequestThriftDTO"; + public static final String CLASS_NAME_REQUEST_DATA_TRACER = "com.profiler.trace.RequestDataTracer"; + public static final String CLASS_NAME_AGENT_STATE_MANAGER = "com.profiler.thread.AgentStateManager"; + + public static final int REQ_DATA_TYPE_DB_GET_CONNECTION = 1; + public static final int REQ_DATA_TYPE_DB_CREATE_STATEMENT = 11; + public static final int REQ_DATA_TYPE_DB_GET_PREPARED_STATEMENT = 12; + public static final int REQ_DATA_TYPE_DB_QUERY = 21; + public static final int REQ_DATA_TYPE_DB_EXECUTE_QUERY = 31; + public static final int REQ_DATA_TYPE_DB_EXECUTE_UPDATE = 32; + public static final int REQ_DATA_TYPE_DB_FETCH = 41; + public static final int REQ_DATA_TYPE_DB_RESULTSET_CLOSE = 42; + public static final int REQ_DATA_TYPE_DB_PREPARED_STATEMENT_PARAM = 51; + public static final int REQ_DATA_TYPE_DB_CLOSE_CONNECTION = 99; } diff --git a/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java b/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java index b9b588ea5..5ee67394a 100644 --- a/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java +++ b/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java @@ -23,24 +23,23 @@ public class JVMInfoThriftDTO implements org.apache.thrift.TBase, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - - static { - schemes.put(StandardScheme.class, - new JVMInfoThriftDTOStandardSchemeFactory()); + + static { + schemes.put(StandardScheme.class, new JVMInfoThriftDTOStandardSchemeFactory()); schemes.put(TupleScheme.class, new JVMInfoThriftDTOTupleSchemeFactory()); } @@ -62,14 +61,8 @@ public class JVMInfoThriftDTO implements org.apache.thrift.TBase byName = new HashMap(); @@ -121,8 +114,7 @@ public class JVMInfoThriftDTO implements org.apache.thrift.TBase 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.AGENT_HASH_CODE, - new org.apache.thrift.meta_data.FieldMetaData("agentHashCode", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA_TIME, - new org.apache.thrift.meta_data.FieldMetaData("dataTime", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.ACTIVE_THREAD_COUNT, - new org.apache.thrift.meta_data.FieldMetaData( - "activeThreadCount", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.GC1_COUNT, - new org.apache.thrift.meta_data.FieldMetaData("gc1Count", - org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.GC1_TIME, - new org.apache.thrift.meta_data.FieldMetaData("gc1Time", - org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.GC2_COUNT, - new org.apache.thrift.meta_data.FieldMetaData("gc2Count", - org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.GC2_TIME, - new org.apache.thrift.meta_data.FieldMetaData("gc2Time", - org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.HEAP_USED, - new org.apache.thrift.meta_data.FieldMetaData("heapUsed", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.HEAP_COMMITTED, - new org.apache.thrift.meta_data.FieldMetaData("heapCommitted", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.NON_HEAP_USED, - new org.apache.thrift.meta_data.FieldMetaData("nonHeapUsed", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.NON_HEAP_COMMITTED, - new org.apache.thrift.meta_data.FieldMetaData( - "nonHeapCommitted", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.PROCESS_CPUTIME, - new org.apache.thrift.meta_data.FieldMetaData("processCPUTime", - org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.DOUBLE))); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.AGENT_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("agentHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.ACTIVE_THREAD_COUNT, new org.apache.thrift.meta_data.FieldMetaData("activeThreadCount", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.GC1_COUNT, new org.apache.thrift.meta_data.FieldMetaData("gc1Count", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.GC1_TIME, new org.apache.thrift.meta_data.FieldMetaData("gc1Time", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.GC2_COUNT, new org.apache.thrift.meta_data.FieldMetaData("gc2Count", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.GC2_TIME, new org.apache.thrift.meta_data.FieldMetaData("gc2Time", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.HEAP_USED, new org.apache.thrift.meta_data.FieldMetaData("heapUsed", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.HEAP_COMMITTED, new org.apache.thrift.meta_data.FieldMetaData("heapCommitted", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.NON_HEAP_USED, new org.apache.thrift.meta_data.FieldMetaData("nonHeapUsed", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.NON_HEAP_COMMITTED, new org.apache.thrift.meta_data.FieldMetaData("nonHeapCommitted", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.PROCESS_CPUTIME, new org.apache.thrift.meta_data.FieldMetaData("processCPUTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( - JVMInfoThriftDTO.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JVMInfoThriftDTO.class, metaDataMap); } public JVMInfoThriftDTO() { } - public JVMInfoThriftDTO(int agentHashCode, long dataTime, - int activeThreadCount, long heapUsed, long heapCommitted, - long nonHeapUsed, long nonHeapCommitted) { + public JVMInfoThriftDTO(int agentHashCode, long dataTime, int activeThreadCount, long heapUsed, long heapCommitted, long nonHeapUsed, long nonHeapCommitted) { this(); this.agentHashCode = agentHashCode; setAgentHashCodeIsSet(true); @@ -918,10 +855,8 @@ public class JVMInfoThriftDTO implements org.apache.thrift.TBase { + private static class JVMInfoThriftDTOStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, - JVMInfoThriftDTO struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { @@ -1235,8 +1137,7 @@ public class JVMInfoThriftDTO implements org.apache.thrift.TBase { + private static class JVMInfoThriftDTOTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, - JVMInfoThriftDTO struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetAgentHashCode()) { @@ -1499,8 +1384,7 @@ public class JVMInfoThriftDTO 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("RequestDataListThriftDTO"); - - private static final org.apache.thrift.protocol.TField HOST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("hostHashCode", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField REQUEST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("requestHashCode", org.apache.thrift.protocol.TType.I32, (short)2); - private static final org.apache.thrift.protocol.TField REQUEST_DATA_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("requestDataList", org.apache.thrift.protocol.TType.LIST, (short)3); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new RequestDataListThriftDTOStandardSchemeFactory()); - schemes.put(TupleScheme.class, new RequestDataListThriftDTOTupleSchemeFactory()); - } - - public int hostHashCode; // required - public int requestHashCode; // required - public List requestDataList; // 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 { - HOST_HASH_CODE((short)1, "hostHashCode"), - REQUEST_HASH_CODE((short)2, "requestHashCode"), - REQUEST_DATA_LIST((short)3, "requestDataList"); - - 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: // HOST_HASH_CODE - return HOST_HASH_CODE; - case 2: // REQUEST_HASH_CODE - return REQUEST_HASH_CODE; - case 3: // REQUEST_DATA_LIST - return REQUEST_DATA_LIST; - 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 __HOSTHASHCODE_ISSET_ID = 0; - private static final int __REQUESTHASHCODE_ISSET_ID = 1; - private BitSet __isset_bit_vector = new BitSet(2); - 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.HOST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("hostHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.REQUEST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("requestHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.REQUEST_DATA_LIST, new org.apache.thrift.meta_data.FieldMetaData("requestDataList", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RequestDataThriftDTO.class)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestDataListThriftDTO.class, metaDataMap); - } - - public RequestDataListThriftDTO() { - } - - public RequestDataListThriftDTO( - int hostHashCode, - int requestHashCode, - List requestDataList) - { - this(); - this.hostHashCode = hostHashCode; - setHostHashCodeIsSet(true); - this.requestHashCode = requestHashCode; - setRequestHashCodeIsSet(true); - this.requestDataList = requestDataList; - } - - /** - * Performs a deep copy on other. - */ - public RequestDataListThriftDTO(RequestDataListThriftDTO other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); - this.hostHashCode = other.hostHashCode; - this.requestHashCode = other.requestHashCode; - if (other.isSetRequestDataList()) { - List __this__requestDataList = new ArrayList(); - for (RequestDataThriftDTO other_element : other.requestDataList) { - __this__requestDataList.add(new RequestDataThriftDTO(other_element)); - } - this.requestDataList = __this__requestDataList; - } - } - - public RequestDataListThriftDTO deepCopy() { - return new RequestDataListThriftDTO(this); - } - - @Override - public void clear() { - setHostHashCodeIsSet(false); - this.hostHashCode = 0; - setRequestHashCodeIsSet(false); - this.requestHashCode = 0; - this.requestDataList = null; - } - - public int getHostHashCode() { - return this.hostHashCode; - } - - public RequestDataListThriftDTO setHostHashCode(int hostHashCode) { - this.hostHashCode = hostHashCode; - setHostHashCodeIsSet(true); - return this; - } - - public void unsetHostHashCode() { - __isset_bit_vector.clear(__HOSTHASHCODE_ISSET_ID); - } - - /** Returns true if field hostHashCode is set (has been assigned a value) and false otherwise */ - public boolean isSetHostHashCode() { - return __isset_bit_vector.get(__HOSTHASHCODE_ISSET_ID); - } - - public void setHostHashCodeIsSet(boolean value) { - __isset_bit_vector.set(__HOSTHASHCODE_ISSET_ID, value); - } - - public int getRequestHashCode() { - return this.requestHashCode; - } - - public RequestDataListThriftDTO setRequestHashCode(int requestHashCode) { - this.requestHashCode = requestHashCode; - setRequestHashCodeIsSet(true); - return this; - } - - public void unsetRequestHashCode() { - __isset_bit_vector.clear(__REQUESTHASHCODE_ISSET_ID); - } - - /** Returns true if field requestHashCode is set (has been assigned a value) and false otherwise */ - public boolean isSetRequestHashCode() { - return __isset_bit_vector.get(__REQUESTHASHCODE_ISSET_ID); - } - - public void setRequestHashCodeIsSet(boolean value) { - __isset_bit_vector.set(__REQUESTHASHCODE_ISSET_ID, value); - } - - public int getRequestDataListSize() { - return (this.requestDataList == null) ? 0 : this.requestDataList.size(); - } - - public java.util.Iterator getRequestDataListIterator() { - return (this.requestDataList == null) ? null : this.requestDataList.iterator(); - } - - public void addToRequestDataList(RequestDataThriftDTO elem) { - if (this.requestDataList == null) { - this.requestDataList = new ArrayList(); - } - this.requestDataList.add(elem); - } - - public List getRequestDataList() { - return this.requestDataList; - } - - public RequestDataListThriftDTO setRequestDataList(List requestDataList) { - this.requestDataList = requestDataList; - return this; - } - - public void unsetRequestDataList() { - this.requestDataList = null; - } - - /** Returns true if field requestDataList is set (has been assigned a value) and false otherwise */ - public boolean isSetRequestDataList() { - return this.requestDataList != null; - } - - public void setRequestDataListIsSet(boolean value) { - if (!value) { - this.requestDataList = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case HOST_HASH_CODE: - if (value == null) { - unsetHostHashCode(); - } else { - setHostHashCode((Integer)value); - } - break; - - case REQUEST_HASH_CODE: - if (value == null) { - unsetRequestHashCode(); - } else { - setRequestHashCode((Integer)value); - } - break; - - case REQUEST_DATA_LIST: - if (value == null) { - unsetRequestDataList(); - } else { - setRequestDataList((List)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case HOST_HASH_CODE: - return Integer.valueOf(getHostHashCode()); - - case REQUEST_HASH_CODE: - return Integer.valueOf(getRequestHashCode()); - - case REQUEST_DATA_LIST: - return getRequestDataList(); - - } - 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 HOST_HASH_CODE: - return isSetHostHashCode(); - case REQUEST_HASH_CODE: - return isSetRequestHashCode(); - case REQUEST_DATA_LIST: - return isSetRequestDataList(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof RequestDataListThriftDTO) - return this.equals((RequestDataListThriftDTO)that); - return false; - } - - public boolean equals(RequestDataListThriftDTO that) { - if (that == null) - return false; - - boolean this_present_hostHashCode = true; - boolean that_present_hostHashCode = true; - if (this_present_hostHashCode || that_present_hostHashCode) { - if (!(this_present_hostHashCode && that_present_hostHashCode)) - return false; - if (this.hostHashCode != that.hostHashCode) - return false; - } - - boolean this_present_requestHashCode = true; - boolean that_present_requestHashCode = true; - if (this_present_requestHashCode || that_present_requestHashCode) { - if (!(this_present_requestHashCode && that_present_requestHashCode)) - return false; - if (this.requestHashCode != that.requestHashCode) - return false; - } - - boolean this_present_requestDataList = true && this.isSetRequestDataList(); - boolean that_present_requestDataList = true && that.isSetRequestDataList(); - if (this_present_requestDataList || that_present_requestDataList) { - if (!(this_present_requestDataList && that_present_requestDataList)) - return false; - if (!this.requestDataList.equals(that.requestDataList)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(RequestDataListThriftDTO other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - RequestDataListThriftDTO typedOther = (RequestDataListThriftDTO)other; - - lastComparison = Boolean.valueOf(isSetHostHashCode()).compareTo(typedOther.isSetHostHashCode()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetHostHashCode()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostHashCode, typedOther.hostHashCode); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetRequestHashCode()).compareTo(typedOther.isSetRequestHashCode()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRequestHashCode()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestHashCode, typedOther.requestHashCode); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetRequestDataList()).compareTo(typedOther.isSetRequestDataList()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRequestDataList()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestDataList, typedOther.requestDataList); - 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("RequestDataListThriftDTO("); - boolean first = true; - - sb.append("hostHashCode:"); - sb.append(this.hostHashCode); - first = false; - if (!first) sb.append(", "); - sb.append("requestHashCode:"); - sb.append(this.requestHashCode); - first = false; - if (!first) sb.append(", "); - sb.append("requestDataList:"); - if (this.requestDataList == null) { - sb.append("null"); - } else { - sb.append(this.requestDataList); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bit_vector = new BitSet(1); - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class RequestDataListThriftDTOStandardSchemeFactory implements SchemeFactory { - public RequestDataListThriftDTOStandardScheme getScheme() { - return new RequestDataListThriftDTOStandardScheme(); - } - } - - private static class RequestDataListThriftDTOStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, RequestDataListThriftDTO 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: // HOST_HASH_CODE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.hostHashCode = iprot.readI32(); - struct.setHostHashCodeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // REQUEST_HASH_CODE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.requestHashCode = iprot.readI32(); - struct.setRequestHashCodeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // REQUEST_DATA_LIST - if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { - { - org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); - struct.requestDataList = new ArrayList(_list0.size); - for (int _i1 = 0; _i1 < _list0.size; ++_i1) - { - RequestDataThriftDTO _elem2; // required - _elem2 = new RequestDataThriftDTO(); - _elem2.read(iprot); - struct.requestDataList.add(_elem2); - } - iprot.readListEnd(); - } - struct.setRequestDataListIsSet(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, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(HOST_HASH_CODE_FIELD_DESC); - oprot.writeI32(struct.hostHashCode); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(REQUEST_HASH_CODE_FIELD_DESC); - oprot.writeI32(struct.requestHashCode); - oprot.writeFieldEnd(); - if (struct.requestDataList != null) { - oprot.writeFieldBegin(REQUEST_DATA_LIST_FIELD_DESC); - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.requestDataList.size())); - for (RequestDataThriftDTO _iter3 : struct.requestDataList) - { - _iter3.write(oprot); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class RequestDataListThriftDTOTupleSchemeFactory implements SchemeFactory { - public RequestDataListThriftDTOTupleScheme getScheme() { - return new RequestDataListThriftDTOTupleScheme(); - } - } - - private static class RequestDataListThriftDTOTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetHostHashCode()) { - optionals.set(0); - } - if (struct.isSetRequestHashCode()) { - optionals.set(1); - } - if (struct.isSetRequestDataList()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetHostHashCode()) { - oprot.writeI32(struct.hostHashCode); - } - if (struct.isSetRequestHashCode()) { - oprot.writeI32(struct.requestHashCode); - } - if (struct.isSetRequestDataList()) { - { - oprot.writeI32(struct.requestDataList.size()); - for (RequestDataThriftDTO _iter4 : struct.requestDataList) - { - _iter4.write(oprot); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.hostHashCode = iprot.readI32(); - struct.setHostHashCodeIsSet(true); - } - if (incoming.get(1)) { - struct.requestHashCode = iprot.readI32(); - struct.setRequestHashCodeIsSet(true); - } - if (incoming.get(2)) { - { - org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.requestDataList = new ArrayList(_list5.size); - for (int _i6 = 0; _i6 < _list5.size; ++_i6) - { - RequestDataThriftDTO _elem7; // required - _elem7 = new RequestDataThriftDTO(); - _elem7.read(iprot); - struct.requestDataList.add(_elem7); - } - } - struct.setRequestDataListIsSet(true); - } - } - } + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RequestDataListThriftDTO"); + + private static final org.apache.thrift.protocol.TField HOST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("hostHashCode", org.apache.thrift.protocol.TType.I32, (short) 1); + private static final org.apache.thrift.protocol.TField REQUEST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("requestHashCode", org.apache.thrift.protocol.TType.I32, (short) 2); + private static final org.apache.thrift.protocol.TField REQUEST_DATA_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("requestDataList", org.apache.thrift.protocol.TType.LIST, (short) 3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RequestDataListThriftDTOStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RequestDataListThriftDTOTupleSchemeFactory()); + } + + public int hostHashCode; // required + public int requestHashCode; // required + public List requestDataList; // 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 { + HOST_HASH_CODE((short) 1, "hostHashCode"), REQUEST_HASH_CODE((short) 2, "requestHashCode"), REQUEST_DATA_LIST((short) 3, "requestDataList"); + + 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: // HOST_HASH_CODE + return HOST_HASH_CODE; + case 2: // REQUEST_HASH_CODE + return REQUEST_HASH_CODE; + case 3: // REQUEST_DATA_LIST + return REQUEST_DATA_LIST; + 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 __HOSTHASHCODE_ISSET_ID = 0; + private static final int __REQUESTHASHCODE_ISSET_ID = 1; + private BitSet __isset_bit_vector = new BitSet(2); + 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.HOST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("hostHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.REQUEST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("requestHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.REQUEST_DATA_LIST, new org.apache.thrift.meta_data.FieldMetaData("requestDataList", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, RequestDataThriftDTO.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestDataListThriftDTO.class, metaDataMap); + } + + public RequestDataListThriftDTO() { + } + + public RequestDataListThriftDTO(int hostHashCode, int requestHashCode, List requestDataList) { + this(); + this.hostHashCode = hostHashCode; + setHostHashCodeIsSet(true); + this.requestHashCode = requestHashCode; + setRequestHashCodeIsSet(true); + this.requestDataList = requestDataList; + } + + /** + * Performs a deep copy on other. + */ + public RequestDataListThriftDTO(RequestDataListThriftDTO other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.hostHashCode = other.hostHashCode; + this.requestHashCode = other.requestHashCode; + if (other.isSetRequestDataList()) { + List __this__requestDataList = new ArrayList(); + for (RequestDataThriftDTO other_element : other.requestDataList) { + __this__requestDataList.add(new RequestDataThriftDTO(other_element)); + } + this.requestDataList = __this__requestDataList; + } + } + + public RequestDataListThriftDTO deepCopy() { + return new RequestDataListThriftDTO(this); + } + + @Override + public void clear() { + setHostHashCodeIsSet(false); + this.hostHashCode = 0; + setRequestHashCodeIsSet(false); + this.requestHashCode = 0; + this.requestDataList = null; + } + + public int getHostHashCode() { + return this.hostHashCode; + } + + public RequestDataListThriftDTO setHostHashCode(int hostHashCode) { + this.hostHashCode = hostHashCode; + setHostHashCodeIsSet(true); + return this; + } + + public void unsetHostHashCode() { + __isset_bit_vector.clear(__HOSTHASHCODE_ISSET_ID); + } + + /** + * Returns true if field hostHashCode is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetHostHashCode() { + return __isset_bit_vector.get(__HOSTHASHCODE_ISSET_ID); + } + + public void setHostHashCodeIsSet(boolean value) { + __isset_bit_vector.set(__HOSTHASHCODE_ISSET_ID, value); + } + + public int getRequestHashCode() { + return this.requestHashCode; + } + + public RequestDataListThriftDTO setRequestHashCode(int requestHashCode) { + this.requestHashCode = requestHashCode; + setRequestHashCodeIsSet(true); + return this; + } + + public void unsetRequestHashCode() { + __isset_bit_vector.clear(__REQUESTHASHCODE_ISSET_ID); + } + + /** + * Returns true if field requestHashCode is set (has been assigned a value) + * and false otherwise + */ + public boolean isSetRequestHashCode() { + return __isset_bit_vector.get(__REQUESTHASHCODE_ISSET_ID); + } + + public void setRequestHashCodeIsSet(boolean value) { + __isset_bit_vector.set(__REQUESTHASHCODE_ISSET_ID, value); + } + + public int getRequestDataListSize() { + return (this.requestDataList == null) ? 0 : this.requestDataList.size(); + } + + public java.util.Iterator getRequestDataListIterator() { + return (this.requestDataList == null) ? null : this.requestDataList.iterator(); + } + + public void addToRequestDataList(RequestDataThriftDTO elem) { + if (this.requestDataList == null) { + this.requestDataList = new ArrayList(); + } + this.requestDataList.add(elem); + } + + public List getRequestDataList() { + return this.requestDataList; + } + + public RequestDataListThriftDTO setRequestDataList(List requestDataList) { + this.requestDataList = requestDataList; + return this; + } + + public void unsetRequestDataList() { + this.requestDataList = null; + } + + /** + * Returns true if field requestDataList is set (has been assigned a value) + * and false otherwise + */ + public boolean isSetRequestDataList() { + return this.requestDataList != null; + } + + public void setRequestDataListIsSet(boolean value) { + if (!value) { + this.requestDataList = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HOST_HASH_CODE: + if (value == null) { + unsetHostHashCode(); + } else { + setHostHashCode((Integer) value); + } + break; + + case REQUEST_HASH_CODE: + if (value == null) { + unsetRequestHashCode(); + } else { + setRequestHashCode((Integer) value); + } + break; + + case REQUEST_DATA_LIST: + if (value == null) { + unsetRequestDataList(); + } else { + setRequestDataList((List) value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HOST_HASH_CODE: + return Integer.valueOf(getHostHashCode()); + + case REQUEST_HASH_CODE: + return Integer.valueOf(getRequestHashCode()); + + case REQUEST_DATA_LIST: + return getRequestDataList(); + + } + 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 HOST_HASH_CODE: + return isSetHostHashCode(); + case REQUEST_HASH_CODE: + return isSetRequestHashCode(); + case REQUEST_DATA_LIST: + return isSetRequestDataList(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof RequestDataListThriftDTO) + return this.equals((RequestDataListThriftDTO) that); + return false; + } + + public boolean equals(RequestDataListThriftDTO that) { + if (that == null) + return false; + + boolean this_present_hostHashCode = true; + boolean that_present_hostHashCode = true; + if (this_present_hostHashCode || that_present_hostHashCode) { + if (!(this_present_hostHashCode && that_present_hostHashCode)) + return false; + if (this.hostHashCode != that.hostHashCode) + return false; + } + + boolean this_present_requestHashCode = true; + boolean that_present_requestHashCode = true; + if (this_present_requestHashCode || that_present_requestHashCode) { + if (!(this_present_requestHashCode && that_present_requestHashCode)) + return false; + if (this.requestHashCode != that.requestHashCode) + return false; + } + + boolean this_present_requestDataList = true && this.isSetRequestDataList(); + boolean that_present_requestDataList = true && that.isSetRequestDataList(); + if (this_present_requestDataList || that_present_requestDataList) { + if (!(this_present_requestDataList && that_present_requestDataList)) + return false; + if (!this.requestDataList.equals(that.requestDataList)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(RequestDataListThriftDTO other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + RequestDataListThriftDTO typedOther = (RequestDataListThriftDTO) other; + + lastComparison = Boolean.valueOf(isSetHostHashCode()).compareTo(typedOther.isSetHostHashCode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHostHashCode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostHashCode, typedOther.hostHashCode); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestHashCode()).compareTo(typedOther.isSetRequestHashCode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestHashCode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestHashCode, typedOther.requestHashCode); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestDataList()).compareTo(typedOther.isSetRequestDataList()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestDataList()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestDataList, typedOther.requestDataList); + 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("RequestDataListThriftDTO("); + boolean first = true; + + sb.append("hostHashCode:"); + sb.append(this.hostHashCode); + first = false; + if (!first) + sb.append(", "); + sb.append("requestHashCode:"); + sb.append(this.requestHashCode); + first = false; + if (!first) + sb.append(", "); + sb.append("requestDataList:"); + if (this.requestDataList == null) { + sb.append("null"); + } else { + sb.append(this.requestDataList); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java + // serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class RequestDataListThriftDTOStandardSchemeFactory implements SchemeFactory { + public RequestDataListThriftDTOStandardScheme getScheme() { + return new RequestDataListThriftDTOStandardScheme(); + } + } + + private static class RequestDataListThriftDTOStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, RequestDataListThriftDTO 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: // HOST_HASH_CODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.hostHashCode = iprot.readI32(); + struct.setHostHashCodeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REQUEST_HASH_CODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.requestHashCode = iprot.readI32(); + struct.setRequestHashCodeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // REQUEST_DATA_LIST + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); + struct.requestDataList = new ArrayList(_list0.size); + for (int _i1 = 0; _i1 < _list0.size; ++_i1) { + RequestDataThriftDTO _elem2; // required + _elem2 = new RequestDataThriftDTO(); + _elem2.read(iprot); + struct.requestDataList.add(_elem2); + } + iprot.readListEnd(); + } + struct.setRequestDataListIsSet(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, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(HOST_HASH_CODE_FIELD_DESC); + oprot.writeI32(struct.hostHashCode); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(REQUEST_HASH_CODE_FIELD_DESC); + oprot.writeI32(struct.requestHashCode); + oprot.writeFieldEnd(); + if (struct.requestDataList != null) { + oprot.writeFieldBegin(REQUEST_DATA_LIST_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.requestDataList.size())); + for (RequestDataThriftDTO _iter3 : struct.requestDataList) { + _iter3.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RequestDataListThriftDTOTupleSchemeFactory implements SchemeFactory { + public RequestDataListThriftDTOTupleScheme getScheme() { + return new RequestDataListThriftDTOTupleScheme(); + } + } + + private static class RequestDataListThriftDTOTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHostHashCode()) { + optionals.set(0); + } + if (struct.isSetRequestHashCode()) { + optionals.set(1); + } + if (struct.isSetRequestDataList()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetHostHashCode()) { + oprot.writeI32(struct.hostHashCode); + } + if (struct.isSetRequestHashCode()) { + oprot.writeI32(struct.requestHashCode); + } + if (struct.isSetRequestDataList()) { + { + oprot.writeI32(struct.requestDataList.size()); + for (RequestDataThriftDTO _iter4 : struct.requestDataList) { + _iter4.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, RequestDataListThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.hostHashCode = iprot.readI32(); + struct.setHostHashCodeIsSet(true); + } + if (incoming.get(1)) { + struct.requestHashCode = iprot.readI32(); + struct.setRequestHashCodeIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.requestDataList = new ArrayList(_list5.size); + for (int _i6 = 0; _i6 < _list5.size; ++_i6) { + RequestDataThriftDTO _elem7; // required + _elem7 = new RequestDataThriftDTO(); + _elem7.read(iprot); + struct.requestDataList.add(_elem7); + } + } + struct.setRequestDataListIsSet(true); + } + } + } } - diff --git a/src/main/java/com/profiler/dto/RequestDataThriftDTO.java b/src/main/java/com/profiler/dto/RequestDataThriftDTO.java index 67dd33c07..6ca3c0207 100644 --- a/src/main/java/com/profiler/dto/RequestDataThriftDTO.java +++ b/src/main/java/com/profiler/dto/RequestDataThriftDTO.java @@ -6,1544 +6,1569 @@ */ package com.profiler.dto; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; - import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.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 RequestDataThriftDTO 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("RequestDataThriftDTO"); - - private static final org.apache.thrift.protocol.TField DATA_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataType", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short)2); - private static final org.apache.thrift.protocol.TField DATA_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataHashCode", org.apache.thrift.protocol.TType.I32, (short)3); - private static final org.apache.thrift.protocol.TField DATA_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("dataString", org.apache.thrift.protocol.TType.STRING, (short)4); - private static final org.apache.thrift.protocol.TField EXTRA_DATA1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData1", org.apache.thrift.protocol.TType.STRING, (short)5); - private static final org.apache.thrift.protocol.TField EXTRA_DATA2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData2", org.apache.thrift.protocol.TType.STRING, (short)6); - private static final org.apache.thrift.protocol.TField EXTRA_DATA3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData3", org.apache.thrift.protocol.TType.STRING, (short)7); - private static final org.apache.thrift.protocol.TField EXTRA_INT1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt1", org.apache.thrift.protocol.TType.I32, (short)8); - private static final org.apache.thrift.protocol.TField EXTRA_INT2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt2", org.apache.thrift.protocol.TType.I32, (short)9); - private static final org.apache.thrift.protocol.TField EXTRA_INT3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt3", org.apache.thrift.protocol.TType.I32, (short)10); - private static final org.apache.thrift.protocol.TField EXTRA_LONG1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong1", org.apache.thrift.protocol.TType.I64, (short)11); - private static final org.apache.thrift.protocol.TField EXTRA_LONG2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong2", org.apache.thrift.protocol.TType.I64, (short)12); - private static final org.apache.thrift.protocol.TField EXTRA_LONG3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong3", org.apache.thrift.protocol.TType.I64, (short)13); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new RequestDataThriftDTOStandardSchemeFactory()); - schemes.put(TupleScheme.class, new RequestDataThriftDTOTupleSchemeFactory()); - } - - public int dataType; // required - public long dataTime; // required - public int dataHashCode; // optional - public String dataString; // optional - public String extraData1; // optional - public String extraData2; // optional - public String extraData3; // optional - public int extraInt1; // optional - public int extraInt2; // optional - public int extraInt3; // optional - public long extraLong1; // optional - public long extraLong2; // optional - public long extraLong3; // optional - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - DATA_TYPE((short)1, "dataType"), - DATA_TIME((short)2, "dataTime"), - DATA_HASH_CODE((short)3, "dataHashCode"), - DATA_STRING((short)4, "dataString"), - EXTRA_DATA1((short)5, "extraData1"), - EXTRA_DATA2((short)6, "extraData2"), - EXTRA_DATA3((short)7, "extraData3"), - EXTRA_INT1((short)8, "extraInt1"), - EXTRA_INT2((short)9, "extraInt2"), - EXTRA_INT3((short)10, "extraInt3"), - EXTRA_LONG1((short)11, "extraLong1"), - EXTRA_LONG2((short)12, "extraLong2"), - EXTRA_LONG3((short)13, "extraLong3"); - - 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: // DATA_TYPE - return DATA_TYPE; - case 2: // DATA_TIME - return DATA_TIME; - case 3: // DATA_HASH_CODE - return DATA_HASH_CODE; - case 4: // DATA_STRING - return DATA_STRING; - case 5: // EXTRA_DATA1 - return EXTRA_DATA1; - case 6: // EXTRA_DATA2 - return EXTRA_DATA2; - case 7: // EXTRA_DATA3 - return EXTRA_DATA3; - case 8: // EXTRA_INT1 - return EXTRA_INT1; - case 9: // EXTRA_INT2 - return EXTRA_INT2; - case 10: // EXTRA_INT3 - return EXTRA_INT3; - case 11: // EXTRA_LONG1 - return EXTRA_LONG1; - case 12: // EXTRA_LONG2 - return EXTRA_LONG2; - case 13: // EXTRA_LONG3 - return EXTRA_LONG3; - 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 __DATATYPE_ISSET_ID = 0; - private static final int __DATATIME_ISSET_ID = 1; - private static final int __DATAHASHCODE_ISSET_ID = 2; - private static final int __EXTRAINT1_ISSET_ID = 3; - private static final int __EXTRAINT2_ISSET_ID = 4; - private static final int __EXTRAINT3_ISSET_ID = 5; - private static final int __EXTRALONG1_ISSET_ID = 6; - private static final int __EXTRALONG2_ISSET_ID = 7; - private static final int __EXTRALONG3_ISSET_ID = 8; - private BitSet __isset_bit_vector = new BitSet(9); - private _Fields optionals[] = {_Fields.DATA_HASH_CODE,_Fields.DATA_STRING,_Fields.EXTRA_DATA1,_Fields.EXTRA_DATA2,_Fields.EXTRA_DATA3,_Fields.EXTRA_INT1,_Fields.EXTRA_INT2,_Fields.EXTRA_INT3,_Fields.EXTRA_LONG1,_Fields.EXTRA_LONG2,_Fields.EXTRA_LONG3}; - 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.DATA_TYPE, new org.apache.thrift.meta_data.FieldMetaData("dataType", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.DATA_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("dataHashCode", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA_STRING, new org.apache.thrift.meta_data.FieldMetaData("dataString", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA1, new org.apache.thrift.meta_data.FieldMetaData("extraData1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA2, new org.apache.thrift.meta_data.FieldMetaData("extraData2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA3, new org.apache.thrift.meta_data.FieldMetaData("extraData3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_INT1, new org.apache.thrift.meta_data.FieldMetaData("extraInt1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_INT2, new org.apache.thrift.meta_data.FieldMetaData("extraInt2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_INT3, new org.apache.thrift.meta_data.FieldMetaData("extraInt3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_LONG1, new org.apache.thrift.meta_data.FieldMetaData("extraLong1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXTRA_LONG2, new org.apache.thrift.meta_data.FieldMetaData("extraLong2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXTRA_LONG3, new org.apache.thrift.meta_data.FieldMetaData("extraLong3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestDataThriftDTO.class, metaDataMap); - } - - public RequestDataThriftDTO() { - } - - public RequestDataThriftDTO( - int dataType, - long dataTime) - { - this(); - this.dataType = dataType; - setDataTypeIsSet(true); - this.dataTime = dataTime; - setDataTimeIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public RequestDataThriftDTO(RequestDataThriftDTO other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); - this.dataType = other.dataType; - this.dataTime = other.dataTime; - this.dataHashCode = other.dataHashCode; - if (other.isSetDataString()) { - this.dataString = other.dataString; - } - if (other.isSetExtraData1()) { - this.extraData1 = other.extraData1; - } - if (other.isSetExtraData2()) { - this.extraData2 = other.extraData2; - } - if (other.isSetExtraData3()) { - this.extraData3 = other.extraData3; - } - this.extraInt1 = other.extraInt1; - this.extraInt2 = other.extraInt2; - this.extraInt3 = other.extraInt3; - this.extraLong1 = other.extraLong1; - this.extraLong2 = other.extraLong2; - this.extraLong3 = other.extraLong3; - } - - public RequestDataThriftDTO deepCopy() { - return new RequestDataThriftDTO(this); - } - - @Override - public void clear() { - setDataTypeIsSet(false); - this.dataType = 0; - setDataTimeIsSet(false); - this.dataTime = 0; - setDataHashCodeIsSet(false); - this.dataHashCode = 0; - this.dataString = null; - this.extraData1 = null; - this.extraData2 = null; - this.extraData3 = null; - setExtraInt1IsSet(false); - this.extraInt1 = 0; - setExtraInt2IsSet(false); - this.extraInt2 = 0; - setExtraInt3IsSet(false); - this.extraInt3 = 0; - setExtraLong1IsSet(false); - this.extraLong1 = 0; - setExtraLong2IsSet(false); - this.extraLong2 = 0; - setExtraLong3IsSet(false); - this.extraLong3 = 0; - } - - public int getDataType() { - return this.dataType; - } - - public RequestDataThriftDTO setDataType(int dataType) { - this.dataType = dataType; - setDataTypeIsSet(true); - return this; - } - - public void unsetDataType() { - __isset_bit_vector.clear(__DATATYPE_ISSET_ID); - } - - /** Returns true if field dataType is set (has been assigned a value) and false otherwise */ - public boolean isSetDataType() { - return __isset_bit_vector.get(__DATATYPE_ISSET_ID); - } - - public void setDataTypeIsSet(boolean value) { - __isset_bit_vector.set(__DATATYPE_ISSET_ID, value); - } - - public long getDataTime() { - return this.dataTime; - } - - public RequestDataThriftDTO setDataTime(long dataTime) { - this.dataTime = dataTime; - setDataTimeIsSet(true); - return this; - } - - public void unsetDataTime() { - __isset_bit_vector.clear(__DATATIME_ISSET_ID); - } - - /** Returns true if field dataTime is set (has been assigned a value) and false otherwise */ - public boolean isSetDataTime() { - return __isset_bit_vector.get(__DATATIME_ISSET_ID); - } - - public void setDataTimeIsSet(boolean value) { - __isset_bit_vector.set(__DATATIME_ISSET_ID, value); - } - - public int getDataHashCode() { - return this.dataHashCode; - } - - public RequestDataThriftDTO setDataHashCode(int dataHashCode) { - this.dataHashCode = dataHashCode; - setDataHashCodeIsSet(true); - return this; - } - - public void unsetDataHashCode() { - __isset_bit_vector.clear(__DATAHASHCODE_ISSET_ID); - } - - /** Returns true if field dataHashCode is set (has been assigned a value) and false otherwise */ - public boolean isSetDataHashCode() { - return __isset_bit_vector.get(__DATAHASHCODE_ISSET_ID); - } - - public void setDataHashCodeIsSet(boolean value) { - __isset_bit_vector.set(__DATAHASHCODE_ISSET_ID, value); - } - - public String getDataString() { - return this.dataString; - } - - public RequestDataThriftDTO setDataString(String dataString) { - this.dataString = dataString; - return this; - } - - public void unsetDataString() { - this.dataString = null; - } - - /** Returns true if field dataString is set (has been assigned a value) and false otherwise */ - public boolean isSetDataString() { - return this.dataString != null; - } - - public void setDataStringIsSet(boolean value) { - if (!value) { - this.dataString = null; - } - } - - public String getExtraData1() { - return this.extraData1; - } - - public RequestDataThriftDTO setExtraData1(String extraData1) { - this.extraData1 = extraData1; - return this; - } - - public void unsetExtraData1() { - this.extraData1 = null; - } - - /** Returns true if field extraData1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData1() { - return this.extraData1 != null; - } - - public void setExtraData1IsSet(boolean value) { - if (!value) { - this.extraData1 = null; - } - } - - public String getExtraData2() { - return this.extraData2; - } - - public RequestDataThriftDTO setExtraData2(String extraData2) { - this.extraData2 = extraData2; - return this; - } - - public void unsetExtraData2() { - this.extraData2 = null; - } - - /** Returns true if field extraData2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData2() { - return this.extraData2 != null; - } - - public void setExtraData2IsSet(boolean value) { - if (!value) { - this.extraData2 = null; - } - } - - public String getExtraData3() { - return this.extraData3; - } - - public RequestDataThriftDTO setExtraData3(String extraData3) { - this.extraData3 = extraData3; - return this; - } - - public void unsetExtraData3() { - this.extraData3 = null; - } - - /** Returns true if field extraData3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData3() { - return this.extraData3 != null; - } - - public void setExtraData3IsSet(boolean value) { - if (!value) { - this.extraData3 = null; - } - } - - public int getExtraInt1() { - return this.extraInt1; - } - - public RequestDataThriftDTO setExtraInt1(int extraInt1) { - this.extraInt1 = extraInt1; - setExtraInt1IsSet(true); - return this; - } - - public void unsetExtraInt1() { - __isset_bit_vector.clear(__EXTRAINT1_ISSET_ID); - } - - /** Returns true if field extraInt1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt1() { - return __isset_bit_vector.get(__EXTRAINT1_ISSET_ID); - } - - public void setExtraInt1IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT1_ISSET_ID, value); - } - - public int getExtraInt2() { - return this.extraInt2; - } - - public RequestDataThriftDTO setExtraInt2(int extraInt2) { - this.extraInt2 = extraInt2; - setExtraInt2IsSet(true); - return this; - } - - public void unsetExtraInt2() { - __isset_bit_vector.clear(__EXTRAINT2_ISSET_ID); - } - - /** Returns true if field extraInt2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt2() { - return __isset_bit_vector.get(__EXTRAINT2_ISSET_ID); - } - - public void setExtraInt2IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT2_ISSET_ID, value); - } - - public int getExtraInt3() { - return this.extraInt3; - } - - public RequestDataThriftDTO setExtraInt3(int extraInt3) { - this.extraInt3 = extraInt3; - setExtraInt3IsSet(true); - return this; - } - - public void unsetExtraInt3() { - __isset_bit_vector.clear(__EXTRAINT3_ISSET_ID); - } - - /** Returns true if field extraInt3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt3() { - return __isset_bit_vector.get(__EXTRAINT3_ISSET_ID); - } - - public void setExtraInt3IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT3_ISSET_ID, value); - } - - public long getExtraLong1() { - return this.extraLong1; - } - - public RequestDataThriftDTO setExtraLong1(long extraLong1) { - this.extraLong1 = extraLong1; - setExtraLong1IsSet(true); - return this; - } - - public void unsetExtraLong1() { - __isset_bit_vector.clear(__EXTRALONG1_ISSET_ID); - } - - /** Returns true if field extraLong1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong1() { - return __isset_bit_vector.get(__EXTRALONG1_ISSET_ID); - } - - public void setExtraLong1IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG1_ISSET_ID, value); - } - - public long getExtraLong2() { - return this.extraLong2; - } - - public RequestDataThriftDTO setExtraLong2(long extraLong2) { - this.extraLong2 = extraLong2; - setExtraLong2IsSet(true); - return this; - } - - public void unsetExtraLong2() { - __isset_bit_vector.clear(__EXTRALONG2_ISSET_ID); - } - - /** Returns true if field extraLong2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong2() { - return __isset_bit_vector.get(__EXTRALONG2_ISSET_ID); - } - - public void setExtraLong2IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG2_ISSET_ID, value); - } - - public long getExtraLong3() { - return this.extraLong3; - } - - public RequestDataThriftDTO setExtraLong3(long extraLong3) { - this.extraLong3 = extraLong3; - setExtraLong3IsSet(true); - return this; - } - - public void unsetExtraLong3() { - __isset_bit_vector.clear(__EXTRALONG3_ISSET_ID); - } - - /** Returns true if field extraLong3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong3() { - return __isset_bit_vector.get(__EXTRALONG3_ISSET_ID); - } - - public void setExtraLong3IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG3_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case DATA_TYPE: - if (value == null) { - unsetDataType(); - } else { - setDataType((Integer)value); - } - break; - - case DATA_TIME: - if (value == null) { - unsetDataTime(); - } else { - setDataTime((Long)value); - } - break; - - case DATA_HASH_CODE: - if (value == null) { - unsetDataHashCode(); - } else { - setDataHashCode((Integer)value); - } - break; - - case DATA_STRING: - if (value == null) { - unsetDataString(); - } else { - setDataString((String)value); - } - break; - - case EXTRA_DATA1: - if (value == null) { - unsetExtraData1(); - } else { - setExtraData1((String)value); - } - break; - - case EXTRA_DATA2: - if (value == null) { - unsetExtraData2(); - } else { - setExtraData2((String)value); - } - break; - - case EXTRA_DATA3: - if (value == null) { - unsetExtraData3(); - } else { - setExtraData3((String)value); - } - break; - - case EXTRA_INT1: - if (value == null) { - unsetExtraInt1(); - } else { - setExtraInt1((Integer)value); - } - break; - - case EXTRA_INT2: - if (value == null) { - unsetExtraInt2(); - } else { - setExtraInt2((Integer)value); - } - break; - - case EXTRA_INT3: - if (value == null) { - unsetExtraInt3(); - } else { - setExtraInt3((Integer)value); - } - break; - - case EXTRA_LONG1: - if (value == null) { - unsetExtraLong1(); - } else { - setExtraLong1((Long)value); - } - break; - - case EXTRA_LONG2: - if (value == null) { - unsetExtraLong2(); - } else { - setExtraLong2((Long)value); - } - break; - - case EXTRA_LONG3: - if (value == null) { - unsetExtraLong3(); - } else { - setExtraLong3((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case DATA_TYPE: - return Integer.valueOf(getDataType()); - - case DATA_TIME: - return Long.valueOf(getDataTime()); - - case DATA_HASH_CODE: - return Integer.valueOf(getDataHashCode()); - - case DATA_STRING: - return getDataString(); - - case EXTRA_DATA1: - return getExtraData1(); - - case EXTRA_DATA2: - return getExtraData2(); - - case EXTRA_DATA3: - return getExtraData3(); - - case EXTRA_INT1: - return Integer.valueOf(getExtraInt1()); - - case EXTRA_INT2: - return Integer.valueOf(getExtraInt2()); - - case EXTRA_INT3: - return Integer.valueOf(getExtraInt3()); - - case EXTRA_LONG1: - return Long.valueOf(getExtraLong1()); - - case EXTRA_LONG2: - return Long.valueOf(getExtraLong2()); - - case EXTRA_LONG3: - return Long.valueOf(getExtraLong3()); - - } - 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 DATA_TYPE: - return isSetDataType(); - case DATA_TIME: - return isSetDataTime(); - case DATA_HASH_CODE: - return isSetDataHashCode(); - case DATA_STRING: - return isSetDataString(); - case EXTRA_DATA1: - return isSetExtraData1(); - case EXTRA_DATA2: - return isSetExtraData2(); - case EXTRA_DATA3: - return isSetExtraData3(); - case EXTRA_INT1: - return isSetExtraInt1(); - case EXTRA_INT2: - return isSetExtraInt2(); - case EXTRA_INT3: - return isSetExtraInt3(); - case EXTRA_LONG1: - return isSetExtraLong1(); - case EXTRA_LONG2: - return isSetExtraLong2(); - case EXTRA_LONG3: - return isSetExtraLong3(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof RequestDataThriftDTO) - return this.equals((RequestDataThriftDTO)that); - return false; - } - - public boolean equals(RequestDataThriftDTO that) { - if (that == null) - return false; - - boolean this_present_dataType = true; - boolean that_present_dataType = true; - if (this_present_dataType || that_present_dataType) { - if (!(this_present_dataType && that_present_dataType)) - return false; - if (this.dataType != that.dataType) - return false; - } - - boolean this_present_dataTime = true; - boolean that_present_dataTime = true; - if (this_present_dataTime || that_present_dataTime) { - if (!(this_present_dataTime && that_present_dataTime)) - return false; - if (this.dataTime != that.dataTime) - return false; - } - - boolean this_present_dataHashCode = true && this.isSetDataHashCode(); - boolean that_present_dataHashCode = true && that.isSetDataHashCode(); - if (this_present_dataHashCode || that_present_dataHashCode) { - if (!(this_present_dataHashCode && that_present_dataHashCode)) - return false; - if (this.dataHashCode != that.dataHashCode) - return false; - } - - boolean this_present_dataString = true && this.isSetDataString(); - boolean that_present_dataString = true && that.isSetDataString(); - if (this_present_dataString || that_present_dataString) { - if (!(this_present_dataString && that_present_dataString)) - return false; - if (!this.dataString.equals(that.dataString)) - return false; - } - - boolean this_present_extraData1 = true && this.isSetExtraData1(); - boolean that_present_extraData1 = true && that.isSetExtraData1(); - if (this_present_extraData1 || that_present_extraData1) { - if (!(this_present_extraData1 && that_present_extraData1)) - return false; - if (!this.extraData1.equals(that.extraData1)) - return false; - } - - boolean this_present_extraData2 = true && this.isSetExtraData2(); - boolean that_present_extraData2 = true && that.isSetExtraData2(); - if (this_present_extraData2 || that_present_extraData2) { - if (!(this_present_extraData2 && that_present_extraData2)) - return false; - if (!this.extraData2.equals(that.extraData2)) - return false; - } - - boolean this_present_extraData3 = true && this.isSetExtraData3(); - boolean that_present_extraData3 = true && that.isSetExtraData3(); - if (this_present_extraData3 || that_present_extraData3) { - if (!(this_present_extraData3 && that_present_extraData3)) - return false; - if (!this.extraData3.equals(that.extraData3)) - return false; - } - - boolean this_present_extraInt1 = true && this.isSetExtraInt1(); - boolean that_present_extraInt1 = true && that.isSetExtraInt1(); - if (this_present_extraInt1 || that_present_extraInt1) { - if (!(this_present_extraInt1 && that_present_extraInt1)) - return false; - if (this.extraInt1 != that.extraInt1) - return false; - } - - boolean this_present_extraInt2 = true && this.isSetExtraInt2(); - boolean that_present_extraInt2 = true && that.isSetExtraInt2(); - if (this_present_extraInt2 || that_present_extraInt2) { - if (!(this_present_extraInt2 && that_present_extraInt2)) - return false; - if (this.extraInt2 != that.extraInt2) - return false; - } - - boolean this_present_extraInt3 = true && this.isSetExtraInt3(); - boolean that_present_extraInt3 = true && that.isSetExtraInt3(); - if (this_present_extraInt3 || that_present_extraInt3) { - if (!(this_present_extraInt3 && that_present_extraInt3)) - return false; - if (this.extraInt3 != that.extraInt3) - return false; - } - - boolean this_present_extraLong1 = true && this.isSetExtraLong1(); - boolean that_present_extraLong1 = true && that.isSetExtraLong1(); - if (this_present_extraLong1 || that_present_extraLong1) { - if (!(this_present_extraLong1 && that_present_extraLong1)) - return false; - if (this.extraLong1 != that.extraLong1) - return false; - } - - boolean this_present_extraLong2 = true && this.isSetExtraLong2(); - boolean that_present_extraLong2 = true && that.isSetExtraLong2(); - if (this_present_extraLong2 || that_present_extraLong2) { - if (!(this_present_extraLong2 && that_present_extraLong2)) - return false; - if (this.extraLong2 != that.extraLong2) - return false; - } - - boolean this_present_extraLong3 = true && this.isSetExtraLong3(); - boolean that_present_extraLong3 = true && that.isSetExtraLong3(); - if (this_present_extraLong3 || that_present_extraLong3) { - if (!(this_present_extraLong3 && that_present_extraLong3)) - return false; - if (this.extraLong3 != that.extraLong3) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(RequestDataThriftDTO other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - RequestDataThriftDTO typedOther = (RequestDataThriftDTO)other; - - lastComparison = Boolean.valueOf(isSetDataType()).compareTo(typedOther.isSetDataType()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataType()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataType, typedOther.dataType); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(typedOther.isSetDataTime()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataTime()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataTime, typedOther.dataTime); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetDataHashCode()).compareTo(typedOther.isSetDataHashCode()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataHashCode()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataHashCode, typedOther.dataHashCode); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetDataString()).compareTo(typedOther.isSetDataString()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataString()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataString, typedOther.dataString); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData1()).compareTo(typedOther.isSetExtraData1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData1, typedOther.extraData1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData2()).compareTo(typedOther.isSetExtraData2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData2, typedOther.extraData2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData3()).compareTo(typedOther.isSetExtraData3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData3, typedOther.extraData3); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt1()).compareTo(typedOther.isSetExtraInt1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt1, typedOther.extraInt1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt2()).compareTo(typedOther.isSetExtraInt2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt2, typedOther.extraInt2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt3()).compareTo(typedOther.isSetExtraInt3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt3, typedOther.extraInt3); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong1()).compareTo(typedOther.isSetExtraLong1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong1, typedOther.extraLong1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong2()).compareTo(typedOther.isSetExtraLong2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong2, typedOther.extraLong2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong3()).compareTo(typedOther.isSetExtraLong3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong3, typedOther.extraLong3); - 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("RequestDataThriftDTO("); - boolean first = true; - - sb.append("dataType:"); - sb.append(this.dataType); - first = false; - if (!first) sb.append(", "); - sb.append("dataTime:"); - sb.append(this.dataTime); - first = false; - if (isSetDataHashCode()) { - if (!first) sb.append(", "); - sb.append("dataHashCode:"); - sb.append(this.dataHashCode); - first = false; - } - if (isSetDataString()) { - if (!first) sb.append(", "); - sb.append("dataString:"); - if (this.dataString == null) { - sb.append("null"); - } else { - sb.append(this.dataString); - } - first = false; - } - if (isSetExtraData1()) { - if (!first) sb.append(", "); - sb.append("extraData1:"); - if (this.extraData1 == null) { - sb.append("null"); - } else { - sb.append(this.extraData1); - } - first = false; - } - if (isSetExtraData2()) { - if (!first) sb.append(", "); - sb.append("extraData2:"); - if (this.extraData2 == null) { - sb.append("null"); - } else { - sb.append(this.extraData2); - } - first = false; - } - if (isSetExtraData3()) { - if (!first) sb.append(", "); - sb.append("extraData3:"); - if (this.extraData3 == null) { - sb.append("null"); - } else { - sb.append(this.extraData3); - } - first = false; - } - if (isSetExtraInt1()) { - if (!first) sb.append(", "); - sb.append("extraInt1:"); - sb.append(this.extraInt1); - first = false; - } - if (isSetExtraInt2()) { - if (!first) sb.append(", "); - sb.append("extraInt2:"); - sb.append(this.extraInt2); - first = false; - } - if (isSetExtraInt3()) { - if (!first) sb.append(", "); - sb.append("extraInt3:"); - sb.append(this.extraInt3); - first = false; - } - if (isSetExtraLong1()) { - if (!first) sb.append(", "); - sb.append("extraLong1:"); - sb.append(this.extraLong1); - first = false; - } - if (isSetExtraLong2()) { - if (!first) sb.append(", "); - sb.append("extraLong2:"); - sb.append(this.extraLong2); - first = false; - } - if (isSetExtraLong3()) { - if (!first) sb.append(", "); - sb.append("extraLong3:"); - sb.append(this.extraLong3); - first = false; - } - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bit_vector = new BitSet(1); - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class RequestDataThriftDTOStandardSchemeFactory implements SchemeFactory { - public RequestDataThriftDTOStandardScheme getScheme() { - return new RequestDataThriftDTOStandardScheme(); - } - } - - private static class RequestDataThriftDTOStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, RequestDataThriftDTO 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: // DATA_TYPE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.dataType = iprot.readI32(); - struct.setDataTypeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // DATA_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.dataTime = iprot.readI64(); - struct.setDataTimeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // DATA_HASH_CODE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.dataHashCode = iprot.readI32(); - struct.setDataHashCodeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // DATA_STRING - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.dataString = iprot.readString(); - struct.setDataStringIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // EXTRA_DATA1 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData1 = iprot.readString(); - struct.setExtraData1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 6: // EXTRA_DATA2 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData2 = iprot.readString(); - struct.setExtraData2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 7: // EXTRA_DATA3 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData3 = iprot.readString(); - struct.setExtraData3IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 8: // EXTRA_INT1 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt1 = iprot.readI32(); - struct.setExtraInt1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 9: // EXTRA_INT2 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt2 = iprot.readI32(); - struct.setExtraInt2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 10: // EXTRA_INT3 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt3 = iprot.readI32(); - struct.setExtraInt3IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 11: // EXTRA_LONG1 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong1 = iprot.readI64(); - struct.setExtraLong1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 12: // EXTRA_LONG2 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong2 = iprot.readI64(); - struct.setExtraLong2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 13: // EXTRA_LONG3 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong3 = iprot.readI64(); - struct.setExtraLong3IsSet(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, RequestDataThriftDTO struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(DATA_TYPE_FIELD_DESC); - oprot.writeI32(struct.dataType); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(DATA_TIME_FIELD_DESC); - oprot.writeI64(struct.dataTime); - oprot.writeFieldEnd(); - if (struct.isSetDataHashCode()) { - oprot.writeFieldBegin(DATA_HASH_CODE_FIELD_DESC); - oprot.writeI32(struct.dataHashCode); - oprot.writeFieldEnd(); - } - if (struct.dataString != null) { - if (struct.isSetDataString()) { - oprot.writeFieldBegin(DATA_STRING_FIELD_DESC); - oprot.writeString(struct.dataString); - oprot.writeFieldEnd(); - } - } - if (struct.extraData1 != null) { - if (struct.isSetExtraData1()) { - oprot.writeFieldBegin(EXTRA_DATA1_FIELD_DESC); - oprot.writeString(struct.extraData1); - oprot.writeFieldEnd(); - } - } - if (struct.extraData2 != null) { - if (struct.isSetExtraData2()) { - oprot.writeFieldBegin(EXTRA_DATA2_FIELD_DESC); - oprot.writeString(struct.extraData2); - oprot.writeFieldEnd(); - } - } - if (struct.extraData3 != null) { - if (struct.isSetExtraData3()) { - oprot.writeFieldBegin(EXTRA_DATA3_FIELD_DESC); - oprot.writeString(struct.extraData3); - oprot.writeFieldEnd(); - } - } - if (struct.isSetExtraInt1()) { - oprot.writeFieldBegin(EXTRA_INT1_FIELD_DESC); - oprot.writeI32(struct.extraInt1); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraInt2()) { - oprot.writeFieldBegin(EXTRA_INT2_FIELD_DESC); - oprot.writeI32(struct.extraInt2); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraInt3()) { - oprot.writeFieldBegin(EXTRA_INT3_FIELD_DESC); - oprot.writeI32(struct.extraInt3); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong1()) { - oprot.writeFieldBegin(EXTRA_LONG1_FIELD_DESC); - oprot.writeI64(struct.extraLong1); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong2()) { - oprot.writeFieldBegin(EXTRA_LONG2_FIELD_DESC); - oprot.writeI64(struct.extraLong2); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong3()) { - oprot.writeFieldBegin(EXTRA_LONG3_FIELD_DESC); - oprot.writeI64(struct.extraLong3); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class RequestDataThriftDTOTupleSchemeFactory implements SchemeFactory { - public RequestDataThriftDTOTupleScheme getScheme() { - return new RequestDataThriftDTOTupleScheme(); - } - } - - private static class RequestDataThriftDTOTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, RequestDataThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetDataType()) { - optionals.set(0); - } - if (struct.isSetDataTime()) { - optionals.set(1); - } - if (struct.isSetDataHashCode()) { - optionals.set(2); - } - if (struct.isSetDataString()) { - optionals.set(3); - } - if (struct.isSetExtraData1()) { - optionals.set(4); - } - if (struct.isSetExtraData2()) { - optionals.set(5); - } - if (struct.isSetExtraData3()) { - optionals.set(6); - } - if (struct.isSetExtraInt1()) { - optionals.set(7); - } - if (struct.isSetExtraInt2()) { - optionals.set(8); - } - if (struct.isSetExtraInt3()) { - optionals.set(9); - } - if (struct.isSetExtraLong1()) { - optionals.set(10); - } - if (struct.isSetExtraLong2()) { - optionals.set(11); - } - if (struct.isSetExtraLong3()) { - optionals.set(12); - } - oprot.writeBitSet(optionals, 13); - if (struct.isSetDataType()) { - oprot.writeI32(struct.dataType); - } - if (struct.isSetDataTime()) { - oprot.writeI64(struct.dataTime); - } - if (struct.isSetDataHashCode()) { - oprot.writeI32(struct.dataHashCode); - } - if (struct.isSetDataString()) { - oprot.writeString(struct.dataString); - } - if (struct.isSetExtraData1()) { - oprot.writeString(struct.extraData1); - } - if (struct.isSetExtraData2()) { - oprot.writeString(struct.extraData2); - } - if (struct.isSetExtraData3()) { - oprot.writeString(struct.extraData3); - } - if (struct.isSetExtraInt1()) { - oprot.writeI32(struct.extraInt1); - } - if (struct.isSetExtraInt2()) { - oprot.writeI32(struct.extraInt2); - } - if (struct.isSetExtraInt3()) { - oprot.writeI32(struct.extraInt3); - } - if (struct.isSetExtraLong1()) { - oprot.writeI64(struct.extraLong1); - } - if (struct.isSetExtraLong2()) { - oprot.writeI64(struct.extraLong2); - } - if (struct.isSetExtraLong3()) { - oprot.writeI64(struct.extraLong3); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, RequestDataThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(13); - if (incoming.get(0)) { - struct.dataType = iprot.readI32(); - struct.setDataTypeIsSet(true); - } - if (incoming.get(1)) { - struct.dataTime = iprot.readI64(); - struct.setDataTimeIsSet(true); - } - if (incoming.get(2)) { - struct.dataHashCode = iprot.readI32(); - struct.setDataHashCodeIsSet(true); - } - if (incoming.get(3)) { - struct.dataString = iprot.readString(); - struct.setDataStringIsSet(true); - } - if (incoming.get(4)) { - struct.extraData1 = iprot.readString(); - struct.setExtraData1IsSet(true); - } - if (incoming.get(5)) { - struct.extraData2 = iprot.readString(); - struct.setExtraData2IsSet(true); - } - if (incoming.get(6)) { - struct.extraData3 = iprot.readString(); - struct.setExtraData3IsSet(true); - } - if (incoming.get(7)) { - struct.extraInt1 = iprot.readI32(); - struct.setExtraInt1IsSet(true); - } - if (incoming.get(8)) { - struct.extraInt2 = iprot.readI32(); - struct.setExtraInt2IsSet(true); - } - if (incoming.get(9)) { - struct.extraInt3 = iprot.readI32(); - struct.setExtraInt3IsSet(true); - } - if (incoming.get(10)) { - struct.extraLong1 = iprot.readI64(); - struct.setExtraLong1IsSet(true); - } - if (incoming.get(11)) { - struct.extraLong2 = iprot.readI64(); - struct.setExtraLong2IsSet(true); - } - if (incoming.get(12)) { - struct.extraLong3 = iprot.readI64(); - struct.setExtraLong3IsSet(true); - } - } - } + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RequestDataThriftDTO"); + + private static final org.apache.thrift.protocol.TField DATA_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataType", org.apache.thrift.protocol.TType.I32, (short) 1); + private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short) 2); + private static final org.apache.thrift.protocol.TField DATA_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataHashCode", org.apache.thrift.protocol.TType.I32, (short) 3); + private static final org.apache.thrift.protocol.TField DATA_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("dataString", org.apache.thrift.protocol.TType.STRING, (short) 4); + private static final org.apache.thrift.protocol.TField EXTRA_DATA1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData1", org.apache.thrift.protocol.TType.STRING, (short) 5); + private static final org.apache.thrift.protocol.TField EXTRA_DATA2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData2", org.apache.thrift.protocol.TType.STRING, (short) 6); + private static final org.apache.thrift.protocol.TField EXTRA_DATA3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData3", org.apache.thrift.protocol.TType.STRING, (short) 7); + private static final org.apache.thrift.protocol.TField EXTRA_INT1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt1", org.apache.thrift.protocol.TType.I32, (short) 8); + private static final org.apache.thrift.protocol.TField EXTRA_INT2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt2", org.apache.thrift.protocol.TType.I32, (short) 9); + private static final org.apache.thrift.protocol.TField EXTRA_INT3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt3", org.apache.thrift.protocol.TType.I32, (short) 10); + private static final org.apache.thrift.protocol.TField EXTRA_LONG1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong1", org.apache.thrift.protocol.TType.I64, (short) 11); + private static final org.apache.thrift.protocol.TField EXTRA_LONG2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong2", org.apache.thrift.protocol.TType.I64, (short) 12); + private static final org.apache.thrift.protocol.TField EXTRA_LONG3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong3", org.apache.thrift.protocol.TType.I64, (short) 13); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RequestDataThriftDTOStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RequestDataThriftDTOTupleSchemeFactory()); + } + + public int dataType; // required + public long dataTime; // required + public int dataHashCode; // optional + public String dataString; // optional + public String extraData1; // optional + public String extraData2; // optional + public String extraData3; // optional + public int extraInt1; // optional + public int extraInt2; // optional + public int extraInt3; // optional + public long extraLong1; // optional + public long extraLong2; // optional + public long extraLong3; // optional + + /** + * The set of fields this struct contains, along with convenience methods + * for finding and manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DATA_TYPE((short) 1, "dataType"), DATA_TIME((short) 2, "dataTime"), DATA_HASH_CODE((short) 3, "dataHashCode"), DATA_STRING((short) 4, "dataString"), EXTRA_DATA1((short) 5, "extraData1"), EXTRA_DATA2((short) 6, "extraData2"), EXTRA_DATA3((short) 7, "extraData3"), EXTRA_INT1((short) 8, + "extraInt1"), EXTRA_INT2((short) 9, "extraInt2"), EXTRA_INT3((short) 10, "extraInt3"), EXTRA_LONG1((short) 11, "extraLong1"), EXTRA_LONG2((short) 12, "extraLong2"), EXTRA_LONG3((short) 13, "extraLong3"); + + 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: // DATA_TYPE + return DATA_TYPE; + case 2: // DATA_TIME + return DATA_TIME; + case 3: // DATA_HASH_CODE + return DATA_HASH_CODE; + case 4: // DATA_STRING + return DATA_STRING; + case 5: // EXTRA_DATA1 + return EXTRA_DATA1; + case 6: // EXTRA_DATA2 + return EXTRA_DATA2; + case 7: // EXTRA_DATA3 + return EXTRA_DATA3; + case 8: // EXTRA_INT1 + return EXTRA_INT1; + case 9: // EXTRA_INT2 + return EXTRA_INT2; + case 10: // EXTRA_INT3 + return EXTRA_INT3; + case 11: // EXTRA_LONG1 + return EXTRA_LONG1; + case 12: // EXTRA_LONG2 + return EXTRA_LONG2; + case 13: // EXTRA_LONG3 + return EXTRA_LONG3; + 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 __DATATYPE_ISSET_ID = 0; + private static final int __DATATIME_ISSET_ID = 1; + private static final int __DATAHASHCODE_ISSET_ID = 2; + private static final int __EXTRAINT1_ISSET_ID = 3; + private static final int __EXTRAINT2_ISSET_ID = 4; + private static final int __EXTRAINT3_ISSET_ID = 5; + private static final int __EXTRALONG1_ISSET_ID = 6; + private static final int __EXTRALONG2_ISSET_ID = 7; + private static final int __EXTRALONG3_ISSET_ID = 8; + private BitSet __isset_bit_vector = new BitSet(9); + private _Fields optionals[] = { _Fields.DATA_HASH_CODE, _Fields.DATA_STRING, _Fields.EXTRA_DATA1, _Fields.EXTRA_DATA2, _Fields.EXTRA_DATA3, _Fields.EXTRA_INT1, _Fields.EXTRA_INT2, _Fields.EXTRA_INT3, _Fields.EXTRA_LONG1, _Fields.EXTRA_LONG2, _Fields.EXTRA_LONG3 }; + 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.DATA_TYPE, new org.apache.thrift.meta_data.FieldMetaData("dataType", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.DATA_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("dataHashCode", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA_STRING, new org.apache.thrift.meta_data.FieldMetaData("dataString", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA1, new org.apache.thrift.meta_data.FieldMetaData("extraData1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA2, new org.apache.thrift.meta_data.FieldMetaData("extraData2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA3, new org.apache.thrift.meta_data.FieldMetaData("extraData3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_INT1, new org.apache.thrift.meta_data.FieldMetaData("extraInt1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_INT2, new org.apache.thrift.meta_data.FieldMetaData("extraInt2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_INT3, new org.apache.thrift.meta_data.FieldMetaData("extraInt3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_LONG1, new org.apache.thrift.meta_data.FieldMetaData("extraLong1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.EXTRA_LONG2, new org.apache.thrift.meta_data.FieldMetaData("extraLong2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.EXTRA_LONG3, new org.apache.thrift.meta_data.FieldMetaData("extraLong3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestDataThriftDTO.class, metaDataMap); + } + + public RequestDataThriftDTO() { + } + + public RequestDataThriftDTO(int dataType, long dataTime) { + this(); + this.dataType = dataType; + setDataTypeIsSet(true); + this.dataTime = dataTime; + setDataTimeIsSet(true); + } + + /** + * Performs a deep copy on other. + */ + public RequestDataThriftDTO(RequestDataThriftDTO other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.dataType = other.dataType; + this.dataTime = other.dataTime; + this.dataHashCode = other.dataHashCode; + if (other.isSetDataString()) { + this.dataString = other.dataString; + } + if (other.isSetExtraData1()) { + this.extraData1 = other.extraData1; + } + if (other.isSetExtraData2()) { + this.extraData2 = other.extraData2; + } + if (other.isSetExtraData3()) { + this.extraData3 = other.extraData3; + } + this.extraInt1 = other.extraInt1; + this.extraInt2 = other.extraInt2; + this.extraInt3 = other.extraInt3; + this.extraLong1 = other.extraLong1; + this.extraLong2 = other.extraLong2; + this.extraLong3 = other.extraLong3; + } + + public RequestDataThriftDTO deepCopy() { + return new RequestDataThriftDTO(this); + } + + @Override + public void clear() { + setDataTypeIsSet(false); + this.dataType = 0; + setDataTimeIsSet(false); + this.dataTime = 0; + setDataHashCodeIsSet(false); + this.dataHashCode = 0; + this.dataString = null; + this.extraData1 = null; + this.extraData2 = null; + this.extraData3 = null; + setExtraInt1IsSet(false); + this.extraInt1 = 0; + setExtraInt2IsSet(false); + this.extraInt2 = 0; + setExtraInt3IsSet(false); + this.extraInt3 = 0; + setExtraLong1IsSet(false); + this.extraLong1 = 0; + setExtraLong2IsSet(false); + this.extraLong2 = 0; + setExtraLong3IsSet(false); + this.extraLong3 = 0; + } + + public int getDataType() { + return this.dataType; + } + + public RequestDataThriftDTO setDataType(int dataType) { + this.dataType = dataType; + setDataTypeIsSet(true); + return this; + } + + public void unsetDataType() { + __isset_bit_vector.clear(__DATATYPE_ISSET_ID); + } + + /** + * Returns true if field dataType is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataType() { + return __isset_bit_vector.get(__DATATYPE_ISSET_ID); + } + + public void setDataTypeIsSet(boolean value) { + __isset_bit_vector.set(__DATATYPE_ISSET_ID, value); + } + + public long getDataTime() { + return this.dataTime; + } + + public RequestDataThriftDTO setDataTime(long dataTime) { + this.dataTime = dataTime; + setDataTimeIsSet(true); + return this; + } + + public void unsetDataTime() { + __isset_bit_vector.clear(__DATATIME_ISSET_ID); + } + + /** + * Returns true if field dataTime is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataTime() { + return __isset_bit_vector.get(__DATATIME_ISSET_ID); + } + + public void setDataTimeIsSet(boolean value) { + __isset_bit_vector.set(__DATATIME_ISSET_ID, value); + } + + public int getDataHashCode() { + return this.dataHashCode; + } + + public RequestDataThriftDTO setDataHashCode(int dataHashCode) { + this.dataHashCode = dataHashCode; + setDataHashCodeIsSet(true); + return this; + } + + public void unsetDataHashCode() { + __isset_bit_vector.clear(__DATAHASHCODE_ISSET_ID); + } + + /** + * Returns true if field dataHashCode is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataHashCode() { + return __isset_bit_vector.get(__DATAHASHCODE_ISSET_ID); + } + + public void setDataHashCodeIsSet(boolean value) { + __isset_bit_vector.set(__DATAHASHCODE_ISSET_ID, value); + } + + public String getDataString() { + return this.dataString; + } + + public RequestDataThriftDTO setDataString(String dataString) { + this.dataString = dataString; + return this; + } + + public void unsetDataString() { + this.dataString = null; + } + + /** + * Returns true if field dataString is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataString() { + return this.dataString != null; + } + + public void setDataStringIsSet(boolean value) { + if (!value) { + this.dataString = null; + } + } + + public String getExtraData1() { + return this.extraData1; + } + + public RequestDataThriftDTO setExtraData1(String extraData1) { + this.extraData1 = extraData1; + return this; + } + + public void unsetExtraData1() { + this.extraData1 = null; + } + + /** + * Returns true if field extraData1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData1() { + return this.extraData1 != null; + } + + public void setExtraData1IsSet(boolean value) { + if (!value) { + this.extraData1 = null; + } + } + + public String getExtraData2() { + return this.extraData2; + } + + public RequestDataThriftDTO setExtraData2(String extraData2) { + this.extraData2 = extraData2; + return this; + } + + public void unsetExtraData2() { + this.extraData2 = null; + } + + /** + * Returns true if field extraData2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData2() { + return this.extraData2 != null; + } + + public void setExtraData2IsSet(boolean value) { + if (!value) { + this.extraData2 = null; + } + } + + public String getExtraData3() { + return this.extraData3; + } + + public RequestDataThriftDTO setExtraData3(String extraData3) { + this.extraData3 = extraData3; + return this; + } + + public void unsetExtraData3() { + this.extraData3 = null; + } + + /** + * Returns true if field extraData3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData3() { + return this.extraData3 != null; + } + + public void setExtraData3IsSet(boolean value) { + if (!value) { + this.extraData3 = null; + } + } + + public int getExtraInt1() { + return this.extraInt1; + } + + public RequestDataThriftDTO setExtraInt1(int extraInt1) { + this.extraInt1 = extraInt1; + setExtraInt1IsSet(true); + return this; + } + + public void unsetExtraInt1() { + __isset_bit_vector.clear(__EXTRAINT1_ISSET_ID); + } + + /** + * Returns true if field extraInt1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt1() { + return __isset_bit_vector.get(__EXTRAINT1_ISSET_ID); + } + + public void setExtraInt1IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT1_ISSET_ID, value); + } + + public int getExtraInt2() { + return this.extraInt2; + } + + public RequestDataThriftDTO setExtraInt2(int extraInt2) { + this.extraInt2 = extraInt2; + setExtraInt2IsSet(true); + return this; + } + + public void unsetExtraInt2() { + __isset_bit_vector.clear(__EXTRAINT2_ISSET_ID); + } + + /** + * Returns true if field extraInt2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt2() { + return __isset_bit_vector.get(__EXTRAINT2_ISSET_ID); + } + + public void setExtraInt2IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT2_ISSET_ID, value); + } + + public int getExtraInt3() { + return this.extraInt3; + } + + public RequestDataThriftDTO setExtraInt3(int extraInt3) { + this.extraInt3 = extraInt3; + setExtraInt3IsSet(true); + return this; + } + + public void unsetExtraInt3() { + __isset_bit_vector.clear(__EXTRAINT3_ISSET_ID); + } + + /** + * Returns true if field extraInt3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt3() { + return __isset_bit_vector.get(__EXTRAINT3_ISSET_ID); + } + + public void setExtraInt3IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT3_ISSET_ID, value); + } + + public long getExtraLong1() { + return this.extraLong1; + } + + public RequestDataThriftDTO setExtraLong1(long extraLong1) { + this.extraLong1 = extraLong1; + setExtraLong1IsSet(true); + return this; + } + + public void unsetExtraLong1() { + __isset_bit_vector.clear(__EXTRALONG1_ISSET_ID); + } + + /** + * Returns true if field extraLong1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong1() { + return __isset_bit_vector.get(__EXTRALONG1_ISSET_ID); + } + + public void setExtraLong1IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG1_ISSET_ID, value); + } + + public long getExtraLong2() { + return this.extraLong2; + } + + public RequestDataThriftDTO setExtraLong2(long extraLong2) { + this.extraLong2 = extraLong2; + setExtraLong2IsSet(true); + return this; + } + + public void unsetExtraLong2() { + __isset_bit_vector.clear(__EXTRALONG2_ISSET_ID); + } + + /** + * Returns true if field extraLong2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong2() { + return __isset_bit_vector.get(__EXTRALONG2_ISSET_ID); + } + + public void setExtraLong2IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG2_ISSET_ID, value); + } + + public long getExtraLong3() { + return this.extraLong3; + } + + public RequestDataThriftDTO setExtraLong3(long extraLong3) { + this.extraLong3 = extraLong3; + setExtraLong3IsSet(true); + return this; + } + + public void unsetExtraLong3() { + __isset_bit_vector.clear(__EXTRALONG3_ISSET_ID); + } + + /** + * Returns true if field extraLong3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong3() { + return __isset_bit_vector.get(__EXTRALONG3_ISSET_ID); + } + + public void setExtraLong3IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG3_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DATA_TYPE: + if (value == null) { + unsetDataType(); + } else { + setDataType((Integer) value); + } + break; + + case DATA_TIME: + if (value == null) { + unsetDataTime(); + } else { + setDataTime((Long) value); + } + break; + + case DATA_HASH_CODE: + if (value == null) { + unsetDataHashCode(); + } else { + setDataHashCode((Integer) value); + } + break; + + case DATA_STRING: + if (value == null) { + unsetDataString(); + } else { + setDataString((String) value); + } + break; + + case EXTRA_DATA1: + if (value == null) { + unsetExtraData1(); + } else { + setExtraData1((String) value); + } + break; + + case EXTRA_DATA2: + if (value == null) { + unsetExtraData2(); + } else { + setExtraData2((String) value); + } + break; + + case EXTRA_DATA3: + if (value == null) { + unsetExtraData3(); + } else { + setExtraData3((String) value); + } + break; + + case EXTRA_INT1: + if (value == null) { + unsetExtraInt1(); + } else { + setExtraInt1((Integer) value); + } + break; + + case EXTRA_INT2: + if (value == null) { + unsetExtraInt2(); + } else { + setExtraInt2((Integer) value); + } + break; + + case EXTRA_INT3: + if (value == null) { + unsetExtraInt3(); + } else { + setExtraInt3((Integer) value); + } + break; + + case EXTRA_LONG1: + if (value == null) { + unsetExtraLong1(); + } else { + setExtraLong1((Long) value); + } + break; + + case EXTRA_LONG2: + if (value == null) { + unsetExtraLong2(); + } else { + setExtraLong2((Long) value); + } + break; + + case EXTRA_LONG3: + if (value == null) { + unsetExtraLong3(); + } else { + setExtraLong3((Long) value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DATA_TYPE: + return Integer.valueOf(getDataType()); + + case DATA_TIME: + return Long.valueOf(getDataTime()); + + case DATA_HASH_CODE: + return Integer.valueOf(getDataHashCode()); + + case DATA_STRING: + return getDataString(); + + case EXTRA_DATA1: + return getExtraData1(); + + case EXTRA_DATA2: + return getExtraData2(); + + case EXTRA_DATA3: + return getExtraData3(); + + case EXTRA_INT1: + return Integer.valueOf(getExtraInt1()); + + case EXTRA_INT2: + return Integer.valueOf(getExtraInt2()); + + case EXTRA_INT3: + return Integer.valueOf(getExtraInt3()); + + case EXTRA_LONG1: + return Long.valueOf(getExtraLong1()); + + case EXTRA_LONG2: + return Long.valueOf(getExtraLong2()); + + case EXTRA_LONG3: + return Long.valueOf(getExtraLong3()); + + } + 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 DATA_TYPE: + return isSetDataType(); + case DATA_TIME: + return isSetDataTime(); + case DATA_HASH_CODE: + return isSetDataHashCode(); + case DATA_STRING: + return isSetDataString(); + case EXTRA_DATA1: + return isSetExtraData1(); + case EXTRA_DATA2: + return isSetExtraData2(); + case EXTRA_DATA3: + return isSetExtraData3(); + case EXTRA_INT1: + return isSetExtraInt1(); + case EXTRA_INT2: + return isSetExtraInt2(); + case EXTRA_INT3: + return isSetExtraInt3(); + case EXTRA_LONG1: + return isSetExtraLong1(); + case EXTRA_LONG2: + return isSetExtraLong2(); + case EXTRA_LONG3: + return isSetExtraLong3(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof RequestDataThriftDTO) + return this.equals((RequestDataThriftDTO) that); + return false; + } + + public boolean equals(RequestDataThriftDTO that) { + if (that == null) + return false; + + boolean this_present_dataType = true; + boolean that_present_dataType = true; + if (this_present_dataType || that_present_dataType) { + if (!(this_present_dataType && that_present_dataType)) + return false; + if (this.dataType != that.dataType) + return false; + } + + boolean this_present_dataTime = true; + boolean that_present_dataTime = true; + if (this_present_dataTime || that_present_dataTime) { + if (!(this_present_dataTime && that_present_dataTime)) + return false; + if (this.dataTime != that.dataTime) + return false; + } + + boolean this_present_dataHashCode = true && this.isSetDataHashCode(); + boolean that_present_dataHashCode = true && that.isSetDataHashCode(); + if (this_present_dataHashCode || that_present_dataHashCode) { + if (!(this_present_dataHashCode && that_present_dataHashCode)) + return false; + if (this.dataHashCode != that.dataHashCode) + return false; + } + + boolean this_present_dataString = true && this.isSetDataString(); + boolean that_present_dataString = true && that.isSetDataString(); + if (this_present_dataString || that_present_dataString) { + if (!(this_present_dataString && that_present_dataString)) + return false; + if (!this.dataString.equals(that.dataString)) + return false; + } + + boolean this_present_extraData1 = true && this.isSetExtraData1(); + boolean that_present_extraData1 = true && that.isSetExtraData1(); + if (this_present_extraData1 || that_present_extraData1) { + if (!(this_present_extraData1 && that_present_extraData1)) + return false; + if (!this.extraData1.equals(that.extraData1)) + return false; + } + + boolean this_present_extraData2 = true && this.isSetExtraData2(); + boolean that_present_extraData2 = true && that.isSetExtraData2(); + if (this_present_extraData2 || that_present_extraData2) { + if (!(this_present_extraData2 && that_present_extraData2)) + return false; + if (!this.extraData2.equals(that.extraData2)) + return false; + } + + boolean this_present_extraData3 = true && this.isSetExtraData3(); + boolean that_present_extraData3 = true && that.isSetExtraData3(); + if (this_present_extraData3 || that_present_extraData3) { + if (!(this_present_extraData3 && that_present_extraData3)) + return false; + if (!this.extraData3.equals(that.extraData3)) + return false; + } + + boolean this_present_extraInt1 = true && this.isSetExtraInt1(); + boolean that_present_extraInt1 = true && that.isSetExtraInt1(); + if (this_present_extraInt1 || that_present_extraInt1) { + if (!(this_present_extraInt1 && that_present_extraInt1)) + return false; + if (this.extraInt1 != that.extraInt1) + return false; + } + + boolean this_present_extraInt2 = true && this.isSetExtraInt2(); + boolean that_present_extraInt2 = true && that.isSetExtraInt2(); + if (this_present_extraInt2 || that_present_extraInt2) { + if (!(this_present_extraInt2 && that_present_extraInt2)) + return false; + if (this.extraInt2 != that.extraInt2) + return false; + } + + boolean this_present_extraInt3 = true && this.isSetExtraInt3(); + boolean that_present_extraInt3 = true && that.isSetExtraInt3(); + if (this_present_extraInt3 || that_present_extraInt3) { + if (!(this_present_extraInt3 && that_present_extraInt3)) + return false; + if (this.extraInt3 != that.extraInt3) + return false; + } + + boolean this_present_extraLong1 = true && this.isSetExtraLong1(); + boolean that_present_extraLong1 = true && that.isSetExtraLong1(); + if (this_present_extraLong1 || that_present_extraLong1) { + if (!(this_present_extraLong1 && that_present_extraLong1)) + return false; + if (this.extraLong1 != that.extraLong1) + return false; + } + + boolean this_present_extraLong2 = true && this.isSetExtraLong2(); + boolean that_present_extraLong2 = true && that.isSetExtraLong2(); + if (this_present_extraLong2 || that_present_extraLong2) { + if (!(this_present_extraLong2 && that_present_extraLong2)) + return false; + if (this.extraLong2 != that.extraLong2) + return false; + } + + boolean this_present_extraLong3 = true && this.isSetExtraLong3(); + boolean that_present_extraLong3 = true && that.isSetExtraLong3(); + if (this_present_extraLong3 || that_present_extraLong3) { + if (!(this_present_extraLong3 && that_present_extraLong3)) + return false; + if (this.extraLong3 != that.extraLong3) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(RequestDataThriftDTO other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + RequestDataThriftDTO typedOther = (RequestDataThriftDTO) other; + + lastComparison = Boolean.valueOf(isSetDataType()).compareTo(typedOther.isSetDataType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataType, typedOther.dataType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(typedOther.isSetDataTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataTime, typedOther.dataTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDataHashCode()).compareTo(typedOther.isSetDataHashCode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataHashCode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataHashCode, typedOther.dataHashCode); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDataString()).compareTo(typedOther.isSetDataString()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataString()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataString, typedOther.dataString); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData1()).compareTo(typedOther.isSetExtraData1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData1, typedOther.extraData1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData2()).compareTo(typedOther.isSetExtraData2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData2, typedOther.extraData2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData3()).compareTo(typedOther.isSetExtraData3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData3, typedOther.extraData3); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt1()).compareTo(typedOther.isSetExtraInt1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt1, typedOther.extraInt1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt2()).compareTo(typedOther.isSetExtraInt2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt2, typedOther.extraInt2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt3()).compareTo(typedOther.isSetExtraInt3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt3, typedOther.extraInt3); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong1()).compareTo(typedOther.isSetExtraLong1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong1, typedOther.extraLong1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong2()).compareTo(typedOther.isSetExtraLong2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong2, typedOther.extraLong2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong3()).compareTo(typedOther.isSetExtraLong3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong3, typedOther.extraLong3); + 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("RequestDataThriftDTO("); + boolean first = true; + + sb.append("dataType:"); + sb.append(this.dataType); + first = false; + if (!first) + sb.append(", "); + sb.append("dataTime:"); + sb.append(this.dataTime); + first = false; + if (isSetDataHashCode()) { + if (!first) + sb.append(", "); + sb.append("dataHashCode:"); + sb.append(this.dataHashCode); + first = false; + } + if (isSetDataString()) { + if (!first) + sb.append(", "); + sb.append("dataString:"); + if (this.dataString == null) { + sb.append("null"); + } else { + sb.append(this.dataString); + } + first = false; + } + if (isSetExtraData1()) { + if (!first) + sb.append(", "); + sb.append("extraData1:"); + if (this.extraData1 == null) { + sb.append("null"); + } else { + sb.append(this.extraData1); + } + first = false; + } + if (isSetExtraData2()) { + if (!first) + sb.append(", "); + sb.append("extraData2:"); + if (this.extraData2 == null) { + sb.append("null"); + } else { + sb.append(this.extraData2); + } + first = false; + } + if (isSetExtraData3()) { + if (!first) + sb.append(", "); + sb.append("extraData3:"); + if (this.extraData3 == null) { + sb.append("null"); + } else { + sb.append(this.extraData3); + } + first = false; + } + if (isSetExtraInt1()) { + if (!first) + sb.append(", "); + sb.append("extraInt1:"); + sb.append(this.extraInt1); + first = false; + } + if (isSetExtraInt2()) { + if (!first) + sb.append(", "); + sb.append("extraInt2:"); + sb.append(this.extraInt2); + first = false; + } + if (isSetExtraInt3()) { + if (!first) + sb.append(", "); + sb.append("extraInt3:"); + sb.append(this.extraInt3); + first = false; + } + if (isSetExtraLong1()) { + if (!first) + sb.append(", "); + sb.append("extraLong1:"); + sb.append(this.extraLong1); + first = false; + } + if (isSetExtraLong2()) { + if (!first) + sb.append(", "); + sb.append("extraLong2:"); + sb.append(this.extraLong2); + first = false; + } + if (isSetExtraLong3()) { + if (!first) + sb.append(", "); + sb.append("extraLong3:"); + sb.append(this.extraLong3); + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java + // serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class RequestDataThriftDTOStandardSchemeFactory implements SchemeFactory { + public RequestDataThriftDTOStandardScheme getScheme() { + return new RequestDataThriftDTOStandardScheme(); + } + } + + private static class RequestDataThriftDTOStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, RequestDataThriftDTO 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: // DATA_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.dataType = iprot.readI32(); + struct.setDataTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // DATA_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.dataTime = iprot.readI64(); + struct.setDataTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // DATA_HASH_CODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.dataHashCode = iprot.readI32(); + struct.setDataHashCodeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // DATA_STRING + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.dataString = iprot.readString(); + struct.setDataStringIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // EXTRA_DATA1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData1 = iprot.readString(); + struct.setExtraData1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // EXTRA_DATA2 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData2 = iprot.readString(); + struct.setExtraData2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // EXTRA_DATA3 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData3 = iprot.readString(); + struct.setExtraData3IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // EXTRA_INT1 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt1 = iprot.readI32(); + struct.setExtraInt1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // EXTRA_INT2 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt2 = iprot.readI32(); + struct.setExtraInt2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 10: // EXTRA_INT3 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt3 = iprot.readI32(); + struct.setExtraInt3IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 11: // EXTRA_LONG1 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong1 = iprot.readI64(); + struct.setExtraLong1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 12: // EXTRA_LONG2 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong2 = iprot.readI64(); + struct.setExtraLong2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 13: // EXTRA_LONG3 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong3 = iprot.readI64(); + struct.setExtraLong3IsSet(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, RequestDataThriftDTO struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DATA_TYPE_FIELD_DESC); + oprot.writeI32(struct.dataType); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(DATA_TIME_FIELD_DESC); + oprot.writeI64(struct.dataTime); + oprot.writeFieldEnd(); + if (struct.isSetDataHashCode()) { + oprot.writeFieldBegin(DATA_HASH_CODE_FIELD_DESC); + oprot.writeI32(struct.dataHashCode); + oprot.writeFieldEnd(); + } + if (struct.dataString != null) { + if (struct.isSetDataString()) { + oprot.writeFieldBegin(DATA_STRING_FIELD_DESC); + oprot.writeString(struct.dataString); + oprot.writeFieldEnd(); + } + } + if (struct.extraData1 != null) { + if (struct.isSetExtraData1()) { + oprot.writeFieldBegin(EXTRA_DATA1_FIELD_DESC); + oprot.writeString(struct.extraData1); + oprot.writeFieldEnd(); + } + } + if (struct.extraData2 != null) { + if (struct.isSetExtraData2()) { + oprot.writeFieldBegin(EXTRA_DATA2_FIELD_DESC); + oprot.writeString(struct.extraData2); + oprot.writeFieldEnd(); + } + } + if (struct.extraData3 != null) { + if (struct.isSetExtraData3()) { + oprot.writeFieldBegin(EXTRA_DATA3_FIELD_DESC); + oprot.writeString(struct.extraData3); + oprot.writeFieldEnd(); + } + } + if (struct.isSetExtraInt1()) { + oprot.writeFieldBegin(EXTRA_INT1_FIELD_DESC); + oprot.writeI32(struct.extraInt1); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraInt2()) { + oprot.writeFieldBegin(EXTRA_INT2_FIELD_DESC); + oprot.writeI32(struct.extraInt2); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraInt3()) { + oprot.writeFieldBegin(EXTRA_INT3_FIELD_DESC); + oprot.writeI32(struct.extraInt3); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong1()) { + oprot.writeFieldBegin(EXTRA_LONG1_FIELD_DESC); + oprot.writeI64(struct.extraLong1); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong2()) { + oprot.writeFieldBegin(EXTRA_LONG2_FIELD_DESC); + oprot.writeI64(struct.extraLong2); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong3()) { + oprot.writeFieldBegin(EXTRA_LONG3_FIELD_DESC); + oprot.writeI64(struct.extraLong3); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RequestDataThriftDTOTupleSchemeFactory implements SchemeFactory { + public RequestDataThriftDTOTupleScheme getScheme() { + return new RequestDataThriftDTOTupleScheme(); + } + } + + private static class RequestDataThriftDTOTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, RequestDataThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDataType()) { + optionals.set(0); + } + if (struct.isSetDataTime()) { + optionals.set(1); + } + if (struct.isSetDataHashCode()) { + optionals.set(2); + } + if (struct.isSetDataString()) { + optionals.set(3); + } + if (struct.isSetExtraData1()) { + optionals.set(4); + } + if (struct.isSetExtraData2()) { + optionals.set(5); + } + if (struct.isSetExtraData3()) { + optionals.set(6); + } + if (struct.isSetExtraInt1()) { + optionals.set(7); + } + if (struct.isSetExtraInt2()) { + optionals.set(8); + } + if (struct.isSetExtraInt3()) { + optionals.set(9); + } + if (struct.isSetExtraLong1()) { + optionals.set(10); + } + if (struct.isSetExtraLong2()) { + optionals.set(11); + } + if (struct.isSetExtraLong3()) { + optionals.set(12); + } + oprot.writeBitSet(optionals, 13); + if (struct.isSetDataType()) { + oprot.writeI32(struct.dataType); + } + if (struct.isSetDataTime()) { + oprot.writeI64(struct.dataTime); + } + if (struct.isSetDataHashCode()) { + oprot.writeI32(struct.dataHashCode); + } + if (struct.isSetDataString()) { + oprot.writeString(struct.dataString); + } + if (struct.isSetExtraData1()) { + oprot.writeString(struct.extraData1); + } + if (struct.isSetExtraData2()) { + oprot.writeString(struct.extraData2); + } + if (struct.isSetExtraData3()) { + oprot.writeString(struct.extraData3); + } + if (struct.isSetExtraInt1()) { + oprot.writeI32(struct.extraInt1); + } + if (struct.isSetExtraInt2()) { + oprot.writeI32(struct.extraInt2); + } + if (struct.isSetExtraInt3()) { + oprot.writeI32(struct.extraInt3); + } + if (struct.isSetExtraLong1()) { + oprot.writeI64(struct.extraLong1); + } + if (struct.isSetExtraLong2()) { + oprot.writeI64(struct.extraLong2); + } + if (struct.isSetExtraLong3()) { + oprot.writeI64(struct.extraLong3); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, RequestDataThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(13); + if (incoming.get(0)) { + struct.dataType = iprot.readI32(); + struct.setDataTypeIsSet(true); + } + if (incoming.get(1)) { + struct.dataTime = iprot.readI64(); + struct.setDataTimeIsSet(true); + } + if (incoming.get(2)) { + struct.dataHashCode = iprot.readI32(); + struct.setDataHashCodeIsSet(true); + } + if (incoming.get(3)) { + struct.dataString = iprot.readString(); + struct.setDataStringIsSet(true); + } + if (incoming.get(4)) { + struct.extraData1 = iprot.readString(); + struct.setExtraData1IsSet(true); + } + if (incoming.get(5)) { + struct.extraData2 = iprot.readString(); + struct.setExtraData2IsSet(true); + } + if (incoming.get(6)) { + struct.extraData3 = iprot.readString(); + struct.setExtraData3IsSet(true); + } + if (incoming.get(7)) { + struct.extraInt1 = iprot.readI32(); + struct.setExtraInt1IsSet(true); + } + if (incoming.get(8)) { + struct.extraInt2 = iprot.readI32(); + struct.setExtraInt2IsSet(true); + } + if (incoming.get(9)) { + struct.extraInt3 = iprot.readI32(); + struct.setExtraInt3IsSet(true); + } + if (incoming.get(10)) { + struct.extraLong1 = iprot.readI64(); + struct.setExtraLong1IsSet(true); + } + if (incoming.get(11)) { + struct.extraLong2 = iprot.readI64(); + struct.setExtraLong2IsSet(true); + } + if (incoming.get(12)) { + struct.extraLong3 = iprot.readI64(); + struct.setExtraLong3IsSet(true); + } + } + } } - diff --git a/src/main/java/com/profiler/dto/RequestThriftDTO.java b/src/main/java/com/profiler/dto/RequestThriftDTO.java index 1b8f6008e..1943d5c6d 100644 --- a/src/main/java/com/profiler/dto/RequestThriftDTO.java +++ b/src/main/java/com/profiler/dto/RequestThriftDTO.java @@ -6,2029 +6,2061 @@ */ package com.profiler.dto; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; - import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.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 RequestThriftDTO 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("RequestThriftDTO"); - - private static final org.apache.thrift.protocol.TField HOST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("hostHashCode", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField REQUEST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("requestHashCode", org.apache.thrift.protocol.TType.I32, (short)2); - private static final org.apache.thrift.protocol.TField DATA_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataType", org.apache.thrift.protocol.TType.I32, (short)3); - private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short)4); - private static final org.apache.thrift.protocol.TField THREAD_CPUTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("threadCPUTime", org.apache.thrift.protocol.TType.I64, (short)5); - private static final org.apache.thrift.protocol.TField THREAD_USER_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("threadUserTime", org.apache.thrift.protocol.TType.I64, (short)6); - private static final org.apache.thrift.protocol.TField REQUEST_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("requestID", org.apache.thrift.protocol.TType.STRING, (short)7); - private static final org.apache.thrift.protocol.TField REQUEST_URL_FIELD_DESC = new org.apache.thrift.protocol.TField("requestURL", org.apache.thrift.protocol.TType.STRING, (short)8); - private static final org.apache.thrift.protocol.TField CLIENT_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("clientIP", org.apache.thrift.protocol.TType.STRING, (short)9); - private static final org.apache.thrift.protocol.TField EXTRA_DATA1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData1", org.apache.thrift.protocol.TType.STRING, (short)10); - private static final org.apache.thrift.protocol.TField EXTRA_DATA2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData2", org.apache.thrift.protocol.TType.STRING, (short)11); - private static final org.apache.thrift.protocol.TField EXTRA_DATA3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData3", org.apache.thrift.protocol.TType.STRING, (short)12); - private static final org.apache.thrift.protocol.TField EXTRA_INT1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt1", org.apache.thrift.protocol.TType.I32, (short)13); - private static final org.apache.thrift.protocol.TField EXTRA_INT2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt2", org.apache.thrift.protocol.TType.I32, (short)14); - private static final org.apache.thrift.protocol.TField EXTRA_INT3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt3", org.apache.thrift.protocol.TType.I32, (short)15); - private static final org.apache.thrift.protocol.TField EXTRA_LONG1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong1", org.apache.thrift.protocol.TType.I64, (short)16); - private static final org.apache.thrift.protocol.TField EXTRA_LONG2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong2", org.apache.thrift.protocol.TType.I64, (short)17); - private static final org.apache.thrift.protocol.TField EXTRA_LONG3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong3", org.apache.thrift.protocol.TType.I64, (short)18); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new RequestThriftDTOStandardSchemeFactory()); - schemes.put(TupleScheme.class, new RequestThriftDTOTupleSchemeFactory()); - } - - public int hostHashCode; // required - public int requestHashCode; // required - public int dataType; // required - public long dataTime; // required - public long threadCPUTime; // required - public long threadUserTime; // required - public String requestID; // optional - public String requestURL; // optional - public String clientIP; // optional - public String extraData1; // optional - public String extraData2; // optional - public String extraData3; // optional - public int extraInt1; // optional - public int extraInt2; // optional - public int extraInt3; // optional - public long extraLong1; // optional - public long extraLong2; // optional - public long extraLong3; // optional - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - HOST_HASH_CODE((short)1, "hostHashCode"), - REQUEST_HASH_CODE((short)2, "requestHashCode"), - DATA_TYPE((short)3, "dataType"), - DATA_TIME((short)4, "dataTime"), - THREAD_CPUTIME((short)5, "threadCPUTime"), - THREAD_USER_TIME((short)6, "threadUserTime"), - REQUEST_ID((short)7, "requestID"), - REQUEST_URL((short)8, "requestURL"), - CLIENT_IP((short)9, "clientIP"), - EXTRA_DATA1((short)10, "extraData1"), - EXTRA_DATA2((short)11, "extraData2"), - EXTRA_DATA3((short)12, "extraData3"), - EXTRA_INT1((short)13, "extraInt1"), - EXTRA_INT2((short)14, "extraInt2"), - EXTRA_INT3((short)15, "extraInt3"), - EXTRA_LONG1((short)16, "extraLong1"), - EXTRA_LONG2((short)17, "extraLong2"), - EXTRA_LONG3((short)18, "extraLong3"); - - 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: // HOST_HASH_CODE - return HOST_HASH_CODE; - case 2: // REQUEST_HASH_CODE - return REQUEST_HASH_CODE; - case 3: // DATA_TYPE - return DATA_TYPE; - case 4: // DATA_TIME - return DATA_TIME; - case 5: // THREAD_CPUTIME - return THREAD_CPUTIME; - case 6: // THREAD_USER_TIME - return THREAD_USER_TIME; - case 7: // REQUEST_ID - return REQUEST_ID; - case 8: // REQUEST_URL - return REQUEST_URL; - case 9: // CLIENT_IP - return CLIENT_IP; - case 10: // EXTRA_DATA1 - return EXTRA_DATA1; - case 11: // EXTRA_DATA2 - return EXTRA_DATA2; - case 12: // EXTRA_DATA3 - return EXTRA_DATA3; - case 13: // EXTRA_INT1 - return EXTRA_INT1; - case 14: // EXTRA_INT2 - return EXTRA_INT2; - case 15: // EXTRA_INT3 - return EXTRA_INT3; - case 16: // EXTRA_LONG1 - return EXTRA_LONG1; - case 17: // EXTRA_LONG2 - return EXTRA_LONG2; - case 18: // EXTRA_LONG3 - return EXTRA_LONG3; - 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 __HOSTHASHCODE_ISSET_ID = 0; - private static final int __REQUESTHASHCODE_ISSET_ID = 1; - private static final int __DATATYPE_ISSET_ID = 2; - private static final int __DATATIME_ISSET_ID = 3; - private static final int __THREADCPUTIME_ISSET_ID = 4; - private static final int __THREADUSERTIME_ISSET_ID = 5; - private static final int __EXTRAINT1_ISSET_ID = 6; - private static final int __EXTRAINT2_ISSET_ID = 7; - private static final int __EXTRAINT3_ISSET_ID = 8; - private static final int __EXTRALONG1_ISSET_ID = 9; - private static final int __EXTRALONG2_ISSET_ID = 10; - private static final int __EXTRALONG3_ISSET_ID = 11; - private BitSet __isset_bit_vector = new BitSet(12); - private _Fields optionals[] = {_Fields.REQUEST_ID,_Fields.REQUEST_URL,_Fields.CLIENT_IP,_Fields.EXTRA_DATA1,_Fields.EXTRA_DATA2,_Fields.EXTRA_DATA3,_Fields.EXTRA_INT1,_Fields.EXTRA_INT2,_Fields.EXTRA_INT3,_Fields.EXTRA_LONG1,_Fields.EXTRA_LONG2,_Fields.EXTRA_LONG3}; - 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.HOST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("hostHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.REQUEST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("requestHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA_TYPE, new org.apache.thrift.meta_data.FieldMetaData("dataType", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.THREAD_CPUTIME, new org.apache.thrift.meta_data.FieldMetaData("threadCPUTime", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.THREAD_USER_TIME, new org.apache.thrift.meta_data.FieldMetaData("threadUserTime", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.REQUEST_ID, new org.apache.thrift.meta_data.FieldMetaData("requestID", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.REQUEST_URL, new org.apache.thrift.meta_data.FieldMetaData("requestURL", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.CLIENT_IP, new org.apache.thrift.meta_data.FieldMetaData("clientIP", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA1, new org.apache.thrift.meta_data.FieldMetaData("extraData1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA2, new org.apache.thrift.meta_data.FieldMetaData("extraData2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_DATA3, new org.apache.thrift.meta_data.FieldMetaData("extraData3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.EXTRA_INT1, new org.apache.thrift.meta_data.FieldMetaData("extraInt1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_INT2, new org.apache.thrift.meta_data.FieldMetaData("extraInt2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_INT3, new org.apache.thrift.meta_data.FieldMetaData("extraInt3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); - tmpMap.put(_Fields.EXTRA_LONG1, new org.apache.thrift.meta_data.FieldMetaData("extraLong1", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXTRA_LONG2, new org.apache.thrift.meta_data.FieldMetaData("extraLong2", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXTRA_LONG3, new org.apache.thrift.meta_data.FieldMetaData("extraLong3", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestThriftDTO.class, metaDataMap); - } - - public RequestThriftDTO() { - } - - public RequestThriftDTO( - int hostHashCode, - int requestHashCode, - int dataType, - long dataTime, - long threadCPUTime, - long threadUserTime) - { - this(); - this.hostHashCode = hostHashCode; - setHostHashCodeIsSet(true); - this.requestHashCode = requestHashCode; - setRequestHashCodeIsSet(true); - this.dataType = dataType; - setDataTypeIsSet(true); - this.dataTime = dataTime; - setDataTimeIsSet(true); - this.threadCPUTime = threadCPUTime; - setThreadCPUTimeIsSet(true); - this.threadUserTime = threadUserTime; - setThreadUserTimeIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public RequestThriftDTO(RequestThriftDTO other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); - this.hostHashCode = other.hostHashCode; - this.requestHashCode = other.requestHashCode; - this.dataType = other.dataType; - this.dataTime = other.dataTime; - this.threadCPUTime = other.threadCPUTime; - this.threadUserTime = other.threadUserTime; - if (other.isSetRequestID()) { - this.requestID = other.requestID; - } - if (other.isSetRequestURL()) { - this.requestURL = other.requestURL; - } - if (other.isSetClientIP()) { - this.clientIP = other.clientIP; - } - if (other.isSetExtraData1()) { - this.extraData1 = other.extraData1; - } - if (other.isSetExtraData2()) { - this.extraData2 = other.extraData2; - } - if (other.isSetExtraData3()) { - this.extraData3 = other.extraData3; - } - this.extraInt1 = other.extraInt1; - this.extraInt2 = other.extraInt2; - this.extraInt3 = other.extraInt3; - this.extraLong1 = other.extraLong1; - this.extraLong2 = other.extraLong2; - this.extraLong3 = other.extraLong3; - } - - public RequestThriftDTO deepCopy() { - return new RequestThriftDTO(this); - } - - @Override - public void clear() { - setHostHashCodeIsSet(false); - this.hostHashCode = 0; - setRequestHashCodeIsSet(false); - this.requestHashCode = 0; - setDataTypeIsSet(false); - this.dataType = 0; - setDataTimeIsSet(false); - this.dataTime = 0; - setThreadCPUTimeIsSet(false); - this.threadCPUTime = 0; - setThreadUserTimeIsSet(false); - this.threadUserTime = 0; - this.requestID = null; - this.requestURL = null; - this.clientIP = null; - this.extraData1 = null; - this.extraData2 = null; - this.extraData3 = null; - setExtraInt1IsSet(false); - this.extraInt1 = 0; - setExtraInt2IsSet(false); - this.extraInt2 = 0; - setExtraInt3IsSet(false); - this.extraInt3 = 0; - setExtraLong1IsSet(false); - this.extraLong1 = 0; - setExtraLong2IsSet(false); - this.extraLong2 = 0; - setExtraLong3IsSet(false); - this.extraLong3 = 0; - } - - public int getHostHashCode() { - return this.hostHashCode; - } - - public RequestThriftDTO setHostHashCode(int hostHashCode) { - this.hostHashCode = hostHashCode; - setHostHashCodeIsSet(true); - return this; - } - - public void unsetHostHashCode() { - __isset_bit_vector.clear(__HOSTHASHCODE_ISSET_ID); - } - - /** Returns true if field hostHashCode is set (has been assigned a value) and false otherwise */ - public boolean isSetHostHashCode() { - return __isset_bit_vector.get(__HOSTHASHCODE_ISSET_ID); - } - - public void setHostHashCodeIsSet(boolean value) { - __isset_bit_vector.set(__HOSTHASHCODE_ISSET_ID, value); - } - - public int getRequestHashCode() { - return this.requestHashCode; - } - - public RequestThriftDTO setRequestHashCode(int requestHashCode) { - this.requestHashCode = requestHashCode; - setRequestHashCodeIsSet(true); - return this; - } - - public void unsetRequestHashCode() { - __isset_bit_vector.clear(__REQUESTHASHCODE_ISSET_ID); - } - - /** Returns true if field requestHashCode is set (has been assigned a value) and false otherwise */ - public boolean isSetRequestHashCode() { - return __isset_bit_vector.get(__REQUESTHASHCODE_ISSET_ID); - } - - public void setRequestHashCodeIsSet(boolean value) { - __isset_bit_vector.set(__REQUESTHASHCODE_ISSET_ID, value); - } - - public int getDataType() { - return this.dataType; - } - - public RequestThriftDTO setDataType(int dataType) { - this.dataType = dataType; - setDataTypeIsSet(true); - return this; - } - - public void unsetDataType() { - __isset_bit_vector.clear(__DATATYPE_ISSET_ID); - } - - /** Returns true if field dataType is set (has been assigned a value) and false otherwise */ - public boolean isSetDataType() { - return __isset_bit_vector.get(__DATATYPE_ISSET_ID); - } - - public void setDataTypeIsSet(boolean value) { - __isset_bit_vector.set(__DATATYPE_ISSET_ID, value); - } - - public long getDataTime() { - return this.dataTime; - } - - public RequestThriftDTO setDataTime(long dataTime) { - this.dataTime = dataTime; - setDataTimeIsSet(true); - return this; - } - - public void unsetDataTime() { - __isset_bit_vector.clear(__DATATIME_ISSET_ID); - } - - /** Returns true if field dataTime is set (has been assigned a value) and false otherwise */ - public boolean isSetDataTime() { - return __isset_bit_vector.get(__DATATIME_ISSET_ID); - } - - public void setDataTimeIsSet(boolean value) { - __isset_bit_vector.set(__DATATIME_ISSET_ID, value); - } - - public long getThreadCPUTime() { - return this.threadCPUTime; - } - - public RequestThriftDTO setThreadCPUTime(long threadCPUTime) { - this.threadCPUTime = threadCPUTime; - setThreadCPUTimeIsSet(true); - return this; - } - - public void unsetThreadCPUTime() { - __isset_bit_vector.clear(__THREADCPUTIME_ISSET_ID); - } - - /** Returns true if field threadCPUTime is set (has been assigned a value) and false otherwise */ - public boolean isSetThreadCPUTime() { - return __isset_bit_vector.get(__THREADCPUTIME_ISSET_ID); - } - - public void setThreadCPUTimeIsSet(boolean value) { - __isset_bit_vector.set(__THREADCPUTIME_ISSET_ID, value); - } - - public long getThreadUserTime() { - return this.threadUserTime; - } - - public RequestThriftDTO setThreadUserTime(long threadUserTime) { - this.threadUserTime = threadUserTime; - setThreadUserTimeIsSet(true); - return this; - } - - public void unsetThreadUserTime() { - __isset_bit_vector.clear(__THREADUSERTIME_ISSET_ID); - } - - /** Returns true if field threadUserTime is set (has been assigned a value) and false otherwise */ - public boolean isSetThreadUserTime() { - return __isset_bit_vector.get(__THREADUSERTIME_ISSET_ID); - } - - public void setThreadUserTimeIsSet(boolean value) { - __isset_bit_vector.set(__THREADUSERTIME_ISSET_ID, value); - } - - public String getRequestID() { - return this.requestID; - } - - public RequestThriftDTO setRequestID(String requestID) { - this.requestID = requestID; - return this; - } - - public void unsetRequestID() { - this.requestID = null; - } - - /** Returns true if field requestID is set (has been assigned a value) and false otherwise */ - public boolean isSetRequestID() { - return this.requestID != null; - } - - public void setRequestIDIsSet(boolean value) { - if (!value) { - this.requestID = null; - } - } - - public String getRequestURL() { - return this.requestURL; - } - - public RequestThriftDTO setRequestURL(String requestURL) { - this.requestURL = requestURL; - return this; - } - - public void unsetRequestURL() { - this.requestURL = null; - } - - /** Returns true if field requestURL is set (has been assigned a value) and false otherwise */ - public boolean isSetRequestURL() { - return this.requestURL != null; - } - - public void setRequestURLIsSet(boolean value) { - if (!value) { - this.requestURL = null; - } - } - - public String getClientIP() { - return this.clientIP; - } - - public RequestThriftDTO setClientIP(String clientIP) { - this.clientIP = clientIP; - return this; - } - - public void unsetClientIP() { - this.clientIP = null; - } - - /** Returns true if field clientIP is set (has been assigned a value) and false otherwise */ - public boolean isSetClientIP() { - return this.clientIP != null; - } - - public void setClientIPIsSet(boolean value) { - if (!value) { - this.clientIP = null; - } - } - - public String getExtraData1() { - return this.extraData1; - } - - public RequestThriftDTO setExtraData1(String extraData1) { - this.extraData1 = extraData1; - return this; - } - - public void unsetExtraData1() { - this.extraData1 = null; - } - - /** Returns true if field extraData1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData1() { - return this.extraData1 != null; - } - - public void setExtraData1IsSet(boolean value) { - if (!value) { - this.extraData1 = null; - } - } - - public String getExtraData2() { - return this.extraData2; - } - - public RequestThriftDTO setExtraData2(String extraData2) { - this.extraData2 = extraData2; - return this; - } - - public void unsetExtraData2() { - this.extraData2 = null; - } - - /** Returns true if field extraData2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData2() { - return this.extraData2 != null; - } - - public void setExtraData2IsSet(boolean value) { - if (!value) { - this.extraData2 = null; - } - } - - public String getExtraData3() { - return this.extraData3; - } - - public RequestThriftDTO setExtraData3(String extraData3) { - this.extraData3 = extraData3; - return this; - } - - public void unsetExtraData3() { - this.extraData3 = null; - } - - /** Returns true if field extraData3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraData3() { - return this.extraData3 != null; - } - - public void setExtraData3IsSet(boolean value) { - if (!value) { - this.extraData3 = null; - } - } - - public int getExtraInt1() { - return this.extraInt1; - } - - public RequestThriftDTO setExtraInt1(int extraInt1) { - this.extraInt1 = extraInt1; - setExtraInt1IsSet(true); - return this; - } - - public void unsetExtraInt1() { - __isset_bit_vector.clear(__EXTRAINT1_ISSET_ID); - } - - /** Returns true if field extraInt1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt1() { - return __isset_bit_vector.get(__EXTRAINT1_ISSET_ID); - } - - public void setExtraInt1IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT1_ISSET_ID, value); - } - - public int getExtraInt2() { - return this.extraInt2; - } - - public RequestThriftDTO setExtraInt2(int extraInt2) { - this.extraInt2 = extraInt2; - setExtraInt2IsSet(true); - return this; - } - - public void unsetExtraInt2() { - __isset_bit_vector.clear(__EXTRAINT2_ISSET_ID); - } - - /** Returns true if field extraInt2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt2() { - return __isset_bit_vector.get(__EXTRAINT2_ISSET_ID); - } - - public void setExtraInt2IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT2_ISSET_ID, value); - } - - public int getExtraInt3() { - return this.extraInt3; - } - - public RequestThriftDTO setExtraInt3(int extraInt3) { - this.extraInt3 = extraInt3; - setExtraInt3IsSet(true); - return this; - } - - public void unsetExtraInt3() { - __isset_bit_vector.clear(__EXTRAINT3_ISSET_ID); - } - - /** Returns true if field extraInt3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraInt3() { - return __isset_bit_vector.get(__EXTRAINT3_ISSET_ID); - } - - public void setExtraInt3IsSet(boolean value) { - __isset_bit_vector.set(__EXTRAINT3_ISSET_ID, value); - } - - public long getExtraLong1() { - return this.extraLong1; - } - - public RequestThriftDTO setExtraLong1(long extraLong1) { - this.extraLong1 = extraLong1; - setExtraLong1IsSet(true); - return this; - } - - public void unsetExtraLong1() { - __isset_bit_vector.clear(__EXTRALONG1_ISSET_ID); - } - - /** Returns true if field extraLong1 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong1() { - return __isset_bit_vector.get(__EXTRALONG1_ISSET_ID); - } - - public void setExtraLong1IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG1_ISSET_ID, value); - } - - public long getExtraLong2() { - return this.extraLong2; - } - - public RequestThriftDTO setExtraLong2(long extraLong2) { - this.extraLong2 = extraLong2; - setExtraLong2IsSet(true); - return this; - } - - public void unsetExtraLong2() { - __isset_bit_vector.clear(__EXTRALONG2_ISSET_ID); - } - - /** Returns true if field extraLong2 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong2() { - return __isset_bit_vector.get(__EXTRALONG2_ISSET_ID); - } - - public void setExtraLong2IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG2_ISSET_ID, value); - } - - public long getExtraLong3() { - return this.extraLong3; - } - - public RequestThriftDTO setExtraLong3(long extraLong3) { - this.extraLong3 = extraLong3; - setExtraLong3IsSet(true); - return this; - } - - public void unsetExtraLong3() { - __isset_bit_vector.clear(__EXTRALONG3_ISSET_ID); - } - - /** Returns true if field extraLong3 is set (has been assigned a value) and false otherwise */ - public boolean isSetExtraLong3() { - return __isset_bit_vector.get(__EXTRALONG3_ISSET_ID); - } - - public void setExtraLong3IsSet(boolean value) { - __isset_bit_vector.set(__EXTRALONG3_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case HOST_HASH_CODE: - if (value == null) { - unsetHostHashCode(); - } else { - setHostHashCode((Integer)value); - } - break; - - case REQUEST_HASH_CODE: - if (value == null) { - unsetRequestHashCode(); - } else { - setRequestHashCode((Integer)value); - } - break; - - case DATA_TYPE: - if (value == null) { - unsetDataType(); - } else { - setDataType((Integer)value); - } - break; - - case DATA_TIME: - if (value == null) { - unsetDataTime(); - } else { - setDataTime((Long)value); - } - break; - - case THREAD_CPUTIME: - if (value == null) { - unsetThreadCPUTime(); - } else { - setThreadCPUTime((Long)value); - } - break; - - case THREAD_USER_TIME: - if (value == null) { - unsetThreadUserTime(); - } else { - setThreadUserTime((Long)value); - } - break; - - case REQUEST_ID: - if (value == null) { - unsetRequestID(); - } else { - setRequestID((String)value); - } - break; - - case REQUEST_URL: - if (value == null) { - unsetRequestURL(); - } else { - setRequestURL((String)value); - } - break; - - case CLIENT_IP: - if (value == null) { - unsetClientIP(); - } else { - setClientIP((String)value); - } - break; - - case EXTRA_DATA1: - if (value == null) { - unsetExtraData1(); - } else { - setExtraData1((String)value); - } - break; - - case EXTRA_DATA2: - if (value == null) { - unsetExtraData2(); - } else { - setExtraData2((String)value); - } - break; - - case EXTRA_DATA3: - if (value == null) { - unsetExtraData3(); - } else { - setExtraData3((String)value); - } - break; - - case EXTRA_INT1: - if (value == null) { - unsetExtraInt1(); - } else { - setExtraInt1((Integer)value); - } - break; - - case EXTRA_INT2: - if (value == null) { - unsetExtraInt2(); - } else { - setExtraInt2((Integer)value); - } - break; - - case EXTRA_INT3: - if (value == null) { - unsetExtraInt3(); - } else { - setExtraInt3((Integer)value); - } - break; - - case EXTRA_LONG1: - if (value == null) { - unsetExtraLong1(); - } else { - setExtraLong1((Long)value); - } - break; - - case EXTRA_LONG2: - if (value == null) { - unsetExtraLong2(); - } else { - setExtraLong2((Long)value); - } - break; - - case EXTRA_LONG3: - if (value == null) { - unsetExtraLong3(); - } else { - setExtraLong3((Long)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case HOST_HASH_CODE: - return Integer.valueOf(getHostHashCode()); - - case REQUEST_HASH_CODE: - return Integer.valueOf(getRequestHashCode()); - - case DATA_TYPE: - return Integer.valueOf(getDataType()); - - case DATA_TIME: - return Long.valueOf(getDataTime()); - - case THREAD_CPUTIME: - return Long.valueOf(getThreadCPUTime()); - - case THREAD_USER_TIME: - return Long.valueOf(getThreadUserTime()); - - case REQUEST_ID: - return getRequestID(); - - case REQUEST_URL: - return getRequestURL(); - - case CLIENT_IP: - return getClientIP(); - - case EXTRA_DATA1: - return getExtraData1(); - - case EXTRA_DATA2: - return getExtraData2(); - - case EXTRA_DATA3: - return getExtraData3(); - - case EXTRA_INT1: - return Integer.valueOf(getExtraInt1()); - - case EXTRA_INT2: - return Integer.valueOf(getExtraInt2()); - - case EXTRA_INT3: - return Integer.valueOf(getExtraInt3()); - - case EXTRA_LONG1: - return Long.valueOf(getExtraLong1()); - - case EXTRA_LONG2: - return Long.valueOf(getExtraLong2()); - - case EXTRA_LONG3: - return Long.valueOf(getExtraLong3()); - - } - 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 HOST_HASH_CODE: - return isSetHostHashCode(); - case REQUEST_HASH_CODE: - return isSetRequestHashCode(); - case DATA_TYPE: - return isSetDataType(); - case DATA_TIME: - return isSetDataTime(); - case THREAD_CPUTIME: - return isSetThreadCPUTime(); - case THREAD_USER_TIME: - return isSetThreadUserTime(); - case REQUEST_ID: - return isSetRequestID(); - case REQUEST_URL: - return isSetRequestURL(); - case CLIENT_IP: - return isSetClientIP(); - case EXTRA_DATA1: - return isSetExtraData1(); - case EXTRA_DATA2: - return isSetExtraData2(); - case EXTRA_DATA3: - return isSetExtraData3(); - case EXTRA_INT1: - return isSetExtraInt1(); - case EXTRA_INT2: - return isSetExtraInt2(); - case EXTRA_INT3: - return isSetExtraInt3(); - case EXTRA_LONG1: - return isSetExtraLong1(); - case EXTRA_LONG2: - return isSetExtraLong2(); - case EXTRA_LONG3: - return isSetExtraLong3(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof RequestThriftDTO) - return this.equals((RequestThriftDTO)that); - return false; - } - - public boolean equals(RequestThriftDTO that) { - if (that == null) - return false; - - boolean this_present_hostHashCode = true; - boolean that_present_hostHashCode = true; - if (this_present_hostHashCode || that_present_hostHashCode) { - if (!(this_present_hostHashCode && that_present_hostHashCode)) - return false; - if (this.hostHashCode != that.hostHashCode) - return false; - } - - boolean this_present_requestHashCode = true; - boolean that_present_requestHashCode = true; - if (this_present_requestHashCode || that_present_requestHashCode) { - if (!(this_present_requestHashCode && that_present_requestHashCode)) - return false; - if (this.requestHashCode != that.requestHashCode) - return false; - } - - boolean this_present_dataType = true; - boolean that_present_dataType = true; - if (this_present_dataType || that_present_dataType) { - if (!(this_present_dataType && that_present_dataType)) - return false; - if (this.dataType != that.dataType) - return false; - } - - boolean this_present_dataTime = true; - boolean that_present_dataTime = true; - if (this_present_dataTime || that_present_dataTime) { - if (!(this_present_dataTime && that_present_dataTime)) - return false; - if (this.dataTime != that.dataTime) - return false; - } - - boolean this_present_threadCPUTime = true; - boolean that_present_threadCPUTime = true; - if (this_present_threadCPUTime || that_present_threadCPUTime) { - if (!(this_present_threadCPUTime && that_present_threadCPUTime)) - return false; - if (this.threadCPUTime != that.threadCPUTime) - return false; - } - - boolean this_present_threadUserTime = true; - boolean that_present_threadUserTime = true; - if (this_present_threadUserTime || that_present_threadUserTime) { - if (!(this_present_threadUserTime && that_present_threadUserTime)) - return false; - if (this.threadUserTime != that.threadUserTime) - return false; - } - - boolean this_present_requestID = true && this.isSetRequestID(); - boolean that_present_requestID = true && that.isSetRequestID(); - if (this_present_requestID || that_present_requestID) { - if (!(this_present_requestID && that_present_requestID)) - return false; - if (!this.requestID.equals(that.requestID)) - return false; - } - - boolean this_present_requestURL = true && this.isSetRequestURL(); - boolean that_present_requestURL = true && that.isSetRequestURL(); - if (this_present_requestURL || that_present_requestURL) { - if (!(this_present_requestURL && that_present_requestURL)) - return false; - if (!this.requestURL.equals(that.requestURL)) - return false; - } - - boolean this_present_clientIP = true && this.isSetClientIP(); - boolean that_present_clientIP = true && that.isSetClientIP(); - if (this_present_clientIP || that_present_clientIP) { - if (!(this_present_clientIP && that_present_clientIP)) - return false; - if (!this.clientIP.equals(that.clientIP)) - return false; - } - - boolean this_present_extraData1 = true && this.isSetExtraData1(); - boolean that_present_extraData1 = true && that.isSetExtraData1(); - if (this_present_extraData1 || that_present_extraData1) { - if (!(this_present_extraData1 && that_present_extraData1)) - return false; - if (!this.extraData1.equals(that.extraData1)) - return false; - } - - boolean this_present_extraData2 = true && this.isSetExtraData2(); - boolean that_present_extraData2 = true && that.isSetExtraData2(); - if (this_present_extraData2 || that_present_extraData2) { - if (!(this_present_extraData2 && that_present_extraData2)) - return false; - if (!this.extraData2.equals(that.extraData2)) - return false; - } - - boolean this_present_extraData3 = true && this.isSetExtraData3(); - boolean that_present_extraData3 = true && that.isSetExtraData3(); - if (this_present_extraData3 || that_present_extraData3) { - if (!(this_present_extraData3 && that_present_extraData3)) - return false; - if (!this.extraData3.equals(that.extraData3)) - return false; - } - - boolean this_present_extraInt1 = true && this.isSetExtraInt1(); - boolean that_present_extraInt1 = true && that.isSetExtraInt1(); - if (this_present_extraInt1 || that_present_extraInt1) { - if (!(this_present_extraInt1 && that_present_extraInt1)) - return false; - if (this.extraInt1 != that.extraInt1) - return false; - } - - boolean this_present_extraInt2 = true && this.isSetExtraInt2(); - boolean that_present_extraInt2 = true && that.isSetExtraInt2(); - if (this_present_extraInt2 || that_present_extraInt2) { - if (!(this_present_extraInt2 && that_present_extraInt2)) - return false; - if (this.extraInt2 != that.extraInt2) - return false; - } - - boolean this_present_extraInt3 = true && this.isSetExtraInt3(); - boolean that_present_extraInt3 = true && that.isSetExtraInt3(); - if (this_present_extraInt3 || that_present_extraInt3) { - if (!(this_present_extraInt3 && that_present_extraInt3)) - return false; - if (this.extraInt3 != that.extraInt3) - return false; - } - - boolean this_present_extraLong1 = true && this.isSetExtraLong1(); - boolean that_present_extraLong1 = true && that.isSetExtraLong1(); - if (this_present_extraLong1 || that_present_extraLong1) { - if (!(this_present_extraLong1 && that_present_extraLong1)) - return false; - if (this.extraLong1 != that.extraLong1) - return false; - } - - boolean this_present_extraLong2 = true && this.isSetExtraLong2(); - boolean that_present_extraLong2 = true && that.isSetExtraLong2(); - if (this_present_extraLong2 || that_present_extraLong2) { - if (!(this_present_extraLong2 && that_present_extraLong2)) - return false; - if (this.extraLong2 != that.extraLong2) - return false; - } - - boolean this_present_extraLong3 = true && this.isSetExtraLong3(); - boolean that_present_extraLong3 = true && that.isSetExtraLong3(); - if (this_present_extraLong3 || that_present_extraLong3) { - if (!(this_present_extraLong3 && that_present_extraLong3)) - return false; - if (this.extraLong3 != that.extraLong3) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(RequestThriftDTO other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - RequestThriftDTO typedOther = (RequestThriftDTO)other; - - lastComparison = Boolean.valueOf(isSetHostHashCode()).compareTo(typedOther.isSetHostHashCode()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetHostHashCode()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostHashCode, typedOther.hostHashCode); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetRequestHashCode()).compareTo(typedOther.isSetRequestHashCode()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRequestHashCode()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestHashCode, typedOther.requestHashCode); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetDataType()).compareTo(typedOther.isSetDataType()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataType()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataType, typedOther.dataType); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(typedOther.isSetDataTime()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDataTime()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataTime, typedOther.dataTime); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetThreadCPUTime()).compareTo(typedOther.isSetThreadCPUTime()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetThreadCPUTime()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threadCPUTime, typedOther.threadCPUTime); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetThreadUserTime()).compareTo(typedOther.isSetThreadUserTime()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetThreadUserTime()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threadUserTime, typedOther.threadUserTime); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetRequestID()).compareTo(typedOther.isSetRequestID()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRequestID()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestID, typedOther.requestID); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetRequestURL()).compareTo(typedOther.isSetRequestURL()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetRequestURL()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestURL, typedOther.requestURL); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetClientIP()).compareTo(typedOther.isSetClientIP()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetClientIP()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clientIP, typedOther.clientIP); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData1()).compareTo(typedOther.isSetExtraData1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData1, typedOther.extraData1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData2()).compareTo(typedOther.isSetExtraData2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData2, typedOther.extraData2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraData3()).compareTo(typedOther.isSetExtraData3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraData3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData3, typedOther.extraData3); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt1()).compareTo(typedOther.isSetExtraInt1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt1, typedOther.extraInt1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt2()).compareTo(typedOther.isSetExtraInt2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt2, typedOther.extraInt2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraInt3()).compareTo(typedOther.isSetExtraInt3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraInt3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt3, typedOther.extraInt3); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong1()).compareTo(typedOther.isSetExtraLong1()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong1()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong1, typedOther.extraLong1); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong2()).compareTo(typedOther.isSetExtraLong2()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong2()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong2, typedOther.extraLong2); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetExtraLong3()).compareTo(typedOther.isSetExtraLong3()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetExtraLong3()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong3, typedOther.extraLong3); - 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("RequestThriftDTO("); - boolean first = true; - - sb.append("hostHashCode:"); - sb.append(this.hostHashCode); - first = false; - if (!first) sb.append(", "); - sb.append("requestHashCode:"); - sb.append(this.requestHashCode); - first = false; - if (!first) sb.append(", "); - sb.append("dataType:"); - sb.append(this.dataType); - first = false; - if (!first) sb.append(", "); - sb.append("dataTime:"); - sb.append(this.dataTime); - first = false; - if (!first) sb.append(", "); - sb.append("threadCPUTime:"); - sb.append(this.threadCPUTime); - first = false; - if (!first) sb.append(", "); - sb.append("threadUserTime:"); - sb.append(this.threadUserTime); - first = false; - if (isSetRequestID()) { - if (!first) sb.append(", "); - sb.append("requestID:"); - if (this.requestID == null) { - sb.append("null"); - } else { - sb.append(this.requestID); - } - first = false; - } - if (isSetRequestURL()) { - if (!first) sb.append(", "); - sb.append("requestURL:"); - if (this.requestURL == null) { - sb.append("null"); - } else { - sb.append(this.requestURL); - } - first = false; - } - if (isSetClientIP()) { - if (!first) sb.append(", "); - sb.append("clientIP:"); - if (this.clientIP == null) { - sb.append("null"); - } else { - sb.append(this.clientIP); - } - first = false; - } - if (isSetExtraData1()) { - if (!first) sb.append(", "); - sb.append("extraData1:"); - if (this.extraData1 == null) { - sb.append("null"); - } else { - sb.append(this.extraData1); - } - first = false; - } - if (isSetExtraData2()) { - if (!first) sb.append(", "); - sb.append("extraData2:"); - if (this.extraData2 == null) { - sb.append("null"); - } else { - sb.append(this.extraData2); - } - first = false; - } - if (isSetExtraData3()) { - if (!first) sb.append(", "); - sb.append("extraData3:"); - if (this.extraData3 == null) { - sb.append("null"); - } else { - sb.append(this.extraData3); - } - first = false; - } - if (isSetExtraInt1()) { - if (!first) sb.append(", "); - sb.append("extraInt1:"); - sb.append(this.extraInt1); - first = false; - } - if (isSetExtraInt2()) { - if (!first) sb.append(", "); - sb.append("extraInt2:"); - sb.append(this.extraInt2); - first = false; - } - if (isSetExtraInt3()) { - if (!first) sb.append(", "); - sb.append("extraInt3:"); - sb.append(this.extraInt3); - first = false; - } - if (isSetExtraLong1()) { - if (!first) sb.append(", "); - sb.append("extraLong1:"); - sb.append(this.extraLong1); - first = false; - } - if (isSetExtraLong2()) { - if (!first) sb.append(", "); - sb.append("extraLong2:"); - sb.append(this.extraLong2); - first = false; - } - if (isSetExtraLong3()) { - if (!first) sb.append(", "); - sb.append("extraLong3:"); - sb.append(this.extraLong3); - first = false; - } - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bit_vector = new BitSet(1); - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class RequestThriftDTOStandardSchemeFactory implements SchemeFactory { - public RequestThriftDTOStandardScheme getScheme() { - return new RequestThriftDTOStandardScheme(); - } - } - - private static class RequestThriftDTOStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, RequestThriftDTO 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: // HOST_HASH_CODE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.hostHashCode = iprot.readI32(); - struct.setHostHashCodeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // REQUEST_HASH_CODE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.requestHashCode = iprot.readI32(); - struct.setRequestHashCodeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // DATA_TYPE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.dataType = iprot.readI32(); - struct.setDataTypeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // DATA_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.dataTime = iprot.readI64(); - struct.setDataTimeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // THREAD_CPUTIME - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.threadCPUTime = iprot.readI64(); - struct.setThreadCPUTimeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 6: // THREAD_USER_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.threadUserTime = iprot.readI64(); - struct.setThreadUserTimeIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 7: // REQUEST_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.requestID = iprot.readString(); - struct.setRequestIDIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 8: // REQUEST_URL - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.requestURL = iprot.readString(); - struct.setRequestURLIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 9: // CLIENT_IP - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.clientIP = iprot.readString(); - struct.setClientIPIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 10: // EXTRA_DATA1 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData1 = iprot.readString(); - struct.setExtraData1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 11: // EXTRA_DATA2 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData2 = iprot.readString(); - struct.setExtraData2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 12: // EXTRA_DATA3 - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.extraData3 = iprot.readString(); - struct.setExtraData3IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 13: // EXTRA_INT1 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt1 = iprot.readI32(); - struct.setExtraInt1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 14: // EXTRA_INT2 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt2 = iprot.readI32(); - struct.setExtraInt2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 15: // EXTRA_INT3 - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.extraInt3 = iprot.readI32(); - struct.setExtraInt3IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 16: // EXTRA_LONG1 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong1 = iprot.readI64(); - struct.setExtraLong1IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 17: // EXTRA_LONG2 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong2 = iprot.readI64(); - struct.setExtraLong2IsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 18: // EXTRA_LONG3 - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.extraLong3 = iprot.readI64(); - struct.setExtraLong3IsSet(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, RequestThriftDTO struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(HOST_HASH_CODE_FIELD_DESC); - oprot.writeI32(struct.hostHashCode); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(REQUEST_HASH_CODE_FIELD_DESC); - oprot.writeI32(struct.requestHashCode); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(DATA_TYPE_FIELD_DESC); - oprot.writeI32(struct.dataType); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(DATA_TIME_FIELD_DESC); - oprot.writeI64(struct.dataTime); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(THREAD_CPUTIME_FIELD_DESC); - oprot.writeI64(struct.threadCPUTime); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(THREAD_USER_TIME_FIELD_DESC); - oprot.writeI64(struct.threadUserTime); - oprot.writeFieldEnd(); - if (struct.requestID != null) { - if (struct.isSetRequestID()) { - oprot.writeFieldBegin(REQUEST_ID_FIELD_DESC); - oprot.writeString(struct.requestID); - oprot.writeFieldEnd(); - } - } - if (struct.requestURL != null) { - if (struct.isSetRequestURL()) { - oprot.writeFieldBegin(REQUEST_URL_FIELD_DESC); - oprot.writeString(struct.requestURL); - oprot.writeFieldEnd(); - } - } - if (struct.clientIP != null) { - if (struct.isSetClientIP()) { - oprot.writeFieldBegin(CLIENT_IP_FIELD_DESC); - oprot.writeString(struct.clientIP); - oprot.writeFieldEnd(); - } - } - if (struct.extraData1 != null) { - if (struct.isSetExtraData1()) { - oprot.writeFieldBegin(EXTRA_DATA1_FIELD_DESC); - oprot.writeString(struct.extraData1); - oprot.writeFieldEnd(); - } - } - if (struct.extraData2 != null) { - if (struct.isSetExtraData2()) { - oprot.writeFieldBegin(EXTRA_DATA2_FIELD_DESC); - oprot.writeString(struct.extraData2); - oprot.writeFieldEnd(); - } - } - if (struct.extraData3 != null) { - if (struct.isSetExtraData3()) { - oprot.writeFieldBegin(EXTRA_DATA3_FIELD_DESC); - oprot.writeString(struct.extraData3); - oprot.writeFieldEnd(); - } - } - if (struct.isSetExtraInt1()) { - oprot.writeFieldBegin(EXTRA_INT1_FIELD_DESC); - oprot.writeI32(struct.extraInt1); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraInt2()) { - oprot.writeFieldBegin(EXTRA_INT2_FIELD_DESC); - oprot.writeI32(struct.extraInt2); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraInt3()) { - oprot.writeFieldBegin(EXTRA_INT3_FIELD_DESC); - oprot.writeI32(struct.extraInt3); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong1()) { - oprot.writeFieldBegin(EXTRA_LONG1_FIELD_DESC); - oprot.writeI64(struct.extraLong1); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong2()) { - oprot.writeFieldBegin(EXTRA_LONG2_FIELD_DESC); - oprot.writeI64(struct.extraLong2); - oprot.writeFieldEnd(); - } - if (struct.isSetExtraLong3()) { - oprot.writeFieldBegin(EXTRA_LONG3_FIELD_DESC); - oprot.writeI64(struct.extraLong3); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class RequestThriftDTOTupleSchemeFactory implements SchemeFactory { - public RequestThriftDTOTupleScheme getScheme() { - return new RequestThriftDTOTupleScheme(); - } - } - - private static class RequestThriftDTOTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, RequestThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetHostHashCode()) { - optionals.set(0); - } - if (struct.isSetRequestHashCode()) { - optionals.set(1); - } - if (struct.isSetDataType()) { - optionals.set(2); - } - if (struct.isSetDataTime()) { - optionals.set(3); - } - if (struct.isSetThreadCPUTime()) { - optionals.set(4); - } - if (struct.isSetThreadUserTime()) { - optionals.set(5); - } - if (struct.isSetRequestID()) { - optionals.set(6); - } - if (struct.isSetRequestURL()) { - optionals.set(7); - } - if (struct.isSetClientIP()) { - optionals.set(8); - } - if (struct.isSetExtraData1()) { - optionals.set(9); - } - if (struct.isSetExtraData2()) { - optionals.set(10); - } - if (struct.isSetExtraData3()) { - optionals.set(11); - } - if (struct.isSetExtraInt1()) { - optionals.set(12); - } - if (struct.isSetExtraInt2()) { - optionals.set(13); - } - if (struct.isSetExtraInt3()) { - optionals.set(14); - } - if (struct.isSetExtraLong1()) { - optionals.set(15); - } - if (struct.isSetExtraLong2()) { - optionals.set(16); - } - if (struct.isSetExtraLong3()) { - optionals.set(17); - } - oprot.writeBitSet(optionals, 18); - if (struct.isSetHostHashCode()) { - oprot.writeI32(struct.hostHashCode); - } - if (struct.isSetRequestHashCode()) { - oprot.writeI32(struct.requestHashCode); - } - if (struct.isSetDataType()) { - oprot.writeI32(struct.dataType); - } - if (struct.isSetDataTime()) { - oprot.writeI64(struct.dataTime); - } - if (struct.isSetThreadCPUTime()) { - oprot.writeI64(struct.threadCPUTime); - } - if (struct.isSetThreadUserTime()) { - oprot.writeI64(struct.threadUserTime); - } - if (struct.isSetRequestID()) { - oprot.writeString(struct.requestID); - } - if (struct.isSetRequestURL()) { - oprot.writeString(struct.requestURL); - } - if (struct.isSetClientIP()) { - oprot.writeString(struct.clientIP); - } - if (struct.isSetExtraData1()) { - oprot.writeString(struct.extraData1); - } - if (struct.isSetExtraData2()) { - oprot.writeString(struct.extraData2); - } - if (struct.isSetExtraData3()) { - oprot.writeString(struct.extraData3); - } - if (struct.isSetExtraInt1()) { - oprot.writeI32(struct.extraInt1); - } - if (struct.isSetExtraInt2()) { - oprot.writeI32(struct.extraInt2); - } - if (struct.isSetExtraInt3()) { - oprot.writeI32(struct.extraInt3); - } - if (struct.isSetExtraLong1()) { - oprot.writeI64(struct.extraLong1); - } - if (struct.isSetExtraLong2()) { - oprot.writeI64(struct.extraLong2); - } - if (struct.isSetExtraLong3()) { - oprot.writeI64(struct.extraLong3); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, RequestThriftDTO struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(18); - if (incoming.get(0)) { - struct.hostHashCode = iprot.readI32(); - struct.setHostHashCodeIsSet(true); - } - if (incoming.get(1)) { - struct.requestHashCode = iprot.readI32(); - struct.setRequestHashCodeIsSet(true); - } - if (incoming.get(2)) { - struct.dataType = iprot.readI32(); - struct.setDataTypeIsSet(true); - } - if (incoming.get(3)) { - struct.dataTime = iprot.readI64(); - struct.setDataTimeIsSet(true); - } - if (incoming.get(4)) { - struct.threadCPUTime = iprot.readI64(); - struct.setThreadCPUTimeIsSet(true); - } - if (incoming.get(5)) { - struct.threadUserTime = iprot.readI64(); - struct.setThreadUserTimeIsSet(true); - } - if (incoming.get(6)) { - struct.requestID = iprot.readString(); - struct.setRequestIDIsSet(true); - } - if (incoming.get(7)) { - struct.requestURL = iprot.readString(); - struct.setRequestURLIsSet(true); - } - if (incoming.get(8)) { - struct.clientIP = iprot.readString(); - struct.setClientIPIsSet(true); - } - if (incoming.get(9)) { - struct.extraData1 = iprot.readString(); - struct.setExtraData1IsSet(true); - } - if (incoming.get(10)) { - struct.extraData2 = iprot.readString(); - struct.setExtraData2IsSet(true); - } - if (incoming.get(11)) { - struct.extraData3 = iprot.readString(); - struct.setExtraData3IsSet(true); - } - if (incoming.get(12)) { - struct.extraInt1 = iprot.readI32(); - struct.setExtraInt1IsSet(true); - } - if (incoming.get(13)) { - struct.extraInt2 = iprot.readI32(); - struct.setExtraInt2IsSet(true); - } - if (incoming.get(14)) { - struct.extraInt3 = iprot.readI32(); - struct.setExtraInt3IsSet(true); - } - if (incoming.get(15)) { - struct.extraLong1 = iprot.readI64(); - struct.setExtraLong1IsSet(true); - } - if (incoming.get(16)) { - struct.extraLong2 = iprot.readI64(); - struct.setExtraLong2IsSet(true); - } - if (incoming.get(17)) { - struct.extraLong3 = iprot.readI64(); - struct.setExtraLong3IsSet(true); - } - } - } + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RequestThriftDTO"); + + private static final org.apache.thrift.protocol.TField HOST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("hostHashCode", org.apache.thrift.protocol.TType.I32, (short) 1); + private static final org.apache.thrift.protocol.TField REQUEST_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("requestHashCode", org.apache.thrift.protocol.TType.I32, (short) 2); + private static final org.apache.thrift.protocol.TField DATA_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dataType", org.apache.thrift.protocol.TType.I32, (short) 3); + private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short) 4); + private static final org.apache.thrift.protocol.TField THREAD_CPUTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("threadCPUTime", org.apache.thrift.protocol.TType.I64, (short) 5); + private static final org.apache.thrift.protocol.TField THREAD_USER_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("threadUserTime", org.apache.thrift.protocol.TType.I64, (short) 6); + private static final org.apache.thrift.protocol.TField REQUEST_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("requestID", org.apache.thrift.protocol.TType.STRING, (short) 7); + private static final org.apache.thrift.protocol.TField REQUEST_URL_FIELD_DESC = new org.apache.thrift.protocol.TField("requestURL", org.apache.thrift.protocol.TType.STRING, (short) 8); + private static final org.apache.thrift.protocol.TField CLIENT_IP_FIELD_DESC = new org.apache.thrift.protocol.TField("clientIP", org.apache.thrift.protocol.TType.STRING, (short) 9); + private static final org.apache.thrift.protocol.TField EXTRA_DATA1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData1", org.apache.thrift.protocol.TType.STRING, (short) 10); + private static final org.apache.thrift.protocol.TField EXTRA_DATA2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData2", org.apache.thrift.protocol.TType.STRING, (short) 11); + private static final org.apache.thrift.protocol.TField EXTRA_DATA3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraData3", org.apache.thrift.protocol.TType.STRING, (short) 12); + private static final org.apache.thrift.protocol.TField EXTRA_INT1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt1", org.apache.thrift.protocol.TType.I32, (short) 13); + private static final org.apache.thrift.protocol.TField EXTRA_INT2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt2", org.apache.thrift.protocol.TType.I32, (short) 14); + private static final org.apache.thrift.protocol.TField EXTRA_INT3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraInt3", org.apache.thrift.protocol.TType.I32, (short) 15); + private static final org.apache.thrift.protocol.TField EXTRA_LONG1_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong1", org.apache.thrift.protocol.TType.I64, (short) 16); + private static final org.apache.thrift.protocol.TField EXTRA_LONG2_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong2", org.apache.thrift.protocol.TType.I64, (short) 17); + private static final org.apache.thrift.protocol.TField EXTRA_LONG3_FIELD_DESC = new org.apache.thrift.protocol.TField("extraLong3", org.apache.thrift.protocol.TType.I64, (short) 18); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RequestThriftDTOStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RequestThriftDTOTupleSchemeFactory()); + } + + public int hostHashCode; // required + public int requestHashCode; // required + public int dataType; // required + public long dataTime; // required + public long threadCPUTime; // required + public long threadUserTime; // required + public String requestID; // optional + public String requestURL; // optional + public String clientIP; // optional + public String extraData1; // optional + public String extraData2; // optional + public String extraData3; // optional + public int extraInt1; // optional + public int extraInt2; // optional + public int extraInt3; // optional + public long extraLong1; // optional + public long extraLong2; // optional + public long extraLong3; // optional + + /** + * The set of fields this struct contains, along with convenience methods + * for finding and manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + HOST_HASH_CODE((short) 1, "hostHashCode"), REQUEST_HASH_CODE((short) 2, "requestHashCode"), DATA_TYPE((short) 3, "dataType"), DATA_TIME((short) 4, "dataTime"), THREAD_CPUTIME((short) 5, "threadCPUTime"), THREAD_USER_TIME((short) 6, "threadUserTime"), REQUEST_ID((short) 7, "requestID"), REQUEST_URL( + (short) 8, "requestURL"), CLIENT_IP((short) 9, "clientIP"), EXTRA_DATA1((short) 10, "extraData1"), EXTRA_DATA2((short) 11, "extraData2"), EXTRA_DATA3((short) 12, "extraData3"), EXTRA_INT1((short) 13, "extraInt1"), EXTRA_INT2((short) 14, "extraInt2"), EXTRA_INT3((short) 15, + "extraInt3"), EXTRA_LONG1((short) 16, "extraLong1"), EXTRA_LONG2((short) 17, "extraLong2"), EXTRA_LONG3((short) 18, "extraLong3"); + + 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: // HOST_HASH_CODE + return HOST_HASH_CODE; + case 2: // REQUEST_HASH_CODE + return REQUEST_HASH_CODE; + case 3: // DATA_TYPE + return DATA_TYPE; + case 4: // DATA_TIME + return DATA_TIME; + case 5: // THREAD_CPUTIME + return THREAD_CPUTIME; + case 6: // THREAD_USER_TIME + return THREAD_USER_TIME; + case 7: // REQUEST_ID + return REQUEST_ID; + case 8: // REQUEST_URL + return REQUEST_URL; + case 9: // CLIENT_IP + return CLIENT_IP; + case 10: // EXTRA_DATA1 + return EXTRA_DATA1; + case 11: // EXTRA_DATA2 + return EXTRA_DATA2; + case 12: // EXTRA_DATA3 + return EXTRA_DATA3; + case 13: // EXTRA_INT1 + return EXTRA_INT1; + case 14: // EXTRA_INT2 + return EXTRA_INT2; + case 15: // EXTRA_INT3 + return EXTRA_INT3; + case 16: // EXTRA_LONG1 + return EXTRA_LONG1; + case 17: // EXTRA_LONG2 + return EXTRA_LONG2; + case 18: // EXTRA_LONG3 + return EXTRA_LONG3; + 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 __HOSTHASHCODE_ISSET_ID = 0; + private static final int __REQUESTHASHCODE_ISSET_ID = 1; + private static final int __DATATYPE_ISSET_ID = 2; + private static final int __DATATIME_ISSET_ID = 3; + private static final int __THREADCPUTIME_ISSET_ID = 4; + private static final int __THREADUSERTIME_ISSET_ID = 5; + private static final int __EXTRAINT1_ISSET_ID = 6; + private static final int __EXTRAINT2_ISSET_ID = 7; + private static final int __EXTRAINT3_ISSET_ID = 8; + private static final int __EXTRALONG1_ISSET_ID = 9; + private static final int __EXTRALONG2_ISSET_ID = 10; + private static final int __EXTRALONG3_ISSET_ID = 11; + private BitSet __isset_bit_vector = new BitSet(12); + private _Fields optionals[] = { _Fields.REQUEST_ID, _Fields.REQUEST_URL, _Fields.CLIENT_IP, _Fields.EXTRA_DATA1, _Fields.EXTRA_DATA2, _Fields.EXTRA_DATA3, _Fields.EXTRA_INT1, _Fields.EXTRA_INT2, _Fields.EXTRA_INT3, _Fields.EXTRA_LONG1, _Fields.EXTRA_LONG2, _Fields.EXTRA_LONG3 }; + 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.HOST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("hostHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.REQUEST_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("requestHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA_TYPE, new org.apache.thrift.meta_data.FieldMetaData("dataType", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.THREAD_CPUTIME, new org.apache.thrift.meta_data.FieldMetaData("threadCPUTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.THREAD_USER_TIME, new org.apache.thrift.meta_data.FieldMetaData("threadUserTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.REQUEST_ID, new org.apache.thrift.meta_data.FieldMetaData("requestID", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.REQUEST_URL, new org.apache.thrift.meta_data.FieldMetaData("requestURL", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CLIENT_IP, new org.apache.thrift.meta_data.FieldMetaData("clientIP", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA1, new org.apache.thrift.meta_data.FieldMetaData("extraData1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA2, new org.apache.thrift.meta_data.FieldMetaData("extraData2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_DATA3, new org.apache.thrift.meta_data.FieldMetaData("extraData3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXTRA_INT1, new org.apache.thrift.meta_data.FieldMetaData("extraInt1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_INT2, new org.apache.thrift.meta_data.FieldMetaData("extraInt2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_INT3, new org.apache.thrift.meta_data.FieldMetaData("extraInt3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.EXTRA_LONG1, new org.apache.thrift.meta_data.FieldMetaData("extraLong1", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.EXTRA_LONG2, new org.apache.thrift.meta_data.FieldMetaData("extraLong2", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.EXTRA_LONG3, new org.apache.thrift.meta_data.FieldMetaData("extraLong3", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RequestThriftDTO.class, metaDataMap); + } + + public RequestThriftDTO() { + } + + public RequestThriftDTO(int hostHashCode, int requestHashCode, int dataType, long dataTime, long threadCPUTime, long threadUserTime) { + this(); + this.hostHashCode = hostHashCode; + setHostHashCodeIsSet(true); + this.requestHashCode = requestHashCode; + setRequestHashCodeIsSet(true); + this.dataType = dataType; + setDataTypeIsSet(true); + this.dataTime = dataTime; + setDataTimeIsSet(true); + this.threadCPUTime = threadCPUTime; + setThreadCPUTimeIsSet(true); + this.threadUserTime = threadUserTime; + setThreadUserTimeIsSet(true); + } + + /** + * Performs a deep copy on other. + */ + public RequestThriftDTO(RequestThriftDTO other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.hostHashCode = other.hostHashCode; + this.requestHashCode = other.requestHashCode; + this.dataType = other.dataType; + this.dataTime = other.dataTime; + this.threadCPUTime = other.threadCPUTime; + this.threadUserTime = other.threadUserTime; + if (other.isSetRequestID()) { + this.requestID = other.requestID; + } + if (other.isSetRequestURL()) { + this.requestURL = other.requestURL; + } + if (other.isSetClientIP()) { + this.clientIP = other.clientIP; + } + if (other.isSetExtraData1()) { + this.extraData1 = other.extraData1; + } + if (other.isSetExtraData2()) { + this.extraData2 = other.extraData2; + } + if (other.isSetExtraData3()) { + this.extraData3 = other.extraData3; + } + this.extraInt1 = other.extraInt1; + this.extraInt2 = other.extraInt2; + this.extraInt3 = other.extraInt3; + this.extraLong1 = other.extraLong1; + this.extraLong2 = other.extraLong2; + this.extraLong3 = other.extraLong3; + } + + public RequestThriftDTO deepCopy() { + return new RequestThriftDTO(this); + } + + @Override + public void clear() { + setHostHashCodeIsSet(false); + this.hostHashCode = 0; + setRequestHashCodeIsSet(false); + this.requestHashCode = 0; + setDataTypeIsSet(false); + this.dataType = 0; + setDataTimeIsSet(false); + this.dataTime = 0; + setThreadCPUTimeIsSet(false); + this.threadCPUTime = 0; + setThreadUserTimeIsSet(false); + this.threadUserTime = 0; + this.requestID = null; + this.requestURL = null; + this.clientIP = null; + this.extraData1 = null; + this.extraData2 = null; + this.extraData3 = null; + setExtraInt1IsSet(false); + this.extraInt1 = 0; + setExtraInt2IsSet(false); + this.extraInt2 = 0; + setExtraInt3IsSet(false); + this.extraInt3 = 0; + setExtraLong1IsSet(false); + this.extraLong1 = 0; + setExtraLong2IsSet(false); + this.extraLong2 = 0; + setExtraLong3IsSet(false); + this.extraLong3 = 0; + } + + public int getHostHashCode() { + return this.hostHashCode; + } + + public RequestThriftDTO setHostHashCode(int hostHashCode) { + this.hostHashCode = hostHashCode; + setHostHashCodeIsSet(true); + return this; + } + + public void unsetHostHashCode() { + __isset_bit_vector.clear(__HOSTHASHCODE_ISSET_ID); + } + + /** + * Returns true if field hostHashCode is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetHostHashCode() { + return __isset_bit_vector.get(__HOSTHASHCODE_ISSET_ID); + } + + public void setHostHashCodeIsSet(boolean value) { + __isset_bit_vector.set(__HOSTHASHCODE_ISSET_ID, value); + } + + public int getRequestHashCode() { + return this.requestHashCode; + } + + public RequestThriftDTO setRequestHashCode(int requestHashCode) { + this.requestHashCode = requestHashCode; + setRequestHashCodeIsSet(true); + return this; + } + + public void unsetRequestHashCode() { + __isset_bit_vector.clear(__REQUESTHASHCODE_ISSET_ID); + } + + /** + * Returns true if field requestHashCode is set (has been assigned a value) + * and false otherwise + */ + public boolean isSetRequestHashCode() { + return __isset_bit_vector.get(__REQUESTHASHCODE_ISSET_ID); + } + + public void setRequestHashCodeIsSet(boolean value) { + __isset_bit_vector.set(__REQUESTHASHCODE_ISSET_ID, value); + } + + public int getDataType() { + return this.dataType; + } + + public RequestThriftDTO setDataType(int dataType) { + this.dataType = dataType; + setDataTypeIsSet(true); + return this; + } + + public void unsetDataType() { + __isset_bit_vector.clear(__DATATYPE_ISSET_ID); + } + + /** + * Returns true if field dataType is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataType() { + return __isset_bit_vector.get(__DATATYPE_ISSET_ID); + } + + public void setDataTypeIsSet(boolean value) { + __isset_bit_vector.set(__DATATYPE_ISSET_ID, value); + } + + public long getDataTime() { + return this.dataTime; + } + + public RequestThriftDTO setDataTime(long dataTime) { + this.dataTime = dataTime; + setDataTimeIsSet(true); + return this; + } + + public void unsetDataTime() { + __isset_bit_vector.clear(__DATATIME_ISSET_ID); + } + + /** + * Returns true if field dataTime is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetDataTime() { + return __isset_bit_vector.get(__DATATIME_ISSET_ID); + } + + public void setDataTimeIsSet(boolean value) { + __isset_bit_vector.set(__DATATIME_ISSET_ID, value); + } + + public long getThreadCPUTime() { + return this.threadCPUTime; + } + + public RequestThriftDTO setThreadCPUTime(long threadCPUTime) { + this.threadCPUTime = threadCPUTime; + setThreadCPUTimeIsSet(true); + return this; + } + + public void unsetThreadCPUTime() { + __isset_bit_vector.clear(__THREADCPUTIME_ISSET_ID); + } + + /** + * Returns true if field threadCPUTime is set (has been assigned a value) + * and false otherwise + */ + public boolean isSetThreadCPUTime() { + return __isset_bit_vector.get(__THREADCPUTIME_ISSET_ID); + } + + public void setThreadCPUTimeIsSet(boolean value) { + __isset_bit_vector.set(__THREADCPUTIME_ISSET_ID, value); + } + + public long getThreadUserTime() { + return this.threadUserTime; + } + + public RequestThriftDTO setThreadUserTime(long threadUserTime) { + this.threadUserTime = threadUserTime; + setThreadUserTimeIsSet(true); + return this; + } + + public void unsetThreadUserTime() { + __isset_bit_vector.clear(__THREADUSERTIME_ISSET_ID); + } + + /** + * Returns true if field threadUserTime is set (has been assigned a value) + * and false otherwise + */ + public boolean isSetThreadUserTime() { + return __isset_bit_vector.get(__THREADUSERTIME_ISSET_ID); + } + + public void setThreadUserTimeIsSet(boolean value) { + __isset_bit_vector.set(__THREADUSERTIME_ISSET_ID, value); + } + + public String getRequestID() { + return this.requestID; + } + + public RequestThriftDTO setRequestID(String requestID) { + this.requestID = requestID; + return this; + } + + public void unsetRequestID() { + this.requestID = null; + } + + /** + * Returns true if field requestID is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetRequestID() { + return this.requestID != null; + } + + public void setRequestIDIsSet(boolean value) { + if (!value) { + this.requestID = null; + } + } + + public String getRequestURL() { + return this.requestURL; + } + + public RequestThriftDTO setRequestURL(String requestURL) { + this.requestURL = requestURL; + return this; + } + + public void unsetRequestURL() { + this.requestURL = null; + } + + /** + * Returns true if field requestURL is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetRequestURL() { + return this.requestURL != null; + } + + public void setRequestURLIsSet(boolean value) { + if (!value) { + this.requestURL = null; + } + } + + public String getClientIP() { + return this.clientIP; + } + + public RequestThriftDTO setClientIP(String clientIP) { + this.clientIP = clientIP; + return this; + } + + public void unsetClientIP() { + this.clientIP = null; + } + + /** + * Returns true if field clientIP is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetClientIP() { + return this.clientIP != null; + } + + public void setClientIPIsSet(boolean value) { + if (!value) { + this.clientIP = null; + } + } + + public String getExtraData1() { + return this.extraData1; + } + + public RequestThriftDTO setExtraData1(String extraData1) { + this.extraData1 = extraData1; + return this; + } + + public void unsetExtraData1() { + this.extraData1 = null; + } + + /** + * Returns true if field extraData1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData1() { + return this.extraData1 != null; + } + + public void setExtraData1IsSet(boolean value) { + if (!value) { + this.extraData1 = null; + } + } + + public String getExtraData2() { + return this.extraData2; + } + + public RequestThriftDTO setExtraData2(String extraData2) { + this.extraData2 = extraData2; + return this; + } + + public void unsetExtraData2() { + this.extraData2 = null; + } + + /** + * Returns true if field extraData2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData2() { + return this.extraData2 != null; + } + + public void setExtraData2IsSet(boolean value) { + if (!value) { + this.extraData2 = null; + } + } + + public String getExtraData3() { + return this.extraData3; + } + + public RequestThriftDTO setExtraData3(String extraData3) { + this.extraData3 = extraData3; + return this; + } + + public void unsetExtraData3() { + this.extraData3 = null; + } + + /** + * Returns true if field extraData3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraData3() { + return this.extraData3 != null; + } + + public void setExtraData3IsSet(boolean value) { + if (!value) { + this.extraData3 = null; + } + } + + public int getExtraInt1() { + return this.extraInt1; + } + + public RequestThriftDTO setExtraInt1(int extraInt1) { + this.extraInt1 = extraInt1; + setExtraInt1IsSet(true); + return this; + } + + public void unsetExtraInt1() { + __isset_bit_vector.clear(__EXTRAINT1_ISSET_ID); + } + + /** + * Returns true if field extraInt1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt1() { + return __isset_bit_vector.get(__EXTRAINT1_ISSET_ID); + } + + public void setExtraInt1IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT1_ISSET_ID, value); + } + + public int getExtraInt2() { + return this.extraInt2; + } + + public RequestThriftDTO setExtraInt2(int extraInt2) { + this.extraInt2 = extraInt2; + setExtraInt2IsSet(true); + return this; + } + + public void unsetExtraInt2() { + __isset_bit_vector.clear(__EXTRAINT2_ISSET_ID); + } + + /** + * Returns true if field extraInt2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt2() { + return __isset_bit_vector.get(__EXTRAINT2_ISSET_ID); + } + + public void setExtraInt2IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT2_ISSET_ID, value); + } + + public int getExtraInt3() { + return this.extraInt3; + } + + public RequestThriftDTO setExtraInt3(int extraInt3) { + this.extraInt3 = extraInt3; + setExtraInt3IsSet(true); + return this; + } + + public void unsetExtraInt3() { + __isset_bit_vector.clear(__EXTRAINT3_ISSET_ID); + } + + /** + * Returns true if field extraInt3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraInt3() { + return __isset_bit_vector.get(__EXTRAINT3_ISSET_ID); + } + + public void setExtraInt3IsSet(boolean value) { + __isset_bit_vector.set(__EXTRAINT3_ISSET_ID, value); + } + + public long getExtraLong1() { + return this.extraLong1; + } + + public RequestThriftDTO setExtraLong1(long extraLong1) { + this.extraLong1 = extraLong1; + setExtraLong1IsSet(true); + return this; + } + + public void unsetExtraLong1() { + __isset_bit_vector.clear(__EXTRALONG1_ISSET_ID); + } + + /** + * Returns true if field extraLong1 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong1() { + return __isset_bit_vector.get(__EXTRALONG1_ISSET_ID); + } + + public void setExtraLong1IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG1_ISSET_ID, value); + } + + public long getExtraLong2() { + return this.extraLong2; + } + + public RequestThriftDTO setExtraLong2(long extraLong2) { + this.extraLong2 = extraLong2; + setExtraLong2IsSet(true); + return this; + } + + public void unsetExtraLong2() { + __isset_bit_vector.clear(__EXTRALONG2_ISSET_ID); + } + + /** + * Returns true if field extraLong2 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong2() { + return __isset_bit_vector.get(__EXTRALONG2_ISSET_ID); + } + + public void setExtraLong2IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG2_ISSET_ID, value); + } + + public long getExtraLong3() { + return this.extraLong3; + } + + public RequestThriftDTO setExtraLong3(long extraLong3) { + this.extraLong3 = extraLong3; + setExtraLong3IsSet(true); + return this; + } + + public void unsetExtraLong3() { + __isset_bit_vector.clear(__EXTRALONG3_ISSET_ID); + } + + /** + * Returns true if field extraLong3 is set (has been assigned a value) and + * false otherwise + */ + public boolean isSetExtraLong3() { + return __isset_bit_vector.get(__EXTRALONG3_ISSET_ID); + } + + public void setExtraLong3IsSet(boolean value) { + __isset_bit_vector.set(__EXTRALONG3_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HOST_HASH_CODE: + if (value == null) { + unsetHostHashCode(); + } else { + setHostHashCode((Integer) value); + } + break; + + case REQUEST_HASH_CODE: + if (value == null) { + unsetRequestHashCode(); + } else { + setRequestHashCode((Integer) value); + } + break; + + case DATA_TYPE: + if (value == null) { + unsetDataType(); + } else { + setDataType((Integer) value); + } + break; + + case DATA_TIME: + if (value == null) { + unsetDataTime(); + } else { + setDataTime((Long) value); + } + break; + + case THREAD_CPUTIME: + if (value == null) { + unsetThreadCPUTime(); + } else { + setThreadCPUTime((Long) value); + } + break; + + case THREAD_USER_TIME: + if (value == null) { + unsetThreadUserTime(); + } else { + setThreadUserTime((Long) value); + } + break; + + case REQUEST_ID: + if (value == null) { + unsetRequestID(); + } else { + setRequestID((String) value); + } + break; + + case REQUEST_URL: + if (value == null) { + unsetRequestURL(); + } else { + setRequestURL((String) value); + } + break; + + case CLIENT_IP: + if (value == null) { + unsetClientIP(); + } else { + setClientIP((String) value); + } + break; + + case EXTRA_DATA1: + if (value == null) { + unsetExtraData1(); + } else { + setExtraData1((String) value); + } + break; + + case EXTRA_DATA2: + if (value == null) { + unsetExtraData2(); + } else { + setExtraData2((String) value); + } + break; + + case EXTRA_DATA3: + if (value == null) { + unsetExtraData3(); + } else { + setExtraData3((String) value); + } + break; + + case EXTRA_INT1: + if (value == null) { + unsetExtraInt1(); + } else { + setExtraInt1((Integer) value); + } + break; + + case EXTRA_INT2: + if (value == null) { + unsetExtraInt2(); + } else { + setExtraInt2((Integer) value); + } + break; + + case EXTRA_INT3: + if (value == null) { + unsetExtraInt3(); + } else { + setExtraInt3((Integer) value); + } + break; + + case EXTRA_LONG1: + if (value == null) { + unsetExtraLong1(); + } else { + setExtraLong1((Long) value); + } + break; + + case EXTRA_LONG2: + if (value == null) { + unsetExtraLong2(); + } else { + setExtraLong2((Long) value); + } + break; + + case EXTRA_LONG3: + if (value == null) { + unsetExtraLong3(); + } else { + setExtraLong3((Long) value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HOST_HASH_CODE: + return Integer.valueOf(getHostHashCode()); + + case REQUEST_HASH_CODE: + return Integer.valueOf(getRequestHashCode()); + + case DATA_TYPE: + return Integer.valueOf(getDataType()); + + case DATA_TIME: + return Long.valueOf(getDataTime()); + + case THREAD_CPUTIME: + return Long.valueOf(getThreadCPUTime()); + + case THREAD_USER_TIME: + return Long.valueOf(getThreadUserTime()); + + case REQUEST_ID: + return getRequestID(); + + case REQUEST_URL: + return getRequestURL(); + + case CLIENT_IP: + return getClientIP(); + + case EXTRA_DATA1: + return getExtraData1(); + + case EXTRA_DATA2: + return getExtraData2(); + + case EXTRA_DATA3: + return getExtraData3(); + + case EXTRA_INT1: + return Integer.valueOf(getExtraInt1()); + + case EXTRA_INT2: + return Integer.valueOf(getExtraInt2()); + + case EXTRA_INT3: + return Integer.valueOf(getExtraInt3()); + + case EXTRA_LONG1: + return Long.valueOf(getExtraLong1()); + + case EXTRA_LONG2: + return Long.valueOf(getExtraLong2()); + + case EXTRA_LONG3: + return Long.valueOf(getExtraLong3()); + + } + 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 HOST_HASH_CODE: + return isSetHostHashCode(); + case REQUEST_HASH_CODE: + return isSetRequestHashCode(); + case DATA_TYPE: + return isSetDataType(); + case DATA_TIME: + return isSetDataTime(); + case THREAD_CPUTIME: + return isSetThreadCPUTime(); + case THREAD_USER_TIME: + return isSetThreadUserTime(); + case REQUEST_ID: + return isSetRequestID(); + case REQUEST_URL: + return isSetRequestURL(); + case CLIENT_IP: + return isSetClientIP(); + case EXTRA_DATA1: + return isSetExtraData1(); + case EXTRA_DATA2: + return isSetExtraData2(); + case EXTRA_DATA3: + return isSetExtraData3(); + case EXTRA_INT1: + return isSetExtraInt1(); + case EXTRA_INT2: + return isSetExtraInt2(); + case EXTRA_INT3: + return isSetExtraInt3(); + case EXTRA_LONG1: + return isSetExtraLong1(); + case EXTRA_LONG2: + return isSetExtraLong2(); + case EXTRA_LONG3: + return isSetExtraLong3(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof RequestThriftDTO) + return this.equals((RequestThriftDTO) that); + return false; + } + + public boolean equals(RequestThriftDTO that) { + if (that == null) + return false; + + boolean this_present_hostHashCode = true; + boolean that_present_hostHashCode = true; + if (this_present_hostHashCode || that_present_hostHashCode) { + if (!(this_present_hostHashCode && that_present_hostHashCode)) + return false; + if (this.hostHashCode != that.hostHashCode) + return false; + } + + boolean this_present_requestHashCode = true; + boolean that_present_requestHashCode = true; + if (this_present_requestHashCode || that_present_requestHashCode) { + if (!(this_present_requestHashCode && that_present_requestHashCode)) + return false; + if (this.requestHashCode != that.requestHashCode) + return false; + } + + boolean this_present_dataType = true; + boolean that_present_dataType = true; + if (this_present_dataType || that_present_dataType) { + if (!(this_present_dataType && that_present_dataType)) + return false; + if (this.dataType != that.dataType) + return false; + } + + boolean this_present_dataTime = true; + boolean that_present_dataTime = true; + if (this_present_dataTime || that_present_dataTime) { + if (!(this_present_dataTime && that_present_dataTime)) + return false; + if (this.dataTime != that.dataTime) + return false; + } + + boolean this_present_threadCPUTime = true; + boolean that_present_threadCPUTime = true; + if (this_present_threadCPUTime || that_present_threadCPUTime) { + if (!(this_present_threadCPUTime && that_present_threadCPUTime)) + return false; + if (this.threadCPUTime != that.threadCPUTime) + return false; + } + + boolean this_present_threadUserTime = true; + boolean that_present_threadUserTime = true; + if (this_present_threadUserTime || that_present_threadUserTime) { + if (!(this_present_threadUserTime && that_present_threadUserTime)) + return false; + if (this.threadUserTime != that.threadUserTime) + return false; + } + + boolean this_present_requestID = true && this.isSetRequestID(); + boolean that_present_requestID = true && that.isSetRequestID(); + if (this_present_requestID || that_present_requestID) { + if (!(this_present_requestID && that_present_requestID)) + return false; + if (!this.requestID.equals(that.requestID)) + return false; + } + + boolean this_present_requestURL = true && this.isSetRequestURL(); + boolean that_present_requestURL = true && that.isSetRequestURL(); + if (this_present_requestURL || that_present_requestURL) { + if (!(this_present_requestURL && that_present_requestURL)) + return false; + if (!this.requestURL.equals(that.requestURL)) + return false; + } + + boolean this_present_clientIP = true && this.isSetClientIP(); + boolean that_present_clientIP = true && that.isSetClientIP(); + if (this_present_clientIP || that_present_clientIP) { + if (!(this_present_clientIP && that_present_clientIP)) + return false; + if (!this.clientIP.equals(that.clientIP)) + return false; + } + + boolean this_present_extraData1 = true && this.isSetExtraData1(); + boolean that_present_extraData1 = true && that.isSetExtraData1(); + if (this_present_extraData1 || that_present_extraData1) { + if (!(this_present_extraData1 && that_present_extraData1)) + return false; + if (!this.extraData1.equals(that.extraData1)) + return false; + } + + boolean this_present_extraData2 = true && this.isSetExtraData2(); + boolean that_present_extraData2 = true && that.isSetExtraData2(); + if (this_present_extraData2 || that_present_extraData2) { + if (!(this_present_extraData2 && that_present_extraData2)) + return false; + if (!this.extraData2.equals(that.extraData2)) + return false; + } + + boolean this_present_extraData3 = true && this.isSetExtraData3(); + boolean that_present_extraData3 = true && that.isSetExtraData3(); + if (this_present_extraData3 || that_present_extraData3) { + if (!(this_present_extraData3 && that_present_extraData3)) + return false; + if (!this.extraData3.equals(that.extraData3)) + return false; + } + + boolean this_present_extraInt1 = true && this.isSetExtraInt1(); + boolean that_present_extraInt1 = true && that.isSetExtraInt1(); + if (this_present_extraInt1 || that_present_extraInt1) { + if (!(this_present_extraInt1 && that_present_extraInt1)) + return false; + if (this.extraInt1 != that.extraInt1) + return false; + } + + boolean this_present_extraInt2 = true && this.isSetExtraInt2(); + boolean that_present_extraInt2 = true && that.isSetExtraInt2(); + if (this_present_extraInt2 || that_present_extraInt2) { + if (!(this_present_extraInt2 && that_present_extraInt2)) + return false; + if (this.extraInt2 != that.extraInt2) + return false; + } + + boolean this_present_extraInt3 = true && this.isSetExtraInt3(); + boolean that_present_extraInt3 = true && that.isSetExtraInt3(); + if (this_present_extraInt3 || that_present_extraInt3) { + if (!(this_present_extraInt3 && that_present_extraInt3)) + return false; + if (this.extraInt3 != that.extraInt3) + return false; + } + + boolean this_present_extraLong1 = true && this.isSetExtraLong1(); + boolean that_present_extraLong1 = true && that.isSetExtraLong1(); + if (this_present_extraLong1 || that_present_extraLong1) { + if (!(this_present_extraLong1 && that_present_extraLong1)) + return false; + if (this.extraLong1 != that.extraLong1) + return false; + } + + boolean this_present_extraLong2 = true && this.isSetExtraLong2(); + boolean that_present_extraLong2 = true && that.isSetExtraLong2(); + if (this_present_extraLong2 || that_present_extraLong2) { + if (!(this_present_extraLong2 && that_present_extraLong2)) + return false; + if (this.extraLong2 != that.extraLong2) + return false; + } + + boolean this_present_extraLong3 = true && this.isSetExtraLong3(); + boolean that_present_extraLong3 = true && that.isSetExtraLong3(); + if (this_present_extraLong3 || that_present_extraLong3) { + if (!(this_present_extraLong3 && that_present_extraLong3)) + return false; + if (this.extraLong3 != that.extraLong3) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(RequestThriftDTO other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + RequestThriftDTO typedOther = (RequestThriftDTO) other; + + lastComparison = Boolean.valueOf(isSetHostHashCode()).compareTo(typedOther.isSetHostHashCode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHostHashCode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostHashCode, typedOther.hostHashCode); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestHashCode()).compareTo(typedOther.isSetRequestHashCode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestHashCode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestHashCode, typedOther.requestHashCode); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDataType()).compareTo(typedOther.isSetDataType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataType, typedOther.dataType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(typedOther.isSetDataTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataTime, typedOther.dataTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetThreadCPUTime()).compareTo(typedOther.isSetThreadCPUTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetThreadCPUTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threadCPUTime, typedOther.threadCPUTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetThreadUserTime()).compareTo(typedOther.isSetThreadUserTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetThreadUserTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threadUserTime, typedOther.threadUserTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestID()).compareTo(typedOther.isSetRequestID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestID, typedOther.requestID); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRequestURL()).compareTo(typedOther.isSetRequestURL()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequestURL()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestURL, typedOther.requestURL); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetClientIP()).compareTo(typedOther.isSetClientIP()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetClientIP()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clientIP, typedOther.clientIP); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData1()).compareTo(typedOther.isSetExtraData1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData1, typedOther.extraData1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData2()).compareTo(typedOther.isSetExtraData2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData2, typedOther.extraData2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraData3()).compareTo(typedOther.isSetExtraData3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraData3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraData3, typedOther.extraData3); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt1()).compareTo(typedOther.isSetExtraInt1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt1, typedOther.extraInt1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt2()).compareTo(typedOther.isSetExtraInt2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt2, typedOther.extraInt2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraInt3()).compareTo(typedOther.isSetExtraInt3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraInt3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraInt3, typedOther.extraInt3); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong1()).compareTo(typedOther.isSetExtraLong1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong1, typedOther.extraLong1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong2()).compareTo(typedOther.isSetExtraLong2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong2, typedOther.extraLong2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExtraLong3()).compareTo(typedOther.isSetExtraLong3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExtraLong3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraLong3, typedOther.extraLong3); + 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("RequestThriftDTO("); + boolean first = true; + + sb.append("hostHashCode:"); + sb.append(this.hostHashCode); + first = false; + if (!first) + sb.append(", "); + sb.append("requestHashCode:"); + sb.append(this.requestHashCode); + first = false; + if (!first) + sb.append(", "); + sb.append("dataType:"); + sb.append(this.dataType); + first = false; + if (!first) + sb.append(", "); + sb.append("dataTime:"); + sb.append(this.dataTime); + first = false; + if (!first) + sb.append(", "); + sb.append("threadCPUTime:"); + sb.append(this.threadCPUTime); + first = false; + if (!first) + sb.append(", "); + sb.append("threadUserTime:"); + sb.append(this.threadUserTime); + first = false; + if (isSetRequestID()) { + if (!first) + sb.append(", "); + sb.append("requestID:"); + if (this.requestID == null) { + sb.append("null"); + } else { + sb.append(this.requestID); + } + first = false; + } + if (isSetRequestURL()) { + if (!first) + sb.append(", "); + sb.append("requestURL:"); + if (this.requestURL == null) { + sb.append("null"); + } else { + sb.append(this.requestURL); + } + first = false; + } + if (isSetClientIP()) { + if (!first) + sb.append(", "); + sb.append("clientIP:"); + if (this.clientIP == null) { + sb.append("null"); + } else { + sb.append(this.clientIP); + } + first = false; + } + if (isSetExtraData1()) { + if (!first) + sb.append(", "); + sb.append("extraData1:"); + if (this.extraData1 == null) { + sb.append("null"); + } else { + sb.append(this.extraData1); + } + first = false; + } + if (isSetExtraData2()) { + if (!first) + sb.append(", "); + sb.append("extraData2:"); + if (this.extraData2 == null) { + sb.append("null"); + } else { + sb.append(this.extraData2); + } + first = false; + } + if (isSetExtraData3()) { + if (!first) + sb.append(", "); + sb.append("extraData3:"); + if (this.extraData3 == null) { + sb.append("null"); + } else { + sb.append(this.extraData3); + } + first = false; + } + if (isSetExtraInt1()) { + if (!first) + sb.append(", "); + sb.append("extraInt1:"); + sb.append(this.extraInt1); + first = false; + } + if (isSetExtraInt2()) { + if (!first) + sb.append(", "); + sb.append("extraInt2:"); + sb.append(this.extraInt2); + first = false; + } + if (isSetExtraInt3()) { + if (!first) + sb.append(", "); + sb.append("extraInt3:"); + sb.append(this.extraInt3); + first = false; + } + if (isSetExtraLong1()) { + if (!first) + sb.append(", "); + sb.append("extraLong1:"); + sb.append(this.extraLong1); + first = false; + } + if (isSetExtraLong2()) { + if (!first) + sb.append(", "); + sb.append("extraLong2:"); + sb.append(this.extraLong2); + first = false; + } + if (isSetExtraLong3()) { + if (!first) + sb.append(", "); + sb.append("extraLong3:"); + sb.append(this.extraLong3); + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java + // serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class RequestThriftDTOStandardSchemeFactory implements SchemeFactory { + public RequestThriftDTOStandardScheme getScheme() { + return new RequestThriftDTOStandardScheme(); + } + } + + private static class RequestThriftDTOStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, RequestThriftDTO 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: // HOST_HASH_CODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.hostHashCode = iprot.readI32(); + struct.setHostHashCodeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REQUEST_HASH_CODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.requestHashCode = iprot.readI32(); + struct.setRequestHashCodeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // DATA_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.dataType = iprot.readI32(); + struct.setDataTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // DATA_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.dataTime = iprot.readI64(); + struct.setDataTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // THREAD_CPUTIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.threadCPUTime = iprot.readI64(); + struct.setThreadCPUTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // THREAD_USER_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.threadUserTime = iprot.readI64(); + struct.setThreadUserTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // REQUEST_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.requestID = iprot.readString(); + struct.setRequestIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // REQUEST_URL + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.requestURL = iprot.readString(); + struct.setRequestURLIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // CLIENT_IP + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.clientIP = iprot.readString(); + struct.setClientIPIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 10: // EXTRA_DATA1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData1 = iprot.readString(); + struct.setExtraData1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 11: // EXTRA_DATA2 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData2 = iprot.readString(); + struct.setExtraData2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 12: // EXTRA_DATA3 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.extraData3 = iprot.readString(); + struct.setExtraData3IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 13: // EXTRA_INT1 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt1 = iprot.readI32(); + struct.setExtraInt1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 14: // EXTRA_INT2 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt2 = iprot.readI32(); + struct.setExtraInt2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 15: // EXTRA_INT3 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.extraInt3 = iprot.readI32(); + struct.setExtraInt3IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 16: // EXTRA_LONG1 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong1 = iprot.readI64(); + struct.setExtraLong1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 17: // EXTRA_LONG2 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong2 = iprot.readI64(); + struct.setExtraLong2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 18: // EXTRA_LONG3 + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.extraLong3 = iprot.readI64(); + struct.setExtraLong3IsSet(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, RequestThriftDTO struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(HOST_HASH_CODE_FIELD_DESC); + oprot.writeI32(struct.hostHashCode); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(REQUEST_HASH_CODE_FIELD_DESC); + oprot.writeI32(struct.requestHashCode); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(DATA_TYPE_FIELD_DESC); + oprot.writeI32(struct.dataType); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(DATA_TIME_FIELD_DESC); + oprot.writeI64(struct.dataTime); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(THREAD_CPUTIME_FIELD_DESC); + oprot.writeI64(struct.threadCPUTime); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(THREAD_USER_TIME_FIELD_DESC); + oprot.writeI64(struct.threadUserTime); + oprot.writeFieldEnd(); + if (struct.requestID != null) { + if (struct.isSetRequestID()) { + oprot.writeFieldBegin(REQUEST_ID_FIELD_DESC); + oprot.writeString(struct.requestID); + oprot.writeFieldEnd(); + } + } + if (struct.requestURL != null) { + if (struct.isSetRequestURL()) { + oprot.writeFieldBegin(REQUEST_URL_FIELD_DESC); + oprot.writeString(struct.requestURL); + oprot.writeFieldEnd(); + } + } + if (struct.clientIP != null) { + if (struct.isSetClientIP()) { + oprot.writeFieldBegin(CLIENT_IP_FIELD_DESC); + oprot.writeString(struct.clientIP); + oprot.writeFieldEnd(); + } + } + if (struct.extraData1 != null) { + if (struct.isSetExtraData1()) { + oprot.writeFieldBegin(EXTRA_DATA1_FIELD_DESC); + oprot.writeString(struct.extraData1); + oprot.writeFieldEnd(); + } + } + if (struct.extraData2 != null) { + if (struct.isSetExtraData2()) { + oprot.writeFieldBegin(EXTRA_DATA2_FIELD_DESC); + oprot.writeString(struct.extraData2); + oprot.writeFieldEnd(); + } + } + if (struct.extraData3 != null) { + if (struct.isSetExtraData3()) { + oprot.writeFieldBegin(EXTRA_DATA3_FIELD_DESC); + oprot.writeString(struct.extraData3); + oprot.writeFieldEnd(); + } + } + if (struct.isSetExtraInt1()) { + oprot.writeFieldBegin(EXTRA_INT1_FIELD_DESC); + oprot.writeI32(struct.extraInt1); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraInt2()) { + oprot.writeFieldBegin(EXTRA_INT2_FIELD_DESC); + oprot.writeI32(struct.extraInt2); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraInt3()) { + oprot.writeFieldBegin(EXTRA_INT3_FIELD_DESC); + oprot.writeI32(struct.extraInt3); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong1()) { + oprot.writeFieldBegin(EXTRA_LONG1_FIELD_DESC); + oprot.writeI64(struct.extraLong1); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong2()) { + oprot.writeFieldBegin(EXTRA_LONG2_FIELD_DESC); + oprot.writeI64(struct.extraLong2); + oprot.writeFieldEnd(); + } + if (struct.isSetExtraLong3()) { + oprot.writeFieldBegin(EXTRA_LONG3_FIELD_DESC); + oprot.writeI64(struct.extraLong3); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RequestThriftDTOTupleSchemeFactory implements SchemeFactory { + public RequestThriftDTOTupleScheme getScheme() { + return new RequestThriftDTOTupleScheme(); + } + } + + private static class RequestThriftDTOTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, RequestThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHostHashCode()) { + optionals.set(0); + } + if (struct.isSetRequestHashCode()) { + optionals.set(1); + } + if (struct.isSetDataType()) { + optionals.set(2); + } + if (struct.isSetDataTime()) { + optionals.set(3); + } + if (struct.isSetThreadCPUTime()) { + optionals.set(4); + } + if (struct.isSetThreadUserTime()) { + optionals.set(5); + } + if (struct.isSetRequestID()) { + optionals.set(6); + } + if (struct.isSetRequestURL()) { + optionals.set(7); + } + if (struct.isSetClientIP()) { + optionals.set(8); + } + if (struct.isSetExtraData1()) { + optionals.set(9); + } + if (struct.isSetExtraData2()) { + optionals.set(10); + } + if (struct.isSetExtraData3()) { + optionals.set(11); + } + if (struct.isSetExtraInt1()) { + optionals.set(12); + } + if (struct.isSetExtraInt2()) { + optionals.set(13); + } + if (struct.isSetExtraInt3()) { + optionals.set(14); + } + if (struct.isSetExtraLong1()) { + optionals.set(15); + } + if (struct.isSetExtraLong2()) { + optionals.set(16); + } + if (struct.isSetExtraLong3()) { + optionals.set(17); + } + oprot.writeBitSet(optionals, 18); + if (struct.isSetHostHashCode()) { + oprot.writeI32(struct.hostHashCode); + } + if (struct.isSetRequestHashCode()) { + oprot.writeI32(struct.requestHashCode); + } + if (struct.isSetDataType()) { + oprot.writeI32(struct.dataType); + } + if (struct.isSetDataTime()) { + oprot.writeI64(struct.dataTime); + } + if (struct.isSetThreadCPUTime()) { + oprot.writeI64(struct.threadCPUTime); + } + if (struct.isSetThreadUserTime()) { + oprot.writeI64(struct.threadUserTime); + } + if (struct.isSetRequestID()) { + oprot.writeString(struct.requestID); + } + if (struct.isSetRequestURL()) { + oprot.writeString(struct.requestURL); + } + if (struct.isSetClientIP()) { + oprot.writeString(struct.clientIP); + } + if (struct.isSetExtraData1()) { + oprot.writeString(struct.extraData1); + } + if (struct.isSetExtraData2()) { + oprot.writeString(struct.extraData2); + } + if (struct.isSetExtraData3()) { + oprot.writeString(struct.extraData3); + } + if (struct.isSetExtraInt1()) { + oprot.writeI32(struct.extraInt1); + } + if (struct.isSetExtraInt2()) { + oprot.writeI32(struct.extraInt2); + } + if (struct.isSetExtraInt3()) { + oprot.writeI32(struct.extraInt3); + } + if (struct.isSetExtraLong1()) { + oprot.writeI64(struct.extraLong1); + } + if (struct.isSetExtraLong2()) { + oprot.writeI64(struct.extraLong2); + } + if (struct.isSetExtraLong3()) { + oprot.writeI64(struct.extraLong3); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, RequestThriftDTO struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(18); + if (incoming.get(0)) { + struct.hostHashCode = iprot.readI32(); + struct.setHostHashCodeIsSet(true); + } + if (incoming.get(1)) { + struct.requestHashCode = iprot.readI32(); + struct.setRequestHashCodeIsSet(true); + } + if (incoming.get(2)) { + struct.dataType = iprot.readI32(); + struct.setDataTypeIsSet(true); + } + if (incoming.get(3)) { + struct.dataTime = iprot.readI64(); + struct.setDataTimeIsSet(true); + } + if (incoming.get(4)) { + struct.threadCPUTime = iprot.readI64(); + struct.setThreadCPUTimeIsSet(true); + } + if (incoming.get(5)) { + struct.threadUserTime = iprot.readI64(); + struct.setThreadUserTimeIsSet(true); + } + if (incoming.get(6)) { + struct.requestID = iprot.readString(); + struct.setRequestIDIsSet(true); + } + if (incoming.get(7)) { + struct.requestURL = iprot.readString(); + struct.setRequestURLIsSet(true); + } + if (incoming.get(8)) { + struct.clientIP = iprot.readString(); + struct.setClientIPIsSet(true); + } + if (incoming.get(9)) { + struct.extraData1 = iprot.readString(); + struct.setExtraData1IsSet(true); + } + if (incoming.get(10)) { + struct.extraData2 = iprot.readString(); + struct.setExtraData2IsSet(true); + } + if (incoming.get(11)) { + struct.extraData3 = iprot.readString(); + struct.setExtraData3IsSet(true); + } + if (incoming.get(12)) { + struct.extraInt1 = iprot.readI32(); + struct.setExtraInt1IsSet(true); + } + if (incoming.get(13)) { + struct.extraInt2 = iprot.readI32(); + struct.setExtraInt2IsSet(true); + } + if (incoming.get(14)) { + struct.extraInt3 = iprot.readI32(); + struct.setExtraInt3IsSet(true); + } + if (incoming.get(15)) { + struct.extraLong1 = iprot.readI64(); + struct.setExtraLong1IsSet(true); + } + if (incoming.get(16)) { + struct.extraLong2 = iprot.readI64(); + struct.setExtraLong2IsSet(true); + } + if (incoming.get(17)) { + struct.extraLong3 = iprot.readI64(); + struct.setExtraLong3IsSet(true); + } + } + } } - diff --git a/src/main/java/com/profiler/logging/DefaultLogger.java b/src/main/java/com/profiler/logging/DefaultLogger.java new file mode 100644 index 000000000..1cc4a5744 --- /dev/null +++ b/src/main/java/com/profiler/logging/DefaultLogger.java @@ -0,0 +1,52 @@ +package com.profiler.logging; + +import java.util.Date; + +import com.profiler.config.TomcatProfilerConfig; + +public class DefaultLogger extends Logger { + + public DefaultLogger(String name) { + super(name); + } + + @Override + public void info(String message, Object... args) { + if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.INFO.priority) { + System.out.printf("[HIPPO] %s [INFO] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); + } + } + + @Override + public void debug(String message, Object... args) { + if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.DEBUG.priority) { + System.out.printf("[HIPPO] %s [DEBUG] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); + } + } + + @Override + public void warn(String message, Object... args) { + if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.WARN.priority) { + System.out.printf("[HIPPO] %s [WARN] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); + } + } + + @Override + public void error(String message, Object... args) { + if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.ERROR.priority) { + System.out.printf("[HIPPO] %s [ERROR] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); + } + } + + @Override + public void fatal(String message, Object... args) { + if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.FATAL.priority) { + System.out.printf("[HIPPO] %s [FATAL] [%s] %s \n", df.format(new Date()), name, String.format(message, args)); + } + } + + @Override + public boolean isDebugEnabled() { + return TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.DEBUG.priority; + } +} diff --git a/src/main/java/com/profiler/logging/LogLevel.java b/src/main/java/com/profiler/logging/LogLevel.java new file mode 100644 index 000000000..19acc959c --- /dev/null +++ b/src/main/java/com/profiler/logging/LogLevel.java @@ -0,0 +1,11 @@ +package com.profiler.logging; + +public enum LogLevel { + INFO(0), DEBUG(1), WARN(2), ERROR(3), FATAL(4); + + int priority; + + LogLevel(int priority) { + this.priority = priority; + } +} diff --git a/src/main/java/com/profiler/logging/Logger.java b/src/main/java/com/profiler/logging/Logger.java new file mode 100644 index 000000000..3af1c2b7a --- /dev/null +++ b/src/main/java/com/profiler/logging/Logger.java @@ -0,0 +1,31 @@ +package com.profiler.logging; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +public abstract class Logger { + + protected final String name; + + protected final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + + public Logger(String name) { + this.name = name; + } + + public static Logger getLogger(Class clazz) { + return new DefaultLogger(clazz.getName()); + } + + public abstract void info(String message, Object... args); + + public abstract void debug(String message, Object... args); + + public abstract void warn(String message, Object... args); + + public abstract void error(String message, Object... args); + + public abstract void fatal(String message, Object... args); + + public abstract boolean isDebugEnabled(); +} diff --git a/src/main/java/com/profiler/modifier/AbstractModifier.java b/src/main/java/com/profiler/modifier/AbstractModifier.java index b6af99059..236418784 100644 --- a/src/main/java/com/profiler/modifier/AbstractModifier.java +++ b/src/main/java/com/profiler/modifier/AbstractModifier.java @@ -1,86 +1,101 @@ package com.profiler.modifier; +import com.profiler.logging.Logger; + import javassist.ClassPool; import javassist.CtClass; import javassist.CtConstructor; import javassist.CtMethod; public abstract class AbstractModifier { + + private static final Logger logger = Logger.getLogger(AbstractModifier.class); + public static void printClassInfo(String className) { - log("Printing Class Info of [" + className + "]"); + logger.debug("Printing Class Info of [" + className + "]"); try { ClassPool pool = ClassPool.getDefault(); - log("try"); + logger.debug("try"); String javaassistClassName = className.replace('/', '.'); - log("replace"); + logger.debug("replace"); CtClass cc = pool.get(javaassistClassName); - log("ClassName:" + javaassistClassName); + logger.debug("ClassName:" + javaassistClassName); CtConstructor[] constructorList = cc.getConstructors(); + for (CtConstructor cons : constructorList) { try { String signature = cons.getSignature(); - System.out.println("Constructor signature:" + signature); + logger.info("Constructor signature:%s", signature); } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } } + CtMethod[] methodList = cc.getDeclaredMethods(); + for (CtMethod tempMethod : methodList) { try { String methodName = tempMethod.getLongName(); - log("MethodName:" + methodName); + + logger.debug("MethodName:" + methodName); + CtClass[] params = tempMethod.getParameterTypes(); + if (params.length != 0) { int paramsLength = params.length; for (int loop = paramsLength - 1; loop > 0; loop--) { - log("Param" + loop + ":" + params[loop].getName()); + logger.debug("Param" + loop + ":" + params[loop].getName()); } } else { - log(" No params"); + logger.debug(" No params"); } - log("ReturnType=" + tempMethod.getReturnType().getName()); + + logger.debug("ReturnType=" + tempMethod.getReturnType().getName()); } catch (Exception methodException) { - log("Exception : " + methodException.getMessage()); + logger.error("Exception : " + methodException.getMessage()); } } } catch (Exception e) { - log(e.getMessage()); + logger.error(e.getMessage()); e.printStackTrace(); } } - public static byte[] addBeforeAfterLogics(ClassPool classPool, - String javassistClassName) { + public static byte[] addBeforeAfterLogics(ClassPool classPool, String javassistClassName) { try { CtClass cc = classPool.get(javassistClassName); CtMethod[] methods = cc.getDeclaredMethods(); + for (CtMethod method : methods) { if (!method.isEmpty()) { String methodName = method.getName(); CtClass[] params = method.getParameterTypes(); StringBuilder sb = new StringBuilder(); + if (params.length != 0) { int paramsLength = params.length; + for (int loop = paramsLength - 1; loop > 0; loop--) { sb.append(params[loop].getName()).append(","); } // sb.substring(0, sb.length()-2); } - method.insertBefore("{System.out.println(\"*****" - + javassistClassName + "." + methodName + "(" + sb - + ") is started.\");}"); - method.insertAfter("{System.out.println(\"*****" - + javassistClassName + "." + methodName + "(" + sb - + ") is finished.\");}"); + method.insertBefore("{System.out.println(\"*****" + javassistClassName + "." + methodName + "(" + sb + ") is started.\");}"); + method.insertAfter("{System.out.println(\"*****" + javassistClassName + "." + methodName + "(" + sb + ") is finished.\");}"); } else { - log(method.getLongName() + " is empty !!!!!"); + logger.warn(method.getLongName() + " is empty !!!!!"); } } + CtConstructor[] constructors = cc.getConstructors(); + for (CtConstructor constructor : constructors) { + if (!constructor.isEmpty()) { CtClass[] params = constructor.getParameterTypes(); StringBuilder sb = new StringBuilder(); + if (params.length != 0) { int paramsLength = params.length; for (int loop = paramsLength - 1; loop > 0; loop--) { @@ -88,28 +103,22 @@ public abstract class AbstractModifier { } // sb.substring(0, sb.length()-2); } - constructor.insertBefore("{System.out.println(\"*****" - + javassistClassName + " Constructor:Param=(" + sb - + ") is started.\");}"); - constructor.insertAfter("{System.out.println(\"*****" - + javassistClassName + " Constructor:Param=(" + sb - + ") is finished.\");}"); + + constructor.insertBefore("{System.out.println(\"*****" + javassistClassName + " Constructor:Param=(" + sb + ") is started.\");}"); + constructor.insertAfter("{System.out.println(\"*****" + javassistClassName + " Constructor:Param=(" + sb + ") is finished.\");}"); } else { - log(constructor.getLongName() + " is empty !!!!!"); + logger.warn(constructor.getLongName() + " is empty !!!!!"); } } return cc.toBytecode(); } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); return null; } } - public static void log(String message) { - System.out.println("[AbstractModifier] " + message); - } - public static void printClassConvertComplete(String javassistClassName) { - log("@@@ " + javassistClassName + " class is converted !!!"); + logger.info("%s class is converted.", javassistClassName); } } diff --git a/src/main/java/com/profiler/modifier/db/cubrid/CubridPreparedStatementModifier.java b/src/main/java/com/profiler/modifier/db/cubrid/CubridPreparedStatementModifier.java index a3cd35242..5555f795c 100644 --- a/src/main/java/com/profiler/modifier/db/cubrid/CubridPreparedStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/cubrid/CubridPreparedStatementModifier.java @@ -6,71 +6,81 @@ import javassist.CtConstructor; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class CubridPreparedStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("CubridPreparedStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class CubridPreparedStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(CubridPreparedStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("CubridPreparedStatementModifier modifing"); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateExecuteQueryMethod(classPool,cc); - updateConstructor(classPool,cc); + updateExecuteQueryMethod(classPool, cc); + updateConstructor(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateConstructor(ClassPool classPool,CtClass cc) throws Exception { - CtConstructor []constructorList=cc.getConstructors(); - for(CtConstructor constructor:constructorList) { - CtClass params[]=constructor.getParameterTypes(); - log("*** Constructor param length="+params.length); - if(params.length>2 ) { + + private static void updateConstructor(ClassPool classPool, CtClass cc) throws Exception { + CtConstructor[] constructorList = cc.getConstructors(); + for (CtConstructor constructor : constructorList) { + CtClass params[] = constructor.getParameterTypes(); + logger.info("*** Constructor param length=" + params.length); + if (params.length > 2) { constructor.insertBefore(getConstructorBeforeInsertCode()); } } } + private static String getConstructorBeforeInsertCode() { - log("*** Changing Constructor "); - StringBuilder sb=new StringBuilder(); + logger.info("*** Changing Constructor "); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----CUBRIDPreparedStatement constructor is called\");"); + // sb.append("System.out.println(\"-----CUBRIDPreparedStatement constructor is called\");"); sb.append("if($2 instanceof cubrid.jdbc.jci.UStatement) { "); -// sb.append("System.out.println(\"-----Query=[\"+$2.getQuery()+\"]\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$2.getQuery());"); + // sb.append("System.out.println(\"-----Query=[\"+$2.getQuery()+\"]\");"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$2.getQuery());"); sb.append("}}"); return sb.toString(); } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("execute", null); - log("*** Changing execute() method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("execute", null); + logger.info("*** Changing execute() method "); + // serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } + @SuppressWarnings("unused") private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----CUBRIDPreparedStatement.execute() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + // sb.append("{"); + // sb.append("System.out.println(\"-----CUBRIDPreparedStatement.execute() method is called\");"); + // sb.append("}"); return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----CUBRIDPreparedStatement.execute() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + // sb.append("System.out.println(\"-----CUBRIDPreparedStatement.execute() method is ended\");"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); return sb.toString(); - + } } diff --git a/src/main/java/com/profiler/modifier/db/cubrid/CubridResultSetModifier.java b/src/main/java/com/profiler/modifier/db/cubrid/CubridResultSetModifier.java index 14afcddc8..a17f59894 100644 --- a/src/main/java/com/profiler/modifier/db/cubrid/CubridResultSetModifier.java +++ b/src/main/java/com/profiler/modifier/db/cubrid/CubridResultSetModifier.java @@ -5,54 +5,77 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class CubridResultSetModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("CubridResultSetModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class CubridResultSetModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(CubridResultSetModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("CubridResultSetModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateNextMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateNextMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateNextMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("next", null); - log("*** Changing next() method "); + + private static void updateNextMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("next", null); + logger.info("Changing next() method "); serviceMethod1.insertBefore(getNextMethodBeforeInsertCode()); } + private static String getNextMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); + sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".updateFetchCount();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".updateFetchCount();"); sb.append("}"); + return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("close", null); - log("*** Changing close() method "); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("close", null); + + logger.info("Changing close() method "); + serviceMethod1.insertBefore(getCloseMethodBeforeInsertCode()); } + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); + sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".addResultSetData();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".addResultSetData();"); sb.append("}"); + return sb.toString(); } } diff --git a/src/main/java/com/profiler/modifier/db/cubrid/CubridStatementModifier.java b/src/main/java/com/profiler/modifier/db/cubrid/CubridStatementModifier.java index 56e28ec95..94c94876d 100644 --- a/src/main/java/com/profiler/modifier/db/cubrid/CubridStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/cubrid/CubridStatementModifier.java @@ -5,55 +5,69 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class CubridStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("CubridStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class CubridStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(CubridStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("CubridStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateExecuteQueryMethod(classPool,cc); + updateExecuteQueryMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[1]; - params[0]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", params); -// CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", null); - log("*** Changing executeQuery method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[1]; + params[0] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod = cc.getDeclaredMethod("executeQuery", params); + + logger.info("Changing executeQuery method."); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); - - } + @SuppressWarnings("unused") private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery() method is called\");"); -// sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery(String) method is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($1)+\"]\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery() method is called\");"); + sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery(String) method is called\");"); + sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($1)+\"]\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery(String) method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$1);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----CUBRIDStatement.executeQuery(String) method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$1);"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); + return sb.toString(); - + } } diff --git a/src/main/java/com/profiler/modifier/db/cubrid/CubridUStatementModifier.java b/src/main/java/com/profiler/modifier/db/cubrid/CubridUStatementModifier.java index a64e7170a..c28c8dfec 100644 --- a/src/main/java/com/profiler/modifier/db/cubrid/CubridUStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/cubrid/CubridUStatementModifier.java @@ -5,45 +5,59 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class CubridUStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("CubridUStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class CubridUStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(CubridUStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("CubridUStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateBindValueMethod(classPool,cc); + updateBindValueMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateBindValueMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params1=new CtClass[3]; - params1[0]=classPool.getCtClass("int"); - params1[1]=classPool.getCtClass("byte"); - params1[2]=classPool.getCtClass("java.lang.Object"); - CtMethod serviceMethod1=cc.getDeclaredMethod("bindValue", params1); - log("*** Changing bindValue(int,byte,String) method "); + + private static void updateBindValueMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params1 = new CtClass[3]; + params1[0] = classPool.getCtClass("int"); + params1[1] = classPool.getCtClass("byte"); + params1[2] = classPool.getCtClass("java.lang.Object"); + CtMethod serviceMethod1 = cc.getDeclaredMethod("bindValue", params1); + + logger.info("Changing bindValue(int, byte, String) method "); + serviceMethod1.insertBefore(getBindValueMethodBeforeInsertCode()); } + private static String getBindValueMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"UStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$3);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$3);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"UStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$3);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$3);"); sb.append("}"); + return sb.toString(); } - + } diff --git a/src/main/java/com/profiler/modifier/db/dbcp/DBCPBasicDataSourceModifier.java b/src/main/java/com/profiler/modifier/db/dbcp/DBCPBasicDataSourceModifier.java index 67c0606be..b17445dd2 100644 --- a/src/main/java/com/profiler/modifier/db/dbcp/DBCPBasicDataSourceModifier.java +++ b/src/main/java/com/profiler/modifier/db/dbcp/DBCPBasicDataSourceModifier.java @@ -5,52 +5,69 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class DBCPBasicDataSourceModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("DBCPBasicDataSourceModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class DBCPBasicDataSourceModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(DBCPBasicDataSourceModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("DBCPBasicDataSourceModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateGetConnectionMethod(classPool,cc); -// updateCloseMethod(classPool,cc); - byte[] newClassfileBuffer=null; - newClassfileBuffer= cc.toBytecode(); -// cc.writeFile(); + updateGetConnectionMethod(classPool, cc); + // updateCloseMethod(classPool,cc); + byte[] newClassfileBuffer = null; + newClassfileBuffer = cc.toBytecode(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateGetConnectionMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("getConnection", null); - log("*** Changing createStatement method "); -// serviceMethod.insertBefore(getGetConnectionMethodBeforeInsertCode()); + + private static void updateGetConnectionMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("getConnection", null); + + logger.info("Changing getConnection method "); + serviceMethod.insertAfter(getGetConnectionMethodAfterInsertCode()); - } + @SuppressWarnings("unused") private static String getGetConnectionMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----BasicDataSource.getConnection() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----BasicDataSource.getConnection() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getGetConnectionMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----BasicDataSource.getConnection() method is ended\");"); -// sb.append("System.out.println(\"-----BasicDataSource.getConnection() \"+$0.getClass().getName());"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putConnection("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_GET_CONNECTION+",$0.getUrl());"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----BasicDataSource.getConnection() method is ended\");"); + sb.append("System.out.println(\"-----BasicDataSource.getConnection() \"+$0.getClass().getName());"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putConnection(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_GET_CONNECTION + ",$0.getUrl());"); sb.append("}"); + return sb.toString(); } - + } diff --git a/src/main/java/com/profiler/modifier/db/dbcp/DBCPPoolModifier.java b/src/main/java/com/profiler/modifier/db/dbcp/DBCPPoolModifier.java index 94aaaecd6..2156c531e 100644 --- a/src/main/java/com/profiler/modifier/db/dbcp/DBCPPoolModifier.java +++ b/src/main/java/com/profiler/modifier/db/dbcp/DBCPPoolModifier.java @@ -5,70 +5,64 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class DBCPPoolModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("DBCPPoolModifier(PoolingDataSource$PoolGuardConnectionWrapper) modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class DBCPPoolModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(DBCPPoolModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("DBCPPoolModifier(PoolingDataSource$PoolGuardConnectionWrapper) modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); -// updateGetConnectionMethod(classPool,cc); - updateCloseMethod(classPool,cc); -/* - CtMethod[] methods=cc.getDeclaredMethods(); - for(CtMethod method:methods) { -// System.out.println(method.getLongName()); - if(!method.isEmpty() ) { - String methodName=method.getName(); - if(methodName.equals("getConnection")) { -// && !methodName.startsWith("version")) { - method.insertBefore("{System.out.println(\"-----DBCP "+method.getLongName()+" is started.\");}"); - method.insertAfter("{System.out.println(\"-----DBCP "+method.getLongName()+" is finished.\");}"); - System.out.println(method.getLongName()); - } - } else { - log(method.getLongName()+" is empty !!!!!"); - } - } -*/ - byte[] newClassfileBuffer=null; - newClassfileBuffer= cc.toBytecode(); -// cc.writeFile(); + updateCloseMethod(classPool, cc); + + byte[] newClassfileBuffer = null; + newClassfileBuffer = cc.toBytecode(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - - - - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("close", null); - log("*** Changing close method "); -// serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("close", null); + logger.info("Changing close method "); + // serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); serviceMethod.insertAfter(getCloseMethodAfterInsertCode()); } - + @SuppressWarnings("unused") private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----PoolingDataSource$PoolGuardConnectionWrapper.close() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----PoolingDataSource$PoolGuardConnectionWrapper.close() method is called\");"); + sb.append("}"); + } + return sb.toString(); } - + private static String getCloseMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----PoolingDataSource$PoolGuardConnectionWrapper.close() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----PoolingDataSource$PoolGuardConnectionWrapper.close() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION + ");"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/profiler/modifier/db/mssql/MSSQLConnectionModifier.java b/src/main/java/com/profiler/modifier/db/mssql/MSSQLConnectionModifier.java index 8712fda8e..ef0ca48a6 100644 --- a/src/main/java/com/profiler/modifier/db/mssql/MSSQLConnectionModifier.java +++ b/src/main/java/com/profiler/modifier/db/mssql/MSSQLConnectionModifier.java @@ -5,74 +5,103 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MSSQLConnectionModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MSSQLConnectionModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethods(classPool,classLoader,javassistClassName,classFileBuffer); +public class MSSQLConnectionModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MSSQLConnectionModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MSSQLConnectionModifier modifing. %s", javassistClassName); + return changeMethods(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethods(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethods(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateCreateStatementMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateCreateStatementMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - - private static void updateCreateStatementMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[2]; - params[0]=classPool.getCtClass("int"); - params[1]=classPool.getCtClass("int"); - CtMethod serviceMethod=cc.getDeclaredMethod("createStatement", params); - log("*** Changing createStatement method "); -// serviceMethod.insertBefore(getCreateStatementMethodBeforeInsertCode()); + + private static void updateCreateStatementMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[2]; + params[0] = classPool.getCtClass("int"); + params[1] = classPool.getCtClass("int"); + CtMethod serviceMethod = cc.getDeclaredMethod("createStatement", params); + + logger.info("Changing createStatement method "); + + serviceMethod.insertBefore(getCreateStatementMethodBeforeInsertCode()); serviceMethod.insertAfter(getCreateStatementMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getCreateStatementMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionJDBC2.createStatement() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----ConnectionJDBC2.createStatement() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getCreateStatementMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionJDBC2.createStatement() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_CREATE_STATEMENT+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----ConnectionJDBC2.createStatement() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_CREATE_STATEMENT + ");"); sb.append("}"); return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("close", null); - log("*** Changing close method "); -// serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("close", null); + + logger.info("Changing close method "); + + serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); serviceMethod.insertAfter(getCloseMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionJDBC2.close() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----ConnectionJDBC2.close() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getCloseMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionJDBC2.close() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----ConnectionJDBC2.close() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION + ");"); sb.append("}"); + return sb.toString(); } } diff --git a/src/main/java/com/profiler/modifier/db/mssql/MSSQLPreparedStatementModifier.java b/src/main/java/com/profiler/modifier/db/mssql/MSSQLPreparedStatementModifier.java index 12480790c..a4a1010b3 100644 --- a/src/main/java/com/profiler/modifier/db/mssql/MSSQLPreparedStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/mssql/MSSQLPreparedStatementModifier.java @@ -6,89 +6,121 @@ import javassist.CtConstructor; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MSSQLPreparedStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MSSQLPreparedStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MSSQLPreparedStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MSSQLPreparedStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MSSQLPreparedStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateSetParameterMethod(classPool,cc); - updateExecuteQueryMethod(classPool,cc); - updateConstructor(classPool,cc); + + updateSetParameterMethod(classPool, cc); + updateExecuteQueryMethod(classPool, cc); + updateConstructor(classPool, cc); + byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateSetParameterMethod(ClassPool classPool,CtClass cc) throws Exception { -// setParameter(int,java.lang.Object,int,int,int) - CtClass[] params1=new CtClass[5]; - params1[0]=classPool.getCtClass("int"); - params1[1]=classPool.getCtClass("java.lang.Object"); - params1[2]=classPool.getCtClass("int"); - params1[3]=classPool.getCtClass("int"); - params1[4]=classPool.getCtClass("int"); - CtMethod serviceMethod1=cc.getDeclaredMethod("setParameter", params1); - log("*** Changing setParameter(int,Object,int,int,int) method "); + + private static void updateSetParameterMethod(ClassPool classPool, CtClass cc) throws Exception { + // setParameter(int,java.lang.Object,int,int,int) + CtClass[] params1 = new CtClass[5]; + params1[0] = classPool.getCtClass("int"); + params1[1] = classPool.getCtClass("java.lang.Object"); + params1[2] = classPool.getCtClass("int"); + params1[3] = classPool.getCtClass("int"); + params1[4] = classPool.getCtClass("int"); + CtMethod serviceMethod1 = cc.getDeclaredMethod("setParameter", params1); + + logger.info("Changing setParameter(int,Object,int,int,int) method "); + serviceMethod1.insertBefore(getSetParameterBeforeInsertCode()); - } + private static String getSetParameterBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----JtdsPreparedStatement.setParameter(int,String,int,int,int) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----JtdsPreparedStatement.setParameter(int,String,int,int,int) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$2);"); sb.append("}"); return sb.toString(); } - private static void updateConstructor(ClassPool classPool,CtClass cc) throws Exception { - CtConstructor []constructorList=cc.getConstructors(); - if(constructorList.length==1) { - log("*** Changing Constructor "); - CtConstructor constructor=constructorList[0]; + + private static void updateConstructor(ClassPool classPool, CtClass cc) throws Exception { + CtConstructor[] constructorList = cc.getConstructors(); + if (constructorList.length == 1) { + logger.info("Changing Constructor "); + CtConstructor constructor = constructorList[0]; constructor.insertAfter(getConstructorAfterInsertCode()); } } + private static String getConstructorAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----JtdsPreparedStatement's constructor is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($2)+\"]\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----JtdsPreparedStatement's constructor is called\");"); + sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($2)+\"]\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$2);"); sb.append("}"); return sb.toString(); } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("execute", null); - log("*** Changing executeQuery() method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("execute", null); + + logger.info("Changing executeQuery() method."); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----JtdsPreparedStatement.execute() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----JtdsPreparedStatement.execute() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----JtdsPreparedStatement.execute() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----JtdsPreparedStatement.execute() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); + return sb.toString(); - } } diff --git a/src/main/java/com/profiler/modifier/db/mssql/MSSQLResultSetModifier.java b/src/main/java/com/profiler/modifier/db/mssql/MSSQLResultSetModifier.java index 14dda4d0c..2e76516bb 100644 --- a/src/main/java/com/profiler/modifier/db/mssql/MSSQLResultSetModifier.java +++ b/src/main/java/com/profiler/modifier/db/mssql/MSSQLResultSetModifier.java @@ -5,56 +5,77 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MSSQLResultSetModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MSSQLResultSetModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MSSQLResultSetModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MSSQLResultSetModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MSSQLResultSetModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateNextMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateNextMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateNextMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("next", null); - log("*** Changing next() method "); + + private static void updateNextMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("next", null); + + logger.info("Changing next() method"); + serviceMethod1.insertBefore(getNextMethodBeforeInsertCode()); } + private static String getNextMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".updateFetchCount();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".updateFetchCount();"); sb.append("}"); + return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("close", null); - log("*** Changing close() method "); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("close", null); + + logger.info("Changing close() method"); + serviceMethod1.insertBefore(getCloseMethodBeforeInsertCode()); } + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - -// sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_RESULTSET_CLOSE+");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".addResultSetData();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_RESULTSET_CLOSE + ");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".addResultSetData();"); sb.append("}"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/src/main/java/com/profiler/modifier/db/mssql/MSSQLStatementModifier.java b/src/main/java/com/profiler/modifier/db/mssql/MSSQLStatementModifier.java index c1ae65bc7..c269a612d 100644 --- a/src/main/java/com/profiler/modifier/db/mssql/MSSQLStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/mssql/MSSQLStatementModifier.java @@ -5,51 +5,67 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MSSQLStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MSSQLStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MSSQLStatementModifier extends AbstractModifier { + private static final Logger logger = Logger.getLogger(MSSQLStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MSSQLStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateExecuteQueryMethod(classPool,cc); + updateExecuteQueryMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[1]; - params[0]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", params); - log("*** Changing executeQuery method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[1]; + params[0] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod = cc.getDeclaredMethod("executeQuery", params); + + logger.info("Changing executeQuery method."); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($1)+\"]\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); + sb.append("System.out.println(\"-----Query=[\"+com.profiler.util.QueryStringUtil.removeCarriageReturn($1)+\"]\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$1);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$1);"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); + return sb.toString(); - } } diff --git a/src/main/java/com/profiler/modifier/db/mysql/MySQLConnectionImplModifier.java b/src/main/java/com/profiler/modifier/db/mysql/MySQLConnectionImplModifier.java index 6c92b2e13..dd37353c8 100644 --- a/src/main/java/com/profiler/modifier/db/mysql/MySQLConnectionImplModifier.java +++ b/src/main/java/com/profiler/modifier/db/mysql/MySQLConnectionImplModifier.java @@ -5,100 +5,142 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MySQLConnectionImplModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MySQLConnectionImplModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethods(classPool,classLoader,javassistClassName,classFileBuffer); +public class MySQLConnectionImplModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MySQLConnectionImplModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MySQLConnectionImplModifier modifing. %s", javassistClassName); + return changeMethods(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethods(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethods(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateGetInstanceMethod(classPool,cc); - updateCreateStatementMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateGetInstanceMethod(classPool, cc); + updateCreateStatementMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - - private static void updateCreateStatementMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("createStatement", null); - log("*** Changing createStatement method "); -// serviceMethod.insertBefore(getCreateStatementMethodBeforeInsertCode()); + + private static void updateCreateStatementMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("createStatement", null); + + logger.info("Changing createStatement method"); + + serviceMethod.insertBefore(getCreateStatementMethodBeforeInsertCode()); serviceMethod.insertAfter(getCreateStatementMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getCreateStatementMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.createStatement() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----ConnectionImpl.createStatement() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getCreateStatementMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.createStatement() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_CREATE_STATEMENT+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----ConnectionImpl.createStatement() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_CREATE_STATEMENT + ");"); sb.append("}"); return sb.toString(); } - private static void updateGetInstanceMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[5]; - params[0]=classPool.getCtClass("java.lang.String"); - params[1]=classPool.getCtClass("int"); - params[2]=classPool.getCtClass("java.util.Properties"); - params[3]=classPool.getCtClass("java.lang.String"); - params[4]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod=cc.getDeclaredMethod("getInstance", params); - log("*** Changing getInstance method "); -// serviceMethod.insertBefore(getGetInstanceMethodBeforeInsertCode()); + + private static void updateGetInstanceMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[5]; + params[0] = classPool.getCtClass("java.lang.String"); + params[1] = classPool.getCtClass("int"); + params[2] = classPool.getCtClass("java.util.Properties"); + params[3] = classPool.getCtClass("java.lang.String"); + params[4] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod = cc.getDeclaredMethod("getInstance", params); + + logger.info("Changing getInstance method "); + + serviceMethod.insertBefore(getGetInstanceMethodBeforeInsertCode()); serviceMethod.insertAfter(getGetInstanceMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getGetInstanceMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.getInstance() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----ConnectionImpl.getInstance() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getGetInstanceMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.getInstance() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putConnection("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_GET_CONNECTION+",$5);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----ConnectionImpl.getInstance() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putConnection(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_GET_CONNECTION + ",$5);"); sb.append("}"); + return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("close", null); - log("*** Changing close method "); -// serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("close", null); + + logger.info("Changing close method "); + + serviceMethod.insertBefore(getCloseMethodBeforeInsertCode()); serviceMethod.insertAfter(getCloseMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.close() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----ConnectionImpl.close() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getCloseMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----ConnectionImpl.close() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----ConnectionImpl.close() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_CLOSE_CONNECTION + ");"); sb.append("}"); + return sb.toString(); } } diff --git a/src/main/java/com/profiler/modifier/db/mysql/MySQLPreparedStatementModifier.java b/src/main/java/com/profiler/modifier/db/mysql/MySQLPreparedStatementModifier.java index 6e882cc97..68823882e 100644 --- a/src/main/java/com/profiler/modifier/db/mysql/MySQLPreparedStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/mysql/MySQLPreparedStatementModifier.java @@ -6,108 +6,144 @@ import javassist.CtConstructor; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MySQLPreparedStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MySQLPreparedStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MySQLPreparedStatementModifier extends AbstractModifier { + private static final Logger logger = Logger.getLogger(MySQLPreparedStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MySQLPreparedStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateSetInternalMethod(classPool,cc); - updateExecuteQueryMethod(classPool,cc); - updateConstructor(classPool,cc); + updateSetInternalMethod(classPool, cc); + updateExecuteQueryMethod(classPool, cc); + updateConstructor(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateSetInternalMethod(ClassPool classPool,CtClass cc) throws Exception { -// setInternal(int paramIndex, String val) - CtClass[] params1=new CtClass[2]; - params1[0]=classPool.getCtClass("int"); - params1[1]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod1=cc.getDeclaredMethod("setInternal", params1); - log("*** Changing setInternal(int,String) method "); + + private static void updateSetInternalMethod(ClassPool classPool, CtClass cc) throws Exception { + // setInternal(int paramIndex, String val) + CtClass[] params1 = new CtClass[2]; + params1[0] = classPool.getCtClass("int"); + params1[1] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod1 = cc.getDeclaredMethod("setInternal", params1); + + logger.info("Changing setInternal(int,String) method "); serviceMethod1.insertBefore(getSetInternal1MethodBeforeInsertCode()); - CtClass[] params2=new CtClass[2]; - params2[0]=classPool.getCtClass("int"); - params2[1]=classPool.getCtClass("byte[]"); - CtMethod serviceMethod2=cc.getDeclaredMethod("setInternal", params2); - log("*** Changing setInternal(int,byte[]) method "); + + CtClass[] params2 = new CtClass[2]; + params2[0] = classPool.getCtClass("int"); + params2[1] = classPool.getCtClass("byte[]"); + CtMethod serviceMethod2 = cc.getDeclaredMethod("setInternal", params2); + + logger.info("Changing setInternal(int,byte[]) method "); serviceMethod2.insertBefore(getSetInternal2MethodBeforeInsertCode()); - } + private static String getSetInternal1MethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$2);"); sb.append("}"); + return sb.toString(); } + private static String getSetInternal2MethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,byte[]) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+new String($2));"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,byte[]) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+new String($2));"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$2);"); sb.append("}"); + return sb.toString(); } - private static void updateConstructor(ClassPool classPool,CtClass cc) throws Exception { - CtConstructor []constructorList=cc.getConstructors(); - if(constructorList.length==3) { - log("*** Changing Constructor "); - for(CtConstructor constructor:constructorList) { - CtClass params[]=constructor.getParameterTypes(); - if(params.length==3) { + + private static void updateConstructor(ClassPool classPool, CtClass cc) throws Exception { + CtConstructor[] constructorList = cc.getConstructors(); + if (constructorList.length == 3) { + logger.info("Changing Constructor"); + for (CtConstructor constructor : constructorList) { + CtClass params[] = constructor.getParameterTypes(); + if (params.length == 3) { constructor.insertBefore(getConstructorBeforeInsertCode()); } } } } + private static String getConstructorBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement's constructor is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+$2+\"]\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----PreparedStatement's constructor is called\");"); + sb.append("System.out.println(\"-----Query=[\"+$2+\"]\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$2);"); sb.append("}"); + return sb.toString(); } - - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", null); - log("*** Changing executeQuery method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("executeQuery", null); + + logger.info("*** Changing executeQuery method "); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); + return sb.toString(); - } } diff --git a/src/main/java/com/profiler/modifier/db/mysql/MySQLResultSetModifier.java b/src/main/java/com/profiler/modifier/db/mysql/MySQLResultSetModifier.java index 21ade585b..ca645f718 100644 --- a/src/main/java/com/profiler/modifier/db/mysql/MySQLResultSetModifier.java +++ b/src/main/java/com/profiler/modifier/db/mysql/MySQLResultSetModifier.java @@ -5,54 +5,64 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MySQLResultSetModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("ResultSetImpl modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MySQLResultSetModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MySQLResultSetModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("ResultSetImpl modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateNextMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateNextMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateNextMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("next", null); - log("*** Changing next() method "); + + private static void updateNextMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("next", null); + + logger.info("*** Changing next() method"); + serviceMethod1.insertBefore(getNextMethodBeforeInsertCode()); } + private static String getNextMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".updateFetchCount();"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".updateFetchCount();"); sb.append("}"); return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("close", null); - log("*** Changing close() method "); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("close", null); + + logger.info("Changing close() method"); + serviceMethod1.insertBefore(getCloseMethodBeforeInsertCode()); } + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".addResultSetData();"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".addResultSetData();"); sb.append("}"); + return sb.toString(); } } diff --git a/src/main/java/com/profiler/modifier/db/mysql/MySQLStatementModifier.java b/src/main/java/com/profiler/modifier/db/mysql/MySQLStatementModifier.java index 80e22c689..8c2287df5 100644 --- a/src/main/java/com/profiler/modifier/db/mysql/MySQLStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/mysql/MySQLStatementModifier.java @@ -5,51 +5,68 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class MySQLStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("MySQLStatementModifier modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class MySQLStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(MySQLStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("MySQLStatementModifier modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateExecuteQueryMethod(classPool,cc); + updateExecuteQueryMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[1]; - params[0]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", params); - log("*** Changing executeQuery method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[1]; + params[0] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod = cc.getDeclaredMethod("executeQuery", params); + + logger.info("Changing executeQuery method"); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+$1+\"]\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); + sb.append("System.out.println(\"-----Query=[\"+$1+\"]\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$1);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$1);"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); return sb.toString(); - + } -} +} \ No newline at end of file diff --git a/src/main/java/com/profiler/modifier/db/oracle/OraclePreparedStatementModifier.java b/src/main/java/com/profiler/modifier/db/oracle/OraclePreparedStatementModifier.java index 51d55b30c..082ab5cba 100644 --- a/src/main/java/com/profiler/modifier/db/oracle/OraclePreparedStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/oracle/OraclePreparedStatementModifier.java @@ -6,114 +6,146 @@ import javassist.CtConstructor; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class OraclePreparedStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("OraclePreparedStatementModifier modifing"); -// printClassInfo(javassistClassName); -// return addBeforeAfterLogics(classPool,javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); -// return null; +public class OraclePreparedStatementModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(OraclePreparedStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("OraclePreparedStatementModifier modifing. %s", javassistClassName); + // printClassInfo(javassistClassName); + // return addBeforeAfterLogics(classPool,javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateSetInternalMethod(classPool,cc); - updateExecuteMethod(classPool,cc); - updateConstructor(classPool,cc); + updateSetInternalMethod(classPool, cc); + updateExecuteMethod(classPool, cc); + updateConstructor(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateSetInternalMethod(ClassPool classPool,CtClass cc) throws Exception { -// setInternal(int paramIndex, String val) - CtClass[] params1=new CtClass[2]; - params1[0]=classPool.getCtClass("int"); - params1[1]=classPool.getCtClass("java.lang.String"); - CtMethod serviceMethod1=cc.getDeclaredMethod("setStringInternal", params1); - log("*** Changing setInternal(int,String) method "); + + private static void updateSetInternalMethod(ClassPool classPool, CtClass cc) throws Exception { + // setInternal(int paramIndex, String val) + CtClass[] params1 = new CtClass[2]; + params1[0] = classPool.getCtClass("int"); + params1[1] = classPool.getCtClass("java.lang.String"); + CtMethod serviceMethod1 = cc.getDeclaredMethod("setStringInternal", params1); + + logger.info("Changing setInternal(int,String) method"); + serviceMethod1.insertBefore(getSetInternal1MethodBeforeInsertCode()); -// CtClass[] params2=new CtClass[2]; -// params2[0]=classPool.getCtClass("int"); -// params2[1]=classPool.getCtClass("byte[]"); -// CtMethod serviceMethod2=cc.getDeclaredMethod("setInternal", params2); -// log("*** Changing setInternal(int,byte[]) method "); -// serviceMethod2.insertBefore(getSetInternal2MethodBeforeInsertCode()); - + + // CtClass[] params2=new CtClass[2]; + // params2[0]=classPool.getCtClass("int"); + // params2[1]=classPool.getCtClass("byte[]"); + // CtMethod serviceMethod2=cc.getDeclaredMethod("setInternal", params2); + // log("*** Changing setInternal(int,byte[]) method "); + // serviceMethod2.insertBefore(getSetInternal2MethodBeforeInsertCode()); } + private static String getSetInternal1MethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$2);"); sb.append("}"); return sb.toString(); } + private static String getSetInternal2MethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,byte[]) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+new String($2));"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlParam($1,$2);"); + // sb.append("System.out.println(\"PreparedStatement.setInternal(int,byte[]) method is called\");"); + // sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+new String($2));"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlParam($1,$2);"); sb.append("}"); return sb.toString(); } - private static void updateConstructor(ClassPool classPool,CtClass cc) throws Exception { - CtConstructor []constructorList=cc.getConstructors(); -// if(constructorList.length==3) { - log("*** Changing Constructor "); - for(CtConstructor constructor:constructorList) { - CtClass params[]=constructor.getParameterTypes(); -// System.out.println(params.length); -// for(CtClass param:params) { -// System.out.println(param.getName()); -// } - if(params.length==6) { + + private static void updateConstructor(ClassPool classPool, CtClass cc) throws Exception { + CtConstructor[] constructorList = cc.getConstructors(); + // if(constructorList.length==3) { + + logger.info("*** Changing Constructor"); + + for (CtConstructor constructor : constructorList) { + CtClass params[] = constructor.getParameterTypes(); + // System.out.println(params.length); + // for(CtClass param:params) { + // System.out.println(param.getName()); + // } + if (params.length == 6) { constructor.insertBefore(getConstructorBeforeInsertCode()); } } -// } + // } } + private static String getConstructorBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement's constructor is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+$2+\"]\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$2);"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----PreparedStatement's constructor is called\");"); + sb.append("System.out.println(\"-----Query=[\"+$2+\"]\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$2);"); sb.append("}"); + return sb.toString(); } - - private static void updateExecuteMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod=cc.getDeclaredMethod("execute", null); - log("*** Changing execute method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod = cc.getDeclaredMethod("execute", null); + logger.info("Changing execute method"); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is called\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is called\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----PreparedStatement.executeQuery() method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); + return sb.toString(); - } } diff --git a/src/main/java/com/profiler/modifier/db/oracle/OracleResultSetModifier.java b/src/main/java/com/profiler/modifier/db/oracle/OracleResultSetModifier.java index 62aa335c4..4c651c5a3 100644 --- a/src/main/java/com/profiler/modifier/db/oracle/OracleResultSetModifier.java +++ b/src/main/java/com/profiler/modifier/db/oracle/OracleResultSetModifier.java @@ -5,54 +5,77 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class OracleResultSetModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("OracleResultSetImpl modifing"); -// printClassInfo(javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class OracleResultSetModifier extends AbstractModifier { + + private static final Logger logger = Logger.getLogger(OracleResultSetModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("OracleResultSetImpl modifing. %s", javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateNextMethod(classPool,cc); - updateCloseMethod(classPool,cc); + updateNextMethod(classPool, cc); + updateCloseMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); -// cc.writeFile(); + // cc.writeFile(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } - private static void updateNextMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("next", null); - log("*** Changing next() method "); + + private static void updateNextMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("next", null); + + logger.info("Changing next() method "); + serviceMethod1.insertBefore(getNextMethodBeforeInsertCode()); } + private static String getNextMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".updateFetchCount();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".updateFetchCount();"); sb.append("}"); + return sb.toString(); } - private static void updateCloseMethod(ClassPool classPool,CtClass cc) throws Exception { - CtMethod serviceMethod1=cc.getDeclaredMethod("close", null); - log("*** Changing close() method "); + + private static void updateCloseMethod(ClassPool classPool, CtClass cc) throws Exception { + CtMethod serviceMethod1 = cc.getDeclaredMethod("close", null); + + logger.info("Changing close() method"); + serviceMethod1.insertBefore(getCloseMethodBeforeInsertCode()); } + private static String getCloseMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); -// sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".addResultSetData();"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"PreparedStatement.setInternal(int,String) method is called\");"); + sb.append("System.out.println(\"-----Position=\"+$1+\" Value=\"+$2);"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".addResultSetData();"); sb.append("}"); + return sb.toString(); } } diff --git a/src/main/java/com/profiler/modifier/db/oracle/OracleStatementModifier.java b/src/main/java/com/profiler/modifier/db/oracle/OracleStatementModifier.java index c8dc2e53e..ff4e41acc 100644 --- a/src/main/java/com/profiler/modifier/db/oracle/OracleStatementModifier.java +++ b/src/main/java/com/profiler/modifier/db/oracle/OracleStatementModifier.java @@ -5,19 +5,23 @@ import javassist.CtClass; import javassist.CtMethod; import com.profiler.config.TomcatProfilerConstant; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; -public class OracleStatementModifier extends AbstractModifier{ - public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) { - log("OracleStatementModifier modifing"); -// printClassInfo(javassistClassName); -// return addBeforeAfterLogics(classPool,javassistClassName); - return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer); +public class OracleStatementModifier extends AbstractModifier { + private static final Logger logger = Logger.getLogger(OracleStatementModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("OracleStatementModifier modifing. %s", javassistClassName); + // printClassInfo(javassistClassName); + // return addBeforeAfterLogics(classPool,javassistClassName); + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) { + + private static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); - updateExecuteQueryMethod(classPool,cc); + updateExecuteQueryMethod(classPool, cc); byte[] newClassfileBuffer = cc.toBytecode(); printClassConvertComplete(javassistClassName); return newClassfileBuffer; @@ -26,32 +30,44 @@ public class OracleStatementModifier extends AbstractModifier{ } return null; } - private static void updateExecuteQueryMethod(ClassPool classPool,CtClass cc) throws Exception { - CtClass[] params=new CtClass[1]; - params[0]=classPool.getCtClass("java.lang.String"); -// CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", params); - CtMethod serviceMethod=cc.getDeclaredMethod("execute", params); - log("*** Changing executeQuery method "); -// serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); + + private static void updateExecuteQueryMethod(ClassPool classPool, CtClass cc) throws Exception { + CtClass[] params = new CtClass[1]; + params[0] = classPool.getCtClass("java.lang.String"); + // CtMethod serviceMethod=cc.getDeclaredMethod("executeQuery", params); + CtMethod serviceMethod = cc.getDeclaredMethod("execute", params); + + logger.info("Changing executeQuery method"); + + serviceMethod.insertBefore(getExecuteQueryMethodBeforeInsertCode()); serviceMethod.insertAfter(getExecuteQueryMethodAfterInsertCode()); } - @SuppressWarnings("unused") + private static String getExecuteQueryMethodBeforeInsertCode() { - StringBuilder sb=new StringBuilder(); -// sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); -// sb.append("System.out.println(\"-----Query=[\"+$1+\"]\");"); -// sb.append("}"); + StringBuilder sb = new StringBuilder(); + + if (logger.isDebugEnabled()) { + sb.append("{"); + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is called\");"); + sb.append("System.out.println(\"-----Query=[\"+$1+\"]\");"); + sb.append("}"); + } + return sb.toString(); } + private static String getExecuteQueryMethodAfterInsertCode() { - StringBuilder sb=new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append("{"); -// sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".putSqlQuery("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY+",$1);"); - sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER+".put("+TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY+");"); + + if (logger.isDebugEnabled()) { + sb.append("System.out.println(\"-----StatementImpl.executeQuery(String) method is ended\");"); + } + + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".putSqlQuery(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_QUERY + ",$1);"); + sb.append(TomcatProfilerConstant.CLASS_NAME_REQUEST_DATA_TRACER + ".put(" + TomcatProfilerConstant.REQ_DATA_TYPE_DB_EXECUTE_QUERY + ");"); sb.append("}"); return sb.toString(); - + } } diff --git a/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java b/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java index a3ee1f78c..ddd561eb5 100644 --- a/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java +++ b/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java @@ -1,53 +1,50 @@ package com.profiler.modifier.tomcat; -import static com.profiler.config.TomcatProfilerConstant.CLASS_NAME_REQUEST_TRACER; import static com.profiler.config.TomcatProfilerConstant.CLASS_NAME_REQUEST_THRIFT_DTO; +import static com.profiler.config.TomcatProfilerConstant.CLASS_NAME_REQUEST_TRACER; import javassist.ByteArrayClassPath; import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; +import com.profiler.logging.Logger; import com.profiler.modifier.AbstractModifier; /** * Modify org.apache.catalina.core.StandardHostValve class * - * @author cowboy93 + * @author cowboy93, netspider * */ public class EntryPointStandardHostValveModifier extends AbstractModifier { - public static byte[] modify(ClassPool classPool, ClassLoader classLoader, - String javassistClassName, byte[] classFileBuffer) { - log("EntryPointModifier.modifyStandardHostValve()"); - // printClassInfo(javassistClassName); - return changeServiceMethod(classPool, classLoader, javassistClassName, - classFileBuffer); + + private static final Logger logger = Logger.getLogger(EntryPointStandardHostValveModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + logger.info("EntryPointModifier.modifyStandardHostValve(). %s", javassistClassName); + return changeServiceMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - private static byte[] changeServiceMethod(ClassPool classPool, - ClassLoader classLoader, String javassistClassName, - byte[] classfileBuffer) { - classPool.insertClassPath(new ByteArrayClassPath(javassistClassName, - classfileBuffer)); + private static byte[] changeServiceMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { + classPool.insertClassPath(new ByteArrayClassPath(javassistClassName, classfileBuffer)); try { addRequestTracerToCurrentClassLoader(classLoader); // log("Class loader="+classPool.getClassLoader().toString()); CtClass cc = classPool.get(javassistClassName); CtClass[] params = new CtClass[2]; - params[0] = classPool - .getCtClass("org.apache.catalina.connector.Request"); - params[1] = classPool - .getCtClass("org.apache.catalina.connector.Response"); + params[0] = classPool.getCtClass("org.apache.catalina.connector.Request"); + params[1] = classPool.getCtClass("org.apache.catalina.connector.Response"); CtMethod serviceMethod = cc.getDeclaredMethod("invoke", params); - log("*** Changing invoke method "); + + logger.info("Changing invoke method"); + serviceMethod.insertBefore(getInvokeMethodBeforeInsertCode()); serviceMethod.insertAfter(getInvokeMethodAfterInsertCode()); CtClass exceptionType = classPool.get("java.lang.Throwable"); // CtClass exceptionType = classPool.get("java.lang.Exception"); - serviceMethod.addCatch(getInvokeMethodCatchInsertCode(), - exceptionType); + serviceMethod.addCatch(getInvokeMethodCatchInsertCode(), exceptionType); // cc.stopPruning(true); // cc.toClass(classLoader,classLoader.getClass().getProtectionDomain()); @@ -58,6 +55,7 @@ public class EntryPointStandardHostValveModifier extends AbstractModifier { printClassConvertComplete(javassistClassName); return newClassfileBuffer; } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; @@ -68,69 +66,91 @@ public class EntryPointStandardHostValveModifier extends AbstractModifier { insertCode.append("{"); insertCode.append("long requestTime=System.currentTimeMillis();"); - insertCode - .append("javax.servlet.http.HttpServletRequest tempRequest=(javax.servlet.http.HttpServletRequest)$1;"); + insertCode.append("javax.servlet.http.HttpServletRequest tempRequest=(javax.servlet.http.HttpServletRequest)$1;"); insertCode.append("String requestURL=tempRequest.getRequestURI();"); insertCode.append("String clientIP=tempRequest.getRemoteAddr();"); insertCode.append(getParameterValues()); - insertCode.append(CLASS_NAME_REQUEST_TRACER).append( - ".startTransaction(requestURL,clientIP,requestTime,params);"); + insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".startTransaction(requestURL,clientIP,requestTime,params);"); + + if (logger.isDebugEnabled()) { + insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is started.\");"); + } - // insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is started.\");"); insertCode.append("}"); return insertCode.toString(); } private static StringBuilder getParameterValues() { StringBuilder insertCode = new StringBuilder(); - insertCode - .append("java.util.Enumeration attrs=tempRequest.getParameterNames();"); + insertCode.append("java.util.Enumeration attrs=tempRequest.getParameterNames();"); insertCode.append("StringBuilder params=new StringBuilder();"); insertCode.append("while(attrs.hasMoreElements()) {"); insertCode.append("String keyString=attrs.nextElement().toString();"); - // insertCode.append("System.out.println(key+\"=\"+tempRequest.getParameter(key.toString()));"); + + if (logger.isDebugEnabled()) { + insertCode.append("System.out.println(keyString+\"=\"+tempRequest.getParameter(keyString));"); + } + insertCode.append("Object value=tempRequest.getParameter(keyString);"); insertCode.append("if(value!=null) {"); insertCode.append("String valueString=value.toString();"); insertCode.append("int valueStringLength=valueString.length();"); - insertCode - .append("if(valueStringLength>0 && valueStringLength<100) params.append(keyString).append(\"=\").append(valueString).append(\",\");"); + insertCode.append("if(valueStringLength>0 && valueStringLength<100) params.append(keyString).append(\"=\").append(valueString).append(\",\");"); insertCode.append("}}"); - // insertCode.append("System.out.println(params);"); + + if (logger.isDebugEnabled()) { + insertCode.append("System.out.println(params);"); + } + return insertCode; } private static String getInvokeMethodAfterInsertCode() { StringBuilder insertCode = new StringBuilder(); insertCode.append("{"); - insertCode.append(CLASS_NAME_REQUEST_TRACER).append( - ".endTransaction();"); - // insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is ended.\");"); + insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".endTransaction();"); + + if (logger.isDebugEnabled()) { + insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is ended.\");"); + } + insertCode.append("}"); + return insertCode.toString(); } private static String getInvokeMethodCatchInsertCode() { StringBuilder insertCode = new StringBuilder(); - // insertCode.append("{"); - // insertCode.append("System.out.println(\"------------------------------------------------\");"); - // insertCode.append("System.out.println(\"--- \"+$e.getMessage()+\" is occured !!!\");"); - insertCode.append(CLASS_NAME_REQUEST_TRACER).append( - ".exceptionTransaction($e);"); - // insertCode.append("System.out.println(\"------------------------------------------------\");"); + + if (logger.isDebugEnabled()) { + insertCode.append("{"); + insertCode.append("System.out.println(\"------------------------------------------------\");"); + insertCode.append("System.out.println(\"--- \"+$e.getMessage()+\" is occured !!!\");"); + } + + insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".exceptionTransaction($e);"); + + if (logger.isDebugEnabled()) { + insertCode.append("System.out.println(\"------------------------------------------------\");"); + } + insertCode.append("throw $e;"); - // insertCode.append("}"); + + if (logger.isDebugEnabled()) { + insertCode.append("}"); + } + return insertCode.toString(); } - private static void addRequestTracerToCurrentClassLoader( - ClassLoader classLoader) { + private static void addRequestTracerToCurrentClassLoader(ClassLoader classLoader) { try { classLoader.loadClass(CLASS_NAME_REQUEST_TRACER); classLoader.loadClass(CLASS_NAME_REQUEST_THRIFT_DTO); classLoader.loadClass("org.apache.thrift.TBase"); } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java b/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java index f0a7d514c..70ba4f64e 100644 --- a/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java +++ b/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java @@ -1,46 +1,49 @@ package com.profiler.modifier.tomcat; -import com.profiler.modifier.AbstractModifier; - import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; +import com.profiler.logging.Logger; +import com.profiler.modifier.AbstractModifier; + /** * When org.apache.catalina.core.StandardService class is loaded in ClassLoader, * this class modifies methods. * - * @author cowboy93 + * @author cowboy93, netspider * */ public class TomcatConnectorModifier extends AbstractModifier { - public static byte[] modify(ClassPool classPool, ClassLoader classLoader, - String javassistClassName, byte[] classFileBuffer) { - // printClassInfo(javassistClassName); - return changeMethod(classPool, classLoader, javassistClassName, - classFileBuffer); + + private static final Logger logger = Logger.getLogger(TomcatConnectorModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + if (logger.isDebugEnabled()) { + printClassInfo(javassistClassName); + } + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - public static byte[] changeMethod(ClassPool classPool, - ClassLoader classLoader, String javassistClassName, - byte[] classfileBuffer) { + public static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); CtClass param[] = new CtClass[1]; param[0] = classPool.getCtClass("int"); CtMethod setPortMethod = cc.getDeclaredMethod("setPort", param); - setPortMethod.insertBefore("{" - + - // "System.out.println(\"*** setPort() method *** Port number=\"+$1);" - // + - "com.profiler.dto.AgentInfoDTO.portNumberBuffer.append($1).append(\" \");" - + "}"); + setPortMethod.insertBefore("{" + + // "System.out.println(\"*** setPort() method *** Port number=\"+$1);" + // + + "com.profiler.dto.AgentInfoDTO.portNumberBuffer.append($1).append(\" \");" + "}"); + printClassConvertComplete(javassistClassName); + return cc.toBytecode(); } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; } -} +} \ No newline at end of file diff --git a/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java b/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java index 2dfeaa3b2..8531747ec 100644 --- a/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java +++ b/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java @@ -1,49 +1,45 @@ package com.profiler.modifier.tomcat; import static com.profiler.config.TomcatProfilerConstant.CLASS_NAME_AGENT_STATE_MANAGER; - -import com.profiler.modifier.AbstractModifier; - import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; +import com.profiler.logging.Logger; +import com.profiler.modifier.AbstractModifier; + /** * When org.apache.catalina.core.StandardService class is loaded in ClassLoader, * this class modifies methods. * - * @author cowboy93 + * @author cowboy93, netspider * */ public class TomcatStandardServiceModifier extends AbstractModifier { - public static byte[] modify(ClassPool classPool, ClassLoader classLoader, - String javassistClassName, byte[] classFileBuffer) { - // printClassInfo(javassistClassName); - return changeMethod(classPool, classLoader, javassistClassName, - classFileBuffer); + + private static final Logger logger = Logger.getLogger(TomcatStandardServiceModifier.class); + + public static byte[] modify(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classFileBuffer) { + if (logger.isDebugEnabled()) { + printClassInfo(javassistClassName); + } + return changeMethod(classPool, classLoader, javassistClassName, classFileBuffer); } - public static byte[] changeMethod(ClassPool classPool, - ClassLoader classLoader, String javassistClassName, - byte[] classfileBuffer) { + public static byte[] changeMethod(ClassPool classPool, ClassLoader classLoader, String javassistClassName, byte[] classfileBuffer) { try { CtClass cc = classPool.get(javassistClassName); + CtMethod startMethod = cc.getDeclaredMethod("start", null); - startMethod - .insertBefore("{" - + "System.out.println(\"*** Start TomcatProfiler JVMStat Thread ***\");" - + CLASS_NAME_AGENT_STATE_MANAGER - + ".startJVMTraceThread();" + "}"); + startMethod.insertBefore("{" + "System.out.println(\"*** Start TomcatProfiler JVMStat Thread ***\");" + CLASS_NAME_AGENT_STATE_MANAGER + ".startJVMTraceThread();" + "}"); + CtMethod stopMethod = cc.getDeclaredMethod("stop", null); - stopMethod - .insertBefore("{" - + "System.out.println(\"*** TomcatProfiler send JVM is stopped info ***\");" - + CLASS_NAME_AGENT_STATE_MANAGER - + ".sendJVMStoppedInfo();" + "}"); + stopMethod.insertBefore("{" + "System.out.println(\"*** TomcatProfiler send JVM is stopped info ***\");" + CLASS_NAME_AGENT_STATE_MANAGER + ".sendJVMStoppedInfo();" + "}"); printClassConvertComplete(javassistClassName); return cc.toBytecode(); } catch (Exception e) { + logger.error(e.getMessage()); e.printStackTrace(); } return null; diff --git a/src/main/java/com/profiler/sender/AgentInfoSender.java b/src/main/java/com/profiler/sender/AgentInfoSender.java index 976683c9c..51ef1db80 100644 --- a/src/main/java/com/profiler/sender/AgentInfoSender.java +++ b/src/main/java/com/profiler/sender/AgentInfoSender.java @@ -3,9 +3,9 @@ package com.profiler.sender; import java.io.ObjectOutputStream; import java.net.Socket; -import com.profiler.Logger; import com.profiler.config.TomcatProfilerConfig; import com.profiler.dto.AgentInfoDTO; +import com.profiler.logging.Logger; public class AgentInfoSender extends Thread {