diff options
author | Simon Rettberg | 2014-09-25 14:32:32 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-09-25 14:32:32 +0200 |
commit | e2bf3ebe01195fe35ac13267e60de78d4943e350 (patch) | |
tree | 602e003c42b474c5da70753cc887a1e6743a29b5 | |
parent | Change Date to UnixTimestamp, add Exception codes to UploadError (diff) | |
download | master-sync-shared-e2bf3ebe01195fe35ac13267e60de78d4943e350.tar.gz master-sync-shared-e2bf3ebe01195fe35ac13267e60de78d4943e350.tar.xz master-sync-shared-e2bf3ebe01195fe35ac13267e60de78d4943e350.zip |
Renamed *Infos -> *Data
-rw-r--r-- | src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java | 163 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/iface/DownloadData.java (renamed from src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java) | 215 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/iface/DownloadException.java | 504 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java | 296 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/iface/UploadData.java (renamed from src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java) | 58 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/iface/UploadError.java | 5 | ||||
-rw-r--r-- | src/main/thrift/imagemaster.thrift | 19 |
7 files changed, 953 insertions, 307 deletions
diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java b/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java index 542234b..370c714 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java @@ -6,8 +6,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.zip.CRC32; @@ -16,18 +15,38 @@ import java.util.zip.CRC32; */ public class CrcFile { - private File file = null; - private List<Integer> crcSums = null; + private final int masterCrc; + private final int[] crcSums; private Boolean valid = null; /** * Loads a crcFile from file * * @param filename + * @throws IOException */ - public CrcFile( String filename ) + public CrcFile( String filename ) throws IOException { - this.file = new File( filename ); + File file = new File( filename ); + DataInputStream dis = null; + try { + dis = new DataInputStream( new FileInputStream( file ) ); + int numSums = (int) ( file.length() / 4 ) - 1; + if ( numSums < 0 ) + throw new IOException( "Invalid crc file: " + filename ); + masterCrc = dis.readInt(); + int[] sums = new int[ numSums ]; + for ( int i = 0; i < numSums; i++ ) { + sums[i] = dis.readInt(); + } + crcSums = sums; + } finally { + if ( dis != null ) + try { + dis.close(); + } catch ( Throwable t ) { + } + } } /** @@ -35,9 +54,18 @@ public class CrcFile * * @param crcSums */ - public CrcFile( List<Integer> crcSums ) + public CrcFile( int[] crcSumsWithLeadingMasterCrc ) + { + this.masterCrc = crcSumsWithLeadingMasterCrc[0]; + this.crcSums = Arrays.copyOfRange( crcSumsWithLeadingMasterCrc, 1, crcSumsWithLeadingMasterCrc.length ); + } + + public CrcFile( List<Integer> crcSumsWithLeadingMasterCrc ) { - this.crcSums = crcSums; + this.masterCrc = crcSumsWithLeadingMasterCrc.get( 0 ); + this.crcSums = new int[ crcSumsWithLeadingMasterCrc.size() - 1 ]; + for ( int i = 0; i < crcSums.length; i++ ) + crcSums[i] = crcSumsWithLeadingMasterCrc.get( i + 1 ); } /** @@ -49,45 +77,25 @@ public class CrcFile * @param filename Where to save the created crc file * @throws IOException If it's not possible to write the file */ - public static CrcFile writeCrcFile( List<Integer> listOfCrcSums, String filename ) throws IOException + public void writeCrcFile( String filename ) throws IOException { File file = new File( filename ); - + if ( file.exists() ) file.delete(); - - FileOutputStream fos = new FileOutputStream( file ); - DataOutputStream dos = new DataOutputStream( fos ); - - for ( Integer sum : listOfCrcSums ) { - dos.writeInt( sum.intValue() ); - } - - dos.close(); - return new CrcFile( filename ); - } - - /** - * Checks if given sums are valid. - * - * @param listOfCrcSums - * @return - */ - public static boolean sumsAreValid( List<Integer> listOfCrcSums ) - { - if ( listOfCrcSums == null || listOfCrcSums.isEmpty() ) - return false; - - int masterSum = listOfCrcSums.get( 0 ); // don't use the first sum for the calculation because it is the sum over the other sums - int size = listOfCrcSums.size(); - - CRC32 crcCalc = new CRC32(); - for ( int i = 1; i < size; i++ ) { - crcCalc.update( ByteBuffer.allocate( 4 ).putInt( listOfCrcSums.get( i ) ).array() ); // update the crc calculator with the next 4 bytes of the integer + FileOutputStream fos = new FileOutputStream( file ); + DataOutputStream dos = null; + try { + dos = new DataOutputStream( fos ); + dos.writeInt( Integer.reverseBytes( masterCrc ) ); + for ( int sum : crcSums ) { + dos.writeInt( Integer.reverseBytes( sum ) ); + } + } finally { + if ( dos != null ) + dos.close(); } - - return ( masterSum == Integer.reverseBytes( (int)crcCalc.getValue() ) ); } /** @@ -95,18 +103,23 @@ public class CrcFile * (If the crc over the file is equal to the first crc sum.) * * @return Whether the crc file is valid - * @throws IOException If the file could not be read or could not be found */ - public boolean isValid() throws IOException + public boolean isValid() { if ( valid == null ) { - if ( file == null ) { - valid = sumsAreValid( this.crcSums ); - } else { - if ( crcSums == null ) - loadSums(); - valid = sumsAreValid( this.crcSums ); + if ( crcSums == null || crcSums.length < 1 ) + return false; + + int masterSum = crcSums[0]; + + CRC32 crcCalc = new CRC32(); + byte[] buffer = new byte[ 4 ]; + + for ( int i = 1; i < crcSums.length; i++ ) { + crcCalc.update( intToByteArrayLittleEndian( crcSums[i], buffer ) ); // update the crc calculator with the next 4 bytes of the integer } + + valid = ( masterSum == Integer.reverseBytes( (int)crcCalc.getValue() ) ); } return valid; } @@ -118,55 +131,25 @@ public class CrcFile * @return The crcSum or 0 if the block number is invalid * @throws IOException If the crcSums could not be loaded from file */ - public int getCRCSum( int blockNumber ) throws IOException + public int getCRCSum( int blockNumber ) { - if ( crcSums == null ) - loadSums(); - if ( crcSums.size() == 0 ) - return 0; - - if ( blockNumber < 0 ) - return 0; - if ( blockNumber > crcSums.size() - 2 ) + if ( crcSums == null || blockNumber < 0 || blockNumber >= crcSums.length ) return 0; - - return crcSums.get( blockNumber + 1 ); + return crcSums[blockNumber]; } - /** - * Returns the loaded crcSums. - * - * @return The loaded crcSums - * @throws IOException If the crcSums could not be loaded from file - */ - public List<Integer> getCrcSums() throws IOException + public int getMasterSum() { - if ( crcSums == null ) - loadSums(); - if ( crcSums.size() == 0 ) - return new ArrayList<>(); - return this.crcSums; + return masterCrc; } - private void loadSums() throws IOException + private static final byte[] intToByteArrayLittleEndian( int value, byte[] buffer ) { - if ( crcSums != null ) - return; - // the crcSums were not read yet - DataInputStream dis = new DataInputStream( new FileInputStream( file ) ); - crcSums = new ArrayList<>(); - for ( int i = 0; i < file.length() / 4; i++ ) { - crcSums.add( dis.readInt() ); - } - dis.close(); + buffer[3] = (byte) ( value >>> 24 ); + buffer[2] = (byte) ( value >>> 16 ); + buffer[1] = (byte) ( value >>> 8 ); + buffer[0] = (byte)value; + return buffer; } - public int getMasterSum() throws IOException - { - if ( crcSums == null ) - loadSums(); - if ( crcSums.size() == 0 ) - return 0; - return this.crcSums.get( 0 ); - } } diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadData.java index baf3ad1..e55b714 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadData.java @@ -32,25 +32,28 @@ import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -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"); +public class DownloadData implements org.apache.thrift.TBase<DownloadData, DownloadData._Fields>, java.io.Serializable, Cloneable, Comparable<DownloadData> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DownloadData"); private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField CRC_SUMS_FIELD_DESC = new org.apache.thrift.protocol.TField("crcSums", org.apache.thrift.protocol.TType.LIST, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new DownloadInfosStandardSchemeFactory()); - schemes.put(TupleScheme.class, new DownloadInfosTupleSchemeFactory()); + schemes.put(StandardScheme.class, new DownloadDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DownloadDataTupleSchemeFactory()); } public String token; // required public int port; // required + public List<Integer> crcSums; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { TOKEN((short)1, "token"), - PORT((short)2, "port"); + PORT((short)2, "port"), + CRC_SUMS((short)3, "crcSums"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -69,6 +72,8 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow return TOKEN; case 2: // PORT return PORT; + case 3: // CRC_SUMS + return CRC_SUMS; default: return null; } @@ -118,36 +123,45 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.CRC_SUMS, new org.apache.thrift.meta_data.FieldMetaData("crcSums", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DownloadInfos.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DownloadData.class, metaDataMap); } - public DownloadInfos() { + public DownloadData() { } - public DownloadInfos( + public DownloadData( String token, - int port) + int port, + List<Integer> crcSums) { this(); this.token = token; this.port = port; setPortIsSet(true); + this.crcSums = crcSums; } /** * Performs a deep copy on <i>other</i>. */ - public DownloadInfos(DownloadInfos other) { + public DownloadData(DownloadData other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetToken()) { this.token = other.token; } this.port = other.port; + if (other.isSetCrcSums()) { + List<Integer> __this__crcSums = new ArrayList<Integer>(other.crcSums); + this.crcSums = __this__crcSums; + } } - public DownloadInfos deepCopy() { - return new DownloadInfos(this); + public DownloadData deepCopy() { + return new DownloadData(this); } @Override @@ -155,13 +169,14 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow this.token = null; setPortIsSet(false); this.port = 0; + this.crcSums = null; } public String getToken() { return this.token; } - public DownloadInfos setToken(String token) { + public DownloadData setToken(String token) { this.token = token; return this; } @@ -185,7 +200,7 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow return this.port; } - public DownloadInfos setPort(int port) { + public DownloadData setPort(int port) { this.port = port; setPortIsSet(true); return this; @@ -204,6 +219,45 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value); } + public int getCrcSumsSize() { + return (this.crcSums == null) ? 0 : this.crcSums.size(); + } + + public java.util.Iterator<Integer> getCrcSumsIterator() { + return (this.crcSums == null) ? null : this.crcSums.iterator(); + } + + public void addToCrcSums(int elem) { + if (this.crcSums == null) { + this.crcSums = new ArrayList<Integer>(); + } + this.crcSums.add(elem); + } + + public List<Integer> getCrcSums() { + return this.crcSums; + } + + public DownloadData setCrcSums(List<Integer> crcSums) { + this.crcSums = crcSums; + return this; + } + + public void unsetCrcSums() { + this.crcSums = null; + } + + /** Returns true if field crcSums is set (has been assigned a value) and false otherwise */ + public boolean isSetCrcSums() { + return this.crcSums != null; + } + + public void setCrcSumsIsSet(boolean value) { + if (!value) { + this.crcSums = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case TOKEN: @@ -222,6 +276,14 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow } break; + case CRC_SUMS: + if (value == null) { + unsetCrcSums(); + } else { + setCrcSums((List<Integer>)value); + } + break; + } } @@ -233,6 +295,9 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow case PORT: return Integer.valueOf(getPort()); + case CRC_SUMS: + return getCrcSums(); + } throw new IllegalStateException(); } @@ -248,6 +313,8 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow return isSetToken(); case PORT: return isSetPort(); + case CRC_SUMS: + return isSetCrcSums(); } throw new IllegalStateException(); } @@ -256,12 +323,12 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow public boolean equals(Object that) { if (that == null) return false; - if (that instanceof DownloadInfos) - return this.equals((DownloadInfos)that); + if (that instanceof DownloadData) + return this.equals((DownloadData)that); return false; } - public boolean equals(DownloadInfos that) { + public boolean equals(DownloadData that) { if (that == null) return false; @@ -283,6 +350,15 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow return false; } + boolean this_present_crcSums = true && this.isSetCrcSums(); + boolean that_present_crcSums = true && that.isSetCrcSums(); + if (this_present_crcSums || that_present_crcSums) { + if (!(this_present_crcSums && that_present_crcSums)) + return false; + if (!this.crcSums.equals(that.crcSums)) + return false; + } + return true; } @@ -292,7 +368,7 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow } @Override - public int compareTo(DownloadInfos other) { + public int compareTo(DownloadData other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -319,6 +395,16 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow return lastComparison; } } + lastComparison = Boolean.valueOf(isSetCrcSums()).compareTo(other.isSetCrcSums()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCrcSums()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.crcSums, other.crcSums); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -336,7 +422,7 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow @Override public String toString() { - StringBuilder sb = new StringBuilder("DownloadInfos("); + StringBuilder sb = new StringBuilder("DownloadData("); boolean first = true; sb.append("token:"); @@ -350,6 +436,14 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow sb.append("port:"); sb.append(this.port); first = false; + if (!first) sb.append(", "); + sb.append("crcSums:"); + if (this.crcSums == null) { + sb.append("null"); + } else { + sb.append(this.crcSums); + } + first = false; sb.append(")"); return sb.toString(); } @@ -377,15 +471,15 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow } } - private static class DownloadInfosStandardSchemeFactory implements SchemeFactory { - public DownloadInfosStandardScheme getScheme() { - return new DownloadInfosStandardScheme(); + private static class DownloadDataStandardSchemeFactory implements SchemeFactory { + public DownloadDataStandardScheme getScheme() { + return new DownloadDataStandardScheme(); } } - private static class DownloadInfosStandardScheme extends StandardScheme<DownloadInfos> { + private static class DownloadDataStandardScheme extends StandardScheme<DownloadData> { - public void read(org.apache.thrift.protocol.TProtocol iprot, DownloadInfos struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, DownloadData struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -411,6 +505,24 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 3: // CRC_SUMS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); + struct.crcSums = new ArrayList<Integer>(_list0.size); + for (int _i1 = 0; _i1 < _list0.size; ++_i1) + { + int _elem2; + _elem2 = iprot.readI32(); + struct.crcSums.add(_elem2); + } + iprot.readListEnd(); + } + struct.setCrcSumsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -422,7 +534,7 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, DownloadInfos struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, DownloadData struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -434,22 +546,34 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow oprot.writeFieldBegin(PORT_FIELD_DESC); oprot.writeI32(struct.port); oprot.writeFieldEnd(); + if (struct.crcSums != null) { + oprot.writeFieldBegin(CRC_SUMS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.crcSums.size())); + for (int _iter3 : struct.crcSums) + { + oprot.writeI32(_iter3); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class DownloadInfosTupleSchemeFactory implements SchemeFactory { - public DownloadInfosTupleScheme getScheme() { - return new DownloadInfosTupleScheme(); + private static class DownloadDataTupleSchemeFactory implements SchemeFactory { + public DownloadDataTupleScheme getScheme() { + return new DownloadDataTupleScheme(); } } - private static class DownloadInfosTupleScheme extends TupleScheme<DownloadInfos> { + private static class DownloadDataTupleScheme extends TupleScheme<DownloadData> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, DownloadInfos struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, DownloadData struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetToken()) { @@ -458,19 +582,31 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow if (struct.isSetPort()) { optionals.set(1); } - oprot.writeBitSet(optionals, 2); + if (struct.isSetCrcSums()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); if (struct.isSetToken()) { oprot.writeString(struct.token); } if (struct.isSetPort()) { oprot.writeI32(struct.port); } + if (struct.isSetCrcSums()) { + { + oprot.writeI32(struct.crcSums.size()); + for (int _iter4 : struct.crcSums) + { + oprot.writeI32(_iter4); + } + } + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, DownloadInfos struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, DownloadData struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.token = iprot.readString(); struct.setTokenIsSet(true); @@ -479,6 +615,19 @@ public class DownloadInfos implements org.apache.thrift.TBase<DownloadInfos, Dow struct.port = iprot.readI32(); struct.setPortIsSet(true); } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32()); + struct.crcSums = new ArrayList<Integer>(_list5.size); + for (int _i6 = 0; _i6 < _list5.size; ++_i6) + { + int _elem7; + _elem7 = iprot.readI32(); + struct.crcSums.add(_elem7); + } + } + struct.setCrcSumsIsSet(true); + } } } diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadException.java new file mode 100644 index 0000000..46404b9 --- /dev/null +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadException.java @@ -0,0 +1,504 @@ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.imagemaster.thrift.iface; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DownloadException extends TException implements org.apache.thrift.TBase<DownloadException, DownloadException._Fields>, java.io.Serializable, Cloneable, Comparable<DownloadException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DownloadException"); + + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DownloadExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DownloadExceptionTupleSchemeFactory()); + } + + /** + * + * @see UploadError + */ + public UploadError number; // required + public String message; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see UploadError + */ + NUMBER((short)1, "number"), + MESSAGE((short)2, "message"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // NUMBER + return NUMBER; + case 2: // MESSAGE + return MESSAGE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, UploadError.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DownloadException.class, metaDataMap); + } + + public DownloadException() { + } + + public DownloadException( + UploadError number, + String message) + { + this(); + this.number = number; + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DownloadException(DownloadException other) { + if (other.isSetNumber()) { + this.number = other.number; + } + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public DownloadException deepCopy() { + return new DownloadException(this); + } + + @Override + public void clear() { + this.number = null; + this.message = null; + } + + /** + * + * @see UploadError + */ + public UploadError getNumber() { + return this.number; + } + + /** + * + * @see UploadError + */ + public DownloadException setNumber(UploadError number) { + this.number = number; + return this; + } + + public void unsetNumber() { + this.number = null; + } + + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; + } + + public void setNumberIsSet(boolean value) { + if (!value) { + this.number = null; + } + } + + public String getMessage() { + return this.message; + } + + public DownloadException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NUMBER: + if (value == null) { + unsetNumber(); + } else { + setNumber((UploadError)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NUMBER: + return getNumber(); + + case MESSAGE: + return getMessage(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NUMBER: + return isSetNumber(); + case MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DownloadException) + return this.equals((DownloadException)that); + return false; + } + + public boolean equals(DownloadException that) { + if (that == null) + return false; + + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) + return false; + if (!this.number.equals(that.number)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(DownloadException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("DownloadException("); + boolean first = true; + + sb.append("number:"); + if (this.number == null) { + sb.append("null"); + } else { + sb.append(this.number); + } + first = false; + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class DownloadExceptionStandardSchemeFactory implements SchemeFactory { + public DownloadExceptionStandardScheme getScheme() { + return new DownloadExceptionStandardScheme(); + } + } + + private static class DownloadExceptionStandardScheme extends StandardScheme<DownloadException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DownloadException struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NUMBER + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.number = UploadError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, DownloadException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DownloadExceptionTupleSchemeFactory implements SchemeFactory { + public DownloadExceptionTupleScheme getScheme() { + return new DownloadExceptionTupleScheme(); + } + } + + private static class DownloadExceptionTupleScheme extends TupleScheme<DownloadException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DownloadException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNumber()) { + optionals.set(0); + } + if (struct.isSetMessage()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DownloadException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.number = UploadError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); + } + if (incoming.get(1)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java index fb3aef7..ff9c288 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java @@ -48,9 +48,9 @@ public class ImageServer { 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; + public UploadData submitImage(String serverSessionId, ImageData imageDescription, List<Integer> crcSums) throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException; - public DownloadInfos getImage(String uuid, String serverSessionId) throws AuthorizationException, ImageDataException, org.apache.thrift.TException; + public DownloadData getImage(String serverSessionId, String uuid) throws AuthorizationException, ImageDataException, org.apache.thrift.TException; } @@ -70,7 +70,7 @@ public class ImageServer { public void submitImage(String serverSessionId, ImageData imageDescription, List<Integer> crcSums, 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 getImage(String serverSessionId, String uuid, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -245,7 +245,7 @@ public class ImageServer { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "serverAuthenticate failed: unknown result"); } - public UploadInfos submitImage(String serverSessionId, ImageData imageDescription, List<Integer> crcSums) throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException + public UploadData submitImage(String serverSessionId, ImageData imageDescription, List<Integer> crcSums) throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException { send_submitImage(serverSessionId, imageDescription, crcSums); return recv_submitImage(); @@ -260,7 +260,7 @@ public class ImageServer { sendBase("submitImage", args); } - public UploadInfos recv_submitImage() throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException + public UploadData recv_submitImage() throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException { submitImage_result result = new submitImage_result(); receiveBase(result, "submitImage"); @@ -279,21 +279,21 @@ public class ImageServer { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "submitImage failed: unknown result"); } - public DownloadInfos getImage(String uuid, String serverSessionId) throws AuthorizationException, ImageDataException, org.apache.thrift.TException + public DownloadData getImage(String serverSessionId, String uuid) throws AuthorizationException, ImageDataException, org.apache.thrift.TException { - send_getImage(uuid, serverSessionId); + send_getImage(serverSessionId, uuid); return recv_getImage(); } - public void send_getImage(String uuid, String serverSessionId) throws org.apache.thrift.TException + public void send_getImage(String serverSessionId, String uuid) throws org.apache.thrift.TException { getImage_args args = new getImage_args(); - args.setUuid(uuid); args.setServerSessionId(serverSessionId); + args.setUuid(uuid); sendBase("getImage", args); } - public DownloadInfos recv_getImage() throws AuthorizationException, ImageDataException, org.apache.thrift.TException + public DownloadData recv_getImage() throws AuthorizationException, ImageDataException, org.apache.thrift.TException { getImage_result result = new getImage_result(); receiveBase(result, "getImage"); @@ -550,7 +550,7 @@ public class ImageServer { prot.writeMessageEnd(); } - public UploadInfos getResult() throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException { + public UploadData getResult() throws AuthorizationException, ImageDataException, UploadException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } @@ -560,32 +560,32 @@ public class ImageServer { } } - public void getImage(String uuid, String serverSessionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getImage(String serverSessionId, String uuid, 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); + getImage_call method_call = new getImage_call(serverSessionId, uuid, 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 { + private String uuid; + public getImage_call(String serverSessionId, String uuid, 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; + this.uuid = uuid; } 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.setUuid(uuid); args.write(prot); prot.writeMessageEnd(); } - public DownloadInfos getResult() throws AuthorizationException, ImageDataException, org.apache.thrift.TException { + public DownloadData 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!"); } @@ -801,7 +801,7 @@ public class ImageServer { 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); + result.success = iface.getImage(args.serverSessionId, args.uuid); } catch (AuthorizationException failure) { result.failure = failure; } catch (ImageDataException failure2) { @@ -1167,7 +1167,7 @@ public class ImageServer { } } - public static class submitImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, submitImage_args, UploadInfos> { + public static class submitImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, submitImage_args, UploadData> { public submitImage() { super("submitImage"); } @@ -1176,10 +1176,10 @@ public class ImageServer { return new submitImage_args(); } - public AsyncMethodCallback<UploadInfos> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback<UploadData> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback<UploadInfos>() { - public void onComplete(UploadInfos o) { + return new AsyncMethodCallback<UploadData>() { + public void onComplete(UploadData o) { submitImage_result result = new submitImage_result(); result.success = o; try { @@ -1229,12 +1229,12 @@ public class ImageServer { return false; } - public void start(I iface, submitImage_args args, org.apache.thrift.async.AsyncMethodCallback<UploadInfos> resultHandler) throws TException { + public void start(I iface, submitImage_args args, org.apache.thrift.async.AsyncMethodCallback<UploadData> resultHandler) throws TException { iface.submitImage(args.serverSessionId, args.imageDescription, args.crcSums,resultHandler); } } - public static class getImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImage_args, DownloadInfos> { + public static class getImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImage_args, DownloadData> { public getImage() { super("getImage"); } @@ -1243,10 +1243,10 @@ public class ImageServer { return new getImage_args(); } - public AsyncMethodCallback<DownloadInfos> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback<DownloadData> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback<DownloadInfos>() { - public void onComplete(DownloadInfos o) { + return new AsyncMethodCallback<DownloadData>() { + public void onComplete(DownloadData o) { getImage_result result = new getImage_result(); result.success = o; try { @@ -1291,8 +1291,8 @@ public class ImageServer { return false; } - public void start(I iface, getImage_args args, org.apache.thrift.async.AsyncMethodCallback<DownloadInfos> resultHandler) throws TException { - iface.getImage(args.uuid, args.serverSessionId,resultHandler); + public void start(I iface, getImage_args args, org.apache.thrift.async.AsyncMethodCallback<DownloadData> resultHandler) throws TException { + iface.getImage(args.serverSessionId, args.uuid,resultHandler); } } @@ -6552,13 +6552,13 @@ public class ImageServer { case 3: // CRC_SUMS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); - struct.crcSums = new ArrayList<Integer>(_list0.size); - for (int _i1 = 0; _i1 < _list0.size; ++_i1) + org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); + struct.crcSums = new ArrayList<Integer>(_list8.size); + for (int _i9 = 0; _i9 < _list8.size; ++_i9) { - int _elem2; - _elem2 = iprot.readI32(); - struct.crcSums.add(_elem2); + int _elem10; + _elem10 = iprot.readI32(); + struct.crcSums.add(_elem10); } iprot.readListEnd(); } @@ -6596,9 +6596,9 @@ public class ImageServer { oprot.writeFieldBegin(CRC_SUMS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.crcSums.size())); - for (int _iter3 : struct.crcSums) + for (int _iter11 : struct.crcSums) { - oprot.writeI32(_iter3); + oprot.writeI32(_iter11); } oprot.writeListEnd(); } @@ -6641,9 +6641,9 @@ public class ImageServer { if (struct.isSetCrcSums()) { { oprot.writeI32(struct.crcSums.size()); - for (int _iter4 : struct.crcSums) + for (int _iter12 : struct.crcSums) { - oprot.writeI32(_iter4); + oprot.writeI32(_iter12); } } } @@ -6664,13 +6664,13 @@ public class ImageServer { } if (incoming.get(2)) { { - org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32()); - struct.crcSums = new ArrayList<Integer>(_list5.size); - for (int _i6 = 0; _i6 < _list5.size; ++_i6) + org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32()); + struct.crcSums = new ArrayList<Integer>(_list13.size); + for (int _i14 = 0; _i14 < _list13.size; ++_i14) { - int _elem7; - _elem7 = iprot.readI32(); - struct.crcSums.add(_elem7); + int _elem15; + _elem15 = iprot.readI32(); + struct.crcSums.add(_elem15); } } struct.setCrcSumsIsSet(true); @@ -6694,7 +6694,7 @@ public class ImageServer { schemes.put(TupleScheme.class, new submitImage_resultTupleSchemeFactory()); } - public UploadInfos success; // required + public UploadData success; // required public AuthorizationException failure; // required public ImageDataException failure2; // required public UploadException failure3; // required @@ -6771,7 +6771,7 @@ public class ImageServer { 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, UploadInfos.class))); + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UploadData.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, @@ -6786,7 +6786,7 @@ public class ImageServer { } public submitImage_result( - UploadInfos success, + UploadData success, AuthorizationException failure, ImageDataException failure2, UploadException failure3) @@ -6803,7 +6803,7 @@ public class ImageServer { */ public submitImage_result(submitImage_result other) { if (other.isSetSuccess()) { - this.success = new UploadInfos(other.success); + this.success = new UploadData(other.success); } if (other.isSetFailure()) { this.failure = new AuthorizationException(other.failure); @@ -6828,11 +6828,11 @@ public class ImageServer { this.failure3 = null; } - public UploadInfos getSuccess() { + public UploadData getSuccess() { return this.success; } - public submitImage_result setSuccess(UploadInfos success) { + public submitImage_result setSuccess(UploadData success) { this.success = success; return this; } @@ -6930,7 +6930,7 @@ public class ImageServer { if (value == null) { unsetSuccess(); } else { - setSuccess((UploadInfos)value); + setSuccess((UploadData)value); } break; @@ -7202,7 +7202,7 @@ public class ImageServer { switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new UploadInfos(); + struct.success = new UploadData(); struct.success.read(iprot); struct.setSuccessIsSet(true); } else { @@ -7321,7 +7321,7 @@ public class ImageServer { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { - struct.success = new UploadInfos(); + struct.success = new UploadData(); struct.success.read(iprot); struct.setSuccessIsSet(true); } @@ -7348,8 +7348,8 @@ public class ImageServer { public static class getImage_args implements org.apache.thrift.TBase<getImage_args, getImage_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImage_args> { 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 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -7357,13 +7357,13 @@ public class ImageServer { schemes.put(TupleScheme.class, new getImage_argsTupleSchemeFactory()); } - public String uuid; // required public String serverSessionId; // required + public String uuid; // 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"); + SERVER_SESSION_ID((short)2, "serverSessionId"), + UUID((short)1, "uuid"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -7378,10 +7378,10 @@ public class ImageServer { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // UUID - return UUID; case 2: // SERVER_SESSION_ID return SERVER_SESSION_ID; + case 1: // UUID + return UUID; default: return null; } @@ -7425,10 +7425,10 @@ public class ImageServer { 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))); + 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"))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImage_args.class, metaDataMap); } @@ -7437,24 +7437,24 @@ public class ImageServer { } public getImage_args( - String uuid, - String serverSessionId) + String serverSessionId, + String uuid) { this(); - this.uuid = uuid; this.serverSessionId = serverSessionId; + this.uuid = uuid; } /** * Performs a deep copy on <i>other</i>. */ public getImage_args(getImage_args other) { - if (other.isSetUuid()) { - this.uuid = other.uuid; - } if (other.isSetServerSessionId()) { this.serverSessionId = other.serverSessionId; } + if (other.isSetUuid()) { + this.uuid = other.uuid; + } } public getImage_args deepCopy() { @@ -7463,73 +7463,73 @@ public class ImageServer { @Override public void clear() { - this.uuid = null; this.serverSessionId = null; + this.uuid = null; } - public String getUuid() { - return this.uuid; + public String getServerSessionId() { + return this.serverSessionId; } - public getImage_args setUuid(String uuid) { - this.uuid = uuid; + public getImage_args setServerSessionId(String serverSessionId) { + this.serverSessionId = serverSessionId; return this; } - public void unsetUuid() { - this.uuid = null; + public void unsetServerSessionId() { + this.serverSessionId = null; } - /** Returns true if field uuid is set (has been assigned a value) and false otherwise */ - public boolean isSetUuid() { - return this.uuid != 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 setUuidIsSet(boolean value) { + public void setServerSessionIdIsSet(boolean value) { if (!value) { - this.uuid = null; + this.serverSessionId = null; } } - public String getServerSessionId() { - return this.serverSessionId; + public String getUuid() { + return this.uuid; } - public getImage_args setServerSessionId(String serverSessionId) { - this.serverSessionId = serverSessionId; + public getImage_args setUuid(String uuid) { + this.uuid = uuid; return this; } - public void unsetServerSessionId() { - this.serverSessionId = null; + public void unsetUuid() { + this.uuid = null; } - /** Returns true if field serverSessionId is set (has been assigned a value) and false otherwise */ - public boolean isSetServerSessionId() { - return this.serverSessionId != 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 setServerSessionIdIsSet(boolean value) { + public void setUuidIsSet(boolean value) { if (!value) { - this.serverSessionId = null; + this.uuid = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { - case UUID: + case SERVER_SESSION_ID: if (value == null) { - unsetUuid(); + unsetServerSessionId(); } else { - setUuid((String)value); + setServerSessionId((String)value); } break; - case SERVER_SESSION_ID: + case UUID: if (value == null) { - unsetServerSessionId(); + unsetUuid(); } else { - setServerSessionId((String)value); + setUuid((String)value); } break; @@ -7538,12 +7538,12 @@ public class ImageServer { public Object getFieldValue(_Fields field) { switch (field) { - case UUID: - return getUuid(); - case SERVER_SESSION_ID: return getServerSessionId(); + case UUID: + return getUuid(); + } throw new IllegalStateException(); } @@ -7555,10 +7555,10 @@ public class ImageServer { } switch (field) { - case UUID: - return isSetUuid(); case SERVER_SESSION_ID: return isSetServerSessionId(); + case UUID: + return isSetUuid(); } throw new IllegalStateException(); } @@ -7576,15 +7576,6 @@ public class ImageServer { 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) { @@ -7594,6 +7585,15 @@ public class ImageServer { 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; + } + return true; } @@ -7610,22 +7610,22 @@ public class ImageServer { int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetUuid()).compareTo(other.isSetUuid()); + lastComparison = Boolean.valueOf(isSetServerSessionId()).compareTo(other.isSetServerSessionId()); if (lastComparison != 0) { return lastComparison; } - if (isSetUuid()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuid, other.uuid); + if (isSetServerSessionId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverSessionId, other.serverSessionId); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetServerSessionId()).compareTo(other.isSetServerSessionId()); + lastComparison = Boolean.valueOf(isSetUuid()).compareTo(other.isSetUuid()); if (lastComparison != 0) { return lastComparison; } - if (isSetServerSessionId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverSessionId, other.serverSessionId); + if (isSetUuid()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuid, other.uuid); if (lastComparison != 0) { return lastComparison; } @@ -7650,19 +7650,19 @@ public class ImageServer { StringBuilder sb = new StringBuilder("getImage_args("); boolean first = true; - sb.append("uuid:"); - if (this.uuid == null) { + sb.append("serverSessionId:"); + if (this.serverSessionId == null) { sb.append("null"); } else { - sb.append(this.uuid); + sb.append(this.serverSessionId); } first = false; if (!first) sb.append(", "); - sb.append("serverSessionId:"); - if (this.serverSessionId == null) { + sb.append("uuid:"); + if (this.uuid == null) { sb.append("null"); } else { - sb.append(this.serverSessionId); + sb.append(this.uuid); } first = false; sb.append(")"); @@ -7708,18 +7708,18 @@ public class ImageServer { break; } switch (schemeField.id) { - case 1: // UUID + case 2: // SERVER_SESSION_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.uuid = iprot.readString(); - struct.setUuidIsSet(true); + struct.serverSessionId = iprot.readString(); + struct.setServerSessionIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // SERVER_SESSION_ID + case 1: // UUID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.serverSessionId = iprot.readString(); - struct.setServerSessionIdIsSet(true); + struct.uuid = iprot.readString(); + struct.setUuidIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -7767,19 +7767,19 @@ public class ImageServer { 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()) { + if (struct.isSetServerSessionId()) { optionals.set(0); } - if (struct.isSetServerSessionId()) { + if (struct.isSetUuid()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); - if (struct.isSetUuid()) { - oprot.writeString(struct.uuid); - } if (struct.isSetServerSessionId()) { oprot.writeString(struct.serverSessionId); } + if (struct.isSetUuid()) { + oprot.writeString(struct.uuid); + } } @Override @@ -7787,13 +7787,13 @@ public class ImageServer { 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); } + if (incoming.get(1)) { + struct.uuid = iprot.readString(); + struct.setUuidIsSet(true); + } } } @@ -7812,7 +7812,7 @@ public class ImageServer { schemes.put(TupleScheme.class, new getImage_resultTupleSchemeFactory()); } - public DownloadInfos success; // required + public DownloadData success; // required public AuthorizationException failure; // required public ImageDataException failure2; // required @@ -7885,7 +7885,7 @@ public class ImageServer { 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, DownloadInfos.class))); + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DownloadData.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, @@ -7898,7 +7898,7 @@ public class ImageServer { } public getImage_result( - DownloadInfos success, + DownloadData success, AuthorizationException failure, ImageDataException failure2) { @@ -7913,7 +7913,7 @@ public class ImageServer { */ public getImage_result(getImage_result other) { if (other.isSetSuccess()) { - this.success = new DownloadInfos(other.success); + this.success = new DownloadData(other.success); } if (other.isSetFailure()) { this.failure = new AuthorizationException(other.failure); @@ -7934,11 +7934,11 @@ public class ImageServer { this.failure2 = null; } - public DownloadInfos getSuccess() { + public DownloadData getSuccess() { return this.success; } - public getImage_result setSuccess(DownloadInfos success) { + public getImage_result setSuccess(DownloadData success) { this.success = success; return this; } @@ -8012,7 +8012,7 @@ public class ImageServer { if (value == null) { unsetSuccess(); } else { - setSuccess((DownloadInfos)value); + setSuccess((DownloadData)value); } break; @@ -8244,7 +8244,7 @@ public class ImageServer { switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new DownloadInfos(); + struct.success = new DownloadData(); struct.success.read(iprot); struct.setSuccessIsSet(true); } else { @@ -8343,7 +8343,7 @@ public class ImageServer { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { - struct.success = new DownloadInfos(); + struct.success = new DownloadData(); struct.success.read(iprot); struct.setSuccessIsSet(true); } diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadData.java index 352ffc4..314920e 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadData.java @@ -32,16 +32,16 @@ import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -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"); +public class UploadData implements org.apache.thrift.TBase<UploadData, UploadData._Fields>, java.io.Serializable, Cloneable, Comparable<UploadData> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UploadData"); private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new UploadInfosStandardSchemeFactory()); - schemes.put(TupleScheme.class, new UploadInfosTupleSchemeFactory()); + schemes.put(StandardScheme.class, new UploadDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UploadDataTupleSchemeFactory()); } public String token; // required @@ -119,13 +119,13 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UploadInfos.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UploadData.class, metaDataMap); } - public UploadInfos() { + public UploadData() { } - public UploadInfos( + public UploadData( String token, int port) { @@ -138,7 +138,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI /** * Performs a deep copy on <i>other</i>. */ - public UploadInfos(UploadInfos other) { + public UploadData(UploadData other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetToken()) { this.token = other.token; @@ -146,8 +146,8 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI this.port = other.port; } - public UploadInfos deepCopy() { - return new UploadInfos(this); + public UploadData deepCopy() { + return new UploadData(this); } @Override @@ -161,7 +161,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI return this.token; } - public UploadInfos setToken(String token) { + public UploadData setToken(String token) { this.token = token; return this; } @@ -185,7 +185,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI return this.port; } - public UploadInfos setPort(int port) { + public UploadData setPort(int port) { this.port = port; setPortIsSet(true); return this; @@ -256,12 +256,12 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI public boolean equals(Object that) { if (that == null) return false; - if (that instanceof UploadInfos) - return this.equals((UploadInfos)that); + if (that instanceof UploadData) + return this.equals((UploadData)that); return false; } - public boolean equals(UploadInfos that) { + public boolean equals(UploadData that) { if (that == null) return false; @@ -292,7 +292,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI } @Override - public int compareTo(UploadInfos other) { + public int compareTo(UploadData other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -336,7 +336,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI @Override public String toString() { - StringBuilder sb = new StringBuilder("UploadInfos("); + StringBuilder sb = new StringBuilder("UploadData("); boolean first = true; sb.append("token:"); @@ -377,15 +377,15 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI } } - private static class UploadInfosStandardSchemeFactory implements SchemeFactory { - public UploadInfosStandardScheme getScheme() { - return new UploadInfosStandardScheme(); + private static class UploadDataStandardSchemeFactory implements SchemeFactory { + public UploadDataStandardScheme getScheme() { + return new UploadDataStandardScheme(); } } - private static class UploadInfosStandardScheme extends StandardScheme<UploadInfos> { + private static class UploadDataStandardScheme extends StandardScheme<UploadData> { - public void read(org.apache.thrift.protocol.TProtocol iprot, UploadInfos struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, UploadData struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -422,7 +422,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, UploadInfos struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, UploadData struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -440,16 +440,16 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI } - private static class UploadInfosTupleSchemeFactory implements SchemeFactory { - public UploadInfosTupleScheme getScheme() { - return new UploadInfosTupleScheme(); + private static class UploadDataTupleSchemeFactory implements SchemeFactory { + public UploadDataTupleScheme getScheme() { + return new UploadDataTupleScheme(); } } - private static class UploadInfosTupleScheme extends TupleScheme<UploadInfos> { + private static class UploadDataTupleScheme extends TupleScheme<UploadData> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, UploadInfos struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, UploadData struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetToken()) { @@ -468,7 +468,7 @@ public class UploadInfos implements org.apache.thrift.TBase<UploadInfos, UploadI } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, UploadInfos struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, UploadData struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadError.java index 0a50985..963ff1c 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadError.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadError.java @@ -15,7 +15,8 @@ public enum UploadError implements org.apache.thrift.TEnum { INVALID_CRC(0), BROKEN_BLOCK(1), GENERIC_ERROR(2), - INVALID_METADATA(3); + INVALID_METADATA(3), + ALREADY_COMPLETE(4); private final int value; @@ -44,6 +45,8 @@ public enum UploadError implements org.apache.thrift.TEnum { return GENERIC_ERROR; case 3: return INVALID_METADATA; + case 4: + return ALREADY_COMPLETE; default: return null; } diff --git a/src/main/thrift/imagemaster.thrift b/src/main/thrift/imagemaster.thrift index 6282952..b03cb0e 100644 --- a/src/main/thrift/imagemaster.thrift +++ b/src/main/thrift/imagemaster.thrift @@ -39,7 +39,8 @@ enum UploadError { INVALID_CRC, BROKEN_BLOCK, GENERIC_ERROR, - INVALID_METADATA + INVALID_METADATA, + ALREADY_COMPLETE } exception AuthorizationException { @@ -70,6 +71,11 @@ exception UploadException { 2: string message } +exception DownloadException { + 1: UploadError number, + 2: string message +} + struct UserInfo { 1: string userId, 2: string firstName, @@ -83,14 +89,15 @@ struct SessionData { 3: string serverAddress } -struct UploadInfos { +struct UploadData { 1: string token, 2: i32 port } -struct DownloadInfos { +struct DownloadData { 1: string token, - 2: i32 port + 2: i32 port, + 3: list<i32> crcSums } struct ServerSessionData { @@ -126,8 +133,8 @@ service ImageServer { ServerSessionData serverAuthenticate(1:string organization, 2:binary challengeResponse) throws (1:ServerAuthenticationException failure), - UploadInfos submitImage(1:string serverSessionId, 2:ImageData imageDescription, 3:list<i32> crcSums) throws (1:AuthorizationException failure, 2: ImageDataException failure2, 3: UploadException failure3), + UploadData submitImage(1:string serverSessionId, 2:ImageData imageDescription, 3:list<i32> crcSums) throws (1:AuthorizationException failure, 2: ImageDataException failure2, 3: UploadException failure3), - DownloadInfos getImage(1:UUID uuid, 2:string serverSessionId) throws (1:AuthorizationException failure, 2: ImageDataException failure2), + DownloadData getImage(2:string serverSessionId, 1:UUID uuid) throws (1:AuthorizationException failure, 2: ImageDataException failure2), } |