diff options
author | Nils Schwabe | 2014-07-10 16:23:52 +0200 |
---|---|---|
committer | Nils Schwabe | 2014-07-10 16:23:52 +0200 |
commit | efa1b409cdd22b0b75bd75ecf9f7caff1f2c7d94 (patch) | |
tree | 2d19d22b7ca7ae17a1cb7a19dbfd0f14b25c603f /src/main/java/org/openslx/imagemaster | |
parent | Removed unnessecary TODOs and comments. (diff) | |
download | master-sync-shared-efa1b409cdd22b0b75bd75ecf9f7caff1f2c7d94.tar.gz master-sync-shared-efa1b409cdd22b0b75bd75ecf9f7caff1f2c7d94.tar.xz master-sync-shared-efa1b409cdd22b0b75bd75ecf9f7caff1f2c7d94.zip |
[Thrift] Add method for server to check if he is authenticated
Diffstat (limited to 'src/main/java/org/openslx/imagemaster')
14 files changed, 870 insertions, 14 deletions
diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java index 01062ea..44ca1fe 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java index cea3a10..d0b6b29 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java index e3e5251..40a2c1d 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, DownloadInfos._Fields>, java.io.Serializable, Cloneable, Comparable<DownloadInfos> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DownloadInfos"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java index 6faca03..a9619ff 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java index 486c85b..1159bc7 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java index ce61bca..acd09d7 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java index 735e1f0..7b7b56a 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") public class ImageServer { public interface Iface { @@ -47,6 +47,8 @@ public class ImageServer { public String startServerAuthentication(String organization) throws ServerAuthenticationException, org.apache.thrift.TException; + public boolean isServerAuthenticated(String serverSessionId) throws org.apache.thrift.TException; + public ServerSessionData serverAuthenticate(String organization, ByteBuffer challengeResponse) throws ServerAuthenticationException, org.apache.thrift.TException; public UploadInfos submitImage(String serverSessionId, ImageData imageDescription, List<Integer> crcSums) throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException; @@ -65,6 +67,8 @@ public class ImageServer { public void startServerAuthentication(String organization, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void isServerAuthenticated(String serverSessionId, 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, List<Integer> crcSums, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -194,6 +198,29 @@ public class ImageServer { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startServerAuthentication failed: unknown result"); } + public boolean isServerAuthenticated(String serverSessionId) throws org.apache.thrift.TException + { + send_isServerAuthenticated(serverSessionId); + return recv_isServerAuthenticated(); + } + + public void send_isServerAuthenticated(String serverSessionId) throws org.apache.thrift.TException + { + isServerAuthenticated_args args = new isServerAuthenticated_args(); + args.setServerSessionId(serverSessionId); + sendBase("isServerAuthenticated", args); + } + + public boolean recv_isServerAuthenticated() throws org.apache.thrift.TException + { + isServerAuthenticated_result result = new isServerAuthenticated_result(); + receiveBase(result, "isServerAuthenticated"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isServerAuthenticated failed: unknown result"); + } + public ServerSessionData serverAuthenticate(String organization, ByteBuffer challengeResponse) throws ServerAuthenticationException, org.apache.thrift.TException { send_serverAuthenticate(organization, challengeResponse); @@ -432,6 +459,38 @@ public class ImageServer { } } + public void isServerAuthenticated(String serverSessionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + isServerAuthenticated_call method_call = new isServerAuthenticated_call(serverSessionId, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class isServerAuthenticated_call extends org.apache.thrift.async.TAsyncMethodCall { + private String serverSessionId; + public isServerAuthenticated_call(String serverSessionId, 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; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isServerAuthenticated", org.apache.thrift.protocol.TMessageType.CALL, 0)); + isServerAuthenticated_args args = new isServerAuthenticated_args(); + args.setServerSessionId(serverSessionId); + 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_isServerAuthenticated(); + } + } + 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); @@ -560,6 +619,7 @@ public class ImageServer { processMap.put("authenticate", new authenticate()); processMap.put("getUserFromToken", new getUserFromToken()); processMap.put("startServerAuthentication", new startServerAuthentication()); + processMap.put("isServerAuthenticated", new isServerAuthenticated()); processMap.put("serverAuthenticate", new serverAuthenticate()); processMap.put("submitImage", new submitImage()); processMap.put("getImage", new getImage()); @@ -659,6 +719,27 @@ public class ImageServer { } } + public static class isServerAuthenticated<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isServerAuthenticated_args> { + public isServerAuthenticated() { + super("isServerAuthenticated"); + } + + public isServerAuthenticated_args getEmptyArgsInstance() { + return new isServerAuthenticated_args(); + } + + protected boolean isOneway() { + return false; + } + + public isServerAuthenticated_result getResult(I iface, isServerAuthenticated_args args) throws org.apache.thrift.TException { + isServerAuthenticated_result result = new isServerAuthenticated_result(); + result.success = iface.isServerAuthenticated(args.serverSessionId); + result.setSuccessIsSet(true); + return result; + } + } + public static class serverAuthenticate<I extends Iface> extends org.apache.thrift.ProcessFunction<I, serverAuthenticate_args> { public serverAuthenticate() { super("serverAuthenticate"); @@ -754,6 +835,7 @@ public class ImageServer { processMap.put("authenticate", new authenticate()); processMap.put("getUserFromToken", new getUserFromToken()); processMap.put("startServerAuthentication", new startServerAuthentication()); + processMap.put("isServerAuthenticated", new isServerAuthenticated()); processMap.put("serverAuthenticate", new serverAuthenticate()); processMap.put("submitImage", new submitImage()); processMap.put("getImage", new getImage()); @@ -983,6 +1065,58 @@ public class ImageServer { } } + public static class isServerAuthenticated<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isServerAuthenticated_args, Boolean> { + public isServerAuthenticated() { + super("isServerAuthenticated"); + } + + public isServerAuthenticated_args getEmptyArgsInstance() { + return new isServerAuthenticated_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) { + isServerAuthenticated_result result = new isServerAuthenticated_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; + isServerAuthenticated_result result = new isServerAuthenticated_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, isServerAuthenticated_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.isServerAuthenticated(args.serverSessionId,resultHandler); + } + } + public static class serverAuthenticate<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, serverAuthenticate_args, ServerSessionData> { public serverAuthenticate() { super("serverAuthenticate"); @@ -4382,6 +4516,728 @@ public class ImageServer { } + public static class isServerAuthenticated_args implements org.apache.thrift.TBase<isServerAuthenticated_args, isServerAuthenticated_args._Fields>, java.io.Serializable, Cloneable, Comparable<isServerAuthenticated_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isServerAuthenticated_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new isServerAuthenticated_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new isServerAuthenticated_argsTupleSchemeFactory()); + } + + public String serverSessionId; // 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"); + + 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; + 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))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isServerAuthenticated_args.class, metaDataMap); + } + + public isServerAuthenticated_args() { + } + + public isServerAuthenticated_args( + String serverSessionId) + { + this(); + this.serverSessionId = serverSessionId; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public isServerAuthenticated_args(isServerAuthenticated_args other) { + if (other.isSetServerSessionId()) { + this.serverSessionId = other.serverSessionId; + } + } + + public isServerAuthenticated_args deepCopy() { + return new isServerAuthenticated_args(this); + } + + @Override + public void clear() { + this.serverSessionId = null; + } + + public String getServerSessionId() { + return this.serverSessionId; + } + + public isServerAuthenticated_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 void setFieldValue(_Fields field, Object value) { + switch (field) { + case SERVER_SESSION_ID: + if (value == null) { + unsetServerSessionId(); + } else { + setServerSessionId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SERVER_SESSION_ID: + return getServerSessionId(); + + } + 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(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof isServerAuthenticated_args) + return this.equals((isServerAuthenticated_args)that); + return false; + } + + public boolean equals(isServerAuthenticated_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; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_serverSessionId = true && (isSetServerSessionId()); + list.add(present_serverSessionId); + if (present_serverSessionId) + list.add(serverSessionId); + + return list.hashCode(); + } + + @Override + public int compareTo(isServerAuthenticated_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; + } + } + 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("isServerAuthenticated_args("); + boolean first = true; + + sb.append("serverSessionId:"); + if (this.serverSessionId == null) { + sb.append("null"); + } else { + sb.append(this.serverSessionId); + } + 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 isServerAuthenticated_argsStandardSchemeFactory implements SchemeFactory { + public isServerAuthenticated_argsStandardScheme getScheme() { + return new isServerAuthenticated_argsStandardScheme(); + } + } + + private static class isServerAuthenticated_argsStandardScheme extends StandardScheme<isServerAuthenticated_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, isServerAuthenticated_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; + 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, isServerAuthenticated_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(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class isServerAuthenticated_argsTupleSchemeFactory implements SchemeFactory { + public isServerAuthenticated_argsTupleScheme getScheme() { + return new isServerAuthenticated_argsTupleScheme(); + } + } + + private static class isServerAuthenticated_argsTupleScheme extends TupleScheme<isServerAuthenticated_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, isServerAuthenticated_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetServerSessionId()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetServerSessionId()) { + oprot.writeString(struct.serverSessionId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, isServerAuthenticated_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.serverSessionId = iprot.readString(); + struct.setServerSessionIdIsSet(true); + } + } + } + + } + + public static class isServerAuthenticated_result implements org.apache.thrift.TBase<isServerAuthenticated_result, isServerAuthenticated_result._Fields>, java.io.Serializable, Cloneable, Comparable<isServerAuthenticated_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isServerAuthenticated_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 isServerAuthenticated_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new isServerAuthenticated_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(isServerAuthenticated_result.class, metaDataMap); + } + + public isServerAuthenticated_result() { + } + + public isServerAuthenticated_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public isServerAuthenticated_result(isServerAuthenticated_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public isServerAuthenticated_result deepCopy() { + return new isServerAuthenticated_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public isServerAuthenticated_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 isServerAuthenticated_result) + return this.equals((isServerAuthenticated_result)that); + return false; + } + + public boolean equals(isServerAuthenticated_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() { + List<Object> list = new ArrayList<Object>(); + + boolean present_success = true; + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(isServerAuthenticated_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("isServerAuthenticated_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 isServerAuthenticated_resultStandardSchemeFactory implements SchemeFactory { + public isServerAuthenticated_resultStandardScheme getScheme() { + return new isServerAuthenticated_resultStandardScheme(); + } + } + + private static class isServerAuthenticated_resultStandardScheme extends StandardScheme<isServerAuthenticated_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, isServerAuthenticated_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, isServerAuthenticated_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 isServerAuthenticated_resultTupleSchemeFactory implements SchemeFactory { + public isServerAuthenticated_resultTupleScheme getScheme() { + return new isServerAuthenticated_resultTupleScheme(); + } + } + + private static class isServerAuthenticated_resultTupleScheme extends TupleScheme<isServerAuthenticated_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, isServerAuthenticated_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, isServerAuthenticated_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 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java index a539712..d5dfd61 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java index 0d8ae43..c2b9821 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java index 8457232..295dfa5 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java index fc7d5e6..640db68 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java index 8298f88..faa382a 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") public class UploadException extends TException implements org.apache.thrift.TBase<UploadException, UploadException._Fields>, java.io.Serializable, Cloneable, Comparable<UploadException> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UploadException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java index 0de523d..e19abe5 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadInfos._Fields>, java.io.Serializable, Cloneable, Comparable<UploadInfos> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UploadInfos"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java index 2bc6ec0..9eebe41 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-7") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") 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"); |