1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 /**
18 * Autogenerated by Thrift Compiler (0.9.0)
19 *
20 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
21 * @generated
22 */
23 package org.apache.accumulo.core.master.thrift;
24
25 import org.apache.thrift.scheme.IScheme;
26 import org.apache.thrift.scheme.SchemeFactory;
27 import org.apache.thrift.scheme.StandardScheme;
28
29 import org.apache.thrift.scheme.TupleScheme;
30 import org.apache.thrift.protocol.TTupleProtocol;
31 import org.apache.thrift.protocol.TProtocolException;
32 import org.apache.thrift.EncodingUtils;
33 import org.apache.thrift.TException;
34 import java.util.List;
35 import java.util.ArrayList;
36 import java.util.Map;
37 import java.util.HashMap;
38 import java.util.EnumMap;
39 import java.util.Set;
40 import java.util.HashSet;
41 import java.util.EnumSet;
42 import java.util.Collections;
43 import java.util.BitSet;
44 import java.nio.ByteBuffer;
45 import java.util.Arrays;
46 import org.slf4j.Logger;
47 import org.slf4j.LoggerFactory;
48
49 @SuppressWarnings("all") public class DeadServer implements org.apache.thrift.TBase<DeadServer, DeadServer._Fields>, java.io.Serializable, Cloneable {
50 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DeadServer");
51
52 private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)1);
53 private static final org.apache.thrift.protocol.TField LAST_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("lastStatus", org.apache.thrift.protocol.TType.I64, (short)2);
54 private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRING, (short)3);
55
56 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
57 static {
58 schemes.put(StandardScheme.class, new DeadServerStandardSchemeFactory());
59 schemes.put(TupleScheme.class, new DeadServerTupleSchemeFactory());
60 }
61
62 public String server;
63 public long lastStatus;
64 public String status;
65
66 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
67 @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
68 SERVER((short)1, "server"),
69 LAST_STATUS((short)2, "lastStatus"),
70 STATUS((short)3, "status");
71
72 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
73
74 static {
75 for (_Fields field : EnumSet.allOf(_Fields.class)) {
76 byName.put(field.getFieldName(), field);
77 }
78 }
79
80 /**
81 * Find the _Fields constant that matches fieldId, or null if its not found.
82 */
83 public static _Fields findByThriftId(int fieldId) {
84 switch(fieldId) {
85 case 1:
86 return SERVER;
87 case 2:
88 return LAST_STATUS;
89 case 3:
90 return STATUS;
91 default:
92 return null;
93 }
94 }
95
96 /**
97 * Find the _Fields constant that matches fieldId, throwing an exception
98 * if it is not found.
99 */
100 public static _Fields findByThriftIdOrThrow(int fieldId) {
101 _Fields fields = findByThriftId(fieldId);
102 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
103 return fields;
104 }
105
106 /**
107 * Find the _Fields constant that matches name, or null if its not found.
108 */
109 public static _Fields findByName(String name) {
110 return byName.get(name);
111 }
112
113 private final short _thriftId;
114 private final String _fieldName;
115
116 _Fields(short thriftId, String fieldName) {
117 _thriftId = thriftId;
118 _fieldName = fieldName;
119 }
120
121 public short getThriftFieldId() {
122 return _thriftId;
123 }
124
125 public String getFieldName() {
126 return _fieldName;
127 }
128 }
129
130
131 private static final int __LASTSTATUS_ISSET_ID = 0;
132 private byte __isset_bitfield = 0;
133 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
134 static {
135 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
136 tmpMap.put(_Fields.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.DEFAULT,
137 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
138 tmpMap.put(_Fields.LAST_STATUS, new org.apache.thrift.meta_data.FieldMetaData("lastStatus", org.apache.thrift.TFieldRequirementType.DEFAULT,
139 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
140 tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT,
141 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
142 metaDataMap = Collections.unmodifiableMap(tmpMap);
143 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DeadServer.class, metaDataMap);
144 }
145
146 public DeadServer() {
147 }
148
149 public DeadServer(
150 String server,
151 long lastStatus,
152 String status)
153 {
154 this();
155 this.server = server;
156 this.lastStatus = lastStatus;
157 setLastStatusIsSet(true);
158 this.status = status;
159 }
160
161 /**
162 * Performs a deep copy on <i>other</i>.
163 */
164 public DeadServer(DeadServer other) {
165 __isset_bitfield = other.__isset_bitfield;
166 if (other.isSetServer()) {
167 this.server = other.server;
168 }
169 this.lastStatus = other.lastStatus;
170 if (other.isSetStatus()) {
171 this.status = other.status;
172 }
173 }
174
175 public DeadServer deepCopy() {
176 return new DeadServer(this);
177 }
178
179 @Override
180 public void clear() {
181 this.server = null;
182 setLastStatusIsSet(false);
183 this.lastStatus = 0;
184 this.status = null;
185 }
186
187 public String getServer() {
188 return this.server;
189 }
190
191 public DeadServer setServer(String server) {
192 this.server = server;
193 return this;
194 }
195
196 public void unsetServer() {
197 this.server = null;
198 }
199
200 /** Returns true if field server is set (has been assigned a value) and false otherwise */
201 public boolean isSetServer() {
202 return this.server != null;
203 }
204
205 public void setServerIsSet(boolean value) {
206 if (!value) {
207 this.server = null;
208 }
209 }
210
211 public long getLastStatus() {
212 return this.lastStatus;
213 }
214
215 public DeadServer setLastStatus(long lastStatus) {
216 this.lastStatus = lastStatus;
217 setLastStatusIsSet(true);
218 return this;
219 }
220
221 public void unsetLastStatus() {
222 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LASTSTATUS_ISSET_ID);
223 }
224
225 /** Returns true if field lastStatus is set (has been assigned a value) and false otherwise */
226 public boolean isSetLastStatus() {
227 return EncodingUtils.testBit(__isset_bitfield, __LASTSTATUS_ISSET_ID);
228 }
229
230 public void setLastStatusIsSet(boolean value) {
231 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LASTSTATUS_ISSET_ID, value);
232 }
233
234 public String getStatus() {
235 return this.status;
236 }
237
238 public DeadServer setStatus(String status) {
239 this.status = status;
240 return this;
241 }
242
243 public void unsetStatus() {
244 this.status = null;
245 }
246
247 /** Returns true if field status is set (has been assigned a value) and false otherwise */
248 public boolean isSetStatus() {
249 return this.status != null;
250 }
251
252 public void setStatusIsSet(boolean value) {
253 if (!value) {
254 this.status = null;
255 }
256 }
257
258 public void setFieldValue(_Fields field, Object value) {
259 switch (field) {
260 case SERVER:
261 if (value == null) {
262 unsetServer();
263 } else {
264 setServer((String)value);
265 }
266 break;
267
268 case LAST_STATUS:
269 if (value == null) {
270 unsetLastStatus();
271 } else {
272 setLastStatus((Long)value);
273 }
274 break;
275
276 case STATUS:
277 if (value == null) {
278 unsetStatus();
279 } else {
280 setStatus((String)value);
281 }
282 break;
283
284 }
285 }
286
287 public Object getFieldValue(_Fields field) {
288 switch (field) {
289 case SERVER:
290 return getServer();
291
292 case LAST_STATUS:
293 return Long.valueOf(getLastStatus());
294
295 case STATUS:
296 return getStatus();
297
298 }
299 throw new IllegalStateException();
300 }
301
302 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
303 public boolean isSet(_Fields field) {
304 if (field == null) {
305 throw new IllegalArgumentException();
306 }
307
308 switch (field) {
309 case SERVER:
310 return isSetServer();
311 case LAST_STATUS:
312 return isSetLastStatus();
313 case STATUS:
314 return isSetStatus();
315 }
316 throw new IllegalStateException();
317 }
318
319 @Override
320 public boolean equals(Object that) {
321 if (that == null)
322 return false;
323 if (that instanceof DeadServer)
324 return this.equals((DeadServer)that);
325 return false;
326 }
327
328 public boolean equals(DeadServer that) {
329 if (that == null)
330 return false;
331
332 boolean this_present_server = true && this.isSetServer();
333 boolean that_present_server = true && that.isSetServer();
334 if (this_present_server || that_present_server) {
335 if (!(this_present_server && that_present_server))
336 return false;
337 if (!this.server.equals(that.server))
338 return false;
339 }
340
341 boolean this_present_lastStatus = true;
342 boolean that_present_lastStatus = true;
343 if (this_present_lastStatus || that_present_lastStatus) {
344 if (!(this_present_lastStatus && that_present_lastStatus))
345 return false;
346 if (this.lastStatus != that.lastStatus)
347 return false;
348 }
349
350 boolean this_present_status = true && this.isSetStatus();
351 boolean that_present_status = true && that.isSetStatus();
352 if (this_present_status || that_present_status) {
353 if (!(this_present_status && that_present_status))
354 return false;
355 if (!this.status.equals(that.status))
356 return false;
357 }
358
359 return true;
360 }
361
362 @Override
363 public int hashCode() {
364 return 0;
365 }
366
367 public int compareTo(DeadServer other) {
368 if (!getClass().equals(other.getClass())) {
369 return getClass().getName().compareTo(other.getClass().getName());
370 }
371
372 int lastComparison = 0;
373 DeadServer typedOther = (DeadServer)other;
374
375 lastComparison = Boolean.valueOf(isSetServer()).compareTo(typedOther.isSetServer());
376 if (lastComparison != 0) {
377 return lastComparison;
378 }
379 if (isSetServer()) {
380 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, typedOther.server);
381 if (lastComparison != 0) {
382 return lastComparison;
383 }
384 }
385 lastComparison = Boolean.valueOf(isSetLastStatus()).compareTo(typedOther.isSetLastStatus());
386 if (lastComparison != 0) {
387 return lastComparison;
388 }
389 if (isSetLastStatus()) {
390 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastStatus, typedOther.lastStatus);
391 if (lastComparison != 0) {
392 return lastComparison;
393 }
394 }
395 lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
396 if (lastComparison != 0) {
397 return lastComparison;
398 }
399 if (isSetStatus()) {
400 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
401 if (lastComparison != 0) {
402 return lastComparison;
403 }
404 }
405 return 0;
406 }
407
408 public _Fields fieldForId(int fieldId) {
409 return _Fields.findByThriftId(fieldId);
410 }
411
412 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
413 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
414 }
415
416 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
417 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
418 }
419
420 @Override
421 public String toString() {
422 StringBuilder sb = new StringBuilder("DeadServer(");
423 boolean first = true;
424
425 sb.append("server:");
426 if (this.server == null) {
427 sb.append("null");
428 } else {
429 sb.append(this.server);
430 }
431 first = false;
432 if (!first) sb.append(", ");
433 sb.append("lastStatus:");
434 sb.append(this.lastStatus);
435 first = false;
436 if (!first) sb.append(", ");
437 sb.append("status:");
438 if (this.status == null) {
439 sb.append("null");
440 } else {
441 sb.append(this.status);
442 }
443 first = false;
444 sb.append(")");
445 return sb.toString();
446 }
447
448 public void validate() throws org.apache.thrift.TException {
449
450
451 }
452
453 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
454 try {
455 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
456 } catch (org.apache.thrift.TException te) {
457 throw new java.io.IOException(te);
458 }
459 }
460
461 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
462 try {
463
464 __isset_bitfield = 0;
465 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
466 } catch (org.apache.thrift.TException te) {
467 throw new java.io.IOException(te);
468 }
469 }
470
471 private static class DeadServerStandardSchemeFactory implements SchemeFactory {
472 public DeadServerStandardScheme getScheme() {
473 return new DeadServerStandardScheme();
474 }
475 }
476
477 private static class DeadServerStandardScheme extends StandardScheme<DeadServer> {
478
479 public void read(org.apache.thrift.protocol.TProtocol iprot, DeadServer struct) throws org.apache.thrift.TException {
480 org.apache.thrift.protocol.TField schemeField;
481 iprot.readStructBegin();
482 while (true)
483 {
484 schemeField = iprot.readFieldBegin();
485 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
486 break;
487 }
488 switch (schemeField.id) {
489 case 1:
490 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
491 struct.server = iprot.readString();
492 struct.setServerIsSet(true);
493 } else {
494 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
495 }
496 break;
497 case 2:
498 if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
499 struct.lastStatus = iprot.readI64();
500 struct.setLastStatusIsSet(true);
501 } else {
502 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
503 }
504 break;
505 case 3:
506 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
507 struct.status = iprot.readString();
508 struct.setStatusIsSet(true);
509 } else {
510 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
511 }
512 break;
513 default:
514 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
515 }
516 iprot.readFieldEnd();
517 }
518 iprot.readStructEnd();
519
520
521 struct.validate();
522 }
523
524 public void write(org.apache.thrift.protocol.TProtocol oprot, DeadServer struct) throws org.apache.thrift.TException {
525 struct.validate();
526
527 oprot.writeStructBegin(STRUCT_DESC);
528 if (struct.server != null) {
529 oprot.writeFieldBegin(SERVER_FIELD_DESC);
530 oprot.writeString(struct.server);
531 oprot.writeFieldEnd();
532 }
533 oprot.writeFieldBegin(LAST_STATUS_FIELD_DESC);
534 oprot.writeI64(struct.lastStatus);
535 oprot.writeFieldEnd();
536 if (struct.status != null) {
537 oprot.writeFieldBegin(STATUS_FIELD_DESC);
538 oprot.writeString(struct.status);
539 oprot.writeFieldEnd();
540 }
541 oprot.writeFieldStop();
542 oprot.writeStructEnd();
543 }
544
545 }
546
547 private static class DeadServerTupleSchemeFactory implements SchemeFactory {
548 public DeadServerTupleScheme getScheme() {
549 return new DeadServerTupleScheme();
550 }
551 }
552
553 private static class DeadServerTupleScheme extends TupleScheme<DeadServer> {
554
555 @Override
556 public void write(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
557 TTupleProtocol oprot = (TTupleProtocol) prot;
558 BitSet optionals = new BitSet();
559 if (struct.isSetServer()) {
560 optionals.set(0);
561 }
562 if (struct.isSetLastStatus()) {
563 optionals.set(1);
564 }
565 if (struct.isSetStatus()) {
566 optionals.set(2);
567 }
568 oprot.writeBitSet(optionals, 3);
569 if (struct.isSetServer()) {
570 oprot.writeString(struct.server);
571 }
572 if (struct.isSetLastStatus()) {
573 oprot.writeI64(struct.lastStatus);
574 }
575 if (struct.isSetStatus()) {
576 oprot.writeString(struct.status);
577 }
578 }
579
580 @Override
581 public void read(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
582 TTupleProtocol iprot = (TTupleProtocol) prot;
583 BitSet incoming = iprot.readBitSet(3);
584 if (incoming.get(0)) {
585 struct.server = iprot.readString();
586 struct.setServerIsSet(true);
587 }
588 if (incoming.get(1)) {
589 struct.lastStatus = iprot.readI64();
590 struct.setLastStatusIsSet(true);
591 }
592 if (incoming.get(2)) {
593 struct.status = iprot.readString();
594 struct.setStatusIsSet(true);
595 }
596 }
597 }
598
599 }
600