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.security.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 AuthInfo implements org.apache.thrift.TBase<AuthInfo, AuthInfo._Fields>, java.io.Serializable, Cloneable {
50 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthInfo");
51
52 private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)1);
53 private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
54 private static final org.apache.thrift.protocol.TField INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceId", 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 AuthInfoStandardSchemeFactory());
59 schemes.put(TupleScheme.class, new AuthInfoTupleSchemeFactory());
60 }
61
62 public String user;
63 public ByteBuffer password;
64 public String instanceId;
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 USER((short)1, "user"),
69 PASSWORD((short)2, "password"),
70 INSTANCE_ID((short)3, "instanceId");
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 USER;
87 case 2:
88 return PASSWORD;
89 case 3:
90 return INSTANCE_ID;
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 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
132 static {
133 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
134 tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
135 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
136 tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT,
137 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
138 tmpMap.put(_Fields.INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("instanceId", org.apache.thrift.TFieldRequirementType.DEFAULT,
139 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
140 metaDataMap = Collections.unmodifiableMap(tmpMap);
141 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthInfo.class, metaDataMap);
142 }
143
144 public AuthInfo() {
145 }
146
147 public AuthInfo(
148 String user,
149 ByteBuffer password,
150 String instanceId)
151 {
152 this();
153 this.user = user;
154 this.password = password;
155 this.instanceId = instanceId;
156 }
157
158 /**
159 * Performs a deep copy on <i>other</i>.
160 */
161 public AuthInfo(AuthInfo other) {
162 if (other.isSetUser()) {
163 this.user = other.user;
164 }
165 if (other.isSetPassword()) {
166 this.password = org.apache.thrift.TBaseHelper.copyBinary(other.password);
167 ;
168 }
169 if (other.isSetInstanceId()) {
170 this.instanceId = other.instanceId;
171 }
172 }
173
174 public AuthInfo deepCopy() {
175 return new AuthInfo(this);
176 }
177
178 @Override
179 public void clear() {
180 this.user = null;
181 this.password = null;
182 this.instanceId = null;
183 }
184
185 public String getUser() {
186 return this.user;
187 }
188
189 public AuthInfo setUser(String user) {
190 this.user = user;
191 return this;
192 }
193
194 public void unsetUser() {
195 this.user = null;
196 }
197
198 /** Returns true if field user is set (has been assigned a value) and false otherwise */
199 public boolean isSetUser() {
200 return this.user != null;
201 }
202
203 public void setUserIsSet(boolean value) {
204 if (!value) {
205 this.user = null;
206 }
207 }
208
209 public byte[] getPassword() {
210 setPassword(org.apache.thrift.TBaseHelper.rightSize(password));
211 return password == null ? null : password.array();
212 }
213
214 public ByteBuffer bufferForPassword() {
215 return password;
216 }
217
218 public AuthInfo setPassword(byte[] password) {
219 setPassword(password == null ? (ByteBuffer)null : ByteBuffer.wrap(password));
220 return this;
221 }
222
223 public AuthInfo setPassword(ByteBuffer password) {
224 this.password = password;
225 return this;
226 }
227
228 public void unsetPassword() {
229 this.password = null;
230 }
231
232 /** Returns true if field password is set (has been assigned a value) and false otherwise */
233 public boolean isSetPassword() {
234 return this.password != null;
235 }
236
237 public void setPasswordIsSet(boolean value) {
238 if (!value) {
239 this.password = null;
240 }
241 }
242
243 public String getInstanceId() {
244 return this.instanceId;
245 }
246
247 public AuthInfo setInstanceId(String instanceId) {
248 this.instanceId = instanceId;
249 return this;
250 }
251
252 public void unsetInstanceId() {
253 this.instanceId = null;
254 }
255
256 /** Returns true if field instanceId is set (has been assigned a value) and false otherwise */
257 public boolean isSetInstanceId() {
258 return this.instanceId != null;
259 }
260
261 public void setInstanceIdIsSet(boolean value) {
262 if (!value) {
263 this.instanceId = null;
264 }
265 }
266
267 public void setFieldValue(_Fields field, Object value) {
268 switch (field) {
269 case USER:
270 if (value == null) {
271 unsetUser();
272 } else {
273 setUser((String)value);
274 }
275 break;
276
277 case PASSWORD:
278 if (value == null) {
279 unsetPassword();
280 } else {
281 setPassword((ByteBuffer)value);
282 }
283 break;
284
285 case INSTANCE_ID:
286 if (value == null) {
287 unsetInstanceId();
288 } else {
289 setInstanceId((String)value);
290 }
291 break;
292
293 }
294 }
295
296 public Object getFieldValue(_Fields field) {
297 switch (field) {
298 case USER:
299 return getUser();
300
301 case PASSWORD:
302 return getPassword();
303
304 case INSTANCE_ID:
305 return getInstanceId();
306
307 }
308 throw new IllegalStateException();
309 }
310
311 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
312 public boolean isSet(_Fields field) {
313 if (field == null) {
314 throw new IllegalArgumentException();
315 }
316
317 switch (field) {
318 case USER:
319 return isSetUser();
320 case PASSWORD:
321 return isSetPassword();
322 case INSTANCE_ID:
323 return isSetInstanceId();
324 }
325 throw new IllegalStateException();
326 }
327
328 @Override
329 public boolean equals(Object that) {
330 if (that == null)
331 return false;
332 if (that instanceof AuthInfo)
333 return this.equals((AuthInfo)that);
334 return false;
335 }
336
337 public boolean equals(AuthInfo that) {
338 if (that == null)
339 return false;
340
341 boolean this_present_user = true && this.isSetUser();
342 boolean that_present_user = true && that.isSetUser();
343 if (this_present_user || that_present_user) {
344 if (!(this_present_user && that_present_user))
345 return false;
346 if (!this.user.equals(that.user))
347 return false;
348 }
349
350 boolean this_present_password = true && this.isSetPassword();
351 boolean that_present_password = true && that.isSetPassword();
352 if (this_present_password || that_present_password) {
353 if (!(this_present_password && that_present_password))
354 return false;
355 if (!this.password.equals(that.password))
356 return false;
357 }
358
359 boolean this_present_instanceId = true && this.isSetInstanceId();
360 boolean that_present_instanceId = true && that.isSetInstanceId();
361 if (this_present_instanceId || that_present_instanceId) {
362 if (!(this_present_instanceId && that_present_instanceId))
363 return false;
364 if (!this.instanceId.equals(that.instanceId))
365 return false;
366 }
367
368 return true;
369 }
370
371 @Override
372 public int hashCode() {
373 return 0;
374 }
375
376 public int compareTo(AuthInfo other) {
377 if (!getClass().equals(other.getClass())) {
378 return getClass().getName().compareTo(other.getClass().getName());
379 }
380
381 int lastComparison = 0;
382 AuthInfo typedOther = (AuthInfo)other;
383
384 lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
385 if (lastComparison != 0) {
386 return lastComparison;
387 }
388 if (isSetUser()) {
389 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
390 if (lastComparison != 0) {
391 return lastComparison;
392 }
393 }
394 lastComparison = Boolean.valueOf(isSetPassword()).compareTo(typedOther.isSetPassword());
395 if (lastComparison != 0) {
396 return lastComparison;
397 }
398 if (isSetPassword()) {
399 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, typedOther.password);
400 if (lastComparison != 0) {
401 return lastComparison;
402 }
403 }
404 lastComparison = Boolean.valueOf(isSetInstanceId()).compareTo(typedOther.isSetInstanceId());
405 if (lastComparison != 0) {
406 return lastComparison;
407 }
408 if (isSetInstanceId()) {
409 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceId, typedOther.instanceId);
410 if (lastComparison != 0) {
411 return lastComparison;
412 }
413 }
414 return 0;
415 }
416
417 public _Fields fieldForId(int fieldId) {
418 return _Fields.findByThriftId(fieldId);
419 }
420
421 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
422 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
423 }
424
425 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
426 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
427 }
428
429 @Override
430 public String toString() {
431 StringBuilder sb = new StringBuilder("AuthInfo(");
432 boolean first = true;
433
434 sb.append("user:");
435 if (this.user == null) {
436 sb.append("null");
437 } else {
438 sb.append(this.user);
439 }
440 first = false;
441 if (!first) sb.append(", ");
442 sb.append("password:");
443 if (this.password == null) {
444 sb.append("null");
445 } else {
446 org.apache.thrift.TBaseHelper.toString(this.password, sb);
447 }
448 first = false;
449 if (!first) sb.append(", ");
450 sb.append("instanceId:");
451 if (this.instanceId == null) {
452 sb.append("null");
453 } else {
454 sb.append(this.instanceId);
455 }
456 first = false;
457 sb.append(")");
458 return sb.toString();
459 }
460
461 public void validate() throws org.apache.thrift.TException {
462
463
464 }
465
466 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
467 try {
468 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
469 } catch (org.apache.thrift.TException te) {
470 throw new java.io.IOException(te);
471 }
472 }
473
474 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
475 try {
476 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
477 } catch (org.apache.thrift.TException te) {
478 throw new java.io.IOException(te);
479 }
480 }
481
482 private static class AuthInfoStandardSchemeFactory implements SchemeFactory {
483 public AuthInfoStandardScheme getScheme() {
484 return new AuthInfoStandardScheme();
485 }
486 }
487
488 private static class AuthInfoStandardScheme extends StandardScheme<AuthInfo> {
489
490 public void read(org.apache.thrift.protocol.TProtocol iprot, AuthInfo struct) throws org.apache.thrift.TException {
491 org.apache.thrift.protocol.TField schemeField;
492 iprot.readStructBegin();
493 while (true)
494 {
495 schemeField = iprot.readFieldBegin();
496 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
497 break;
498 }
499 switch (schemeField.id) {
500 case 1:
501 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
502 struct.user = iprot.readString();
503 struct.setUserIsSet(true);
504 } else {
505 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
506 }
507 break;
508 case 2:
509 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
510 struct.password = iprot.readBinary();
511 struct.setPasswordIsSet(true);
512 } else {
513 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
514 }
515 break;
516 case 3:
517 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
518 struct.instanceId = iprot.readString();
519 struct.setInstanceIdIsSet(true);
520 } else {
521 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
522 }
523 break;
524 default:
525 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
526 }
527 iprot.readFieldEnd();
528 }
529 iprot.readStructEnd();
530
531
532 struct.validate();
533 }
534
535 public void write(org.apache.thrift.protocol.TProtocol oprot, AuthInfo struct) throws org.apache.thrift.TException {
536 struct.validate();
537
538 oprot.writeStructBegin(STRUCT_DESC);
539 if (struct.user != null) {
540 oprot.writeFieldBegin(USER_FIELD_DESC);
541 oprot.writeString(struct.user);
542 oprot.writeFieldEnd();
543 }
544 if (struct.password != null) {
545 oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
546 oprot.writeBinary(struct.password);
547 oprot.writeFieldEnd();
548 }
549 if (struct.instanceId != null) {
550 oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC);
551 oprot.writeString(struct.instanceId);
552 oprot.writeFieldEnd();
553 }
554 oprot.writeFieldStop();
555 oprot.writeStructEnd();
556 }
557
558 }
559
560 private static class AuthInfoTupleSchemeFactory implements SchemeFactory {
561 public AuthInfoTupleScheme getScheme() {
562 return new AuthInfoTupleScheme();
563 }
564 }
565
566 private static class AuthInfoTupleScheme extends TupleScheme<AuthInfo> {
567
568 @Override
569 public void write(org.apache.thrift.protocol.TProtocol prot, AuthInfo struct) throws org.apache.thrift.TException {
570 TTupleProtocol oprot = (TTupleProtocol) prot;
571 BitSet optionals = new BitSet();
572 if (struct.isSetUser()) {
573 optionals.set(0);
574 }
575 if (struct.isSetPassword()) {
576 optionals.set(1);
577 }
578 if (struct.isSetInstanceId()) {
579 optionals.set(2);
580 }
581 oprot.writeBitSet(optionals, 3);
582 if (struct.isSetUser()) {
583 oprot.writeString(struct.user);
584 }
585 if (struct.isSetPassword()) {
586 oprot.writeBinary(struct.password);
587 }
588 if (struct.isSetInstanceId()) {
589 oprot.writeString(struct.instanceId);
590 }
591 }
592
593 @Override
594 public void read(org.apache.thrift.protocol.TProtocol prot, AuthInfo struct) throws org.apache.thrift.TException {
595 TTupleProtocol iprot = (TTupleProtocol) prot;
596 BitSet incoming = iprot.readBitSet(3);
597 if (incoming.get(0)) {
598 struct.user = iprot.readString();
599 struct.setUserIsSet(true);
600 }
601 if (incoming.get(1)) {
602 struct.password = iprot.readBinary();
603 struct.setPasswordIsSet(true);
604 }
605 if (incoming.get(2)) {
606 struct.instanceId = iprot.readString();
607 struct.setInstanceIdIsSet(true);
608 }
609 }
610 }
611
612 }
613