diff options
author | Michael Petretti | 2014-05-06 17:18:56 +0200 |
---|---|---|
committer | Michael Petretti | 2014-05-06 17:18:56 +0200 |
commit | 257bad2360dc8ba68ef6f93219a90917a7ffe447 (patch) | |
tree | f48fb37a0c30fe9755789557f3e4bf9d700654eb /src | |
download | satellite-daemon-257bad2360dc8ba68ef6f93219a90917a7ffe447.tar.gz satellite-daemon-257bad2360dc8ba68ef6f93219a90917a7ffe447.tar.xz satellite-daemon-257bad2360dc8ba68ef6f93219a90917a7ffe447.zip |
initial commit
Diffstat (limited to 'src')
21 files changed, 13660 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationError.java new file mode 100644 index 0000000..2fd9fcf --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationError.java @@ -0,0 +1,51 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum AuthenticationError implements org.apache.thrift.TEnum { + GENERIC_ERROR(0), + INVALID_CREDENTIALS(1), + ACCOUNT_SUSPENDED(2), + BANNED_NETWORK(3); + + private final int value; + + private AuthenticationError(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static AuthenticationError findByValue(int value) { + switch (value) { + case 0: + return GENERIC_ERROR; + case 1: + return INVALID_CREDENTIALS; + case 2: + return ACCOUNT_SUSPENDED; + case 3: + return BANNED_NETWORK; + default: + return null; + } + } +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java new file mode 100644 index 0000000..5efc66c --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java @@ -0,0 +1,504 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 AuthenticationException extends TException implements org.apache.thrift.TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthenticationException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException"); + + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new AuthenticationExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AuthenticationExceptionTupleSchemeFactory()); + } + + /** + * + * @see AuthenticationError + */ + public AuthenticationError number; // required + public String message; // 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 { + /** + * + * @see AuthenticationError + */ + NUMBER((short)1, "number"), + MESSAGE((short)2, "message"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // NUMBER + return NUMBER; + case 2: // MESSAGE + return MESSAGE; + 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 + 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.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AuthenticationError.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap); + } + + public AuthenticationException() { + } + + public AuthenticationException( + AuthenticationError number, + String message) + { + this(); + this.number = number; + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public AuthenticationException(AuthenticationException other) { + if (other.isSetNumber()) { + this.number = other.number; + } + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public AuthenticationException deepCopy() { + return new AuthenticationException(this); + } + + @Override + public void clear() { + this.number = null; + this.message = null; + } + + /** + * + * @see AuthenticationError + */ + public AuthenticationError getNumber() { + return this.number; + } + + /** + * + * @see AuthenticationError + */ + public AuthenticationException setNumber(AuthenticationError number) { + this.number = number; + return this; + } + + public void unsetNumber() { + this.number = null; + } + + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; + } + + public void setNumberIsSet(boolean value) { + if (!value) { + this.number = null; + } + } + + public String getMessage() { + return this.message; + } + + public AuthenticationException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NUMBER: + if (value == null) { + unsetNumber(); + } else { + setNumber((AuthenticationError)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NUMBER: + return getNumber(); + + case MESSAGE: + return getMessage(); + + } + 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 NUMBER: + return isSetNumber(); + case MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof AuthenticationException) + return this.equals((AuthenticationException)that); + return false; + } + + public boolean equals(AuthenticationException that) { + if (that == null) + return false; + + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) + return false; + if (!this.number.equals(that.number)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(AuthenticationException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + 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("AuthenticationException("); + boolean first = true; + + sb.append("number:"); + if (this.number == null) { + sb.append("null"); + } else { + sb.append(this.number); + } + first = false; + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 AuthenticationExceptionStandardSchemeFactory implements SchemeFactory { + public AuthenticationExceptionStandardScheme getScheme() { + return new AuthenticationExceptionStandardScheme(); + } + } + + private static class AuthenticationExceptionStandardScheme extends StandardScheme<AuthenticationException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationException 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: // NUMBER + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.number = AuthenticationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(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, AuthenticationException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class AuthenticationExceptionTupleSchemeFactory implements SchemeFactory { + public AuthenticationExceptionTupleScheme getScheme() { + return new AuthenticationExceptionTupleScheme(); + } + } + + private static class AuthenticationExceptionTupleScheme extends TupleScheme<AuthenticationException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNumber()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.number = AuthenticationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationError.java new file mode 100644 index 0000000..a49ad92 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationError.java @@ -0,0 +1,48 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum AuthorizationError implements org.apache.thrift.TEnum { + GENERIC_ERROR(0), + NOT_AUTHENTICATED(1), + NO_PERMISSION(2); + + private final int value; + + private AuthorizationError(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static AuthorizationError findByValue(int value) { + switch (value) { + case 0: + return GENERIC_ERROR; + case 1: + return NOT_AUTHENTICATED; + case 2: + return NO_PERMISSION; + default: + return null; + } + } +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java new file mode 100644 index 0000000..5f798ac --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java @@ -0,0 +1,504 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 AuthorizationException extends TException implements org.apache.thrift.TBase<AuthorizationException, AuthorizationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthorizationException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException"); + + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new AuthorizationExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AuthorizationExceptionTupleSchemeFactory()); + } + + /** + * + * @see AuthorizationError + */ + public AuthorizationError number; // required + public String message; // 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 { + /** + * + * @see AuthorizationError + */ + NUMBER((short)1, "number"), + MESSAGE((short)2, "message"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // NUMBER + return NUMBER; + case 2: // MESSAGE + return MESSAGE; + 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 + 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.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AuthorizationError.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthorizationException.class, metaDataMap); + } + + public AuthorizationException() { + } + + public AuthorizationException( + AuthorizationError number, + String message) + { + this(); + this.number = number; + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public AuthorizationException(AuthorizationException other) { + if (other.isSetNumber()) { + this.number = other.number; + } + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public AuthorizationException deepCopy() { + return new AuthorizationException(this); + } + + @Override + public void clear() { + this.number = null; + this.message = null; + } + + /** + * + * @see AuthorizationError + */ + public AuthorizationError getNumber() { + return this.number; + } + + /** + * + * @see AuthorizationError + */ + public AuthorizationException setNumber(AuthorizationError number) { + this.number = number; + return this; + } + + public void unsetNumber() { + this.number = null; + } + + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; + } + + public void setNumberIsSet(boolean value) { + if (!value) { + this.number = null; + } + } + + public String getMessage() { + return this.message; + } + + public AuthorizationException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NUMBER: + if (value == null) { + unsetNumber(); + } else { + setNumber((AuthorizationError)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NUMBER: + return getNumber(); + + case MESSAGE: + return getMessage(); + + } + 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 NUMBER: + return isSetNumber(); + case MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof AuthorizationException) + return this.equals((AuthorizationException)that); + return false; + } + + public boolean equals(AuthorizationException that) { + if (that == null) + return false; + + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) + return false; + if (!this.number.equals(that.number)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(AuthorizationException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + 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("AuthorizationException("); + boolean first = true; + + sb.append("number:"); + if (this.number == null) { + sb.append("null"); + } else { + sb.append(this.number); + } + first = false; + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 AuthorizationExceptionStandardSchemeFactory implements SchemeFactory { + public AuthorizationExceptionStandardScheme getScheme() { + return new AuthorizationExceptionStandardScheme(); + } + } + + private static class AuthorizationExceptionStandardScheme extends StandardScheme<AuthorizationException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, AuthorizationException 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: // NUMBER + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.number = AuthorizationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(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, AuthorizationException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class AuthorizationExceptionTupleSchemeFactory implements SchemeFactory { + public AuthorizationExceptionTupleScheme getScheme() { + return new AuthorizationExceptionTupleScheme(); + } + } + + private static class AuthorizationExceptionTupleScheme extends TupleScheme<AuthorizationException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNumber()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.number = AuthorizationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java new file mode 100644 index 0000000..fccb7b3 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java @@ -0,0 +1,488 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 FtpCredentials implements org.apache.thrift.TBase<FtpCredentials, FtpCredentials._Fields>, java.io.Serializable, Cloneable, Comparable<FtpCredentials> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FtpCredentials"); + + private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); + 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); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new FtpCredentialsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new FtpCredentialsTupleSchemeFactory()); + } + + public String username; // required + public String password; // 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 { + USERNAME((short)1, "username"), + PASSWORD((short)2, "password"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // USERNAME + return USERNAME; + case 2: // PASSWORD + return PASSWORD; + 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 + 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.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FtpCredentials.class, metaDataMap); + } + + public FtpCredentials() { + } + + public FtpCredentials( + String username, + String password) + { + this(); + this.username = username; + this.password = password; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public FtpCredentials(FtpCredentials other) { + if (other.isSetUsername()) { + this.username = other.username; + } + if (other.isSetPassword()) { + this.password = other.password; + } + } + + public FtpCredentials deepCopy() { + return new FtpCredentials(this); + } + + @Override + public void clear() { + this.username = null; + this.password = null; + } + + public String getUsername() { + return this.username; + } + + public FtpCredentials setUsername(String username) { + this.username = username; + return this; + } + + public void unsetUsername() { + this.username = null; + } + + /** Returns true if field username is set (has been assigned a value) and false otherwise */ + public boolean isSetUsername() { + return this.username != null; + } + + public void setUsernameIsSet(boolean value) { + if (!value) { + this.username = null; + } + } + + public String getPassword() { + return this.password; + } + + public FtpCredentials setPassword(String password) { + this.password = password; + return this; + } + + public void unsetPassword() { + this.password = null; + } + + /** Returns true if field password is set (has been assigned a value) and false otherwise */ + public boolean isSetPassword() { + return this.password != null; + } + + public void setPasswordIsSet(boolean value) { + if (!value) { + this.password = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USERNAME: + if (value == null) { + unsetUsername(); + } else { + setUsername((String)value); + } + break; + + case PASSWORD: + if (value == null) { + unsetPassword(); + } else { + setPassword((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USERNAME: + return getUsername(); + + case PASSWORD: + return getPassword(); + + } + 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 USERNAME: + return isSetUsername(); + case PASSWORD: + return isSetPassword(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof FtpCredentials) + return this.equals((FtpCredentials)that); + return false; + } + + public boolean equals(FtpCredentials that) { + if (that == null) + return false; + + boolean this_present_username = true && this.isSetUsername(); + boolean that_present_username = true && that.isSetUsername(); + if (this_present_username || that_present_username) { + if (!(this_present_username && that_present_username)) + return false; + if (!this.username.equals(that.username)) + return false; + } + + boolean this_present_password = true && this.isSetPassword(); + boolean that_present_password = true && that.isSetPassword(); + if (this_present_password || that_present_password) { + if (!(this_present_password && that_present_password)) + return false; + if (!this.password.equals(that.password)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(FtpCredentials other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUsername()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPassword()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password); + 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("FtpCredentials("); + boolean first = true; + + sb.append("username:"); + if (this.username == null) { + sb.append("null"); + } else { + sb.append(this.username); + } + first = false; + if (!first) sb.append(", "); + sb.append("password:"); + if (this.password == null) { + sb.append("null"); + } else { + sb.append(this.password); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 FtpCredentialsStandardSchemeFactory implements SchemeFactory { + public FtpCredentialsStandardScheme getScheme() { + return new FtpCredentialsStandardScheme(); + } + } + + private static class FtpCredentialsStandardScheme extends StandardScheme<FtpCredentials> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, FtpCredentials 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: // USERNAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PASSWORD + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.password = iprot.readString(); + struct.setPasswordIsSet(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, FtpCredentials struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.username != null) { + oprot.writeFieldBegin(USERNAME_FIELD_DESC); + oprot.writeString(struct.username); + oprot.writeFieldEnd(); + } + if (struct.password != null) { + oprot.writeFieldBegin(PASSWORD_FIELD_DESC); + oprot.writeString(struct.password); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class FtpCredentialsTupleSchemeFactory implements SchemeFactory { + public FtpCredentialsTupleScheme getScheme() { + return new FtpCredentialsTupleScheme(); + } + } + + private static class FtpCredentialsTupleScheme extends TupleScheme<FtpCredentials> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, FtpCredentials struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUsername()) { + optionals.set(0); + } + if (struct.isSetPassword()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUsername()) { + oprot.writeString(struct.username); + } + if (struct.isSetPassword()) { + oprot.writeString(struct.password); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, FtpCredentials struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + } + if (incoming.get(1)) { + struct.password = iprot.readString(); + struct.setPasswordIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java new file mode 100644 index 0000000..7f2edd7 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java @@ -0,0 +1,1456 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 ImageData implements org.apache.thrift.TBase<ImageData, ImageData._Fields>, java.io.Serializable, Cloneable, Comparable<ImageData> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ImageData"); + + private static final org.apache.thrift.protocol.TField UUID_FIELD_DESC = new org.apache.thrift.protocol.TField("uuid", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField IMAGE_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("imageVersion", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField IMAGE_CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageCreateTime", org.apache.thrift.protocol.TType.I64, (short)4); + private static final org.apache.thrift.protocol.TField IMAGE_UPDATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageUpdateTime", org.apache.thrift.protocol.TType.I64, (short)5); + private static final org.apache.thrift.protocol.TField IMAGE_OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("imageOwner", org.apache.thrift.protocol.TType.STRING, (short)6); + private static final org.apache.thrift.protocol.TField CONENT_OPERATING_SYSTEM_FIELD_DESC = new org.apache.thrift.protocol.TField("conentOperatingSystem", org.apache.thrift.protocol.TType.STRING, (short)7); + private static final org.apache.thrift.protocol.TField STATUS_IS_VALID_FIELD_DESC = new org.apache.thrift.protocol.TField("statusIsValid", org.apache.thrift.protocol.TType.BOOL, (short)8); + private static final org.apache.thrift.protocol.TField STATUS_IS_DELETED_FIELD_DESC = new org.apache.thrift.protocol.TField("statusIsDeleted", org.apache.thrift.protocol.TType.BOOL, (short)9); + private static final org.apache.thrift.protocol.TField IMAGE_SHORT_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("imageShortDescription", org.apache.thrift.protocol.TType.STRING, (short)10); + private static final org.apache.thrift.protocol.TField IMAGE_LONG_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("imageLongDescription", org.apache.thrift.protocol.TType.STRING, (short)11); + private static final org.apache.thrift.protocol.TField FILE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("fileSize", org.apache.thrift.protocol.TType.I64, (short)12); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ImageDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ImageDataTupleSchemeFactory()); + } + + public String uuid; // required + public int imageVersion; // required + public String imageName; // required + public long imageCreateTime; // required + public long imageUpdateTime; // required + public String imageOwner; // required + public String conentOperatingSystem; // required + public boolean statusIsValid; // required + public boolean statusIsDeleted; // required + public String imageShortDescription; // required + public String imageLongDescription; // required + public long fileSize; // 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 { + UUID((short)1, "uuid"), + IMAGE_VERSION((short)2, "imageVersion"), + IMAGE_NAME((short)3, "imageName"), + IMAGE_CREATE_TIME((short)4, "imageCreateTime"), + IMAGE_UPDATE_TIME((short)5, "imageUpdateTime"), + IMAGE_OWNER((short)6, "imageOwner"), + CONENT_OPERATING_SYSTEM((short)7, "conentOperatingSystem"), + STATUS_IS_VALID((short)8, "statusIsValid"), + STATUS_IS_DELETED((short)9, "statusIsDeleted"), + IMAGE_SHORT_DESCRIPTION((short)10, "imageShortDescription"), + IMAGE_LONG_DESCRIPTION((short)11, "imageLongDescription"), + FILE_SIZE((short)12, "fileSize"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // UUID + return UUID; + case 2: // IMAGE_VERSION + return IMAGE_VERSION; + case 3: // IMAGE_NAME + return IMAGE_NAME; + case 4: // IMAGE_CREATE_TIME + return IMAGE_CREATE_TIME; + case 5: // IMAGE_UPDATE_TIME + return IMAGE_UPDATE_TIME; + case 6: // IMAGE_OWNER + return IMAGE_OWNER; + case 7: // CONENT_OPERATING_SYSTEM + return CONENT_OPERATING_SYSTEM; + case 8: // STATUS_IS_VALID + return STATUS_IS_VALID; + case 9: // STATUS_IS_DELETED + return STATUS_IS_DELETED; + case 10: // IMAGE_SHORT_DESCRIPTION + return IMAGE_SHORT_DESCRIPTION; + case 11: // IMAGE_LONG_DESCRIPTION + return IMAGE_LONG_DESCRIPTION; + case 12: // FILE_SIZE + return FILE_SIZE; + 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 __IMAGEVERSION_ISSET_ID = 0; + private static final int __IMAGECREATETIME_ISSET_ID = 1; + private static final int __IMAGEUPDATETIME_ISSET_ID = 2; + private static final int __STATUSISVALID_ISSET_ID = 3; + private static final int __STATUSISDELETED_ISSET_ID = 4; + private static final int __FILESIZE_ISSET_ID = 5; + private byte __isset_bitfield = 0; + 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.UUID, new org.apache.thrift.meta_data.FieldMetaData("uuid", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "UUID"))); + tmpMap.put(_Fields.IMAGE_VERSION, new org.apache.thrift.meta_data.FieldMetaData("imageVersion", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.IMAGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("imageName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IMAGE_CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("imageCreateTime", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "Date"))); + tmpMap.put(_Fields.IMAGE_UPDATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("imageUpdateTime", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "Date"))); + tmpMap.put(_Fields.IMAGE_OWNER, new org.apache.thrift.meta_data.FieldMetaData("imageOwner", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CONENT_OPERATING_SYSTEM, new org.apache.thrift.meta_data.FieldMetaData("conentOperatingSystem", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.STATUS_IS_VALID, new org.apache.thrift.meta_data.FieldMetaData("statusIsValid", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.STATUS_IS_DELETED, new org.apache.thrift.meta_data.FieldMetaData("statusIsDeleted", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IMAGE_SHORT_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("imageShortDescription", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IMAGE_LONG_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("imageLongDescription", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.FILE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("fileSize", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ImageData.class, metaDataMap); + } + + public ImageData() { + } + + public ImageData( + String uuid, + int imageVersion, + String imageName, + long imageCreateTime, + long imageUpdateTime, + String imageOwner, + String conentOperatingSystem, + boolean statusIsValid, + boolean statusIsDeleted, + String imageShortDescription, + String imageLongDescription, + long fileSize) + { + this(); + this.uuid = uuid; + this.imageVersion = imageVersion; + setImageVersionIsSet(true); + this.imageName = imageName; + this.imageCreateTime = imageCreateTime; + setImageCreateTimeIsSet(true); + this.imageUpdateTime = imageUpdateTime; + setImageUpdateTimeIsSet(true); + this.imageOwner = imageOwner; + this.conentOperatingSystem = conentOperatingSystem; + this.statusIsValid = statusIsValid; + setStatusIsValidIsSet(true); + this.statusIsDeleted = statusIsDeleted; + setStatusIsDeletedIsSet(true); + this.imageShortDescription = imageShortDescription; + this.imageLongDescription = imageLongDescription; + this.fileSize = fileSize; + setFileSizeIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ImageData(ImageData other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetUuid()) { + this.uuid = other.uuid; + } + this.imageVersion = other.imageVersion; + if (other.isSetImageName()) { + this.imageName = other.imageName; + } + this.imageCreateTime = other.imageCreateTime; + this.imageUpdateTime = other.imageUpdateTime; + if (other.isSetImageOwner()) { + this.imageOwner = other.imageOwner; + } + if (other.isSetConentOperatingSystem()) { + this.conentOperatingSystem = other.conentOperatingSystem; + } + this.statusIsValid = other.statusIsValid; + this.statusIsDeleted = other.statusIsDeleted; + if (other.isSetImageShortDescription()) { + this.imageShortDescription = other.imageShortDescription; + } + if (other.isSetImageLongDescription()) { + this.imageLongDescription = other.imageLongDescription; + } + this.fileSize = other.fileSize; + } + + public ImageData deepCopy() { + return new ImageData(this); + } + + @Override + public void clear() { + this.uuid = null; + setImageVersionIsSet(false); + this.imageVersion = 0; + this.imageName = null; + setImageCreateTimeIsSet(false); + this.imageCreateTime = 0; + setImageUpdateTimeIsSet(false); + this.imageUpdateTime = 0; + this.imageOwner = null; + this.conentOperatingSystem = null; + setStatusIsValidIsSet(false); + this.statusIsValid = false; + setStatusIsDeletedIsSet(false); + this.statusIsDeleted = false; + this.imageShortDescription = null; + this.imageLongDescription = null; + setFileSizeIsSet(false); + this.fileSize = 0; + } + + public String getUuid() { + return this.uuid; + } + + public ImageData setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public void unsetUuid() { + this.uuid = null; + } + + /** Returns true if field uuid is set (has been assigned a value) and false otherwise */ + public boolean isSetUuid() { + return this.uuid != null; + } + + public void setUuidIsSet(boolean value) { + if (!value) { + this.uuid = null; + } + } + + public int getImageVersion() { + return this.imageVersion; + } + + public ImageData setImageVersion(int imageVersion) { + this.imageVersion = imageVersion; + setImageVersionIsSet(true); + return this; + } + + public void unsetImageVersion() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGEVERSION_ISSET_ID); + } + + /** Returns true if field imageVersion is set (has been assigned a value) and false otherwise */ + public boolean isSetImageVersion() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGEVERSION_ISSET_ID); + } + + public void setImageVersionIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGEVERSION_ISSET_ID, value); + } + + public String getImageName() { + return this.imageName; + } + + public ImageData setImageName(String imageName) { + this.imageName = imageName; + return this; + } + + public void unsetImageName() { + this.imageName = null; + } + + /** Returns true if field imageName is set (has been assigned a value) and false otherwise */ + public boolean isSetImageName() { + return this.imageName != null; + } + + public void setImageNameIsSet(boolean value) { + if (!value) { + this.imageName = null; + } + } + + public long getImageCreateTime() { + return this.imageCreateTime; + } + + public ImageData setImageCreateTime(long imageCreateTime) { + this.imageCreateTime = imageCreateTime; + setImageCreateTimeIsSet(true); + return this; + } + + public void unsetImageCreateTime() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGECREATETIME_ISSET_ID); + } + + /** Returns true if field imageCreateTime is set (has been assigned a value) and false otherwise */ + public boolean isSetImageCreateTime() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGECREATETIME_ISSET_ID); + } + + public void setImageCreateTimeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGECREATETIME_ISSET_ID, value); + } + + public long getImageUpdateTime() { + return this.imageUpdateTime; + } + + public ImageData setImageUpdateTime(long imageUpdateTime) { + this.imageUpdateTime = imageUpdateTime; + setImageUpdateTimeIsSet(true); + return this; + } + + public void unsetImageUpdateTime() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGEUPDATETIME_ISSET_ID); + } + + /** Returns true if field imageUpdateTime is set (has been assigned a value) and false otherwise */ + public boolean isSetImageUpdateTime() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGEUPDATETIME_ISSET_ID); + } + + public void setImageUpdateTimeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGEUPDATETIME_ISSET_ID, value); + } + + public String getImageOwner() { + return this.imageOwner; + } + + public ImageData setImageOwner(String imageOwner) { + this.imageOwner = imageOwner; + return this; + } + + public void unsetImageOwner() { + this.imageOwner = null; + } + + /** Returns true if field imageOwner is set (has been assigned a value) and false otherwise */ + public boolean isSetImageOwner() { + return this.imageOwner != null; + } + + public void setImageOwnerIsSet(boolean value) { + if (!value) { + this.imageOwner = null; + } + } + + public String getConentOperatingSystem() { + return this.conentOperatingSystem; + } + + public ImageData setConentOperatingSystem(String conentOperatingSystem) { + this.conentOperatingSystem = conentOperatingSystem; + return this; + } + + public void unsetConentOperatingSystem() { + this.conentOperatingSystem = null; + } + + /** Returns true if field conentOperatingSystem is set (has been assigned a value) and false otherwise */ + public boolean isSetConentOperatingSystem() { + return this.conentOperatingSystem != null; + } + + public void setConentOperatingSystemIsSet(boolean value) { + if (!value) { + this.conentOperatingSystem = null; + } + } + + public boolean isStatusIsValid() { + return this.statusIsValid; + } + + public ImageData setStatusIsValid(boolean statusIsValid) { + this.statusIsValid = statusIsValid; + setStatusIsValidIsSet(true); + return this; + } + + public void unsetStatusIsValid() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STATUSISVALID_ISSET_ID); + } + + /** Returns true if field statusIsValid is set (has been assigned a value) and false otherwise */ + public boolean isSetStatusIsValid() { + return EncodingUtils.testBit(__isset_bitfield, __STATUSISVALID_ISSET_ID); + } + + public void setStatusIsValidIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STATUSISVALID_ISSET_ID, value); + } + + public boolean isStatusIsDeleted() { + return this.statusIsDeleted; + } + + public ImageData setStatusIsDeleted(boolean statusIsDeleted) { + this.statusIsDeleted = statusIsDeleted; + setStatusIsDeletedIsSet(true); + return this; + } + + public void unsetStatusIsDeleted() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STATUSISDELETED_ISSET_ID); + } + + /** Returns true if field statusIsDeleted is set (has been assigned a value) and false otherwise */ + public boolean isSetStatusIsDeleted() { + return EncodingUtils.testBit(__isset_bitfield, __STATUSISDELETED_ISSET_ID); + } + + public void setStatusIsDeletedIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STATUSISDELETED_ISSET_ID, value); + } + + public String getImageShortDescription() { + return this.imageShortDescription; + } + + public ImageData setImageShortDescription(String imageShortDescription) { + this.imageShortDescription = imageShortDescription; + return this; + } + + public void unsetImageShortDescription() { + this.imageShortDescription = null; + } + + /** Returns true if field imageShortDescription is set (has been assigned a value) and false otherwise */ + public boolean isSetImageShortDescription() { + return this.imageShortDescription != null; + } + + public void setImageShortDescriptionIsSet(boolean value) { + if (!value) { + this.imageShortDescription = null; + } + } + + public String getImageLongDescription() { + return this.imageLongDescription; + } + + public ImageData setImageLongDescription(String imageLongDescription) { + this.imageLongDescription = imageLongDescription; + return this; + } + + public void unsetImageLongDescription() { + this.imageLongDescription = null; + } + + /** Returns true if field imageLongDescription is set (has been assigned a value) and false otherwise */ + public boolean isSetImageLongDescription() { + return this.imageLongDescription != null; + } + + public void setImageLongDescriptionIsSet(boolean value) { + if (!value) { + this.imageLongDescription = null; + } + } + + public long getFileSize() { + return this.fileSize; + } + + public ImageData setFileSize(long fileSize) { + this.fileSize = fileSize; + setFileSizeIsSet(true); + return this; + } + + public void unsetFileSize() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FILESIZE_ISSET_ID); + } + + /** Returns true if field fileSize is set (has been assigned a value) and false otherwise */ + public boolean isSetFileSize() { + return EncodingUtils.testBit(__isset_bitfield, __FILESIZE_ISSET_ID); + } + + public void setFileSizeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESIZE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case UUID: + if (value == null) { + unsetUuid(); + } else { + setUuid((String)value); + } + break; + + case IMAGE_VERSION: + if (value == null) { + unsetImageVersion(); + } else { + setImageVersion((Integer)value); + } + break; + + case IMAGE_NAME: + if (value == null) { + unsetImageName(); + } else { + setImageName((String)value); + } + break; + + case IMAGE_CREATE_TIME: + if (value == null) { + unsetImageCreateTime(); + } else { + setImageCreateTime((Long)value); + } + break; + + case IMAGE_UPDATE_TIME: + if (value == null) { + unsetImageUpdateTime(); + } else { + setImageUpdateTime((Long)value); + } + break; + + case IMAGE_OWNER: + if (value == null) { + unsetImageOwner(); + } else { + setImageOwner((String)value); + } + break; + + case CONENT_OPERATING_SYSTEM: + if (value == null) { + unsetConentOperatingSystem(); + } else { + setConentOperatingSystem((String)value); + } + break; + + case STATUS_IS_VALID: + if (value == null) { + unsetStatusIsValid(); + } else { + setStatusIsValid((Boolean)value); + } + break; + + case STATUS_IS_DELETED: + if (value == null) { + unsetStatusIsDeleted(); + } else { + setStatusIsDeleted((Boolean)value); + } + break; + + case IMAGE_SHORT_DESCRIPTION: + if (value == null) { + unsetImageShortDescription(); + } else { + setImageShortDescription((String)value); + } + break; + + case IMAGE_LONG_DESCRIPTION: + if (value == null) { + unsetImageLongDescription(); + } else { + setImageLongDescription((String)value); + } + break; + + case FILE_SIZE: + if (value == null) { + unsetFileSize(); + } else { + setFileSize((Long)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case UUID: + return getUuid(); + + case IMAGE_VERSION: + return Integer.valueOf(getImageVersion()); + + case IMAGE_NAME: + return getImageName(); + + case IMAGE_CREATE_TIME: + return Long.valueOf(getImageCreateTime()); + + case IMAGE_UPDATE_TIME: + return Long.valueOf(getImageUpdateTime()); + + case IMAGE_OWNER: + return getImageOwner(); + + case CONENT_OPERATING_SYSTEM: + return getConentOperatingSystem(); + + case STATUS_IS_VALID: + return Boolean.valueOf(isStatusIsValid()); + + case STATUS_IS_DELETED: + return Boolean.valueOf(isStatusIsDeleted()); + + case IMAGE_SHORT_DESCRIPTION: + return getImageShortDescription(); + + case IMAGE_LONG_DESCRIPTION: + return getImageLongDescription(); + + case FILE_SIZE: + return Long.valueOf(getFileSize()); + + } + 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 UUID: + return isSetUuid(); + case IMAGE_VERSION: + return isSetImageVersion(); + case IMAGE_NAME: + return isSetImageName(); + case IMAGE_CREATE_TIME: + return isSetImageCreateTime(); + case IMAGE_UPDATE_TIME: + return isSetImageUpdateTime(); + case IMAGE_OWNER: + return isSetImageOwner(); + case CONENT_OPERATING_SYSTEM: + return isSetConentOperatingSystem(); + case STATUS_IS_VALID: + return isSetStatusIsValid(); + case STATUS_IS_DELETED: + return isSetStatusIsDeleted(); + case IMAGE_SHORT_DESCRIPTION: + return isSetImageShortDescription(); + case IMAGE_LONG_DESCRIPTION: + return isSetImageLongDescription(); + case FILE_SIZE: + return isSetFileSize(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ImageData) + return this.equals((ImageData)that); + return false; + } + + public boolean equals(ImageData that) { + if (that == null) + return false; + + boolean this_present_uuid = true && this.isSetUuid(); + boolean that_present_uuid = true && that.isSetUuid(); + if (this_present_uuid || that_present_uuid) { + if (!(this_present_uuid && that_present_uuid)) + return false; + if (!this.uuid.equals(that.uuid)) + return false; + } + + boolean this_present_imageVersion = true; + boolean that_present_imageVersion = true; + if (this_present_imageVersion || that_present_imageVersion) { + if (!(this_present_imageVersion && that_present_imageVersion)) + return false; + if (this.imageVersion != that.imageVersion) + return false; + } + + boolean this_present_imageName = true && this.isSetImageName(); + boolean that_present_imageName = true && that.isSetImageName(); + if (this_present_imageName || that_present_imageName) { + if (!(this_present_imageName && that_present_imageName)) + return false; + if (!this.imageName.equals(that.imageName)) + return false; + } + + boolean this_present_imageCreateTime = true; + boolean that_present_imageCreateTime = true; + if (this_present_imageCreateTime || that_present_imageCreateTime) { + if (!(this_present_imageCreateTime && that_present_imageCreateTime)) + return false; + if (this.imageCreateTime != that.imageCreateTime) + return false; + } + + boolean this_present_imageUpdateTime = true; + boolean that_present_imageUpdateTime = true; + if (this_present_imageUpdateTime || that_present_imageUpdateTime) { + if (!(this_present_imageUpdateTime && that_present_imageUpdateTime)) + return false; + if (this.imageUpdateTime != that.imageUpdateTime) + return false; + } + + boolean this_present_imageOwner = true && this.isSetImageOwner(); + boolean that_present_imageOwner = true && that.isSetImageOwner(); + if (this_present_imageOwner || that_present_imageOwner) { + if (!(this_present_imageOwner && that_present_imageOwner)) + return false; + if (!this.imageOwner.equals(that.imageOwner)) + return false; + } + + boolean this_present_conentOperatingSystem = true && this.isSetConentOperatingSystem(); + boolean that_present_conentOperatingSystem = true && that.isSetConentOperatingSystem(); + if (this_present_conentOperatingSystem || that_present_conentOperatingSystem) { + if (!(this_present_conentOperatingSystem && that_present_conentOperatingSystem)) + return false; + if (!this.conentOperatingSystem.equals(that.conentOperatingSystem)) + return false; + } + + boolean this_present_statusIsValid = true; + boolean that_present_statusIsValid = true; + if (this_present_statusIsValid || that_present_statusIsValid) { + if (!(this_present_statusIsValid && that_present_statusIsValid)) + return false; + if (this.statusIsValid != that.statusIsValid) + return false; + } + + boolean this_present_statusIsDeleted = true; + boolean that_present_statusIsDeleted = true; + if (this_present_statusIsDeleted || that_present_statusIsDeleted) { + if (!(this_present_statusIsDeleted && that_present_statusIsDeleted)) + return false; + if (this.statusIsDeleted != that.statusIsDeleted) + return false; + } + + boolean this_present_imageShortDescription = true && this.isSetImageShortDescription(); + boolean that_present_imageShortDescription = true && that.isSetImageShortDescription(); + if (this_present_imageShortDescription || that_present_imageShortDescription) { + if (!(this_present_imageShortDescription && that_present_imageShortDescription)) + return false; + if (!this.imageShortDescription.equals(that.imageShortDescription)) + return false; + } + + boolean this_present_imageLongDescription = true && this.isSetImageLongDescription(); + boolean that_present_imageLongDescription = true && that.isSetImageLongDescription(); + if (this_present_imageLongDescription || that_present_imageLongDescription) { + if (!(this_present_imageLongDescription && that_present_imageLongDescription)) + return false; + if (!this.imageLongDescription.equals(that.imageLongDescription)) + return false; + } + + boolean this_present_fileSize = true; + boolean that_present_fileSize = true; + if (this_present_fileSize || that_present_fileSize) { + if (!(this_present_fileSize && that_present_fileSize)) + return false; + if (this.fileSize != that.fileSize) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ImageData other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUuid()).compareTo(other.isSetUuid()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUuid()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuid, other.uuid); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageVersion()).compareTo(other.isSetImageVersion()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageVersion()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageVersion, other.imageVersion); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageName()).compareTo(other.isSetImageName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageName, other.imageName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageCreateTime()).compareTo(other.isSetImageCreateTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageCreateTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageCreateTime, other.imageCreateTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageUpdateTime()).compareTo(other.isSetImageUpdateTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageUpdateTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageUpdateTime, other.imageUpdateTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageOwner()).compareTo(other.isSetImageOwner()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageOwner()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageOwner, other.imageOwner); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetConentOperatingSystem()).compareTo(other.isSetConentOperatingSystem()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetConentOperatingSystem()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.conentOperatingSystem, other.conentOperatingSystem); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetStatusIsValid()).compareTo(other.isSetStatusIsValid()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatusIsValid()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statusIsValid, other.statusIsValid); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetStatusIsDeleted()).compareTo(other.isSetStatusIsDeleted()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatusIsDeleted()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statusIsDeleted, other.statusIsDeleted); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageShortDescription()).compareTo(other.isSetImageShortDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageShortDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageShortDescription, other.imageShortDescription); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageLongDescription()).compareTo(other.isSetImageLongDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageLongDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageLongDescription, other.imageLongDescription); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFileSize()).compareTo(other.isSetFileSize()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFileSize()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fileSize, other.fileSize); + 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("ImageData("); + boolean first = true; + + sb.append("uuid:"); + if (this.uuid == null) { + sb.append("null"); + } else { + sb.append(this.uuid); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageVersion:"); + sb.append(this.imageVersion); + first = false; + if (!first) sb.append(", "); + sb.append("imageName:"); + if (this.imageName == null) { + sb.append("null"); + } else { + sb.append(this.imageName); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageCreateTime:"); + sb.append(this.imageCreateTime); + first = false; + if (!first) sb.append(", "); + sb.append("imageUpdateTime:"); + sb.append(this.imageUpdateTime); + first = false; + if (!first) sb.append(", "); + sb.append("imageOwner:"); + if (this.imageOwner == null) { + sb.append("null"); + } else { + sb.append(this.imageOwner); + } + first = false; + if (!first) sb.append(", "); + sb.append("conentOperatingSystem:"); + if (this.conentOperatingSystem == null) { + sb.append("null"); + } else { + sb.append(this.conentOperatingSystem); + } + first = false; + if (!first) sb.append(", "); + sb.append("statusIsValid:"); + sb.append(this.statusIsValid); + first = false; + if (!first) sb.append(", "); + sb.append("statusIsDeleted:"); + sb.append(this.statusIsDeleted); + first = false; + if (!first) sb.append(", "); + sb.append("imageShortDescription:"); + if (this.imageShortDescription == null) { + sb.append("null"); + } else { + sb.append(this.imageShortDescription); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageLongDescription:"); + if (this.imageLongDescription == null) { + sb.append("null"); + } else { + sb.append(this.imageLongDescription); + } + first = false; + if (!first) sb.append(", "); + sb.append("fileSize:"); + sb.append(this.fileSize); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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_bitfield = 0; + 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 ImageDataStandardSchemeFactory implements SchemeFactory { + public ImageDataStandardScheme getScheme() { + return new ImageDataStandardScheme(); + } + } + + private static class ImageDataStandardScheme extends StandardScheme<ImageData> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ImageData 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: // UUID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.uuid = iprot.readString(); + struct.setUuidIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // IMAGE_VERSION + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.imageVersion = iprot.readI32(); + struct.setImageVersionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // IMAGE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // IMAGE_CREATE_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.imageCreateTime = iprot.readI64(); + struct.setImageCreateTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IMAGE_UPDATE_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.imageUpdateTime = iprot.readI64(); + struct.setImageUpdateTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // IMAGE_OWNER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageOwner = iprot.readString(); + struct.setImageOwnerIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // CONENT_OPERATING_SYSTEM + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.conentOperatingSystem = iprot.readString(); + struct.setConentOperatingSystemIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // STATUS_IS_VALID + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.statusIsValid = iprot.readBool(); + struct.setStatusIsValidIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // STATUS_IS_DELETED + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.statusIsDeleted = iprot.readBool(); + struct.setStatusIsDeletedIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 10: // IMAGE_SHORT_DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageShortDescription = iprot.readString(); + struct.setImageShortDescriptionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 11: // IMAGE_LONG_DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageLongDescription = iprot.readString(); + struct.setImageLongDescriptionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 12: // FILE_SIZE + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.fileSize = iprot.readI64(); + struct.setFileSizeIsSet(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, ImageData struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.uuid != null) { + oprot.writeFieldBegin(UUID_FIELD_DESC); + oprot.writeString(struct.uuid); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(IMAGE_VERSION_FIELD_DESC); + oprot.writeI32(struct.imageVersion); + oprot.writeFieldEnd(); + if (struct.imageName != null) { + oprot.writeFieldBegin(IMAGE_NAME_FIELD_DESC); + oprot.writeString(struct.imageName); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(IMAGE_CREATE_TIME_FIELD_DESC); + oprot.writeI64(struct.imageCreateTime); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IMAGE_UPDATE_TIME_FIELD_DESC); + oprot.writeI64(struct.imageUpdateTime); + oprot.writeFieldEnd(); + if (struct.imageOwner != null) { + oprot.writeFieldBegin(IMAGE_OWNER_FIELD_DESC); + oprot.writeString(struct.imageOwner); + oprot.writeFieldEnd(); + } + if (struct.conentOperatingSystem != null) { + oprot.writeFieldBegin(CONENT_OPERATING_SYSTEM_FIELD_DESC); + oprot.writeString(struct.conentOperatingSystem); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(STATUS_IS_VALID_FIELD_DESC); + oprot.writeBool(struct.statusIsValid); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(STATUS_IS_DELETED_FIELD_DESC); + oprot.writeBool(struct.statusIsDeleted); + oprot.writeFieldEnd(); + if (struct.imageShortDescription != null) { + oprot.writeFieldBegin(IMAGE_SHORT_DESCRIPTION_FIELD_DESC); + oprot.writeString(struct.imageShortDescription); + oprot.writeFieldEnd(); + } + if (struct.imageLongDescription != null) { + oprot.writeFieldBegin(IMAGE_LONG_DESCRIPTION_FIELD_DESC); + oprot.writeString(struct.imageLongDescription); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(FILE_SIZE_FIELD_DESC); + oprot.writeI64(struct.fileSize); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ImageDataTupleSchemeFactory implements SchemeFactory { + public ImageDataTupleScheme getScheme() { + return new ImageDataTupleScheme(); + } + } + + private static class ImageDataTupleScheme extends TupleScheme<ImageData> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ImageData struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUuid()) { + optionals.set(0); + } + if (struct.isSetImageVersion()) { + optionals.set(1); + } + if (struct.isSetImageName()) { + optionals.set(2); + } + if (struct.isSetImageCreateTime()) { + optionals.set(3); + } + if (struct.isSetImageUpdateTime()) { + optionals.set(4); + } + if (struct.isSetImageOwner()) { + optionals.set(5); + } + if (struct.isSetConentOperatingSystem()) { + optionals.set(6); + } + if (struct.isSetStatusIsValid()) { + optionals.set(7); + } + if (struct.isSetStatusIsDeleted()) { + optionals.set(8); + } + if (struct.isSetImageShortDescription()) { + optionals.set(9); + } + if (struct.isSetImageLongDescription()) { + optionals.set(10); + } + if (struct.isSetFileSize()) { + optionals.set(11); + } + oprot.writeBitSet(optionals, 12); + if (struct.isSetUuid()) { + oprot.writeString(struct.uuid); + } + if (struct.isSetImageVersion()) { + oprot.writeI32(struct.imageVersion); + } + if (struct.isSetImageName()) { + oprot.writeString(struct.imageName); + } + if (struct.isSetImageCreateTime()) { + oprot.writeI64(struct.imageCreateTime); + } + if (struct.isSetImageUpdateTime()) { + oprot.writeI64(struct.imageUpdateTime); + } + if (struct.isSetImageOwner()) { + oprot.writeString(struct.imageOwner); + } + if (struct.isSetConentOperatingSystem()) { + oprot.writeString(struct.conentOperatingSystem); + } + if (struct.isSetStatusIsValid()) { + oprot.writeBool(struct.statusIsValid); + } + if (struct.isSetStatusIsDeleted()) { + oprot.writeBool(struct.statusIsDeleted); + } + if (struct.isSetImageShortDescription()) { + oprot.writeString(struct.imageShortDescription); + } + if (struct.isSetImageLongDescription()) { + oprot.writeString(struct.imageLongDescription); + } + if (struct.isSetFileSize()) { + oprot.writeI64(struct.fileSize); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ImageData struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(12); + if (incoming.get(0)) { + struct.uuid = iprot.readString(); + struct.setUuidIsSet(true); + } + if (incoming.get(1)) { + struct.imageVersion = iprot.readI32(); + struct.setImageVersionIsSet(true); + } + if (incoming.get(2)) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } + if (incoming.get(3)) { + struct.imageCreateTime = iprot.readI64(); + struct.setImageCreateTimeIsSet(true); + } + if (incoming.get(4)) { + struct.imageUpdateTime = iprot.readI64(); + struct.setImageUpdateTimeIsSet(true); + } + if (incoming.get(5)) { + struct.imageOwner = iprot.readString(); + struct.setImageOwnerIsSet(true); + } + if (incoming.get(6)) { + struct.conentOperatingSystem = iprot.readString(); + struct.setConentOperatingSystemIsSet(true); + } + if (incoming.get(7)) { + struct.statusIsValid = iprot.readBool(); + struct.setStatusIsValidIsSet(true); + } + if (incoming.get(8)) { + struct.statusIsDeleted = iprot.readBool(); + struct.setStatusIsDeletedIsSet(true); + } + if (incoming.get(9)) { + struct.imageShortDescription = iprot.readString(); + struct.setImageShortDescriptionIsSet(true); + } + if (incoming.get(10)) { + struct.imageLongDescription = iprot.readString(); + struct.setImageLongDescriptionIsSet(true); + } + if (incoming.get(11)) { + struct.fileSize = iprot.readI64(); + struct.setFileSizeIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataError.java new file mode 100644 index 0000000..fdd7b81 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataError.java @@ -0,0 +1,45 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum ImageDataError implements org.apache.thrift.TEnum { + INVALID_DATA(0), + UNKNOWN_IMAGE(1); + + private final int value; + + private ImageDataError(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static ImageDataError findByValue(int value) { + switch (value) { + case 0: + return INVALID_DATA; + case 1: + return UNKNOWN_IMAGE; + default: + return null; + } + } +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java new file mode 100644 index 0000000..a5ac923 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java @@ -0,0 +1,504 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 ImageDataException extends TException implements org.apache.thrift.TBase<ImageDataException, ImageDataException._Fields>, java.io.Serializable, Cloneable, Comparable<ImageDataException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ImageDataException"); + + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ImageDataExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ImageDataExceptionTupleSchemeFactory()); + } + + /** + * + * @see ImageDataError + */ + public ImageDataError number; // required + public String message; // 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 { + /** + * + * @see ImageDataError + */ + NUMBER((short)1, "number"), + MESSAGE((short)2, "message"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // NUMBER + return NUMBER; + case 2: // MESSAGE + return MESSAGE; + 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 + 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.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ImageDataError.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ImageDataException.class, metaDataMap); + } + + public ImageDataException() { + } + + public ImageDataException( + ImageDataError number, + String message) + { + this(); + this.number = number; + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ImageDataException(ImageDataException other) { + if (other.isSetNumber()) { + this.number = other.number; + } + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public ImageDataException deepCopy() { + return new ImageDataException(this); + } + + @Override + public void clear() { + this.number = null; + this.message = null; + } + + /** + * + * @see ImageDataError + */ + public ImageDataError getNumber() { + return this.number; + } + + /** + * + * @see ImageDataError + */ + public ImageDataException setNumber(ImageDataError number) { + this.number = number; + return this; + } + + public void unsetNumber() { + this.number = null; + } + + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; + } + + public void setNumberIsSet(boolean value) { + if (!value) { + this.number = null; + } + } + + public String getMessage() { + return this.message; + } + + public ImageDataException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NUMBER: + if (value == null) { + unsetNumber(); + } else { + setNumber((ImageDataError)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NUMBER: + return getNumber(); + + case MESSAGE: + return getMessage(); + + } + 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 NUMBER: + return isSetNumber(); + case MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ImageDataException) + return this.equals((ImageDataException)that); + return false; + } + + public boolean equals(ImageDataException that) { + if (that == null) + return false; + + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) + return false; + if (!this.number.equals(that.number)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ImageDataException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + 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("ImageDataException("); + boolean first = true; + + sb.append("number:"); + if (this.number == null) { + sb.append("null"); + } else { + sb.append(this.number); + } + first = false; + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 ImageDataExceptionStandardSchemeFactory implements SchemeFactory { + public ImageDataExceptionStandardScheme getScheme() { + return new ImageDataExceptionStandardScheme(); + } + } + + private static class ImageDataExceptionStandardScheme extends StandardScheme<ImageDataException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ImageDataException 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: // NUMBER + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.number = ImageDataError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(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, ImageDataException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ImageDataExceptionTupleSchemeFactory implements SchemeFactory { + public ImageDataExceptionTupleScheme getScheme() { + return new ImageDataExceptionTupleScheme(); + } + } + + private static class ImageDataExceptionTupleScheme extends TupleScheme<ImageDataException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ImageDataException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNumber()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ImageDataException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.number = ImageDataError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java new file mode 100644 index 0000000..2751dd6 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java @@ -0,0 +1,7148 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 ImageServer { + + public interface Iface { + + public boolean ping() throws org.apache.thrift.TException; + + public SessionData authenticate(String username, String password) throws AuthenticationException, org.apache.thrift.TException; + + public UserInfo getUserFromToken(String token) throws InvalidTokenException, org.apache.thrift.TException; + + public String startServerAuthentication(String organization) throws ServerAuthenticationException, org.apache.thrift.TException; + + public ServerSessionData serverAuthenticate(String organization, ByteBuffer challengeResponse) throws ServerAuthenticationException, org.apache.thrift.TException; + + public FtpCredentials submitImage(String serverSessionId, ImageData imageDescription) throws AuthorizationException, ImageDataException, org.apache.thrift.TException; + + public boolean finshedUpload(String ftpUser, ImageData imageDescription) throws ImageDataException, org.apache.thrift.TException; + + } + + public interface AsyncIface { + + public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void authenticate(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getUserFromToken(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void startServerAuthentication(String organization, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void serverAuthenticate(String organization, ByteBuffer challengeResponse, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void submitImage(String serverSessionId, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void finshedUpload(String ftpUser, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> { + public Factory() {} + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) + { + super(prot, prot); + } + + public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public boolean ping() throws org.apache.thrift.TException + { + send_ping(); + return recv_ping(); + } + + public void send_ping() throws org.apache.thrift.TException + { + ping_args args = new ping_args(); + sendBase("ping", args); + } + + public boolean recv_ping() throws org.apache.thrift.TException + { + ping_result result = new ping_result(); + receiveBase(result, "ping"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "ping failed: unknown result"); + } + + public SessionData authenticate(String username, String password) throws AuthenticationException, org.apache.thrift.TException + { + send_authenticate(username, password); + return recv_authenticate(); + } + + public void send_authenticate(String username, String password) throws org.apache.thrift.TException + { + authenticate_args args = new authenticate_args(); + args.setUsername(username); + args.setPassword(password); + sendBase("authenticate", args); + } + + public SessionData recv_authenticate() throws AuthenticationException, org.apache.thrift.TException + { + authenticate_result result = new authenticate_result(); + receiveBase(result, "authenticate"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "authenticate failed: unknown result"); + } + + public UserInfo getUserFromToken(String token) throws InvalidTokenException, org.apache.thrift.TException + { + send_getUserFromToken(token); + return recv_getUserFromToken(); + } + + public void send_getUserFromToken(String token) throws org.apache.thrift.TException + { + getUserFromToken_args args = new getUserFromToken_args(); + args.setToken(token); + sendBase("getUserFromToken", args); + } + + public UserInfo recv_getUserFromToken() throws InvalidTokenException, org.apache.thrift.TException + { + getUserFromToken_result result = new getUserFromToken_result(); + receiveBase(result, "getUserFromToken"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserFromToken failed: unknown result"); + } + + public String startServerAuthentication(String organization) throws ServerAuthenticationException, org.apache.thrift.TException + { + send_startServerAuthentication(organization); + return recv_startServerAuthentication(); + } + + public void send_startServerAuthentication(String organization) throws org.apache.thrift.TException + { + startServerAuthentication_args args = new startServerAuthentication_args(); + args.setOrganization(organization); + sendBase("startServerAuthentication", args); + } + + public String recv_startServerAuthentication() throws ServerAuthenticationException, org.apache.thrift.TException + { + startServerAuthentication_result result = new startServerAuthentication_result(); + receiveBase(result, "startServerAuthentication"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startServerAuthentication failed: unknown result"); + } + + public ServerSessionData serverAuthenticate(String organization, ByteBuffer challengeResponse) throws ServerAuthenticationException, org.apache.thrift.TException + { + send_serverAuthenticate(organization, challengeResponse); + return recv_serverAuthenticate(); + } + + public void send_serverAuthenticate(String organization, ByteBuffer challengeResponse) throws org.apache.thrift.TException + { + serverAuthenticate_args args = new serverAuthenticate_args(); + args.setOrganization(organization); + args.setChallengeResponse(challengeResponse); + sendBase("serverAuthenticate", args); + } + + public ServerSessionData recv_serverAuthenticate() throws ServerAuthenticationException, org.apache.thrift.TException + { + serverAuthenticate_result result = new serverAuthenticate_result(); + receiveBase(result, "serverAuthenticate"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "serverAuthenticate failed: unknown result"); + } + + public FtpCredentials submitImage(String serverSessionId, ImageData imageDescription) throws AuthorizationException, ImageDataException, org.apache.thrift.TException + { + send_submitImage(serverSessionId, imageDescription); + return recv_submitImage(); + } + + public void send_submitImage(String serverSessionId, ImageData imageDescription) throws org.apache.thrift.TException + { + submitImage_args args = new submitImage_args(); + args.setServerSessionId(serverSessionId); + args.setImageDescription(imageDescription); + sendBase("submitImage", args); + } + + public FtpCredentials recv_submitImage() throws AuthorizationException, ImageDataException, org.apache.thrift.TException + { + submitImage_result result = new submitImage_result(); + receiveBase(result, "submitImage"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + if (result.failure2 != null) { + throw result.failure2; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "submitImage failed: unknown result"); + } + + public boolean finshedUpload(String ftpUser, ImageData imageDescription) throws ImageDataException, org.apache.thrift.TException + { + send_finshedUpload(ftpUser, imageDescription); + return recv_finshedUpload(); + } + + public void send_finshedUpload(String ftpUser, ImageData imageDescription) throws org.apache.thrift.TException + { + finshedUpload_args args = new finshedUpload_args(); + args.setFtpUser(ftpUser); + args.setImageDescription(imageDescription); + sendBase("finshedUpload", args); + } + + public boolean recv_finshedUpload() throws ImageDataException, org.apache.thrift.TException + { + finshedUpload_result result = new finshedUpload_result(); + receiveBase(result, "finshedUpload"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.failure != null) { + throw result.failure; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "finshedUpload failed: unknown result"); + } + + } + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { + public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + ping_call method_call = new ping_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class ping_call extends org.apache.thrift.async.TAsyncMethodCall { + public ping_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("ping", org.apache.thrift.protocol.TMessageType.CALL, 0)); + ping_args args = new ping_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public boolean getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_ping(); + } + } + + public void authenticate(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + authenticate_call method_call = new authenticate_call(username, password, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class authenticate_call extends org.apache.thrift.async.TAsyncMethodCall { + private String username; + private String password; + public authenticate_call(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.username = username; + this.password = password; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("authenticate", org.apache.thrift.protocol.TMessageType.CALL, 0)); + authenticate_args args = new authenticate_args(); + args.setUsername(username); + args.setPassword(password); + args.write(prot); + prot.writeMessageEnd(); + } + + public SessionData getResult() throws AuthenticationException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_authenticate(); + } + } + + public void getUserFromToken(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getUserFromToken_call method_call = new getUserFromToken_call(token, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getUserFromToken_call extends org.apache.thrift.async.TAsyncMethodCall { + private String token; + public getUserFromToken_call(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.token = token; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserFromToken", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getUserFromToken_args args = new getUserFromToken_args(); + args.setToken(token); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserInfo getResult() throws InvalidTokenException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getUserFromToken(); + } + } + + public void startServerAuthentication(String organization, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + startServerAuthentication_call method_call = new startServerAuthentication_call(organization, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class startServerAuthentication_call extends org.apache.thrift.async.TAsyncMethodCall { + private String organization; + public startServerAuthentication_call(String organization, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.organization = organization; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startServerAuthentication", org.apache.thrift.protocol.TMessageType.CALL, 0)); + startServerAuthentication_args args = new startServerAuthentication_args(); + args.setOrganization(organization); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws ServerAuthenticationException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_startServerAuthentication(); + } + } + + public void serverAuthenticate(String organization, ByteBuffer challengeResponse, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + serverAuthenticate_call method_call = new serverAuthenticate_call(organization, challengeResponse, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class serverAuthenticate_call extends org.apache.thrift.async.TAsyncMethodCall { + private String organization; + private ByteBuffer challengeResponse; + public serverAuthenticate_call(String organization, ByteBuffer challengeResponse, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.organization = organization; + this.challengeResponse = challengeResponse; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("serverAuthenticate", org.apache.thrift.protocol.TMessageType.CALL, 0)); + serverAuthenticate_args args = new serverAuthenticate_args(); + args.setOrganization(organization); + args.setChallengeResponse(challengeResponse); + args.write(prot); + prot.writeMessageEnd(); + } + + public ServerSessionData getResult() throws ServerAuthenticationException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_serverAuthenticate(); + } + } + + public void submitImage(String serverSessionId, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + submitImage_call method_call = new submitImage_call(serverSessionId, imageDescription, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class submitImage_call extends org.apache.thrift.async.TAsyncMethodCall { + private String serverSessionId; + private ImageData imageDescription; + public submitImage_call(String serverSessionId, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.serverSessionId = serverSessionId; + this.imageDescription = imageDescription; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("submitImage", org.apache.thrift.protocol.TMessageType.CALL, 0)); + submitImage_args args = new submitImage_args(); + args.setServerSessionId(serverSessionId); + args.setImageDescription(imageDescription); + args.write(prot); + prot.writeMessageEnd(); + } + + public FtpCredentials getResult() throws AuthorizationException, ImageDataException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_submitImage(); + } + } + + public void finshedUpload(String ftpUser, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + finshedUpload_call method_call = new finshedUpload_call(ftpUser, imageDescription, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class finshedUpload_call extends org.apache.thrift.async.TAsyncMethodCall { + private String ftpUser; + private ImageData imageDescription; + public finshedUpload_call(String ftpUser, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.ftpUser = ftpUser; + this.imageDescription = imageDescription; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("finshedUpload", org.apache.thrift.protocol.TMessageType.CALL, 0)); + finshedUpload_args args = new finshedUpload_args(); + args.setFtpUser(ftpUser); + args.setImageDescription(imageDescription); + args.write(prot); + prot.writeMessageEnd(); + } + + public boolean getResult() throws ImageDataException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_finshedUpload(); + } + } + + } + + public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + public Processor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>())); + } + + protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + processMap.put("ping", new ping()); + processMap.put("authenticate", new authenticate()); + processMap.put("getUserFromToken", new getUserFromToken()); + processMap.put("startServerAuthentication", new startServerAuthentication()); + processMap.put("serverAuthenticate", new serverAuthenticate()); + processMap.put("submitImage", new submitImage()); + processMap.put("finshedUpload", new finshedUpload()); + return processMap; + } + + public static class ping<I extends Iface> extends org.apache.thrift.ProcessFunction<I, ping_args> { + public ping() { + super("ping"); + } + + public ping_args getEmptyArgsInstance() { + return new ping_args(); + } + + protected boolean isOneway() { + return false; + } + + public ping_result getResult(I iface, ping_args args) throws org.apache.thrift.TException { + ping_result result = new ping_result(); + result.success = iface.ping(); + result.setSuccessIsSet(true); + return result; + } + } + + public static class authenticate<I extends Iface> extends org.apache.thrift.ProcessFunction<I, authenticate_args> { + public authenticate() { + super("authenticate"); + } + + public authenticate_args getEmptyArgsInstance() { + return new authenticate_args(); + } + + protected boolean isOneway() { + return false; + } + + public authenticate_result getResult(I iface, authenticate_args args) throws org.apache.thrift.TException { + authenticate_result result = new authenticate_result(); + try { + result.success = iface.authenticate(args.username, args.password); + } catch (AuthenticationException failure) { + result.failure = failure; + } + return result; + } + } + + public static class getUserFromToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserFromToken_args> { + public getUserFromToken() { + super("getUserFromToken"); + } + + public getUserFromToken_args getEmptyArgsInstance() { + return new getUserFromToken_args(); + } + + protected boolean isOneway() { + return false; + } + + public getUserFromToken_result getResult(I iface, getUserFromToken_args args) throws org.apache.thrift.TException { + getUserFromToken_result result = new getUserFromToken_result(); + try { + result.success = iface.getUserFromToken(args.token); + } catch (InvalidTokenException failure) { + result.failure = failure; + } + return result; + } + } + + public static class startServerAuthentication<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startServerAuthentication_args> { + public startServerAuthentication() { + super("startServerAuthentication"); + } + + public startServerAuthentication_args getEmptyArgsInstance() { + return new startServerAuthentication_args(); + } + + protected boolean isOneway() { + return false; + } + + public startServerAuthentication_result getResult(I iface, startServerAuthentication_args args) throws org.apache.thrift.TException { + startServerAuthentication_result result = new startServerAuthentication_result(); + try { + result.success = iface.startServerAuthentication(args.organization); + } catch (ServerAuthenticationException failure) { + result.failure = failure; + } + return result; + } + } + + public static class serverAuthenticate<I extends Iface> extends org.apache.thrift.ProcessFunction<I, serverAuthenticate_args> { + public serverAuthenticate() { + super("serverAuthenticate"); + } + + public serverAuthenticate_args getEmptyArgsInstance() { + return new serverAuthenticate_args(); + } + + protected boolean isOneway() { + return false; + } + + public serverAuthenticate_result getResult(I iface, serverAuthenticate_args args) throws org.apache.thrift.TException { + serverAuthenticate_result result = new serverAuthenticate_result(); + try { + result.success = iface.serverAuthenticate(args.organization, args.challengeResponse); + } catch (ServerAuthenticationException failure) { + result.failure = failure; + } + return result; + } + } + + public static class submitImage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, submitImage_args> { + public submitImage() { + super("submitImage"); + } + + public submitImage_args getEmptyArgsInstance() { + return new submitImage_args(); + } + + protected boolean isOneway() { + return false; + } + + public submitImage_result getResult(I iface, submitImage_args args) throws org.apache.thrift.TException { + submitImage_result result = new submitImage_result(); + try { + result.success = iface.submitImage(args.serverSessionId, args.imageDescription); + } catch (AuthorizationException failure) { + result.failure = failure; + } catch (ImageDataException failure2) { + result.failure2 = failure2; + } + return result; + } + } + + public static class finshedUpload<I extends Iface> extends org.apache.thrift.ProcessFunction<I, finshedUpload_args> { + public finshedUpload() { + super("finshedUpload"); + } + + public finshedUpload_args getEmptyArgsInstance() { + return new finshedUpload_args(); + } + + protected boolean isOneway() { + return false; + } + + public finshedUpload_result getResult(I iface, finshedUpload_args args) throws org.apache.thrift.TException { + finshedUpload_result result = new finshedUpload_result(); + try { + result.success = iface.finshedUpload(args.ftpUser, args.imageDescription); + result.setSuccessIsSet(true); + } catch (ImageDataException failure) { + result.failure = failure; + } + return result; + } + } + + } + + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("ping", new ping()); + processMap.put("authenticate", new authenticate()); + processMap.put("getUserFromToken", new getUserFromToken()); + processMap.put("startServerAuthentication", new startServerAuthentication()); + processMap.put("serverAuthenticate", new serverAuthenticate()); + processMap.put("submitImage", new submitImage()); + processMap.put("finshedUpload", new finshedUpload()); + return processMap; + } + + public static class ping<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, ping_args, Boolean> { + public ping() { + super("ping"); + } + + public ping_args getEmptyArgsInstance() { + return new ping_args(); + } + + public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Boolean>() { + public void onComplete(Boolean o) { + ping_result result = new ping_result(); + result.success = o; + result.setSuccessIsSet(true); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + ping_result result = new ping_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, ping_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.ping(resultHandler); + } + } + + public static class authenticate<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, authenticate_args, SessionData> { + public authenticate() { + super("authenticate"); + } + + public authenticate_args getEmptyArgsInstance() { + return new authenticate_args(); + } + + public AsyncMethodCallback<SessionData> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<SessionData>() { + public void onComplete(SessionData o) { + authenticate_result result = new authenticate_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + authenticate_result result = new authenticate_result(); + if (e instanceof AuthenticationException) { + result.failure = (AuthenticationException) e; + result.setFailureIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, authenticate_args args, org.apache.thrift.async.AsyncMethodCallback<SessionData> resultHandler) throws TException { + iface.authenticate(args.username, args.password,resultHandler); + } + } + + public static class getUserFromToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserFromToken_args, UserInfo> { + public getUserFromToken() { + super("getUserFromToken"); + } + + public getUserFromToken_args getEmptyArgsInstance() { + return new getUserFromToken_args(); + } + + public AsyncMethodCallback<UserInfo> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<UserInfo>() { + public void onComplete(UserInfo o) { + getUserFromToken_result result = new getUserFromToken_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getUserFromToken_result result = new getUserFromToken_result(); + if (e instanceof InvalidTokenException) { + result.failure = (InvalidTokenException) e; + result.setFailureIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getUserFromToken_args args, org.apache.thrift.async.AsyncMethodCallback<UserInfo> resultHandler) throws TException { + iface.getUserFromToken(args.token,resultHandler); + } + } + + public static class startServerAuthentication<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startServerAuthentication_args, String> { + public startServerAuthentication() { + super("startServerAuthentication"); + } + + public startServerAuthentication_args getEmptyArgsInstance() { + return new startServerAuthentication_args(); + } + + public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<String>() { + public void onComplete(String o) { + startServerAuthentication_result result = new startServerAuthentication_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + startServerAuthentication_result result = new startServerAuthentication_result(); + if (e instanceof ServerAuthenticationException) { + result.failure = (ServerAuthenticationException) e; + result.setFailureIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, startServerAuthentication_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { + iface.startServerAuthentication(args.organization,resultHandler); + } + } + + public static class serverAuthenticate<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, serverAuthenticate_args, ServerSessionData> { + public serverAuthenticate() { + super("serverAuthenticate"); + } + + public serverAuthenticate_args getEmptyArgsInstance() { + return new serverAuthenticate_args(); + } + + public AsyncMethodCallback<ServerSessionData> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<ServerSessionData>() { + public void onComplete(ServerSessionData o) { + serverAuthenticate_result result = new serverAuthenticate_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + serverAuthenticate_result result = new serverAuthenticate_result(); + if (e instanceof ServerAuthenticationException) { + result.failure = (ServerAuthenticationException) e; + result.setFailureIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, serverAuthenticate_args args, org.apache.thrift.async.AsyncMethodCallback<ServerSessionData> resultHandler) throws TException { + iface.serverAuthenticate(args.organization, args.challengeResponse,resultHandler); + } + } + + public static class submitImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, submitImage_args, FtpCredentials> { + public submitImage() { + super("submitImage"); + } + + public submitImage_args getEmptyArgsInstance() { + return new submitImage_args(); + } + + public AsyncMethodCallback<FtpCredentials> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<FtpCredentials>() { + public void onComplete(FtpCredentials o) { + submitImage_result result = new submitImage_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + submitImage_result result = new submitImage_result(); + if (e instanceof AuthorizationException) { + result.failure = (AuthorizationException) e; + result.setFailureIsSet(true); + msg = result; + } + else if (e instanceof ImageDataException) { + result.failure2 = (ImageDataException) e; + result.setFailure2IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, submitImage_args args, org.apache.thrift.async.AsyncMethodCallback<FtpCredentials> resultHandler) throws TException { + iface.submitImage(args.serverSessionId, args.imageDescription,resultHandler); + } + } + + public static class finshedUpload<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, finshedUpload_args, Boolean> { + public finshedUpload() { + super("finshedUpload"); + } + + public finshedUpload_args getEmptyArgsInstance() { + return new finshedUpload_args(); + } + + public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Boolean>() { + public void onComplete(Boolean o) { + finshedUpload_result result = new finshedUpload_result(); + result.success = o; + result.setSuccessIsSet(true); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + finshedUpload_result result = new finshedUpload_result(); + if (e instanceof ImageDataException) { + result.failure = (ImageDataException) e; + result.setFailureIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, finshedUpload_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.finshedUpload(args.ftpUser, args.imageDescription,resultHandler); + } + } + + } + + public static class ping_args implements org.apache.thrift.TBase<ping_args, ping_args._Fields>, java.io.Serializable, Cloneable, Comparable<ping_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ping_args"); + + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ping_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ping_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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) { + 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; + } + } + 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); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ping_args.class, metaDataMap); + } + + public ping_args() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ping_args(ping_args other) { + } + + public ping_args deepCopy() { + return new ping_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + 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) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ping_args) + return this.equals((ping_args)that); + return false; + } + + public boolean equals(ping_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ping_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("ping_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 ping_argsStandardSchemeFactory implements SchemeFactory { + public ping_argsStandardScheme getScheme() { + return new ping_argsStandardScheme(); + } + } + + private static class ping_argsStandardScheme extends StandardScheme<ping_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ping_args 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) { + 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, ping_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ping_argsTupleSchemeFactory implements SchemeFactory { + public ping_argsTupleScheme getScheme() { + return new ping_argsTupleScheme(); + } + } + + private static class ping_argsTupleScheme extends TupleScheme<ping_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class ping_result implements org.apache.thrift.TBase<ping_result, ping_result._Fields>, java.io.Serializable, Cloneable, Comparable<ping_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ping_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ping_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ping_resultTupleSchemeFactory()); + } + + public boolean success; // 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 { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + 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 __SUCCESS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ping_result.class, metaDataMap); + } + + public ping_result() { + } + + public ping_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ping_result(ping_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public ping_result deepCopy() { + return new ping_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public ping_result setSuccess(boolean success) { + this.success = success; + setSuccessIsSet(true); + return this; + } + + public void unsetSuccess() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return Boolean.valueOf(isSuccess()); + + } + 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 SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ping_result) + return this.equals((ping_result)that); + return false; + } + + public boolean equals(ping_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ping_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + 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("ping_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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_bitfield = 0; + 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 ping_resultStandardSchemeFactory implements SchemeFactory { + public ping_resultStandardScheme getScheme() { + return new ping_resultStandardScheme(); + } + } + + private static class ping_resultStandardScheme extends StandardScheme<ping_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ping_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(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, ping_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ping_resultTupleSchemeFactory implements SchemeFactory { + public ping_resultTupleScheme getScheme() { + return new ping_resultTupleScheme(); + } + } + + private static class ping_resultTupleScheme extends TupleScheme<ping_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ping_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeBool(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ping_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class authenticate_args implements org.apache.thrift.TBase<authenticate_args, authenticate_args._Fields>, java.io.Serializable, Cloneable, Comparable<authenticate_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_args"); + + private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); + 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); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new authenticate_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new authenticate_argsTupleSchemeFactory()); + } + + public String username; // required + public String password; // 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 { + USERNAME((short)1, "username"), + PASSWORD((short)2, "password"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // USERNAME + return USERNAME; + case 2: // PASSWORD + return PASSWORD; + 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 + 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.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_args.class, metaDataMap); + } + + public authenticate_args() { + } + + public authenticate_args( + String username, + String password) + { + this(); + this.username = username; + this.password = password; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public authenticate_args(authenticate_args other) { + if (other.isSetUsername()) { + this.username = other.username; + } + if (other.isSetPassword()) { + this.password = other.password; + } + } + + public authenticate_args deepCopy() { + return new authenticate_args(this); + } + + @Override + public void clear() { + this.username = null; + this.password = null; + } + + public String getUsername() { + return this.username; + } + + public authenticate_args setUsername(String username) { + this.username = username; + return this; + } + + public void unsetUsername() { + this.username = null; + } + + /** Returns true if field username is set (has been assigned a value) and false otherwise */ + public boolean isSetUsername() { + return this.username != null; + } + + public void setUsernameIsSet(boolean value) { + if (!value) { + this.username = null; + } + } + + public String getPassword() { + return this.password; + } + + public authenticate_args setPassword(String password) { + this.password = password; + return this; + } + + public void unsetPassword() { + this.password = null; + } + + /** Returns true if field password is set (has been assigned a value) and false otherwise */ + public boolean isSetPassword() { + return this.password != null; + } + + public void setPasswordIsSet(boolean value) { + if (!value) { + this.password = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USERNAME: + if (value == null) { + unsetUsername(); + } else { + setUsername((String)value); + } + break; + + case PASSWORD: + if (value == null) { + unsetPassword(); + } else { + setPassword((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USERNAME: + return getUsername(); + + case PASSWORD: + return getPassword(); + + } + 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 USERNAME: + return isSetUsername(); + case PASSWORD: + return isSetPassword(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof authenticate_args) + return this.equals((authenticate_args)that); + return false; + } + + public boolean equals(authenticate_args that) { + if (that == null) + return false; + + boolean this_present_username = true && this.isSetUsername(); + boolean that_present_username = true && that.isSetUsername(); + if (this_present_username || that_present_username) { + if (!(this_present_username && that_present_username)) + return false; + if (!this.username.equals(that.username)) + return false; + } + + boolean this_present_password = true && this.isSetPassword(); + boolean that_present_password = true && that.isSetPassword(); + if (this_present_password || that_present_password) { + if (!(this_present_password && that_present_password)) + return false; + if (!this.password.equals(that.password)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(authenticate_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUsername()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPassword()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password); + 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("authenticate_args("); + boolean first = true; + + sb.append("username:"); + if (this.username == null) { + sb.append("null"); + } else { + sb.append(this.username); + } + first = false; + if (!first) sb.append(", "); + sb.append("password:"); + if (this.password == null) { + sb.append("null"); + } else { + sb.append(this.password); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 authenticate_argsStandardSchemeFactory implements SchemeFactory { + public authenticate_argsStandardScheme getScheme() { + return new authenticate_argsStandardScheme(); + } + } + + private static class authenticate_argsStandardScheme extends StandardScheme<authenticate_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_args 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: // USERNAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PASSWORD + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.password = iprot.readString(); + struct.setPasswordIsSet(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, authenticate_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.username != null) { + oprot.writeFieldBegin(USERNAME_FIELD_DESC); + oprot.writeString(struct.username); + oprot.writeFieldEnd(); + } + if (struct.password != null) { + oprot.writeFieldBegin(PASSWORD_FIELD_DESC); + oprot.writeString(struct.password); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class authenticate_argsTupleSchemeFactory implements SchemeFactory { + public authenticate_argsTupleScheme getScheme() { + return new authenticate_argsTupleScheme(); + } + } + + private static class authenticate_argsTupleScheme extends TupleScheme<authenticate_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUsername()) { + optionals.set(0); + } + if (struct.isSetPassword()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUsername()) { + oprot.writeString(struct.username); + } + if (struct.isSetPassword()) { + oprot.writeString(struct.password); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + } + if (incoming.get(1)) { + struct.password = iprot.readString(); + struct.setPasswordIsSet(true); + } + } + } + + } + + public static class authenticate_result implements org.apache.thrift.TBase<authenticate_result, authenticate_result._Fields>, java.io.Serializable, Cloneable, Comparable<authenticate_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new authenticate_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new authenticate_resultTupleSchemeFactory()); + } + + public SessionData success; // required + public AuthenticationException failure; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + 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 + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SessionData.class))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_result.class, metaDataMap); + } + + public authenticate_result() { + } + + public authenticate_result( + SessionData success, + AuthenticationException failure) + { + this(); + this.success = success; + this.failure = failure; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public authenticate_result(authenticate_result other) { + if (other.isSetSuccess()) { + this.success = new SessionData(other.success); + } + if (other.isSetFailure()) { + this.failure = new AuthenticationException(other.failure); + } + } + + public authenticate_result deepCopy() { + return new authenticate_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + } + + public SessionData getSuccess() { + return this.success; + } + + public authenticate_result setSuccess(SessionData success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public AuthenticationException getFailure() { + return this.failure; + } + + public authenticate_result setFailure(AuthenticationException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((SessionData)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((AuthenticationException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case FAILURE: + return getFailure(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof authenticate_result) + return this.equals((authenticate_result)that); + return false; + } + + public boolean equals(authenticate_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(authenticate_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + 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("authenticate_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 { + 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 authenticate_resultStandardSchemeFactory implements SchemeFactory { + public authenticate_resultStandardScheme getScheme() { + return new authenticate_resultStandardScheme(); + } + } + + private static class authenticate_resultStandardScheme extends StandardScheme<authenticate_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new SessionData(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new AuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(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, authenticate_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class authenticate_resultTupleSchemeFactory implements SchemeFactory { + public authenticate_resultTupleScheme getScheme() { + return new authenticate_resultTupleScheme(); + } + } + + private static class authenticate_resultTupleScheme extends TupleScheme<authenticate_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = new SessionData(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new AuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + } + } + + } + + public static class getUserFromToken_args implements org.apache.thrift.TBase<getUserFromToken_args, getUserFromToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserFromToken_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserFromToken_args"); + + private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getUserFromToken_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getUserFromToken_argsTupleSchemeFactory()); + } + + public String token; // 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 { + TOKEN((short)1, "token"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // TOKEN + return TOKEN; + 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 + 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.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Token"))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserFromToken_args.class, metaDataMap); + } + + public getUserFromToken_args() { + } + + public getUserFromToken_args( + String token) + { + this(); + this.token = token; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getUserFromToken_args(getUserFromToken_args other) { + if (other.isSetToken()) { + this.token = other.token; + } + } + + public getUserFromToken_args deepCopy() { + return new getUserFromToken_args(this); + } + + @Override + public void clear() { + this.token = null; + } + + public String getToken() { + return this.token; + } + + public getUserFromToken_args setToken(String token) { + this.token = token; + return this; + } + + public void unsetToken() { + this.token = null; + } + + /** Returns true if field token is set (has been assigned a value) and false otherwise */ + public boolean isSetToken() { + return this.token != null; + } + + public void setTokenIsSet(boolean value) { + if (!value) { + this.token = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TOKEN: + if (value == null) { + unsetToken(); + } else { + setToken((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TOKEN: + return getToken(); + + } + 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 TOKEN: + return isSetToken(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getUserFromToken_args) + return this.equals((getUserFromToken_args)that); + return false; + } + + public boolean equals(getUserFromToken_args that) { + if (that == null) + return false; + + boolean this_present_token = true && this.isSetToken(); + boolean that_present_token = true && that.isSetToken(); + if (this_present_token || that_present_token) { + if (!(this_present_token && that_present_token)) + return false; + if (!this.token.equals(that.token)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getUserFromToken_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token); + 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("getUserFromToken_args("); + boolean first = true; + + sb.append("token:"); + if (this.token == null) { + sb.append("null"); + } else { + sb.append(this.token); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 getUserFromToken_argsStandardSchemeFactory implements SchemeFactory { + public getUserFromToken_argsStandardScheme getScheme() { + return new getUserFromToken_argsStandardScheme(); + } + } + + private static class getUserFromToken_argsStandardScheme extends StandardScheme<getUserFromToken_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getUserFromToken_args 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: // TOKEN + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.token = iprot.readString(); + struct.setTokenIsSet(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, getUserFromToken_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.token != null) { + oprot.writeFieldBegin(TOKEN_FIELD_DESC); + oprot.writeString(struct.token); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getUserFromToken_argsTupleSchemeFactory implements SchemeFactory { + public getUserFromToken_argsTupleScheme getScheme() { + return new getUserFromToken_argsTupleScheme(); + } + } + + private static class getUserFromToken_argsTupleScheme extends TupleScheme<getUserFromToken_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetToken()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetToken()) { + oprot.writeString(struct.token); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.token = iprot.readString(); + struct.setTokenIsSet(true); + } + } + } + + } + + public static class getUserFromToken_result implements org.apache.thrift.TBase<getUserFromToken_result, getUserFromToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserFromToken_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserFromToken_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getUserFromToken_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getUserFromToken_resultTupleSchemeFactory()); + } + + public UserInfo success; // required + public InvalidTokenException failure; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + 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 + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserInfo.class))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserFromToken_result.class, metaDataMap); + } + + public getUserFromToken_result() { + } + + public getUserFromToken_result( + UserInfo success, + InvalidTokenException failure) + { + this(); + this.success = success; + this.failure = failure; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getUserFromToken_result(getUserFromToken_result other) { + if (other.isSetSuccess()) { + this.success = new UserInfo(other.success); + } + if (other.isSetFailure()) { + this.failure = new InvalidTokenException(other.failure); + } + } + + public getUserFromToken_result deepCopy() { + return new getUserFromToken_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + } + + public UserInfo getSuccess() { + return this.success; + } + + public getUserFromToken_result setSuccess(UserInfo success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public InvalidTokenException getFailure() { + return this.failure; + } + + public getUserFromToken_result setFailure(InvalidTokenException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserInfo)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((InvalidTokenException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case FAILURE: + return getFailure(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getUserFromToken_result) + return this.equals((getUserFromToken_result)that); + return false; + } + + public boolean equals(getUserFromToken_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getUserFromToken_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + 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("getUserFromToken_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 { + 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 getUserFromToken_resultStandardSchemeFactory implements SchemeFactory { + public getUserFromToken_resultStandardScheme getScheme() { + return new getUserFromToken_resultStandardScheme(); + } + } + + private static class getUserFromToken_resultStandardScheme extends StandardScheme<getUserFromToken_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getUserFromToken_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserInfo(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new InvalidTokenException(); + struct.failure.read(iprot); + struct.setFailureIsSet(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, getUserFromToken_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getUserFromToken_resultTupleSchemeFactory implements SchemeFactory { + public getUserFromToken_resultTupleScheme getScheme() { + return new getUserFromToken_resultTupleScheme(); + } + } + + private static class getUserFromToken_resultTupleScheme extends TupleScheme<getUserFromToken_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = new UserInfo(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new InvalidTokenException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + } + } + + } + + public static class startServerAuthentication_args implements org.apache.thrift.TBase<startServerAuthentication_args, startServerAuthentication_args._Fields>, java.io.Serializable, Cloneable, Comparable<startServerAuthentication_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startServerAuthentication_args"); + + private static final org.apache.thrift.protocol.TField ORGANIZATION_FIELD_DESC = new org.apache.thrift.protocol.TField("organization", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new startServerAuthentication_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new startServerAuthentication_argsTupleSchemeFactory()); + } + + public String organization; // 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 { + ORGANIZATION((short)1, "organization"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // ORGANIZATION + return ORGANIZATION; + 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 + 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.ORGANIZATION, new org.apache.thrift.meta_data.FieldMetaData("organization", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startServerAuthentication_args.class, metaDataMap); + } + + public startServerAuthentication_args() { + } + + public startServerAuthentication_args( + String organization) + { + this(); + this.organization = organization; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public startServerAuthentication_args(startServerAuthentication_args other) { + if (other.isSetOrganization()) { + this.organization = other.organization; + } + } + + public startServerAuthentication_args deepCopy() { + return new startServerAuthentication_args(this); + } + + @Override + public void clear() { + this.organization = null; + } + + public String getOrganization() { + return this.organization; + } + + public startServerAuthentication_args setOrganization(String organization) { + this.organization = organization; + return this; + } + + public void unsetOrganization() { + this.organization = null; + } + + /** Returns true if field organization is set (has been assigned a value) and false otherwise */ + public boolean isSetOrganization() { + return this.organization != null; + } + + public void setOrganizationIsSet(boolean value) { + if (!value) { + this.organization = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ORGANIZATION: + if (value == null) { + unsetOrganization(); + } else { + setOrganization((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ORGANIZATION: + return getOrganization(); + + } + 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 ORGANIZATION: + return isSetOrganization(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof startServerAuthentication_args) + return this.equals((startServerAuthentication_args)that); + return false; + } + + public boolean equals(startServerAuthentication_args that) { + if (that == null) + return false; + + boolean this_present_organization = true && this.isSetOrganization(); + boolean that_present_organization = true && that.isSetOrganization(); + if (this_present_organization || that_present_organization) { + if (!(this_present_organization && that_present_organization)) + return false; + if (!this.organization.equals(that.organization)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(startServerAuthentication_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetOrganization()).compareTo(other.isSetOrganization()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOrganization()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organization, other.organization); + 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("startServerAuthentication_args("); + boolean first = true; + + sb.append("organization:"); + if (this.organization == null) { + sb.append("null"); + } else { + sb.append(this.organization); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 startServerAuthentication_argsStandardSchemeFactory implements SchemeFactory { + public startServerAuthentication_argsStandardScheme getScheme() { + return new startServerAuthentication_argsStandardScheme(); + } + } + + private static class startServerAuthentication_argsStandardScheme extends StandardScheme<startServerAuthentication_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, startServerAuthentication_args 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: // ORGANIZATION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.organization = iprot.readString(); + struct.setOrganizationIsSet(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, startServerAuthentication_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.organization != null) { + oprot.writeFieldBegin(ORGANIZATION_FIELD_DESC); + oprot.writeString(struct.organization); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class startServerAuthentication_argsTupleSchemeFactory implements SchemeFactory { + public startServerAuthentication_argsTupleScheme getScheme() { + return new startServerAuthentication_argsTupleScheme(); + } + } + + private static class startServerAuthentication_argsTupleScheme extends TupleScheme<startServerAuthentication_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, startServerAuthentication_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetOrganization()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetOrganization()) { + oprot.writeString(struct.organization); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, startServerAuthentication_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.organization = iprot.readString(); + struct.setOrganizationIsSet(true); + } + } + } + + } + + public static class startServerAuthentication_result implements org.apache.thrift.TBase<startServerAuthentication_result, startServerAuthentication_result._Fields>, java.io.Serializable, Cloneable, Comparable<startServerAuthentication_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startServerAuthentication_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new startServerAuthentication_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new startServerAuthentication_resultTupleSchemeFactory()); + } + + public String success; // required + public ServerAuthenticationException failure; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + 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 + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startServerAuthentication_result.class, metaDataMap); + } + + public startServerAuthentication_result() { + } + + public startServerAuthentication_result( + String success, + ServerAuthenticationException failure) + { + this(); + this.success = success; + this.failure = failure; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public startServerAuthentication_result(startServerAuthentication_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + if (other.isSetFailure()) { + this.failure = new ServerAuthenticationException(other.failure); + } + } + + public startServerAuthentication_result deepCopy() { + return new startServerAuthentication_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + } + + public String getSuccess() { + return this.success; + } + + public startServerAuthentication_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public ServerAuthenticationException getFailure() { + return this.failure; + } + + public startServerAuthentication_result setFailure(ServerAuthenticationException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((ServerAuthenticationException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case FAILURE: + return getFailure(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof startServerAuthentication_result) + return this.equals((startServerAuthentication_result)that); + return false; + } + + public boolean equals(startServerAuthentication_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(startServerAuthentication_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + 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("startServerAuthentication_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 startServerAuthentication_resultStandardSchemeFactory implements SchemeFactory { + public startServerAuthentication_resultStandardScheme getScheme() { + return new startServerAuthentication_resultStandardScheme(); + } + } + + private static class startServerAuthentication_resultStandardScheme extends StandardScheme<startServerAuthentication_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, startServerAuthentication_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new ServerAuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(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, startServerAuthentication_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class startServerAuthentication_resultTupleSchemeFactory implements SchemeFactory { + public startServerAuthentication_resultTupleScheme getScheme() { + return new startServerAuthentication_resultTupleScheme(); + } + } + + private static class startServerAuthentication_resultTupleScheme extends TupleScheme<startServerAuthentication_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, startServerAuthentication_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, startServerAuthentication_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new ServerAuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + } + } + + } + + public static class serverAuthenticate_args implements org.apache.thrift.TBase<serverAuthenticate_args, serverAuthenticate_args._Fields>, java.io.Serializable, Cloneable, Comparable<serverAuthenticate_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("serverAuthenticate_args"); + + private static final org.apache.thrift.protocol.TField ORGANIZATION_FIELD_DESC = new org.apache.thrift.protocol.TField("organization", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CHALLENGE_RESPONSE_FIELD_DESC = new org.apache.thrift.protocol.TField("challengeResponse", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new serverAuthenticate_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new serverAuthenticate_argsTupleSchemeFactory()); + } + + public String organization; // required + public ByteBuffer challengeResponse; // 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 { + ORGANIZATION((short)1, "organization"), + CHALLENGE_RESPONSE((short)2, "challengeResponse"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // ORGANIZATION + return ORGANIZATION; + case 2: // CHALLENGE_RESPONSE + return CHALLENGE_RESPONSE; + 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 + 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.ORGANIZATION, new org.apache.thrift.meta_data.FieldMetaData("organization", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CHALLENGE_RESPONSE, new org.apache.thrift.meta_data.FieldMetaData("challengeResponse", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(serverAuthenticate_args.class, metaDataMap); + } + + public serverAuthenticate_args() { + } + + public serverAuthenticate_args( + String organization, + ByteBuffer challengeResponse) + { + this(); + this.organization = organization; + this.challengeResponse = challengeResponse; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public serverAuthenticate_args(serverAuthenticate_args other) { + if (other.isSetOrganization()) { + this.organization = other.organization; + } + if (other.isSetChallengeResponse()) { + this.challengeResponse = org.apache.thrift.TBaseHelper.copyBinary(other.challengeResponse); +; + } + } + + public serverAuthenticate_args deepCopy() { + return new serverAuthenticate_args(this); + } + + @Override + public void clear() { + this.organization = null; + this.challengeResponse = null; + } + + public String getOrganization() { + return this.organization; + } + + public serverAuthenticate_args setOrganization(String organization) { + this.organization = organization; + return this; + } + + public void unsetOrganization() { + this.organization = null; + } + + /** Returns true if field organization is set (has been assigned a value) and false otherwise */ + public boolean isSetOrganization() { + return this.organization != null; + } + + public void setOrganizationIsSet(boolean value) { + if (!value) { + this.organization = null; + } + } + + public byte[] getChallengeResponse() { + setChallengeResponse(org.apache.thrift.TBaseHelper.rightSize(challengeResponse)); + return challengeResponse == null ? null : challengeResponse.array(); + } + + public ByteBuffer bufferForChallengeResponse() { + return challengeResponse; + } + + public serverAuthenticate_args setChallengeResponse(byte[] challengeResponse) { + setChallengeResponse(challengeResponse == null ? (ByteBuffer)null : ByteBuffer.wrap(challengeResponse)); + return this; + } + + public serverAuthenticate_args setChallengeResponse(ByteBuffer challengeResponse) { + this.challengeResponse = challengeResponse; + return this; + } + + public void unsetChallengeResponse() { + this.challengeResponse = null; + } + + /** Returns true if field challengeResponse is set (has been assigned a value) and false otherwise */ + public boolean isSetChallengeResponse() { + return this.challengeResponse != null; + } + + public void setChallengeResponseIsSet(boolean value) { + if (!value) { + this.challengeResponse = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ORGANIZATION: + if (value == null) { + unsetOrganization(); + } else { + setOrganization((String)value); + } + break; + + case CHALLENGE_RESPONSE: + if (value == null) { + unsetChallengeResponse(); + } else { + setChallengeResponse((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ORGANIZATION: + return getOrganization(); + + case CHALLENGE_RESPONSE: + return getChallengeResponse(); + + } + 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 ORGANIZATION: + return isSetOrganization(); + case CHALLENGE_RESPONSE: + return isSetChallengeResponse(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof serverAuthenticate_args) + return this.equals((serverAuthenticate_args)that); + return false; + } + + public boolean equals(serverAuthenticate_args that) { + if (that == null) + return false; + + boolean this_present_organization = true && this.isSetOrganization(); + boolean that_present_organization = true && that.isSetOrganization(); + if (this_present_organization || that_present_organization) { + if (!(this_present_organization && that_present_organization)) + return false; + if (!this.organization.equals(that.organization)) + return false; + } + + boolean this_present_challengeResponse = true && this.isSetChallengeResponse(); + boolean that_present_challengeResponse = true && that.isSetChallengeResponse(); + if (this_present_challengeResponse || that_present_challengeResponse) { + if (!(this_present_challengeResponse && that_present_challengeResponse)) + return false; + if (!this.challengeResponse.equals(that.challengeResponse)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(serverAuthenticate_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetOrganization()).compareTo(other.isSetOrganization()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOrganization()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organization, other.organization); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetChallengeResponse()).compareTo(other.isSetChallengeResponse()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetChallengeResponse()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.challengeResponse, other.challengeResponse); + 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("serverAuthenticate_args("); + boolean first = true; + + sb.append("organization:"); + if (this.organization == null) { + sb.append("null"); + } else { + sb.append(this.organization); + } + first = false; + if (!first) sb.append(", "); + sb.append("challengeResponse:"); + if (this.challengeResponse == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.challengeResponse, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 serverAuthenticate_argsStandardSchemeFactory implements SchemeFactory { + public serverAuthenticate_argsStandardScheme getScheme() { + return new serverAuthenticate_argsStandardScheme(); + } + } + + private static class serverAuthenticate_argsStandardScheme extends StandardScheme<serverAuthenticate_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, serverAuthenticate_args 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: // ORGANIZATION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.organization = iprot.readString(); + struct.setOrganizationIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CHALLENGE_RESPONSE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.challengeResponse = iprot.readBinary(); + struct.setChallengeResponseIsSet(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, serverAuthenticate_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.organization != null) { + oprot.writeFieldBegin(ORGANIZATION_FIELD_DESC); + oprot.writeString(struct.organization); + oprot.writeFieldEnd(); + } + if (struct.challengeResponse != null) { + oprot.writeFieldBegin(CHALLENGE_RESPONSE_FIELD_DESC); + oprot.writeBinary(struct.challengeResponse); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class serverAuthenticate_argsTupleSchemeFactory implements SchemeFactory { + public serverAuthenticate_argsTupleScheme getScheme() { + return new serverAuthenticate_argsTupleScheme(); + } + } + + private static class serverAuthenticate_argsTupleScheme extends TupleScheme<serverAuthenticate_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, serverAuthenticate_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetOrganization()) { + optionals.set(0); + } + if (struct.isSetChallengeResponse()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetOrganization()) { + oprot.writeString(struct.organization); + } + if (struct.isSetChallengeResponse()) { + oprot.writeBinary(struct.challengeResponse); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, serverAuthenticate_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.organization = iprot.readString(); + struct.setOrganizationIsSet(true); + } + if (incoming.get(1)) { + struct.challengeResponse = iprot.readBinary(); + struct.setChallengeResponseIsSet(true); + } + } + } + + } + + public static class serverAuthenticate_result implements org.apache.thrift.TBase<serverAuthenticate_result, serverAuthenticate_result._Fields>, java.io.Serializable, Cloneable, Comparable<serverAuthenticate_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("serverAuthenticate_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new serverAuthenticate_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new serverAuthenticate_resultTupleSchemeFactory()); + } + + public ServerSessionData success; // required + public ServerAuthenticationException failure; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + 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 + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ServerSessionData.class))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(serverAuthenticate_result.class, metaDataMap); + } + + public serverAuthenticate_result() { + } + + public serverAuthenticate_result( + ServerSessionData success, + ServerAuthenticationException failure) + { + this(); + this.success = success; + this.failure = failure; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public serverAuthenticate_result(serverAuthenticate_result other) { + if (other.isSetSuccess()) { + this.success = new ServerSessionData(other.success); + } + if (other.isSetFailure()) { + this.failure = new ServerAuthenticationException(other.failure); + } + } + + public serverAuthenticate_result deepCopy() { + return new serverAuthenticate_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + } + + public ServerSessionData getSuccess() { + return this.success; + } + + public serverAuthenticate_result setSuccess(ServerSessionData success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public ServerAuthenticationException getFailure() { + return this.failure; + } + + public serverAuthenticate_result setFailure(ServerAuthenticationException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((ServerSessionData)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((ServerAuthenticationException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case FAILURE: + return getFailure(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof serverAuthenticate_result) + return this.equals((serverAuthenticate_result)that); + return false; + } + + public boolean equals(serverAuthenticate_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(serverAuthenticate_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + 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("serverAuthenticate_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 { + 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 serverAuthenticate_resultStandardSchemeFactory implements SchemeFactory { + public serverAuthenticate_resultStandardScheme getScheme() { + return new serverAuthenticate_resultStandardScheme(); + } + } + + private static class serverAuthenticate_resultStandardScheme extends StandardScheme<serverAuthenticate_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, serverAuthenticate_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new ServerSessionData(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new ServerAuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(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, serverAuthenticate_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class serverAuthenticate_resultTupleSchemeFactory implements SchemeFactory { + public serverAuthenticate_resultTupleScheme getScheme() { + return new serverAuthenticate_resultTupleScheme(); + } + } + + private static class serverAuthenticate_resultTupleScheme extends TupleScheme<serverAuthenticate_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, serverAuthenticate_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, serverAuthenticate_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = new ServerSessionData(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new ServerAuthenticationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + } + } + + } + + public static class submitImage_args implements org.apache.thrift.TBase<submitImage_args, submitImage_args._Fields>, java.io.Serializable, Cloneable, Comparable<submitImage_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("submitImage_args"); + + private static final org.apache.thrift.protocol.TField SERVER_SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("serverSessionId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField IMAGE_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("imageDescription", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new submitImage_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new submitImage_argsTupleSchemeFactory()); + } + + public String serverSessionId; // required + public ImageData imageDescription; // 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 { + SERVER_SESSION_ID((short)1, "serverSessionId"), + IMAGE_DESCRIPTION((short)2, "imageDescription"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // SERVER_SESSION_ID + return SERVER_SESSION_ID; + case 2: // IMAGE_DESCRIPTION + return IMAGE_DESCRIPTION; + 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 + 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.SERVER_SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("serverSessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IMAGE_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("imageDescription", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ImageData.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(submitImage_args.class, metaDataMap); + } + + public submitImage_args() { + } + + public submitImage_args( + String serverSessionId, + ImageData imageDescription) + { + this(); + this.serverSessionId = serverSessionId; + this.imageDescription = imageDescription; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public submitImage_args(submitImage_args other) { + if (other.isSetServerSessionId()) { + this.serverSessionId = other.serverSessionId; + } + if (other.isSetImageDescription()) { + this.imageDescription = new ImageData(other.imageDescription); + } + } + + public submitImage_args deepCopy() { + return new submitImage_args(this); + } + + @Override + public void clear() { + this.serverSessionId = null; + this.imageDescription = null; + } + + public String getServerSessionId() { + return this.serverSessionId; + } + + public submitImage_args setServerSessionId(String serverSessionId) { + this.serverSessionId = serverSessionId; + return this; + } + + public void unsetServerSessionId() { + this.serverSessionId = null; + } + + /** Returns true if field serverSessionId is set (has been assigned a value) and false otherwise */ + public boolean isSetServerSessionId() { + return this.serverSessionId != null; + } + + public void setServerSessionIdIsSet(boolean value) { + if (!value) { + this.serverSessionId = null; + } + } + + public ImageData getImageDescription() { + return this.imageDescription; + } + + public submitImage_args setImageDescription(ImageData imageDescription) { + this.imageDescription = imageDescription; + return this; + } + + public void unsetImageDescription() { + this.imageDescription = null; + } + + /** Returns true if field imageDescription is set (has been assigned a value) and false otherwise */ + public boolean isSetImageDescription() { + return this.imageDescription != null; + } + + public void setImageDescriptionIsSet(boolean value) { + if (!value) { + this.imageDescription = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SERVER_SESSION_ID: + if (value == null) { + unsetServerSessionId(); + } else { + setServerSessionId((String)value); + } + break; + + case IMAGE_DESCRIPTION: + if (value == null) { + unsetImageDescription(); + } else { + setImageDescription((ImageData)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SERVER_SESSION_ID: + return getServerSessionId(); + + case IMAGE_DESCRIPTION: + return getImageDescription(); + + } + 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 SERVER_SESSION_ID: + return isSetServerSessionId(); + case IMAGE_DESCRIPTION: + return isSetImageDescription(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof submitImage_args) + return this.equals((submitImage_args)that); + return false; + } + + public boolean equals(submitImage_args that) { + if (that == null) + return false; + + boolean this_present_serverSessionId = true && this.isSetServerSessionId(); + boolean that_present_serverSessionId = true && that.isSetServerSessionId(); + if (this_present_serverSessionId || that_present_serverSessionId) { + if (!(this_present_serverSessionId && that_present_serverSessionId)) + return false; + if (!this.serverSessionId.equals(that.serverSessionId)) + return false; + } + + boolean this_present_imageDescription = true && this.isSetImageDescription(); + boolean that_present_imageDescription = true && that.isSetImageDescription(); + if (this_present_imageDescription || that_present_imageDescription) { + if (!(this_present_imageDescription && that_present_imageDescription)) + return false; + if (!this.imageDescription.equals(that.imageDescription)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(submitImage_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetServerSessionId()).compareTo(other.isSetServerSessionId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetServerSessionId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverSessionId, other.serverSessionId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageDescription()).compareTo(other.isSetImageDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageDescription, other.imageDescription); + 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("submitImage_args("); + boolean first = true; + + sb.append("serverSessionId:"); + if (this.serverSessionId == null) { + sb.append("null"); + } else { + sb.append(this.serverSessionId); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageDescription:"); + if (this.imageDescription == null) { + sb.append("null"); + } else { + sb.append(this.imageDescription); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (imageDescription != null) { + imageDescription.validate(); + } + } + + 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 { + 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 submitImage_argsStandardSchemeFactory implements SchemeFactory { + public submitImage_argsStandardScheme getScheme() { + return new submitImage_argsStandardScheme(); + } + } + + private static class submitImage_argsStandardScheme extends StandardScheme<submitImage_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, submitImage_args 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: // SERVER_SESSION_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.serverSessionId = iprot.readString(); + struct.setServerSessionIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // IMAGE_DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.imageDescription = new ImageData(); + struct.imageDescription.read(iprot); + struct.setImageDescriptionIsSet(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, submitImage_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.serverSessionId != null) { + oprot.writeFieldBegin(SERVER_SESSION_ID_FIELD_DESC); + oprot.writeString(struct.serverSessionId); + oprot.writeFieldEnd(); + } + if (struct.imageDescription != null) { + oprot.writeFieldBegin(IMAGE_DESCRIPTION_FIELD_DESC); + struct.imageDescription.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class submitImage_argsTupleSchemeFactory implements SchemeFactory { + public submitImage_argsTupleScheme getScheme() { + return new submitImage_argsTupleScheme(); + } + } + + private static class submitImage_argsTupleScheme extends TupleScheme<submitImage_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, submitImage_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetServerSessionId()) { + optionals.set(0); + } + if (struct.isSetImageDescription()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetServerSessionId()) { + oprot.writeString(struct.serverSessionId); + } + if (struct.isSetImageDescription()) { + struct.imageDescription.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, submitImage_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.serverSessionId = iprot.readString(); + struct.setServerSessionIdIsSet(true); + } + if (incoming.get(1)) { + struct.imageDescription = new ImageData(); + struct.imageDescription.read(iprot); + struct.setImageDescriptionIsSet(true); + } + } + } + + } + + public static class submitImage_result implements org.apache.thrift.TBase<submitImage_result, submitImage_result._Fields>, java.io.Serializable, Cloneable, Comparable<submitImage_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("submitImage_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField FAILURE2_FIELD_DESC = new org.apache.thrift.protocol.TField("failure2", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new submitImage_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new submitImage_resultTupleSchemeFactory()); + } + + public FtpCredentials success; // required + public AuthorizationException failure; // required + public ImageDataException failure2; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"), + FAILURE2((short)2, "failure2"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + case 2: // FAILURE2 + return FAILURE2; + 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 + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, FtpCredentials.class))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + tmpMap.put(_Fields.FAILURE2, new org.apache.thrift.meta_data.FieldMetaData("failure2", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(submitImage_result.class, metaDataMap); + } + + public submitImage_result() { + } + + public submitImage_result( + FtpCredentials success, + AuthorizationException failure, + ImageDataException failure2) + { + this(); + this.success = success; + this.failure = failure; + this.failure2 = failure2; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public submitImage_result(submitImage_result other) { + if (other.isSetSuccess()) { + this.success = new FtpCredentials(other.success); + } + if (other.isSetFailure()) { + this.failure = new AuthorizationException(other.failure); + } + if (other.isSetFailure2()) { + this.failure2 = new ImageDataException(other.failure2); + } + } + + public submitImage_result deepCopy() { + return new submitImage_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + this.failure2 = null; + } + + public FtpCredentials getSuccess() { + return this.success; + } + + public submitImage_result setSuccess(FtpCredentials success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public AuthorizationException getFailure() { + return this.failure; + } + + public submitImage_result setFailure(AuthorizationException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public ImageDataException getFailure2() { + return this.failure2; + } + + public submitImage_result setFailure2(ImageDataException failure2) { + this.failure2 = failure2; + return this; + } + + public void unsetFailure2() { + this.failure2 = null; + } + + /** Returns true if field failure2 is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure2() { + return this.failure2 != null; + } + + public void setFailure2IsSet(boolean value) { + if (!value) { + this.failure2 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((FtpCredentials)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((AuthorizationException)value); + } + break; + + case FAILURE2: + if (value == null) { + unsetFailure2(); + } else { + setFailure2((ImageDataException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case FAILURE: + return getFailure(); + + case FAILURE2: + return getFailure2(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + case FAILURE2: + return isSetFailure2(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof submitImage_result) + return this.equals((submitImage_result)that); + return false; + } + + public boolean equals(submitImage_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + boolean this_present_failure2 = true && this.isSetFailure2(); + boolean that_present_failure2 = true && that.isSetFailure2(); + if (this_present_failure2 || that_present_failure2) { + if (!(this_present_failure2 && that_present_failure2)) + return false; + if (!this.failure2.equals(that.failure2)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(submitImage_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure2()).compareTo(other.isSetFailure2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure2, other.failure2); + 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("submitImage_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + if (!first) sb.append(", "); + sb.append("failure2:"); + if (this.failure2 == null) { + sb.append("null"); + } else { + sb.append(this.failure2); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 { + 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 submitImage_resultStandardSchemeFactory implements SchemeFactory { + public submitImage_resultStandardScheme getScheme() { + return new submitImage_resultStandardScheme(); + } + } + + private static class submitImage_resultStandardScheme extends StandardScheme<submitImage_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, submitImage_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new FtpCredentials(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new AuthorizationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // FAILURE2 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure2 = new ImageDataException(); + struct.failure2.read(iprot); + struct.setFailure2IsSet(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, submitImage_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.failure2 != null) { + oprot.writeFieldBegin(FAILURE2_FIELD_DESC); + struct.failure2.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class submitImage_resultTupleSchemeFactory implements SchemeFactory { + public submitImage_resultTupleScheme getScheme() { + return new submitImage_resultTupleScheme(); + } + } + + private static class submitImage_resultTupleScheme extends TupleScheme<submitImage_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, submitImage_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + if (struct.isSetFailure2()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + if (struct.isSetFailure2()) { + struct.failure2.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, submitImage_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.success = new FtpCredentials(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new AuthorizationException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + if (incoming.get(2)) { + struct.failure2 = new ImageDataException(); + struct.failure2.read(iprot); + struct.setFailure2IsSet(true); + } + } + } + + } + + public static class finshedUpload_args implements org.apache.thrift.TBase<finshedUpload_args, finshedUpload_args._Fields>, java.io.Serializable, Cloneable, Comparable<finshedUpload_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("finshedUpload_args"); + + private static final org.apache.thrift.protocol.TField FTP_USER_FIELD_DESC = new org.apache.thrift.protocol.TField("ftpUser", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField IMAGE_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("imageDescription", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new finshedUpload_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new finshedUpload_argsTupleSchemeFactory()); + } + + public String ftpUser; // required + public ImageData imageDescription; // 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 { + FTP_USER((short)1, "ftpUser"), + IMAGE_DESCRIPTION((short)2, "imageDescription"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // FTP_USER + return FTP_USER; + case 2: // IMAGE_DESCRIPTION + return IMAGE_DESCRIPTION; + 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 + 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.FTP_USER, new org.apache.thrift.meta_data.FieldMetaData("ftpUser", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IMAGE_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("imageDescription", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ImageData.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(finshedUpload_args.class, metaDataMap); + } + + public finshedUpload_args() { + } + + public finshedUpload_args( + String ftpUser, + ImageData imageDescription) + { + this(); + this.ftpUser = ftpUser; + this.imageDescription = imageDescription; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public finshedUpload_args(finshedUpload_args other) { + if (other.isSetFtpUser()) { + this.ftpUser = other.ftpUser; + } + if (other.isSetImageDescription()) { + this.imageDescription = new ImageData(other.imageDescription); + } + } + + public finshedUpload_args deepCopy() { + return new finshedUpload_args(this); + } + + @Override + public void clear() { + this.ftpUser = null; + this.imageDescription = null; + } + + public String getFtpUser() { + return this.ftpUser; + } + + public finshedUpload_args setFtpUser(String ftpUser) { + this.ftpUser = ftpUser; + return this; + } + + public void unsetFtpUser() { + this.ftpUser = null; + } + + /** Returns true if field ftpUser is set (has been assigned a value) and false otherwise */ + public boolean isSetFtpUser() { + return this.ftpUser != null; + } + + public void setFtpUserIsSet(boolean value) { + if (!value) { + this.ftpUser = null; + } + } + + public ImageData getImageDescription() { + return this.imageDescription; + } + + public finshedUpload_args setImageDescription(ImageData imageDescription) { + this.imageDescription = imageDescription; + return this; + } + + public void unsetImageDescription() { + this.imageDescription = null; + } + + /** Returns true if field imageDescription is set (has been assigned a value) and false otherwise */ + public boolean isSetImageDescription() { + return this.imageDescription != null; + } + + public void setImageDescriptionIsSet(boolean value) { + if (!value) { + this.imageDescription = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case FTP_USER: + if (value == null) { + unsetFtpUser(); + } else { + setFtpUser((String)value); + } + break; + + case IMAGE_DESCRIPTION: + if (value == null) { + unsetImageDescription(); + } else { + setImageDescription((ImageData)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case FTP_USER: + return getFtpUser(); + + case IMAGE_DESCRIPTION: + return getImageDescription(); + + } + 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 FTP_USER: + return isSetFtpUser(); + case IMAGE_DESCRIPTION: + return isSetImageDescription(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof finshedUpload_args) + return this.equals((finshedUpload_args)that); + return false; + } + + public boolean equals(finshedUpload_args that) { + if (that == null) + return false; + + boolean this_present_ftpUser = true && this.isSetFtpUser(); + boolean that_present_ftpUser = true && that.isSetFtpUser(); + if (this_present_ftpUser || that_present_ftpUser) { + if (!(this_present_ftpUser && that_present_ftpUser)) + return false; + if (!this.ftpUser.equals(that.ftpUser)) + return false; + } + + boolean this_present_imageDescription = true && this.isSetImageDescription(); + boolean that_present_imageDescription = true && that.isSetImageDescription(); + if (this_present_imageDescription || that_present_imageDescription) { + if (!(this_present_imageDescription && that_present_imageDescription)) + return false; + if (!this.imageDescription.equals(that.imageDescription)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(finshedUpload_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetFtpUser()).compareTo(other.isSetFtpUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFtpUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ftpUser, other.ftpUser); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImageDescription()).compareTo(other.isSetImageDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageDescription, other.imageDescription); + 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("finshedUpload_args("); + boolean first = true; + + sb.append("ftpUser:"); + if (this.ftpUser == null) { + sb.append("null"); + } else { + sb.append(this.ftpUser); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageDescription:"); + if (this.imageDescription == null) { + sb.append("null"); + } else { + sb.append(this.imageDescription); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (imageDescription != null) { + imageDescription.validate(); + } + } + + 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 { + 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 finshedUpload_argsStandardSchemeFactory implements SchemeFactory { + public finshedUpload_argsStandardScheme getScheme() { + return new finshedUpload_argsStandardScheme(); + } + } + + private static class finshedUpload_argsStandardScheme extends StandardScheme<finshedUpload_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, finshedUpload_args 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: // FTP_USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.ftpUser = iprot.readString(); + struct.setFtpUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // IMAGE_DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.imageDescription = new ImageData(); + struct.imageDescription.read(iprot); + struct.setImageDescriptionIsSet(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, finshedUpload_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.ftpUser != null) { + oprot.writeFieldBegin(FTP_USER_FIELD_DESC); + oprot.writeString(struct.ftpUser); + oprot.writeFieldEnd(); + } + if (struct.imageDescription != null) { + oprot.writeFieldBegin(IMAGE_DESCRIPTION_FIELD_DESC); + struct.imageDescription.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class finshedUpload_argsTupleSchemeFactory implements SchemeFactory { + public finshedUpload_argsTupleScheme getScheme() { + return new finshedUpload_argsTupleScheme(); + } + } + + private static class finshedUpload_argsTupleScheme extends TupleScheme<finshedUpload_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, finshedUpload_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetFtpUser()) { + optionals.set(0); + } + if (struct.isSetImageDescription()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetFtpUser()) { + oprot.writeString(struct.ftpUser); + } + if (struct.isSetImageDescription()) { + struct.imageDescription.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, finshedUpload_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.ftpUser = iprot.readString(); + struct.setFtpUserIsSet(true); + } + if (incoming.get(1)) { + struct.imageDescription = new ImageData(); + struct.imageDescription.read(iprot); + struct.setImageDescriptionIsSet(true); + } + } + } + + } + + public static class finshedUpload_result implements org.apache.thrift.TBase<finshedUpload_result, finshedUpload_result._Fields>, java.io.Serializable, Cloneable, Comparable<finshedUpload_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("finshedUpload_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new finshedUpload_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new finshedUpload_resultTupleSchemeFactory()); + } + + public boolean success; // required + public ImageDataException failure; // 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 { + SUCCESS((short)0, "success"), + FAILURE((short)1, "failure"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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 0: // SUCCESS + return SUCCESS; + case 1: // FAILURE + return FAILURE; + 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 __SUCCESS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(finshedUpload_result.class, metaDataMap); + } + + public finshedUpload_result() { + } + + public finshedUpload_result( + boolean success, + ImageDataException failure) + { + this(); + this.success = success; + setSuccessIsSet(true); + this.failure = failure; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public finshedUpload_result(finshedUpload_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + if (other.isSetFailure()) { + this.failure = new ImageDataException(other.failure); + } + } + + public finshedUpload_result deepCopy() { + return new finshedUpload_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + this.failure = null; + } + + public boolean isSuccess() { + return this.success; + } + + public finshedUpload_result setSuccess(boolean success) { + this.success = success; + setSuccessIsSet(true); + return this; + } + + public void unsetSuccess() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + } + + public ImageDataException getFailure() { + return this.failure; + } + + public finshedUpload_result setFailure(ImageDataException failure) { + this.failure = failure; + return this; + } + + public void unsetFailure() { + this.failure = null; + } + + /** Returns true if field failure is set (has been assigned a value) and false otherwise */ + public boolean isSetFailure() { + return this.failure != null; + } + + public void setFailureIsSet(boolean value) { + if (!value) { + this.failure = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Boolean)value); + } + break; + + case FAILURE: + if (value == null) { + unsetFailure(); + } else { + setFailure((ImageDataException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return Boolean.valueOf(isSuccess()); + + case FAILURE: + return getFailure(); + + } + 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 SUCCESS: + return isSetSuccess(); + case FAILURE: + return isSetFailure(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof finshedUpload_result) + return this.equals((finshedUpload_result)that); + return false; + } + + public boolean equals(finshedUpload_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + boolean this_present_failure = true && this.isSetFailure(); + boolean that_present_failure = true && that.isSetFailure(); + if (this_present_failure || that_present_failure) { + if (!(this_present_failure && that_present_failure)) + return false; + if (!this.failure.equals(that.failure)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(finshedUpload_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailure()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); + 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("finshedUpload_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + if (!first) sb.append(", "); + sb.append("failure:"); + if (this.failure == null) { + sb.append("null"); + } else { + sb.append(this.failure); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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_bitfield = 0; + 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 finshedUpload_resultStandardSchemeFactory implements SchemeFactory { + public finshedUpload_resultStandardScheme getScheme() { + return new finshedUpload_resultStandardScheme(); + } + } + + private static class finshedUpload_resultStandardScheme extends StandardScheme<finshedUpload_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, finshedUpload_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // FAILURE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.failure = new ImageDataException(); + struct.failure.read(iprot); + struct.setFailureIsSet(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, finshedUpload_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + } + if (struct.failure != null) { + oprot.writeFieldBegin(FAILURE_FIELD_DESC); + struct.failure.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class finshedUpload_resultTupleSchemeFactory implements SchemeFactory { + public finshedUpload_resultTupleScheme getScheme() { + return new finshedUpload_resultTupleScheme(); + } + } + + private static class finshedUpload_resultTupleScheme extends TupleScheme<finshedUpload_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, finshedUpload_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetFailure()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + oprot.writeBool(struct.success); + } + if (struct.isSetFailure()) { + struct.failure.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, finshedUpload_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.failure = new ImageDataException(); + struct.failure.read(iprot); + struct.setFailureIsSet(true); + } + } + } + + } + +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java new file mode 100644 index 0000000..e163c4f --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java @@ -0,0 +1,280 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 InvalidTokenException extends TException implements org.apache.thrift.TBase<InvalidTokenException, InvalidTokenException._Fields>, java.io.Serializable, Cloneable, Comparable<InvalidTokenException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidTokenException"); + + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new InvalidTokenExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new InvalidTokenExceptionTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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) { + 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; + } + } + 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); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidTokenException.class, metaDataMap); + } + + public InvalidTokenException() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public InvalidTokenException(InvalidTokenException other) { + } + + public InvalidTokenException deepCopy() { + return new InvalidTokenException(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + 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) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof InvalidTokenException) + return this.equals((InvalidTokenException)that); + return false; + } + + public boolean equals(InvalidTokenException that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(InvalidTokenException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("InvalidTokenException("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 InvalidTokenExceptionStandardSchemeFactory implements SchemeFactory { + public InvalidTokenExceptionStandardScheme getScheme() { + return new InvalidTokenExceptionStandardScheme(); + } + } + + private static class InvalidTokenExceptionStandardScheme extends StandardScheme<InvalidTokenException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidTokenException 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) { + 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, InvalidTokenException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class InvalidTokenExceptionTupleSchemeFactory implements SchemeFactory { + public InvalidTokenExceptionTupleScheme getScheme() { + return new InvalidTokenExceptionTupleScheme(); + } + } + + private static class InvalidTokenExceptionTupleScheme extends TupleScheme<InvalidTokenException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, InvalidTokenException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, InvalidTokenException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java new file mode 100644 index 0000000..f813d0d --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java @@ -0,0 +1,48 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum ServerAuthenticationError implements org.apache.thrift.TEnum { + GENERIC_ERROR(0), + INVALID_ORGANIZATION(1), + BANNED_NETWORK(2); + + private final int value; + + private ServerAuthenticationError(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static ServerAuthenticationError findByValue(int value) { + switch (value) { + case 0: + return GENERIC_ERROR; + case 1: + return INVALID_ORGANIZATION; + case 2: + return BANNED_NETWORK; + default: + return null; + } + } +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java new file mode 100644 index 0000000..69c29b7 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java @@ -0,0 +1,504 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 ServerAuthenticationException extends TException implements org.apache.thrift.TBase<ServerAuthenticationException, ServerAuthenticationException._Fields>, java.io.Serializable, Cloneable, Comparable<ServerAuthenticationException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServerAuthenticationException"); + + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ServerAuthenticationExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ServerAuthenticationExceptionTupleSchemeFactory()); + } + + /** + * + * @see ServerAuthenticationError + */ + public ServerAuthenticationError number; // required + public String message; // 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 { + /** + * + * @see ServerAuthenticationError + */ + NUMBER((short)1, "number"), + MESSAGE((short)2, "message"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // NUMBER + return NUMBER; + case 2: // MESSAGE + return MESSAGE; + 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 + 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.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ServerAuthenticationError.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ServerAuthenticationException.class, metaDataMap); + } + + public ServerAuthenticationException() { + } + + public ServerAuthenticationException( + ServerAuthenticationError number, + String message) + { + this(); + this.number = number; + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ServerAuthenticationException(ServerAuthenticationException other) { + if (other.isSetNumber()) { + this.number = other.number; + } + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public ServerAuthenticationException deepCopy() { + return new ServerAuthenticationException(this); + } + + @Override + public void clear() { + this.number = null; + this.message = null; + } + + /** + * + * @see ServerAuthenticationError + */ + public ServerAuthenticationError getNumber() { + return this.number; + } + + /** + * + * @see ServerAuthenticationError + */ + public ServerAuthenticationException setNumber(ServerAuthenticationError number) { + this.number = number; + return this; + } + + public void unsetNumber() { + this.number = null; + } + + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; + } + + public void setNumberIsSet(boolean value) { + if (!value) { + this.number = null; + } + } + + public String getMessage() { + return this.message; + } + + public ServerAuthenticationException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NUMBER: + if (value == null) { + unsetNumber(); + } else { + setNumber((ServerAuthenticationError)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NUMBER: + return getNumber(); + + case MESSAGE: + return getMessage(); + + } + 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 NUMBER: + return isSetNumber(); + case MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ServerAuthenticationException) + return this.equals((ServerAuthenticationException)that); + return false; + } + + public boolean equals(ServerAuthenticationException that) { + if (that == null) + return false; + + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) + return false; + if (!this.number.equals(that.number)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ServerAuthenticationException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + 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("ServerAuthenticationException("); + boolean first = true; + + sb.append("number:"); + if (this.number == null) { + sb.append("null"); + } else { + sb.append(this.number); + } + first = false; + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 ServerAuthenticationExceptionStandardSchemeFactory implements SchemeFactory { + public ServerAuthenticationExceptionStandardScheme getScheme() { + return new ServerAuthenticationExceptionStandardScheme(); + } + } + + private static class ServerAuthenticationExceptionStandardScheme extends StandardScheme<ServerAuthenticationException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ServerAuthenticationException 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: // NUMBER + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.number = ServerAuthenticationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(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, ServerAuthenticationException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ServerAuthenticationExceptionTupleSchemeFactory implements SchemeFactory { + public ServerAuthenticationExceptionTupleScheme getScheme() { + return new ServerAuthenticationExceptionTupleScheme(); + } + } + + private static class ServerAuthenticationExceptionTupleScheme extends TupleScheme<ServerAuthenticationException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ServerAuthenticationException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNumber()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ServerAuthenticationException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.number = ServerAuthenticationError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java new file mode 100644 index 0000000..8f8893a --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java @@ -0,0 +1,388 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 ServerSessionData implements org.apache.thrift.TBase<ServerSessionData, ServerSessionData._Fields>, java.io.Serializable, Cloneable, Comparable<ServerSessionData> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServerSessionData"); + + private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ServerSessionDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ServerSessionDataTupleSchemeFactory()); + } + + public String sessionId; // 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 { + SESSION_ID((short)1, "sessionId"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // SESSION_ID + return SESSION_ID; + 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 + 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.SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("sessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "ID"))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ServerSessionData.class, metaDataMap); + } + + public ServerSessionData() { + } + + public ServerSessionData( + String sessionId) + { + this(); + this.sessionId = sessionId; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ServerSessionData(ServerSessionData other) { + if (other.isSetSessionId()) { + this.sessionId = other.sessionId; + } + } + + public ServerSessionData deepCopy() { + return new ServerSessionData(this); + } + + @Override + public void clear() { + this.sessionId = null; + } + + public String getSessionId() { + return this.sessionId; + } + + public ServerSessionData setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + public void unsetSessionId() { + this.sessionId = null; + } + + /** Returns true if field sessionId is set (has been assigned a value) and false otherwise */ + public boolean isSetSessionId() { + return this.sessionId != null; + } + + public void setSessionIdIsSet(boolean value) { + if (!value) { + this.sessionId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SESSION_ID: + if (value == null) { + unsetSessionId(); + } else { + setSessionId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SESSION_ID: + return getSessionId(); + + } + 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 SESSION_ID: + return isSetSessionId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ServerSessionData) + return this.equals((ServerSessionData)that); + return false; + } + + public boolean equals(ServerSessionData that) { + if (that == null) + return false; + + boolean this_present_sessionId = true && this.isSetSessionId(); + boolean that_present_sessionId = true && that.isSetSessionId(); + if (this_present_sessionId || that_present_sessionId) { + if (!(this_present_sessionId && that_present_sessionId)) + return false; + if (!this.sessionId.equals(that.sessionId)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ServerSessionData other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSessionId()).compareTo(other.isSetSessionId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSessionId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionId, other.sessionId); + 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("ServerSessionData("); + boolean first = true; + + sb.append("sessionId:"); + if (this.sessionId == null) { + sb.append("null"); + } else { + sb.append(this.sessionId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 ServerSessionDataStandardSchemeFactory implements SchemeFactory { + public ServerSessionDataStandardScheme getScheme() { + return new ServerSessionDataStandardScheme(); + } + } + + private static class ServerSessionDataStandardScheme extends StandardScheme<ServerSessionData> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ServerSessionData 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: // SESSION_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.sessionId = iprot.readString(); + struct.setSessionIdIsSet(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, ServerSessionData struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.sessionId != null) { + oprot.writeFieldBegin(SESSION_ID_FIELD_DESC); + oprot.writeString(struct.sessionId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ServerSessionDataTupleSchemeFactory implements SchemeFactory { + public ServerSessionDataTupleScheme getScheme() { + return new ServerSessionDataTupleScheme(); + } + } + + private static class ServerSessionDataTupleScheme extends TupleScheme<ServerSessionData> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ServerSessionData struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSessionId()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSessionId()) { + oprot.writeString(struct.sessionId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ServerSessionData struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.sessionId = iprot.readString(); + struct.setSessionIdIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java new file mode 100644 index 0000000..711abeb --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java @@ -0,0 +1,588 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 SessionData implements org.apache.thrift.TBase<SessionData, SessionData._Fields>, java.io.Serializable, Cloneable, Comparable<SessionData> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SessionData"); + + private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField AUTH_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authToken", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField SERVER_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("serverAddress", org.apache.thrift.protocol.TType.STRING, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new SessionDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new SessionDataTupleSchemeFactory()); + } + + public String sessionId; // required + public String authToken; // required + public String serverAddress; // 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 { + SESSION_ID((short)1, "sessionId"), + AUTH_TOKEN((short)2, "authToken"), + SERVER_ADDRESS((short)3, "serverAddress"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // SESSION_ID + return SESSION_ID; + case 2: // AUTH_TOKEN + return AUTH_TOKEN; + case 3: // SERVER_ADDRESS + return SERVER_ADDRESS; + 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 + 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.SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("sessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "ID"))); + tmpMap.put(_Fields.AUTH_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authToken", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Token"))); + tmpMap.put(_Fields.SERVER_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("serverAddress", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SessionData.class, metaDataMap); + } + + public SessionData() { + } + + public SessionData( + String sessionId, + String authToken, + String serverAddress) + { + this(); + this.sessionId = sessionId; + this.authToken = authToken; + this.serverAddress = serverAddress; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public SessionData(SessionData other) { + if (other.isSetSessionId()) { + this.sessionId = other.sessionId; + } + if (other.isSetAuthToken()) { + this.authToken = other.authToken; + } + if (other.isSetServerAddress()) { + this.serverAddress = other.serverAddress; + } + } + + public SessionData deepCopy() { + return new SessionData(this); + } + + @Override + public void clear() { + this.sessionId = null; + this.authToken = null; + this.serverAddress = null; + } + + public String getSessionId() { + return this.sessionId; + } + + public SessionData setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + public void unsetSessionId() { + this.sessionId = null; + } + + /** Returns true if field sessionId is set (has been assigned a value) and false otherwise */ + public boolean isSetSessionId() { + return this.sessionId != null; + } + + public void setSessionIdIsSet(boolean value) { + if (!value) { + this.sessionId = null; + } + } + + public String getAuthToken() { + return this.authToken; + } + + public SessionData setAuthToken(String authToken) { + this.authToken = authToken; + return this; + } + + public void unsetAuthToken() { + this.authToken = null; + } + + /** Returns true if field authToken is set (has been assigned a value) and false otherwise */ + public boolean isSetAuthToken() { + return this.authToken != null; + } + + public void setAuthTokenIsSet(boolean value) { + if (!value) { + this.authToken = null; + } + } + + public String getServerAddress() { + return this.serverAddress; + } + + public SessionData setServerAddress(String serverAddress) { + this.serverAddress = serverAddress; + return this; + } + + public void unsetServerAddress() { + this.serverAddress = null; + } + + /** Returns true if field serverAddress is set (has been assigned a value) and false otherwise */ + public boolean isSetServerAddress() { + return this.serverAddress != null; + } + + public void setServerAddressIsSet(boolean value) { + if (!value) { + this.serverAddress = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SESSION_ID: + if (value == null) { + unsetSessionId(); + } else { + setSessionId((String)value); + } + break; + + case AUTH_TOKEN: + if (value == null) { + unsetAuthToken(); + } else { + setAuthToken((String)value); + } + break; + + case SERVER_ADDRESS: + if (value == null) { + unsetServerAddress(); + } else { + setServerAddress((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SESSION_ID: + return getSessionId(); + + case AUTH_TOKEN: + return getAuthToken(); + + case SERVER_ADDRESS: + return getServerAddress(); + + } + 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 SESSION_ID: + return isSetSessionId(); + case AUTH_TOKEN: + return isSetAuthToken(); + case SERVER_ADDRESS: + return isSetServerAddress(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof SessionData) + return this.equals((SessionData)that); + return false; + } + + public boolean equals(SessionData that) { + if (that == null) + return false; + + boolean this_present_sessionId = true && this.isSetSessionId(); + boolean that_present_sessionId = true && that.isSetSessionId(); + if (this_present_sessionId || that_present_sessionId) { + if (!(this_present_sessionId && that_present_sessionId)) + return false; + if (!this.sessionId.equals(that.sessionId)) + return false; + } + + boolean this_present_authToken = true && this.isSetAuthToken(); + boolean that_present_authToken = true && that.isSetAuthToken(); + if (this_present_authToken || that_present_authToken) { + if (!(this_present_authToken && that_present_authToken)) + return false; + if (!this.authToken.equals(that.authToken)) + return false; + } + + boolean this_present_serverAddress = true && this.isSetServerAddress(); + boolean that_present_serverAddress = true && that.isSetServerAddress(); + if (this_present_serverAddress || that_present_serverAddress) { + if (!(this_present_serverAddress && that_present_serverAddress)) + return false; + if (!this.serverAddress.equals(that.serverAddress)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(SessionData other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSessionId()).compareTo(other.isSetSessionId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSessionId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionId, other.sessionId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAuthToken()).compareTo(other.isSetAuthToken()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAuthToken()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authToken, other.authToken); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetServerAddress()).compareTo(other.isSetServerAddress()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetServerAddress()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverAddress, other.serverAddress); + 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("SessionData("); + boolean first = true; + + sb.append("sessionId:"); + if (this.sessionId == null) { + sb.append("null"); + } else { + sb.append(this.sessionId); + } + first = false; + if (!first) sb.append(", "); + sb.append("authToken:"); + if (this.authToken == null) { + sb.append("null"); + } else { + sb.append(this.authToken); + } + first = false; + if (!first) sb.append(", "); + sb.append("serverAddress:"); + if (this.serverAddress == null) { + sb.append("null"); + } else { + sb.append(this.serverAddress); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 SessionDataStandardSchemeFactory implements SchemeFactory { + public SessionDataStandardScheme getScheme() { + return new SessionDataStandardScheme(); + } + } + + private static class SessionDataStandardScheme extends StandardScheme<SessionData> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, SessionData 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: // SESSION_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.sessionId = iprot.readString(); + struct.setSessionIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // AUTH_TOKEN + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.authToken = iprot.readString(); + struct.setAuthTokenIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // SERVER_ADDRESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.serverAddress = iprot.readString(); + struct.setServerAddressIsSet(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, SessionData struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.sessionId != null) { + oprot.writeFieldBegin(SESSION_ID_FIELD_DESC); + oprot.writeString(struct.sessionId); + oprot.writeFieldEnd(); + } + if (struct.authToken != null) { + oprot.writeFieldBegin(AUTH_TOKEN_FIELD_DESC); + oprot.writeString(struct.authToken); + oprot.writeFieldEnd(); + } + if (struct.serverAddress != null) { + oprot.writeFieldBegin(SERVER_ADDRESS_FIELD_DESC); + oprot.writeString(struct.serverAddress); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class SessionDataTupleSchemeFactory implements SchemeFactory { + public SessionDataTupleScheme getScheme() { + return new SessionDataTupleScheme(); + } + } + + private static class SessionDataTupleScheme extends TupleScheme<SessionData> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, SessionData struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSessionId()) { + optionals.set(0); + } + if (struct.isSetAuthToken()) { + optionals.set(1); + } + if (struct.isSetServerAddress()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetSessionId()) { + oprot.writeString(struct.sessionId); + } + if (struct.isSetAuthToken()) { + oprot.writeString(struct.authToken); + } + if (struct.isSetServerAddress()) { + oprot.writeString(struct.serverAddress); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, SessionData struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.sessionId = iprot.readString(); + struct.setSessionIdIsSet(true); + } + if (incoming.get(1)) { + struct.authToken = iprot.readString(); + struct.setAuthTokenIsSet(true); + } + if (incoming.get(2)) { + struct.serverAddress = iprot.readString(); + struct.setServerAddressIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java new file mode 100644 index 0000000..67f9340 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java @@ -0,0 +1,688 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +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 org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +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 UserInfo implements org.apache.thrift.TBase<UserInfo, UserInfo._Fields>, java.io.Serializable, Cloneable, Comparable<UserInfo> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo"); + + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField FIRST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("firstName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField LAST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastName", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField E_MAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("eMail", org.apache.thrift.protocol.TType.STRING, (short)4); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new UserInfoStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserInfoTupleSchemeFactory()); + } + + public String userId; // required + public String firstName; // required + public String lastName; // required + public String eMail; // 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 { + USER_ID((short)1, "userId"), + FIRST_NAME((short)2, "firstName"), + LAST_NAME((short)3, "lastName"), + E_MAIL((short)4, "eMail"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + 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: // USER_ID + return USER_ID; + case 2: // FIRST_NAME + return FIRST_NAME; + case 3: // LAST_NAME + return LAST_NAME; + case 4: // E_MAIL + return E_MAIL; + 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 + 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.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.FIRST_NAME, new org.apache.thrift.meta_data.FieldMetaData("firstName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.LAST_NAME, new org.apache.thrift.meta_data.FieldMetaData("lastName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.E_MAIL, new org.apache.thrift.meta_data.FieldMetaData("eMail", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserInfo.class, metaDataMap); + } + + public UserInfo() { + } + + public UserInfo( + String userId, + String firstName, + String lastName, + String eMail) + { + this(); + this.userId = userId; + this.firstName = firstName; + this.lastName = lastName; + this.eMail = eMail; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public UserInfo(UserInfo other) { + if (other.isSetUserId()) { + this.userId = other.userId; + } + if (other.isSetFirstName()) { + this.firstName = other.firstName; + } + if (other.isSetLastName()) { + this.lastName = other.lastName; + } + if (other.isSetEMail()) { + this.eMail = other.eMail; + } + } + + public UserInfo deepCopy() { + return new UserInfo(this); + } + + @Override + public void clear() { + this.userId = null; + this.firstName = null; + this.lastName = null; + this.eMail = null; + } + + public String getUserId() { + return this.userId; + } + + public UserInfo setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public String getFirstName() { + return this.firstName; + } + + public UserInfo setFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + public void unsetFirstName() { + this.firstName = null; + } + + /** Returns true if field firstName is set (has been assigned a value) and false otherwise */ + public boolean isSetFirstName() { + return this.firstName != null; + } + + public void setFirstNameIsSet(boolean value) { + if (!value) { + this.firstName = null; + } + } + + public String getLastName() { + return this.lastName; + } + + public UserInfo setLastName(String lastName) { + this.lastName = lastName; + return this; + } + + public void unsetLastName() { + this.lastName = null; + } + + /** Returns true if field lastName is set (has been assigned a value) and false otherwise */ + public boolean isSetLastName() { + return this.lastName != null; + } + + public void setLastNameIsSet(boolean value) { + if (!value) { + this.lastName = null; + } + } + + public String getEMail() { + return this.eMail; + } + + public UserInfo setEMail(String eMail) { + this.eMail = eMail; + return this; + } + + public void unsetEMail() { + this.eMail = null; + } + + /** Returns true if field eMail is set (has been assigned a value) and false otherwise */ + public boolean isSetEMail() { + return this.eMail != null; + } + + public void setEMailIsSet(boolean value) { + if (!value) { + this.eMail = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String)value); + } + break; + + case FIRST_NAME: + if (value == null) { + unsetFirstName(); + } else { + setFirstName((String)value); + } + break; + + case LAST_NAME: + if (value == null) { + unsetLastName(); + } else { + setLastName((String)value); + } + break; + + case E_MAIL: + if (value == null) { + unsetEMail(); + } else { + setEMail((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER_ID: + return getUserId(); + + case FIRST_NAME: + return getFirstName(); + + case LAST_NAME: + return getLastName(); + + case E_MAIL: + return getEMail(); + + } + 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 USER_ID: + return isSetUserId(); + case FIRST_NAME: + return isSetFirstName(); + case LAST_NAME: + return isSetLastName(); + case E_MAIL: + return isSetEMail(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof UserInfo) + return this.equals((UserInfo)that); + return false; + } + + public boolean equals(UserInfo that) { + if (that == null) + return false; + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) + return false; + if (!this.userId.equals(that.userId)) + return false; + } + + boolean this_present_firstName = true && this.isSetFirstName(); + boolean that_present_firstName = true && that.isSetFirstName(); + if (this_present_firstName || that_present_firstName) { + if (!(this_present_firstName && that_present_firstName)) + return false; + if (!this.firstName.equals(that.firstName)) + return false; + } + + boolean this_present_lastName = true && this.isSetLastName(); + boolean that_present_lastName = true && that.isSetLastName(); + if (this_present_lastName || that_present_lastName) { + if (!(this_present_lastName && that_present_lastName)) + return false; + if (!this.lastName.equals(that.lastName)) + return false; + } + + boolean this_present_eMail = true && this.isSetEMail(); + boolean that_present_eMail = true && that.isSetEMail(); + if (this_present_eMail || that_present_eMail) { + if (!(this_present_eMail && that_present_eMail)) + return false; + if (!this.eMail.equals(that.eMail)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(UserInfo other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFirstName()).compareTo(other.isSetFirstName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFirstName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstName, other.firstName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLastName()).compareTo(other.isSetLastName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLastName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastName, other.lastName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetEMail()).compareTo(other.isSetEMail()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetEMail()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eMail, other.eMail); + 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("UserInfo("); + boolean first = true; + + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("firstName:"); + if (this.firstName == null) { + sb.append("null"); + } else { + sb.append(this.firstName); + } + first = false; + if (!first) sb.append(", "); + sb.append("lastName:"); + if (this.lastName == null) { + sb.append("null"); + } else { + sb.append(this.lastName); + } + first = false; + if (!first) sb.append(", "); + sb.append("eMail:"); + if (this.eMail == null) { + sb.append("null"); + } else { + sb.append(this.eMail); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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 UserInfoStandardSchemeFactory implements SchemeFactory { + public UserInfoStandardScheme getScheme() { + return new UserInfoStandardScheme(); + } + } + + private static class UserInfoStandardScheme extends StandardScheme<UserInfo> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserInfo 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: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // FIRST_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.firstName = iprot.readString(); + struct.setFirstNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // LAST_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.lastName = iprot.readString(); + struct.setLastNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // E_MAIL + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.eMail = iprot.readString(); + struct.setEMailIsSet(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, UserInfo struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + if (struct.firstName != null) { + oprot.writeFieldBegin(FIRST_NAME_FIELD_DESC); + oprot.writeString(struct.firstName); + oprot.writeFieldEnd(); + } + if (struct.lastName != null) { + oprot.writeFieldBegin(LAST_NAME_FIELD_DESC); + oprot.writeString(struct.lastName); + oprot.writeFieldEnd(); + } + if (struct.eMail != null) { + oprot.writeFieldBegin(E_MAIL_FIELD_DESC); + oprot.writeString(struct.eMail); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class UserInfoTupleSchemeFactory implements SchemeFactory { + public UserInfoTupleScheme getScheme() { + return new UserInfoTupleScheme(); + } + } + + private static class UserInfoTupleScheme extends TupleScheme<UserInfo> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserId()) { + optionals.set(0); + } + if (struct.isSetFirstName()) { + optionals.set(1); + } + if (struct.isSetLastName()) { + optionals.set(2); + } + if (struct.isSetEMail()) { + optionals.set(3); + } + oprot.writeBitSet(optionals, 4); + if (struct.isSetUserId()) { + oprot.writeString(struct.userId); + } + if (struct.isSetFirstName()) { + oprot.writeString(struct.firstName); + } + if (struct.isSetLastName()) { + oprot.writeString(struct.lastName); + } + if (struct.isSetEMail()) { + oprot.writeString(struct.eMail); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(4); + if (incoming.get(0)) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } + if (incoming.get(1)) { + struct.firstName = iprot.readString(); + struct.setFirstNameIsSet(true); + } + if (incoming.get(2)) { + struct.lastName = iprot.readString(); + struct.setLastNameIsSet(true); + } + if (incoming.get(3)) { + struct.eMail = iprot.readString(); + struct.setEMailIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java new file mode 100644 index 0000000..9eb1cd6 --- /dev/null +++ b/src/main/java/org/openslx/satellitedaemon/App.java @@ -0,0 +1,56 @@ +package org.openslx.satellitedaemon; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.security.InvalidKeyException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.SignatureException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.UUID; + +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.openslx.imagemaster.thrift.iface.FtpCredentials; +import org.openslx.imagemaster.thrift.iface.ImageData; +import org.openslx.imagemaster.thrift.iface.ImageServer; +import org.openslx.imagemaster.thrift.iface.ServerSessionData; +import org.openslx.satellitedaemon.util.RndStringEncrypt; + +/** + * HS Server. + * + */ +public class App { + public static void main(String[] args) throws UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException, IOException, InvalidKeyException, SignatureException { + try { + TTransport transport; + + transport = new TSocket("132.230.4.23", 9090); //Nils IP + transport.open(); + + TProtocol protocol = new TBinaryProtocol(transport); + ImageServer.Client client = new ImageServer.Client( + protocol); + + String rnd = client.startServerAuthentication("uni-freiburg.de"); + System.out.println(rnd); + + RndStringEncrypt rse = new RndStringEncrypt("serverid", "password", "/home/michael/satellite-daemon/config/serverid.jks"); + byte[] byteArray = rse.encryptRndString(rnd); + ServerSessionData sSD = client.serverAuthenticate("uni-freiburg.de", ByteBuffer.wrap(byteArray)); + System.out.println(sSD.sessionId); + ImageData imDat = new ImageData(UUID.randomUUID().toString(), 113, "TestImage", 100, 105, "me", "anyThing", true, false, "theBest", "theVeryBest", 1024 ); + FtpCredentials ftpc = client.submitImage(sSD.sessionId, imDat); + + transport.close(); + } catch (TException x) { + x.printStackTrace(); + } + } +} diff --git a/src/main/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtil.java b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtil.java new file mode 100644 index 0000000..d83c0ea --- /dev/null +++ b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtil.java @@ -0,0 +1,88 @@ +package org.openslx.satellitedaemon.ftp; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.apache.commons.net.ftp.FTPClient; + +public class FtpUpDownUtil { + /** + * FTP-Dateienliste. + * @return String-Array der Dateinamen auf dem FTP-Server + */ + public static String[] list( String host, int port, String usr, String pwd ) throws IOException + { + FTPClient ftpClient = new FTPClient(); + String[] filenameList; + + try { + ftpClient.connect( host, port ); + ftpClient.login( usr, pwd ); + filenameList = ftpClient.listNames(); + ftpClient.logout(); + } finally { + ftpClient.disconnect(); + } + + return filenameList; + } + + /** + * FTP-Client-Download. + * @return true falls ok + */ + public static boolean download( String localResultFile, String remoteSourceFile, + String host, int port, String usr, String pwd, boolean showMessages ) throws IOException + { + FTPClient ftpClient = new FTPClient(); + FileOutputStream fos = null; + boolean resultOk = true; + + try { + ftpClient.connect( host, port ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + resultOk &= ftpClient.login( usr, pwd ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + fos = new FileOutputStream( localResultFile ); + resultOk &= ftpClient.retrieveFile( remoteSourceFile, fos ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + resultOk &= ftpClient.logout(); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + } finally { + try { if( fos != null ) { fos.close(); } } catch( IOException e ) {/* nothing to do */} + ftpClient.disconnect(); + } + + return resultOk; + } + + /** + * FTP-Client-Upload. + * @return true falls ok + */ + public static boolean upload( String localSourceFile, String remoteResultFile, + String host, int port, String usr, String pwd, boolean showMessages ) throws IOException + { + FTPClient ftpClient = new FTPClient(); + FileInputStream fis = null; + boolean resultOk = true; + + try { + ftpClient.connect( host, port ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + resultOk &= ftpClient.login( usr, pwd ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + fis = new FileInputStream( localSourceFile ); + resultOk &= ftpClient.storeFile( remoteResultFile, fis ); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + resultOk &= ftpClient.logout(); + if( showMessages ) { System.out.println( ftpClient.getReplyString() ); } + } finally { + try { if( fis != null ) { fis.close(); } } catch( IOException e ) {/* nothing to do */} + ftpClient.disconnect(); + } + + return resultOk; + } +} diff --git a/src/main/java/org/openslx/satellitedaemon/util/RndStringEncrypt.java b/src/main/java/org/openslx/satellitedaemon/util/RndStringEncrypt.java new file mode 100644 index 0000000..c99a768 --- /dev/null +++ b/src/main/java/org/openslx/satellitedaemon/util/RndStringEncrypt.java @@ -0,0 +1,50 @@ +package org.openslx.satellitedaemon.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.KeyPair; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.Signature; +import java.security.SignatureException; +import java.security.UnrecoverableKeyException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; + +public class RndStringEncrypt { + + KeyPair pair; + + public RndStringEncrypt(String alias, String password, String file) + throws NoSuchAlgorithmException, CertificateException, + FileNotFoundException, IOException, KeyStoreException, + UnrecoverableKeyException { + KeyStore keystore = KeyStore.getInstance("JKS"); + keystore.load(new FileInputStream(new File(file)), + password.toCharArray()); + Certificate cert = null; + + Key key = keystore.getKey(alias, password.toCharArray()); + + if (key instanceof PrivateKey) { + cert = keystore.getCertificate(alias); + PublicKey publicKey = cert.getPublicKey(); + pair = new KeyPair(publicKey, (PrivateKey) key); + } + } + + public byte[] encryptRndString(String message) throws NoSuchAlgorithmException, + InvalidKeyException, SignatureException { + Signature signature = Signature.getInstance("SHA256WITHRSA"); + signature.initSign(pair.getPrivate()); + signature.update(message.getBytes()); + return signature.sign(); + } +} diff --git a/src/test/java/org/openslx/satellitedaemon/AppTest.java b/src/test/java/org/openslx/satellitedaemon/AppTest.java new file mode 100644 index 0000000..ff5320c --- /dev/null +++ b/src/test/java/org/openslx/satellitedaemon/AppTest.java @@ -0,0 +1,38 @@ +package org.openslx.satellitedaemon; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/src/test/java/org/openslx/satellitedaemon/ftp/FtpTestUtil.java b/src/test/java/org/openslx/satellitedaemon/ftp/FtpTestUtil.java new file mode 100644 index 0000000..44d14c5 --- /dev/null +++ b/src/test/java/org/openslx/satellitedaemon/ftp/FtpTestUtil.java @@ -0,0 +1,111 @@ +package org.openslx.satellitedaemon.ftp; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; + +import org.apache.ftpserver.ConnectionConfigFactory; +import org.apache.ftpserver.FtpServer; +import org.apache.ftpserver.FtpServerFactory; +import org.apache.ftpserver.ftplet.Authority; +import org.apache.ftpserver.ftplet.FtpException; +import org.apache.ftpserver.ftplet.UserManager; +import org.apache.ftpserver.listener.ListenerFactory; +import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; +import org.apache.ftpserver.usermanager.SaltedPasswordEncryptor; +import org.apache.ftpserver.usermanager.impl.BaseUser; +import org.apache.ftpserver.usermanager.impl.WritePermission; + +/** + * FTP-Test-Utility, basierend auf Apache FtpServer: {@link http + * ://www.jarvana.com + * /jarvana/view/org/apache/ftpserver/ftpserver-core/1.0.6/ftpserver + * -core-1.0.6-javadoc.jar!/org/apache/ftpserver/FtpServer.html} + */ +public class FtpTestUtil { + /** + * Erzeuge FTP-Server. + * + * @param ftpPort + * FTP-Port, z.B. 2121 + * @param ftpHomeDir + * FTP-Verzeichnis, z.B. "target/FtpHome" + * @param readUserName + * leseberechtigter Benutzer: Name + * @param readUserPwd + * leseberechtigter Benutzer: Passwort + * @param writeUserName + * schreibberechtigter Benutzer: Name + * @param writeUserPwd + * schreibberechtigter Benutzer: Passwort + * @param ftpUsersPropsFile + * kann null sein, oder z.B. "target/FtpUsers.properties" + * @param maxLogins + * maximale Anzahl von Logins (0 fuer Defaultwert) + */ + public static FtpServer createFtpServer(int ftpPort, String ftpHomeDir, + String readUserName, String readUserPwd, String writeUserName, + String writeUserPwd) throws FtpException, IOException { + return createFtpServer(ftpPort, ftpHomeDir, readUserName, readUserPwd, + writeUserName, writeUserPwd, null, 0); + } + + public static FtpServer createFtpServer(int ftpPort, String ftpHomeDir, + String readUserName, String readUserPwd, String writeUserName, + String writeUserPwd, String ftpUsersPropsFile, int maxLogins) + throws FtpException, IOException { + return createFtpServer(ftpPort, ftpHomeDir, readUserName, readUserPwd, + writeUserName, writeUserPwd, ftpUsersPropsFile, maxLogins, 0); + } + + public static FtpServer createFtpServer(int ftpPort, String ftpHomeDir, + String readUserName, String readUserPwd, String writeUserName, + String writeUserPwd, String ftpUsersPropsFile, int maxLogins, + int maxIdleTimeSec) throws FtpException, IOException { + File fhd = new File(ftpHomeDir); + if (!fhd.exists()) + fhd.mkdirs(); + + ListenerFactory listenerFactory = new ListenerFactory(); + listenerFactory.setPort(ftpPort); + + PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory(); + userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor()); + if (ftpUsersPropsFile != null && ftpUsersPropsFile.trim().length() > 0) { + File upf = new File(ftpUsersPropsFile); + if (!upf.exists()) + upf.createNewFile(); + userManagerFactory.setFile(upf); + } + + // Einen Nur-Lese-User und einen User mit Schreibberechtigung anlegen: + UserManager userManager = userManagerFactory.createUserManager(); + BaseUser userRd = new BaseUser(); + BaseUser userWr = new BaseUser(); + userRd.setName(readUserName); + userRd.setPassword(readUserPwd); + userRd.setHomeDirectory(ftpHomeDir); + userWr.setName(writeUserName); + userWr.setPassword(writeUserPwd); + userWr.setHomeDirectory(ftpHomeDir); + if (maxIdleTimeSec > 0) { + userRd.setMaxIdleTime(maxIdleTimeSec); + userWr.setMaxIdleTime(maxIdleTimeSec); + } + ArrayList<Authority> authorities = new ArrayList<Authority>(); + authorities.add(new WritePermission()); + userWr.setAuthorities(authorities); + userManager.save(userRd); + userManager.save(userWr); + + FtpServerFactory serverFactory = new FtpServerFactory(); + serverFactory.addListener("default", listenerFactory.createListener()); + serverFactory.setUserManager(userManager); + if (maxLogins > 0) { + ConnectionConfigFactory ccf = new ConnectionConfigFactory(); + ccf.setMaxLogins(maxLogins); + serverFactory.setConnectionConfig(ccf.createConnectionConfig()); + } + return serverFactory.createServer(); + } +} diff --git a/src/test/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtilTest.java b/src/test/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtilTest.java new file mode 100644 index 0000000..4caa8db --- /dev/null +++ b/src/test/java/org/openslx/satellitedaemon/ftp/FtpUpDownUtilTest.java @@ -0,0 +1,73 @@ +package org.openslx.satellitedaemon.ftp; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + +import junit.framework.Assert; + +import org.apache.ftpserver.FtpServer; +import org.apache.ftpserver.ftplet.FtpException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class FtpUpDownUtilTest { + private static final int FTP_PORT = 2121; + private static final String FTP_HOST = "localhost"; + private static final String FTP_HOME_DIR = "target/FtpHome"; + private static final String FTPUSERSPROPS_FILE = "target/FtpUsers.properties"; + private static final String READ_USER_NAME = "ReadUserName"; + private static final String READ_USER_PWD = "ReadUserPwd"; + private static final String WRITE_USER_NAME = "WriteUserName"; + private static final String WRITE_USER_PWD = "WriteUserPwd"; + private static FtpServer ftpServer; + + @BeforeClass + public static void startFtpServer() throws FtpException, IOException + { + ftpServer = FtpTestUtil.createFtpServer( FTP_PORT, FTP_HOME_DIR, + READ_USER_NAME, READ_USER_PWD, WRITE_USER_NAME, WRITE_USER_PWD, FTPUSERSPROPS_FILE, 0 ); + ftpServer.start(); + } + + @AfterClass + public static void stoppFtpServer() + { + // Um den FTP-Server von ausserhalb des Tests eine Zeit lang ueber + // ftp://WriteUserName:WriteUserPwd@localhost:2121 + // anzusprechen, kann folgende Zeile aktiviert werden: + // try { Thread.sleep( 55000 ); } catch( InterruptedException e ) {/*ok*/} + ftpServer.stop(); + ftpServer = null; + } + + @Test + public void testFtp() throws IOException + { + final String LOCAL_SRC_FILE = "TestSrc.txt"; + final String LOCAL_DST_FILE = "target/TestDst.txt"; + final String REMOTE_FILE = "Test.txt"; + + File testFile = new File( LOCAL_SRC_FILE ); + if( !testFile.exists() ) testFile.createNewFile(); + + // Upload-Versuch ohne Schreibberechtigung muss fehlschlagen: + Assert.assertFalse( "READ_USER", FtpUpDownUtil.upload( LOCAL_SRC_FILE, REMOTE_FILE, FTP_HOST, FTP_PORT, + READ_USER_NAME, READ_USER_PWD, false ) ); + + // Teste Upload mit Schreibberechtigung: + Assert.assertTrue( "WRITE_USER", FtpUpDownUtil.upload( LOCAL_SRC_FILE, REMOTE_FILE, FTP_HOST, FTP_PORT, + WRITE_USER_NAME, WRITE_USER_PWD, false ) ); + Assert.assertTrue( "REMOTE_FILE.exists", new File( FTP_HOME_DIR, REMOTE_FILE ).exists() ); + + // Teste Download: + Assert.assertTrue( "Download", FtpUpDownUtil.download( LOCAL_DST_FILE, REMOTE_FILE, FTP_HOST, FTP_PORT, + READ_USER_NAME, READ_USER_PWD, false ) ); + Assert.assertTrue( "LOCAL_DST_FILE.exists", new File( LOCAL_DST_FILE ).exists() ); + + // Teste Auflistung: + String[] remoteFilenameList = FtpUpDownUtil.list( FTP_HOST, FTP_PORT, READ_USER_NAME, READ_USER_PWD ); + Assert.assertTrue( "remoteFilenameList", Arrays.asList( remoteFilenameList ).contains( REMOTE_FILE ) ); + } +} |