From fd54c1817a963a9c9c70f71c9f33f5f6f31c993b Mon Sep 17 00:00:00 2001 From: Michael Petretti Date: Wed, 18 Jun 2014 16:00:02 +0200 Subject: small changes --- .../thrift/iface/AuthenticationError.java | 3 + .../thrift/iface/AuthenticationException.java | 30 +- .../imagemaster/thrift/iface/ImageServer.java | 2018 ++++++++++++++++++++ .../satellitedaemon/ftp/ThriftConnection.java | 9 +- 4 files changed, 2047 insertions(+), 13 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 index 849989d..2fd9fcf 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationError.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationError.java @@ -7,6 +7,9 @@ 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), 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 24883c9..5efc66c 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java @@ -6,19 +6,31 @@ */ package org.openslx.imagemaster.thrift.iface; -import java.util.BitSet; -import java.util.Collections; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -import org.apache.thrift.TException; -import org.apache.thrift.protocol.TTupleProtocol; 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, java.io.Serializable, Cloneable, Comparable { 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/ImageServer.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java index 2751dd6..6b863c3 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java @@ -50,6 +50,10 @@ public class ImageServer { public boolean finshedUpload(String ftpUser, ImageData imageDescription) throws ImageDataException, org.apache.thrift.TException; + public FtpCredentials getImage(String uuid, String serverSessionId) throws AuthorizationException, ImageDataException, org.apache.thrift.TException; + + public boolean finishedDownload(String ftpUser) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -68,6 +72,10 @@ public class ImageServer { public void finshedUpload(String ftpUser, ImageData imageDescription, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getImage(String uuid, String serverSessionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void finishedDownload(String ftpUser, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -275,6 +283,59 @@ public class ImageServer { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "finshedUpload failed: unknown result"); } + public FtpCredentials getImage(String uuid, String serverSessionId) throws AuthorizationException, ImageDataException, org.apache.thrift.TException + { + send_getImage(uuid, serverSessionId); + return recv_getImage(); + } + + public void send_getImage(String uuid, String serverSessionId) throws org.apache.thrift.TException + { + getImage_args args = new getImage_args(); + args.setUuid(uuid); + args.setServerSessionId(serverSessionId); + sendBase("getImage", args); + } + + public FtpCredentials recv_getImage() throws AuthorizationException, ImageDataException, org.apache.thrift.TException + { + getImage_result result = new getImage_result(); + receiveBase(result, "getImage"); + 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, "getImage failed: unknown result"); + } + + public boolean finishedDownload(String ftpUser) throws org.apache.thrift.TException + { + send_finishedDownload(ftpUser); + return recv_finishedDownload(); + } + + public void send_finishedDownload(String ftpUser) throws org.apache.thrift.TException + { + finishedDownload_args args = new finishedDownload_args(); + args.setFtpUser(ftpUser); + sendBase("finishedDownload", args); + } + + public boolean recv_finishedDownload() throws org.apache.thrift.TException + { + finishedDownload_result result = new finishedDownload_result(); + receiveBase(result, "finishedDownload"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "finishedDownload 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 { @@ -526,6 +587,73 @@ public class ImageServer { } } + public void getImage(String uuid, String serverSessionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getImage_call method_call = new getImage_call(uuid, serverSessionId, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getImage_call extends org.apache.thrift.async.TAsyncMethodCall { + private String uuid; + private String serverSessionId; + public getImage_call(String uuid, 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.uuid = uuid; + 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("getImage", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getImage_args args = new getImage_args(); + args.setUuid(uuid); + args.setServerSessionId(serverSessionId); + 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_getImage(); + } + } + + public void finishedDownload(String ftpUser, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + finishedDownload_call method_call = new finishedDownload_call(ftpUser, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class finishedDownload_call extends org.apache.thrift.async.TAsyncMethodCall { + private String ftpUser; + public finishedDownload_call(String ftpUser, 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; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("finishedDownload", org.apache.thrift.protocol.TMessageType.CALL, 0)); + finishedDownload_args args = new finishedDownload_args(); + args.setFtpUser(ftpUser); + 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_finishedDownload(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -546,6 +674,8 @@ public class ImageServer { processMap.put("serverAuthenticate", new serverAuthenticate()); processMap.put("submitImage", new submitImage()); processMap.put("finshedUpload", new finshedUpload()); + processMap.put("getImage", new getImage()); + processMap.put("finishedDownload", new finishedDownload()); return processMap; } @@ -717,6 +847,53 @@ public class ImageServer { } } + public static class getImage extends org.apache.thrift.ProcessFunction { + public getImage() { + super("getImage"); + } + + public getImage_args getEmptyArgsInstance() { + return new getImage_args(); + } + + protected boolean isOneway() { + return false; + } + + public getImage_result getResult(I iface, getImage_args args) throws org.apache.thrift.TException { + getImage_result result = new getImage_result(); + try { + result.success = iface.getImage(args.uuid, args.serverSessionId); + } catch (AuthorizationException failure) { + result.failure = failure; + } catch (ImageDataException failure2) { + result.failure2 = failure2; + } + return result; + } + } + + public static class finishedDownload extends org.apache.thrift.ProcessFunction { + public finishedDownload() { + super("finishedDownload"); + } + + public finishedDownload_args getEmptyArgsInstance() { + return new finishedDownload_args(); + } + + protected boolean isOneway() { + return false; + } + + public finishedDownload_result getResult(I iface, finishedDownload_args args) throws org.apache.thrift.TException { + finishedDownload_result result = new finishedDownload_result(); + result.success = iface.finishedDownload(args.ftpUser); + result.setSuccessIsSet(true); + return result; + } + } + } public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { @@ -737,6 +914,8 @@ public class ImageServer { processMap.put("serverAuthenticate", new serverAuthenticate()); processMap.put("submitImage", new submitImage()); processMap.put("finshedUpload", new finshedUpload()); + processMap.put("getImage", new getImage()); + processMap.put("finishedDownload", new finishedDownload()); return processMap; } @@ -1140,6 +1319,120 @@ public class ImageServer { } } + public static class getImage extends org.apache.thrift.AsyncProcessFunction { + public getImage() { + super("getImage"); + } + + public getImage_args getEmptyArgsInstance() { + return new getImage_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(FtpCredentials o) { + getImage_result result = new getImage_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; + getImage_result result = new getImage_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, getImage_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.getImage(args.uuid, args.serverSessionId,resultHandler); + } + } + + public static class finishedDownload extends org.apache.thrift.AsyncProcessFunction { + public finishedDownload() { + super("finishedDownload"); + } + + public finishedDownload_args getEmptyArgsInstance() { + return new finishedDownload_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Boolean o) { + finishedDownload_result result = new finishedDownload_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; + finishedDownload_result result = new finishedDownload_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, finishedDownload_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.finishedDownload(args.ftpUser,resultHandler); + } + } + } public static class ping_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { @@ -7145,4 +7438,1729 @@ public class ImageServer { } + public static class getImage_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImage_args"); + + 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 SERVER_SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("serverSessionId", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getImage_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImage_argsTupleSchemeFactory()); + } + + public String uuid; // required + 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 { + UUID((short)1, "uuid"), + SERVER_SESSION_ID((short)2, "serverSessionId"); + + private static final Map byName = new HashMap(); + + 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: // 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.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.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(getImage_args.class, metaDataMap); + } + + public getImage_args() { + } + + public getImage_args( + String uuid, + String serverSessionId) + { + this(); + this.uuid = uuid; + this.serverSessionId = serverSessionId; + } + + /** + * Performs a deep copy on other. + */ + public getImage_args(getImage_args other) { + if (other.isSetUuid()) { + this.uuid = other.uuid; + } + if (other.isSetServerSessionId()) { + this.serverSessionId = other.serverSessionId; + } + } + + public getImage_args deepCopy() { + return new getImage_args(this); + } + + @Override + public void clear() { + this.uuid = null; + this.serverSessionId = null; + } + + public String getUuid() { + return this.uuid; + } + + public getImage_args 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 String getServerSessionId() { + return this.serverSessionId; + } + + public getImage_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 UUID: + if (value == null) { + unsetUuid(); + } else { + setUuid((String)value); + } + break; + + case SERVER_SESSION_ID: + if (value == null) { + unsetServerSessionId(); + } else { + setServerSessionId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case UUID: + return getUuid(); + + 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 UUID: + return isSetUuid(); + case SERVER_SESSION_ID: + return isSetServerSessionId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getImage_args) + return this.equals((getImage_args)that); + return false; + } + + public boolean equals(getImage_args 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_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() { + return 0; + } + + @Override + public int compareTo(getImage_args 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(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("getImage_args("); + 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("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 getImage_argsStandardSchemeFactory implements SchemeFactory { + public getImage_argsStandardScheme getScheme() { + return new getImage_argsStandardScheme(); + } + } + + private static class getImage_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImage_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: // 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: // 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, getImage_args 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(); + } + if (struct.serverSessionId != null) { + oprot.writeFieldBegin(SERVER_SESSION_ID_FIELD_DESC); + oprot.writeString(struct.serverSessionId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImage_argsTupleSchemeFactory implements SchemeFactory { + public getImage_argsTupleScheme getScheme() { + return new getImage_argsTupleScheme(); + } + } + + private static class getImage_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImage_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUuid()) { + optionals.set(0); + } + if (struct.isSetServerSessionId()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUuid()) { + oprot.writeString(struct.uuid); + } + if (struct.isSetServerSessionId()) { + oprot.writeString(struct.serverSessionId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImage_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.uuid = iprot.readString(); + struct.setUuidIsSet(true); + } + if (incoming.get(1)) { + struct.serverSessionId = iprot.readString(); + struct.setServerSessionIdIsSet(true); + } + } + } + + } + + public static class getImage_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImage_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, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getImage_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImage_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 byName = new HashMap(); + + 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(getImage_result.class, metaDataMap); + } + + public getImage_result() { + } + + public getImage_result( + FtpCredentials success, + AuthorizationException failure, + ImageDataException failure2) + { + this(); + this.success = success; + this.failure = failure; + this.failure2 = failure2; + } + + /** + * Performs a deep copy on other. + */ + public getImage_result(getImage_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 getImage_result deepCopy() { + return new getImage_result(this); + } + + @Override + public void clear() { + this.success = null; + this.failure = null; + this.failure2 = null; + } + + public FtpCredentials getSuccess() { + return this.success; + } + + public getImage_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 getImage_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 getImage_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 getImage_result) + return this.equals((getImage_result)that); + return false; + } + + public boolean equals(getImage_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(getImage_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("getImage_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 getImage_resultStandardSchemeFactory implements SchemeFactory { + public getImage_resultStandardScheme getScheme() { + return new getImage_resultStandardScheme(); + } + } + + private static class getImage_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImage_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, getImage_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 getImage_resultTupleSchemeFactory implements SchemeFactory { + public getImage_resultTupleScheme getScheme() { + return new getImage_resultTupleScheme(); + } + } + + private static class getImage_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImage_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, getImage_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 finishedDownload_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("finishedDownload_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 Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new finishedDownload_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new finishedDownload_argsTupleSchemeFactory()); + } + + public String ftpUser; // 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"); + + private static final Map byName = new HashMap(); + + 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; + 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))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(finishedDownload_args.class, metaDataMap); + } + + public finishedDownload_args() { + } + + public finishedDownload_args( + String ftpUser) + { + this(); + this.ftpUser = ftpUser; + } + + /** + * Performs a deep copy on other. + */ + public finishedDownload_args(finishedDownload_args other) { + if (other.isSetFtpUser()) { + this.ftpUser = other.ftpUser; + } + } + + public finishedDownload_args deepCopy() { + return new finishedDownload_args(this); + } + + @Override + public void clear() { + this.ftpUser = null; + } + + public String getFtpUser() { + return this.ftpUser; + } + + public finishedDownload_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 void setFieldValue(_Fields field, Object value) { + switch (field) { + case FTP_USER: + if (value == null) { + unsetFtpUser(); + } else { + setFtpUser((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case FTP_USER: + return getFtpUser(); + + } + 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(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof finishedDownload_args) + return this.equals((finishedDownload_args)that); + return false; + } + + public boolean equals(finishedDownload_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; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(finishedDownload_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; + } + } + 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("finishedDownload_args("); + boolean first = true; + + sb.append("ftpUser:"); + if (this.ftpUser == null) { + sb.append("null"); + } else { + sb.append(this.ftpUser); + } + 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 finishedDownload_argsStandardSchemeFactory implements SchemeFactory { + public finishedDownload_argsStandardScheme getScheme() { + return new finishedDownload_argsStandardScheme(); + } + } + + private static class finishedDownload_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, finishedDownload_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; + 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, finishedDownload_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(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class finishedDownload_argsTupleSchemeFactory implements SchemeFactory { + public finishedDownload_argsTupleScheme getScheme() { + return new finishedDownload_argsTupleScheme(); + } + } + + private static class finishedDownload_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, finishedDownload_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetFtpUser()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetFtpUser()) { + oprot.writeString(struct.ftpUser); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, finishedDownload_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.ftpUser = iprot.readString(); + struct.setFtpUserIsSet(true); + } + } + } + + } + + public static class finishedDownload_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("finishedDownload_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, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new finishedDownload_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new finishedDownload_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 byName = new HashMap(); + + 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(finishedDownload_result.class, metaDataMap); + } + + public finishedDownload_result() { + } + + public finishedDownload_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on other. + */ + public finishedDownload_result(finishedDownload_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public finishedDownload_result deepCopy() { + return new finishedDownload_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public finishedDownload_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 finishedDownload_result) + return this.equals((finishedDownload_result)that); + return false; + } + + public boolean equals(finishedDownload_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(finishedDownload_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("finishedDownload_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 finishedDownload_resultStandardSchemeFactory implements SchemeFactory { + public finishedDownload_resultStandardScheme getScheme() { + return new finishedDownload_resultStandardScheme(); + } + } + + private static class finishedDownload_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, finishedDownload_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, finishedDownload_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 finishedDownload_resultTupleSchemeFactory implements SchemeFactory { + public finishedDownload_resultTupleScheme getScheme() { + return new finishedDownload_resultTupleScheme(); + } + } + + private static class finishedDownload_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, finishedDownload_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, finishedDownload_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); + } + } + } + + } + } diff --git a/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java index 0f28c39..0b22389 100644 --- a/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java +++ b/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java @@ -37,8 +37,8 @@ public class ThriftConnection private static Logger log = Logger.getLogger( ThriftConnection.class ); /** - * The method calls getConnection() to check if the connection is ok, - * if so, it returns ftpCredential. + * The method calls getConnection() to check if the connection is ok + * and to get the ServerSessionData. If connection is ok, it returns ftpCredential. * * @return returns 'null' if there is a problem. */ @@ -122,6 +122,7 @@ public class ThriftConnection String toEncrypt; if ( theClient == null ) { log.debug( "The client was null" ); + return null; } try { toEncrypt = theClient.startServerAuthentication( Globals.getPropertyString( PropString.THRIFTORGANIZATIONNAME) ); @@ -133,11 +134,11 @@ public class ThriftConnection sSD = theClient.serverAuthenticate( Globals.getPropertyString( PropString.THRIFTORGANIZATIONNAME), ByteBuffer.wrap( byteArray ) ); } catch ( ServerAuthenticationException e ) { - log.error( "ThriftConnection: Server Authetication was not sucessful." ); + log.error( "ThriftConnection: ServerAuthenticationException: Server Authetication was not sucessful." ); e.printStackTrace(); return null; } catch ( TException e ) { - log.error( "ThriftConnection: Server Authetication was not sucessful." ); + log.error( "ThriftConnection: TExeption: Server Authetication was not sucessful." ); e.printStackTrace(); return null; } -- cgit v1.2.3-55-g7522