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 ThriftSecurityException extends TException implements org.apache.thrift.TBase<ThriftSecurityException, ThriftSecurityException._Fields>, java.io.Serializable, Cloneable {
50 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftSecurityException");
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 CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.I32, (short)2);
54
55 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
56 static {
57 schemes.put(StandardScheme.class, new ThriftSecurityExceptionStandardSchemeFactory());
58 schemes.put(TupleScheme.class, new ThriftSecurityExceptionTupleSchemeFactory());
59 }
60
61 public String user;
62 /**
63 *
64 * @see SecurityErrorCode
65 */
66 public SecurityErrorCode code;
67
68 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
69 @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
70 USER((short)1, "user"),
71 /**
72 *
73 * @see SecurityErrorCode
74 */
75 CODE((short)2, "code");
76
77 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
78
79 static {
80 for (_Fields field : EnumSet.allOf(_Fields.class)) {
81 byName.put(field.getFieldName(), field);
82 }
83 }
84
85 /**
86 * Find the _Fields constant that matches fieldId, or null if its not found.
87 */
88 public static _Fields findByThriftId(int fieldId) {
89 switch(fieldId) {
90 case 1:
91 return USER;
92 case 2:
93 return CODE;
94 default:
95 return null;
96 }
97 }
98
99 /**
100 * Find the _Fields constant that matches fieldId, throwing an exception
101 * if it is not found.
102 */
103 public static _Fields findByThriftIdOrThrow(int fieldId) {
104 _Fields fields = findByThriftId(fieldId);
105 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
106 return fields;
107 }
108
109 /**
110 * Find the _Fields constant that matches name, or null if its not found.
111 */
112 public static _Fields findByName(String name) {
113 return byName.get(name);
114 }
115
116 private final short _thriftId;
117 private final String _fieldName;
118
119 _Fields(short thriftId, String fieldName) {
120 _thriftId = thriftId;
121 _fieldName = fieldName;
122 }
123
124 public short getThriftFieldId() {
125 return _thriftId;
126 }
127
128 public String getFieldName() {
129 return _fieldName;
130 }
131 }
132
133
134 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
135 static {
136 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
137 tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
138 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
139 tmpMap.put(_Fields.CODE, new org.apache.thrift.meta_data.FieldMetaData("code", org.apache.thrift.TFieldRequirementType.DEFAULT,
140 new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SecurityErrorCode.class)));
141 metaDataMap = Collections.unmodifiableMap(tmpMap);
142 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftSecurityException.class, metaDataMap);
143 }
144
145 public ThriftSecurityException() {
146 }
147
148 public ThriftSecurityException(
149 String user,
150 SecurityErrorCode code)
151 {
152 this();
153 this.user = user;
154 this.code = code;
155 }
156
157 /**
158 * Performs a deep copy on <i>other</i>.
159 */
160 public ThriftSecurityException(ThriftSecurityException other) {
161 if (other.isSetUser()) {
162 this.user = other.user;
163 }
164 if (other.isSetCode()) {
165 this.code = other.code;
166 }
167 }
168
169 public ThriftSecurityException deepCopy() {
170 return new ThriftSecurityException(this);
171 }
172
173 @Override
174 public void clear() {
175 this.user = null;
176 this.code = null;
177 }
178
179 public String getUser() {
180 return this.user;
181 }
182
183 public ThriftSecurityException setUser(String user) {
184 this.user = user;
185 return this;
186 }
187
188 public void unsetUser() {
189 this.user = null;
190 }
191
192 /** Returns true if field user is set (has been assigned a value) and false otherwise */
193 public boolean isSetUser() {
194 return this.user != null;
195 }
196
197 public void setUserIsSet(boolean value) {
198 if (!value) {
199 this.user = null;
200 }
201 }
202
203 /**
204 *
205 * @see SecurityErrorCode
206 */
207 public SecurityErrorCode getCode() {
208 return this.code;
209 }
210
211 /**
212 *
213 * @see SecurityErrorCode
214 */
215 public ThriftSecurityException setCode(SecurityErrorCode code) {
216 this.code = code;
217 return this;
218 }
219
220 public void unsetCode() {
221 this.code = null;
222 }
223
224 /** Returns true if field code is set (has been assigned a value) and false otherwise */
225 public boolean isSetCode() {
226 return this.code != null;
227 }
228
229 public void setCodeIsSet(boolean value) {
230 if (!value) {
231 this.code = null;
232 }
233 }
234
235 public void setFieldValue(_Fields field, Object value) {
236 switch (field) {
237 case USER:
238 if (value == null) {
239 unsetUser();
240 } else {
241 setUser((String)value);
242 }
243 break;
244
245 case CODE:
246 if (value == null) {
247 unsetCode();
248 } else {
249 setCode((SecurityErrorCode)value);
250 }
251 break;
252
253 }
254 }
255
256 public Object getFieldValue(_Fields field) {
257 switch (field) {
258 case USER:
259 return getUser();
260
261 case CODE:
262 return getCode();
263
264 }
265 throw new IllegalStateException();
266 }
267
268 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
269 public boolean isSet(_Fields field) {
270 if (field == null) {
271 throw new IllegalArgumentException();
272 }
273
274 switch (field) {
275 case USER:
276 return isSetUser();
277 case CODE:
278 return isSetCode();
279 }
280 throw new IllegalStateException();
281 }
282
283 @Override
284 public boolean equals(Object that) {
285 if (that == null)
286 return false;
287 if (that instanceof ThriftSecurityException)
288 return this.equals((ThriftSecurityException)that);
289 return false;
290 }
291
292 public boolean equals(ThriftSecurityException that) {
293 if (that == null)
294 return false;
295
296 boolean this_present_user = true && this.isSetUser();
297 boolean that_present_user = true && that.isSetUser();
298 if (this_present_user || that_present_user) {
299 if (!(this_present_user && that_present_user))
300 return false;
301 if (!this.user.equals(that.user))
302 return false;
303 }
304
305 boolean this_present_code = true && this.isSetCode();
306 boolean that_present_code = true && that.isSetCode();
307 if (this_present_code || that_present_code) {
308 if (!(this_present_code && that_present_code))
309 return false;
310 if (!this.code.equals(that.code))
311 return false;
312 }
313
314 return true;
315 }
316
317 @Override
318 public int hashCode() {
319 return 0;
320 }
321
322 public int compareTo(ThriftSecurityException other) {
323 if (!getClass().equals(other.getClass())) {
324 return getClass().getName().compareTo(other.getClass().getName());
325 }
326
327 int lastComparison = 0;
328 ThriftSecurityException typedOther = (ThriftSecurityException)other;
329
330 lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
331 if (lastComparison != 0) {
332 return lastComparison;
333 }
334 if (isSetUser()) {
335 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
336 if (lastComparison != 0) {
337 return lastComparison;
338 }
339 }
340 lastComparison = Boolean.valueOf(isSetCode()).compareTo(typedOther.isSetCode());
341 if (lastComparison != 0) {
342 return lastComparison;
343 }
344 if (isSetCode()) {
345 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, typedOther.code);
346 if (lastComparison != 0) {
347 return lastComparison;
348 }
349 }
350 return 0;
351 }
352
353 public _Fields fieldForId(int fieldId) {
354 return _Fields.findByThriftId(fieldId);
355 }
356
357 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
358 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
359 }
360
361 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
362 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
363 }
364
365 @Override
366 public String toString() {
367 StringBuilder sb = new StringBuilder("ThriftSecurityException(");
368 boolean first = true;
369
370 sb.append("user:");
371 if (this.user == null) {
372 sb.append("null");
373 } else {
374 sb.append(this.user);
375 }
376 first = false;
377 if (!first) sb.append(", ");
378 sb.append("code:");
379 if (this.code == null) {
380 sb.append("null");
381 } else {
382 sb.append(this.code);
383 }
384 first = false;
385 sb.append(")");
386 return sb.toString();
387 }
388
389 public void validate() throws org.apache.thrift.TException {
390
391
392 }
393
394 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
395 try {
396 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
397 } catch (org.apache.thrift.TException te) {
398 throw new java.io.IOException(te);
399 }
400 }
401
402 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
403 try {
404 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
405 } catch (org.apache.thrift.TException te) {
406 throw new java.io.IOException(te);
407 }
408 }
409
410 private static class ThriftSecurityExceptionStandardSchemeFactory implements SchemeFactory {
411 public ThriftSecurityExceptionStandardScheme getScheme() {
412 return new ThriftSecurityExceptionStandardScheme();
413 }
414 }
415
416 private static class ThriftSecurityExceptionStandardScheme extends StandardScheme<ThriftSecurityException> {
417
418 public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftSecurityException struct) throws org.apache.thrift.TException {
419 org.apache.thrift.protocol.TField schemeField;
420 iprot.readStructBegin();
421 while (true)
422 {
423 schemeField = iprot.readFieldBegin();
424 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
425 break;
426 }
427 switch (schemeField.id) {
428 case 1:
429 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
430 struct.user = iprot.readString();
431 struct.setUserIsSet(true);
432 } else {
433 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
434 }
435 break;
436 case 2:
437 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
438 struct.code = SecurityErrorCode.findByValue(iprot.readI32());
439 struct.setCodeIsSet(true);
440 } else {
441 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
442 }
443 break;
444 default:
445 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
446 }
447 iprot.readFieldEnd();
448 }
449 iprot.readStructEnd();
450
451
452 struct.validate();
453 }
454
455 public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftSecurityException struct) throws org.apache.thrift.TException {
456 struct.validate();
457
458 oprot.writeStructBegin(STRUCT_DESC);
459 if (struct.user != null) {
460 oprot.writeFieldBegin(USER_FIELD_DESC);
461 oprot.writeString(struct.user);
462 oprot.writeFieldEnd();
463 }
464 if (struct.code != null) {
465 oprot.writeFieldBegin(CODE_FIELD_DESC);
466 oprot.writeI32(struct.code.getValue());
467 oprot.writeFieldEnd();
468 }
469 oprot.writeFieldStop();
470 oprot.writeStructEnd();
471 }
472
473 }
474
475 private static class ThriftSecurityExceptionTupleSchemeFactory implements SchemeFactory {
476 public ThriftSecurityExceptionTupleScheme getScheme() {
477 return new ThriftSecurityExceptionTupleScheme();
478 }
479 }
480
481 private static class ThriftSecurityExceptionTupleScheme extends TupleScheme<ThriftSecurityException> {
482
483 @Override
484 public void write(org.apache.thrift.protocol.TProtocol prot, ThriftSecurityException struct) throws org.apache.thrift.TException {
485 TTupleProtocol oprot = (TTupleProtocol) prot;
486 BitSet optionals = new BitSet();
487 if (struct.isSetUser()) {
488 optionals.set(0);
489 }
490 if (struct.isSetCode()) {
491 optionals.set(1);
492 }
493 oprot.writeBitSet(optionals, 2);
494 if (struct.isSetUser()) {
495 oprot.writeString(struct.user);
496 }
497 if (struct.isSetCode()) {
498 oprot.writeI32(struct.code.getValue());
499 }
500 }
501
502 @Override
503 public void read(org.apache.thrift.protocol.TProtocol prot, ThriftSecurityException struct) throws org.apache.thrift.TException {
504 TTupleProtocol iprot = (TTupleProtocol) prot;
505 BitSet incoming = iprot.readBitSet(2);
506 if (incoming.get(0)) {
507 struct.user = iprot.readString();
508 struct.setUserIsSet(true);
509 }
510 if (incoming.get(1)) {
511 struct.code = SecurityErrorCode.findByValue(iprot.readI32());
512 struct.setCodeIsSet(true);
513 }
514 }
515 }
516
517 }
518