BeeswaxException.java 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. /**
  2. * Autogenerated by Thrift
  3. *
  4. * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5. */
  6. package com.cloudera.beeswax.api;
  7. import org.apache.commons.lang.builder.HashCodeBuilder;
  8. import java.util.List;
  9. import java.util.ArrayList;
  10. import java.util.Map;
  11. import java.util.HashMap;
  12. import java.util.EnumMap;
  13. import java.util.Set;
  14. import java.util.HashSet;
  15. import java.util.EnumSet;
  16. import java.util.Collections;
  17. import java.util.BitSet;
  18. import java.nio.ByteBuffer;
  19. import java.util.Arrays;
  20. import org.slf4j.Logger;
  21. import org.slf4j.LoggerFactory;
  22. import org.apache.thrift.*;
  23. import org.apache.thrift.async.*;
  24. import org.apache.thrift.meta_data.*;
  25. import org.apache.thrift.transport.*;
  26. import org.apache.thrift.protocol.*;
  27. public class BeeswaxException extends Exception implements TBase<BeeswaxException, BeeswaxException._Fields>, java.io.Serializable, Cloneable {
  28. private static final TStruct STRUCT_DESC = new TStruct("BeeswaxException");
  29. private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
  30. private static final TField LOG_CONTEXT_FIELD_DESC = new TField("log_context", TType.STRING, (short)2);
  31. private static final TField HANDLE_FIELD_DESC = new TField("handle", TType.STRUCT, (short)3);
  32. public String message;
  33. public String log_context;
  34. public QueryHandle handle;
  35. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  36. public enum _Fields implements TFieldIdEnum {
  37. MESSAGE((short)1, "message"),
  38. LOG_CONTEXT((short)2, "log_context"),
  39. HANDLE((short)3, "handle");
  40. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  41. static {
  42. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  43. byName.put(field.getFieldName(), field);
  44. }
  45. }
  46. /**
  47. * Find the _Fields constant that matches fieldId, or null if its not found.
  48. */
  49. public static _Fields findByThriftId(int fieldId) {
  50. switch(fieldId) {
  51. case 1: // MESSAGE
  52. return MESSAGE;
  53. case 2: // LOG_CONTEXT
  54. return LOG_CONTEXT;
  55. case 3: // HANDLE
  56. return HANDLE;
  57. default:
  58. return null;
  59. }
  60. }
  61. /**
  62. * Find the _Fields constant that matches fieldId, throwing an exception
  63. * if it is not found.
  64. */
  65. public static _Fields findByThriftIdOrThrow(int fieldId) {
  66. _Fields fields = findByThriftId(fieldId);
  67. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  68. return fields;
  69. }
  70. /**
  71. * Find the _Fields constant that matches name, or null if its not found.
  72. */
  73. public static _Fields findByName(String name) {
  74. return byName.get(name);
  75. }
  76. private final short _thriftId;
  77. private final String _fieldName;
  78. _Fields(short thriftId, String fieldName) {
  79. _thriftId = thriftId;
  80. _fieldName = fieldName;
  81. }
  82. public short getThriftFieldId() {
  83. return _thriftId;
  84. }
  85. public String getFieldName() {
  86. return _fieldName;
  87. }
  88. }
  89. // isset id assignments
  90. public static final Map<_Fields, FieldMetaData> metaDataMap;
  91. static {
  92. Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
  93. tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
  94. new FieldValueMetaData(TType.STRING)));
  95. tmpMap.put(_Fields.LOG_CONTEXT, new FieldMetaData("log_context", TFieldRequirementType.DEFAULT,
  96. new FieldValueMetaData(TType.STRING , "LogContextId")));
  97. tmpMap.put(_Fields.HANDLE, new FieldMetaData("handle", TFieldRequirementType.DEFAULT,
  98. new StructMetaData(TType.STRUCT, QueryHandle.class)));
  99. metaDataMap = Collections.unmodifiableMap(tmpMap);
  100. FieldMetaData.addStructMetaDataMap(BeeswaxException.class, metaDataMap);
  101. }
  102. public BeeswaxException() {
  103. }
  104. public BeeswaxException(
  105. String message,
  106. String log_context,
  107. QueryHandle handle)
  108. {
  109. this();
  110. this.message = message;
  111. this.log_context = log_context;
  112. this.handle = handle;
  113. }
  114. /**
  115. * Performs a deep copy on <i>other</i>.
  116. */
  117. public BeeswaxException(BeeswaxException other) {
  118. if (other.isSetMessage()) {
  119. this.message = other.message;
  120. }
  121. if (other.isSetLog_context()) {
  122. this.log_context = other.log_context;
  123. }
  124. if (other.isSetHandle()) {
  125. this.handle = new QueryHandle(other.handle);
  126. }
  127. }
  128. public BeeswaxException deepCopy() {
  129. return new BeeswaxException(this);
  130. }
  131. @Override
  132. public void clear() {
  133. this.message = null;
  134. this.log_context = null;
  135. this.handle = null;
  136. }
  137. public String getMessage() {
  138. return this.message;
  139. }
  140. public BeeswaxException setMessage(String message) {
  141. this.message = message;
  142. return this;
  143. }
  144. public void unsetMessage() {
  145. this.message = null;
  146. }
  147. /** Returns true if field message is set (has been asigned a value) and false otherwise */
  148. public boolean isSetMessage() {
  149. return this.message != null;
  150. }
  151. public void setMessageIsSet(boolean value) {
  152. if (!value) {
  153. this.message = null;
  154. }
  155. }
  156. public String getLog_context() {
  157. return this.log_context;
  158. }
  159. public BeeswaxException setLog_context(String log_context) {
  160. this.log_context = log_context;
  161. return this;
  162. }
  163. public void unsetLog_context() {
  164. this.log_context = null;
  165. }
  166. /** Returns true if field log_context is set (has been asigned a value) and false otherwise */
  167. public boolean isSetLog_context() {
  168. return this.log_context != null;
  169. }
  170. public void setLog_contextIsSet(boolean value) {
  171. if (!value) {
  172. this.log_context = null;
  173. }
  174. }
  175. public QueryHandle getHandle() {
  176. return this.handle;
  177. }
  178. public BeeswaxException setHandle(QueryHandle handle) {
  179. this.handle = handle;
  180. return this;
  181. }
  182. public void unsetHandle() {
  183. this.handle = null;
  184. }
  185. /** Returns true if field handle is set (has been asigned a value) and false otherwise */
  186. public boolean isSetHandle() {
  187. return this.handle != null;
  188. }
  189. public void setHandleIsSet(boolean value) {
  190. if (!value) {
  191. this.handle = null;
  192. }
  193. }
  194. public void setFieldValue(_Fields field, Object value) {
  195. switch (field) {
  196. case MESSAGE:
  197. if (value == null) {
  198. unsetMessage();
  199. } else {
  200. setMessage((String)value);
  201. }
  202. break;
  203. case LOG_CONTEXT:
  204. if (value == null) {
  205. unsetLog_context();
  206. } else {
  207. setLog_context((String)value);
  208. }
  209. break;
  210. case HANDLE:
  211. if (value == null) {
  212. unsetHandle();
  213. } else {
  214. setHandle((QueryHandle)value);
  215. }
  216. break;
  217. }
  218. }
  219. public Object getFieldValue(_Fields field) {
  220. switch (field) {
  221. case MESSAGE:
  222. return getMessage();
  223. case LOG_CONTEXT:
  224. return getLog_context();
  225. case HANDLE:
  226. return getHandle();
  227. }
  228. throw new IllegalStateException();
  229. }
  230. /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  231. public boolean isSet(_Fields field) {
  232. if (field == null) {
  233. throw new IllegalArgumentException();
  234. }
  235. switch (field) {
  236. case MESSAGE:
  237. return isSetMessage();
  238. case LOG_CONTEXT:
  239. return isSetLog_context();
  240. case HANDLE:
  241. return isSetHandle();
  242. }
  243. throw new IllegalStateException();
  244. }
  245. @Override
  246. public boolean equals(Object that) {
  247. if (that == null)
  248. return false;
  249. if (that instanceof BeeswaxException)
  250. return this.equals((BeeswaxException)that);
  251. return false;
  252. }
  253. public boolean equals(BeeswaxException that) {
  254. if (that == null)
  255. return false;
  256. boolean this_present_message = true && this.isSetMessage();
  257. boolean that_present_message = true && that.isSetMessage();
  258. if (this_present_message || that_present_message) {
  259. if (!(this_present_message && that_present_message))
  260. return false;
  261. if (!this.message.equals(that.message))
  262. return false;
  263. }
  264. boolean this_present_log_context = true && this.isSetLog_context();
  265. boolean that_present_log_context = true && that.isSetLog_context();
  266. if (this_present_log_context || that_present_log_context) {
  267. if (!(this_present_log_context && that_present_log_context))
  268. return false;
  269. if (!this.log_context.equals(that.log_context))
  270. return false;
  271. }
  272. boolean this_present_handle = true && this.isSetHandle();
  273. boolean that_present_handle = true && that.isSetHandle();
  274. if (this_present_handle || that_present_handle) {
  275. if (!(this_present_handle && that_present_handle))
  276. return false;
  277. if (!this.handle.equals(that.handle))
  278. return false;
  279. }
  280. return true;
  281. }
  282. @Override
  283. public int hashCode() {
  284. HashCodeBuilder builder = new HashCodeBuilder();
  285. boolean present_message = true && (isSetMessage());
  286. builder.append(present_message);
  287. if (present_message)
  288. builder.append(message);
  289. boolean present_log_context = true && (isSetLog_context());
  290. builder.append(present_log_context);
  291. if (present_log_context)
  292. builder.append(log_context);
  293. boolean present_handle = true && (isSetHandle());
  294. builder.append(present_handle);
  295. if (present_handle)
  296. builder.append(handle);
  297. return builder.toHashCode();
  298. }
  299. public int compareTo(BeeswaxException other) {
  300. if (!getClass().equals(other.getClass())) {
  301. return getClass().getName().compareTo(other.getClass().getName());
  302. }
  303. int lastComparison = 0;
  304. BeeswaxException typedOther = (BeeswaxException)other;
  305. lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
  306. if (lastComparison != 0) {
  307. return lastComparison;
  308. }
  309. if (isSetMessage()) {
  310. lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
  311. if (lastComparison != 0) {
  312. return lastComparison;
  313. }
  314. }
  315. lastComparison = Boolean.valueOf(isSetLog_context()).compareTo(typedOther.isSetLog_context());
  316. if (lastComparison != 0) {
  317. return lastComparison;
  318. }
  319. if (isSetLog_context()) {
  320. lastComparison = TBaseHelper.compareTo(this.log_context, typedOther.log_context);
  321. if (lastComparison != 0) {
  322. return lastComparison;
  323. }
  324. }
  325. lastComparison = Boolean.valueOf(isSetHandle()).compareTo(typedOther.isSetHandle());
  326. if (lastComparison != 0) {
  327. return lastComparison;
  328. }
  329. if (isSetHandle()) {
  330. lastComparison = TBaseHelper.compareTo(this.handle, typedOther.handle);
  331. if (lastComparison != 0) {
  332. return lastComparison;
  333. }
  334. }
  335. return 0;
  336. }
  337. public _Fields fieldForId(int fieldId) {
  338. return _Fields.findByThriftId(fieldId);
  339. }
  340. public void read(TProtocol iprot) throws TException {
  341. TField field;
  342. iprot.readStructBegin();
  343. while (true)
  344. {
  345. field = iprot.readFieldBegin();
  346. if (field.type == TType.STOP) {
  347. break;
  348. }
  349. switch (field.id) {
  350. case 1: // MESSAGE
  351. if (field.type == TType.STRING) {
  352. this.message = iprot.readString();
  353. } else {
  354. TProtocolUtil.skip(iprot, field.type);
  355. }
  356. break;
  357. case 2: // LOG_CONTEXT
  358. if (field.type == TType.STRING) {
  359. this.log_context = iprot.readString();
  360. } else {
  361. TProtocolUtil.skip(iprot, field.type);
  362. }
  363. break;
  364. case 3: // HANDLE
  365. if (field.type == TType.STRUCT) {
  366. this.handle = new QueryHandle();
  367. this.handle.read(iprot);
  368. } else {
  369. TProtocolUtil.skip(iprot, field.type);
  370. }
  371. break;
  372. default:
  373. TProtocolUtil.skip(iprot, field.type);
  374. }
  375. iprot.readFieldEnd();
  376. }
  377. iprot.readStructEnd();
  378. // check for required fields of primitive type, which can't be checked in the validate method
  379. validate();
  380. }
  381. public void write(TProtocol oprot) throws TException {
  382. validate();
  383. oprot.writeStructBegin(STRUCT_DESC);
  384. if (this.message != null) {
  385. oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
  386. oprot.writeString(this.message);
  387. oprot.writeFieldEnd();
  388. }
  389. if (this.log_context != null) {
  390. oprot.writeFieldBegin(LOG_CONTEXT_FIELD_DESC);
  391. oprot.writeString(this.log_context);
  392. oprot.writeFieldEnd();
  393. }
  394. if (this.handle != null) {
  395. oprot.writeFieldBegin(HANDLE_FIELD_DESC);
  396. this.handle.write(oprot);
  397. oprot.writeFieldEnd();
  398. }
  399. oprot.writeFieldStop();
  400. oprot.writeStructEnd();
  401. }
  402. @Override
  403. public String toString() {
  404. StringBuilder sb = new StringBuilder("BeeswaxException(");
  405. boolean first = true;
  406. sb.append("message:");
  407. if (this.message == null) {
  408. sb.append("null");
  409. } else {
  410. sb.append(this.message);
  411. }
  412. first = false;
  413. if (!first) sb.append(", ");
  414. sb.append("log_context:");
  415. if (this.log_context == null) {
  416. sb.append("null");
  417. } else {
  418. sb.append(this.log_context);
  419. }
  420. first = false;
  421. if (!first) sb.append(", ");
  422. sb.append("handle:");
  423. if (this.handle == null) {
  424. sb.append("null");
  425. } else {
  426. sb.append(this.handle);
  427. }
  428. first = false;
  429. sb.append(")");
  430. return sb.toString();
  431. }
  432. public void validate() throws TException {
  433. // check for required fields
  434. }
  435. }