summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-04-18 15:18:05 +0200
committerSimon Rettberg2016-04-18 15:18:05 +0200
commitcc70f09431deb7937e01cc6583884fb5067a2994 (patch)
treefcf7c8720a4479b09e07c82eb13f7015bb4d0533
parentPreparations/changes for global image sync (diff)
downloadmaster-sync-shared-cc70f09431deb7937e01cc6583884fb5067a2994.tar.gz
master-sync-shared-cc70f09431deb7937e01cc6583884fb5067a2994.tar.xz
master-sync-shared-cc70f09431deb7937e01cc6583884fb5067a2994.zip
More additions for central image store
-rw-r--r--src/main/java/org/openslx/bwlp/thrift/iface/ImagePublishData.java238
-rw-r--r--src/main/java/org/openslx/bwlp/thrift/iface/SatelliteServer.java1573
-rw-r--r--src/main/java/org/openslx/filetransfer/util/ChunkList.java98
-rw-r--r--src/main/java/org/openslx/filetransfer/util/FileChunk.java6
-rw-r--r--src/main/java/org/openslx/filetransfer/util/HashChecker.java24
-rw-r--r--src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java61
-rw-r--r--src/main/java/org/openslx/sat/thrift/version/Version.java4
-rw-r--r--src/main/java/org/openslx/thrifthelper/ImagePublishDataEx.java9
-rw-r--r--src/main/thrift/bwlp.thrift9
9 files changed, 1928 insertions, 94 deletions
diff --git a/src/main/java/org/openslx/bwlp/thrift/iface/ImagePublishData.java b/src/main/java/org/openslx/bwlp/thrift/iface/ImagePublishData.java
index 87b632f..f04fd6b 100644
--- a/src/main/java/org/openslx/bwlp/thrift/iface/ImagePublishData.java
+++ b/src/main/java/org/openslx/bwlp/thrift/iface/ImagePublishData.java
@@ -34,7 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-01-04")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-04-18")
public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishData, ImagePublishData._Fields>, java.io.Serializable, Cloneable, Comparable<ImagePublishData> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ImagePublishData");
@@ -43,13 +43,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)5);
- private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRUCT, (short)6);
+ private static final org.apache.thrift.protocol.TField UPLOADER_FIELD_DESC = new org.apache.thrift.protocol.TField("uploader", org.apache.thrift.protocol.TType.STRUCT, (short)6);
private static final org.apache.thrift.protocol.TField FILE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("fileSize", org.apache.thrift.protocol.TType.I64, (short)7);
private static final org.apache.thrift.protocol.TField SOFTWARE_FIELD_DESC = new org.apache.thrift.protocol.TField("software", org.apache.thrift.protocol.TType.LIST, (short)8);
private static final org.apache.thrift.protocol.TField TAGS_FIELD_DESC = new org.apache.thrift.protocol.TField("tags", org.apache.thrift.protocol.TType.LIST, (short)9);
private static final org.apache.thrift.protocol.TField OS_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("osId", org.apache.thrift.protocol.TType.I32, (short)10);
private static final org.apache.thrift.protocol.TField VIRT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("virtId", org.apache.thrift.protocol.TType.STRING, (short)11);
private static final org.apache.thrift.protocol.TField IS_TEMPLATE_FIELD_DESC = new org.apache.thrift.protocol.TField("isTemplate", org.apache.thrift.protocol.TType.BOOL, (short)12);
+ private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRUCT, (short)13);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -62,13 +63,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
public String imageName; // required
public String description; // required
public long createTime; // required
- public UserInfo user; // required
+ public UserInfo uploader; // required
public long fileSize; // required
public List<String> software; // required
public List<String> tags; // required
public int osId; // required
public String virtId; // required
public boolean isTemplate; // required
+ public UserInfo owner; // 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 {
@@ -77,13 +79,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
IMAGE_NAME((short)3, "imageName"),
DESCRIPTION((short)4, "description"),
CREATE_TIME((short)5, "createTime"),
- USER((short)6, "user"),
+ UPLOADER((short)6, "uploader"),
FILE_SIZE((short)7, "fileSize"),
SOFTWARE((short)8, "software"),
TAGS((short)9, "tags"),
OS_ID((short)10, "osId"),
VIRT_ID((short)11, "virtId"),
- IS_TEMPLATE((short)12, "isTemplate");
+ IS_TEMPLATE((short)12, "isTemplate"),
+ OWNER((short)13, "owner");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -108,8 +111,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return DESCRIPTION;
case 5: // CREATE_TIME
return CREATE_TIME;
- case 6: // USER
- return USER;
+ case 6: // UPLOADER
+ return UPLOADER;
case 7: // FILE_SIZE
return FILE_SIZE;
case 8: // SOFTWARE
@@ -122,6 +125,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return VIRT_ID;
case 12: // IS_TEMPLATE
return IS_TEMPLATE;
+ case 13: // OWNER
+ return OWNER;
default:
return null;
}
@@ -180,7 +185,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "UnixTimestamp")));
- tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ tmpMap.put(_Fields.UPLOADER, new org.apache.thrift.meta_data.FieldMetaData("uploader", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserInfo.class)));
tmpMap.put(_Fields.FILE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("fileSize", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
@@ -196,6 +201,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.IS_TEMPLATE, new org.apache.thrift.meta_data.FieldMetaData("isTemplate", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserInfo.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ImagePublishData.class, metaDataMap);
}
@@ -209,13 +216,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
String imageName,
String description,
long createTime,
- UserInfo user,
+ UserInfo uploader,
long fileSize,
List<String> software,
List<String> tags,
int osId,
String virtId,
- boolean isTemplate)
+ boolean isTemplate,
+ UserInfo owner)
{
this();
this.imageBaseId = imageBaseId;
@@ -224,7 +232,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.description = description;
this.createTime = createTime;
setCreateTimeIsSet(true);
- this.user = user;
+ this.uploader = uploader;
this.fileSize = fileSize;
setFileSizeIsSet(true);
this.software = software;
@@ -234,6 +242,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.virtId = virtId;
this.isTemplate = isTemplate;
setIsTemplateIsSet(true);
+ this.owner = owner;
}
/**
@@ -254,8 +263,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.description = other.description;
}
this.createTime = other.createTime;
- if (other.isSetUser()) {
- this.user = new UserInfo(other.user);
+ if (other.isSetUploader()) {
+ this.uploader = new UserInfo(other.uploader);
}
this.fileSize = other.fileSize;
if (other.isSetSoftware()) {
@@ -271,6 +280,9 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.virtId = other.virtId;
}
this.isTemplate = other.isTemplate;
+ if (other.isSetOwner()) {
+ this.owner = new UserInfo(other.owner);
+ }
}
public ImagePublishData deepCopy() {
@@ -285,7 +297,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.description = null;
setCreateTimeIsSet(false);
this.createTime = 0;
- this.user = null;
+ this.uploader = null;
setFileSizeIsSet(false);
this.fileSize = 0;
this.software = null;
@@ -295,6 +307,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
this.virtId = null;
setIsTemplateIsSet(false);
this.isTemplate = false;
+ this.owner = null;
}
public String getImageBaseId() {
@@ -416,27 +429,27 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
}
- public UserInfo getUser() {
- return this.user;
+ public UserInfo getUploader() {
+ return this.uploader;
}
- public ImagePublishData setUser(UserInfo user) {
- this.user = user;
+ public ImagePublishData setUploader(UserInfo uploader) {
+ this.uploader = uploader;
return this;
}
- public void unsetUser() {
- this.user = null;
+ public void unsetUploader() {
+ this.uploader = null;
}
- /** Returns true if field user is set (has been assigned a value) and false otherwise */
- public boolean isSetUser() {
- return this.user != null;
+ /** Returns true if field uploader is set (has been assigned a value) and false otherwise */
+ public boolean isSetUploader() {
+ return this.uploader != null;
}
- public void setUserIsSet(boolean value) {
+ public void setUploaderIsSet(boolean value) {
if (!value) {
- this.user = null;
+ this.uploader = null;
}
}
@@ -611,6 +624,30 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID, value);
}
+ public UserInfo getOwner() {
+ return this.owner;
+ }
+
+ public ImagePublishData setOwner(UserInfo owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ public void unsetOwner() {
+ this.owner = null;
+ }
+
+ /** Returns true if field owner is set (has been assigned a value) and false otherwise */
+ public boolean isSetOwner() {
+ return this.owner != null;
+ }
+
+ public void setOwnerIsSet(boolean value) {
+ if (!value) {
+ this.owner = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case IMAGE_BASE_ID:
@@ -653,11 +690,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
}
break;
- case USER:
+ case UPLOADER:
if (value == null) {
- unsetUser();
+ unsetUploader();
} else {
- setUser((UserInfo)value);
+ setUploader((UserInfo)value);
}
break;
@@ -709,6 +746,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
}
break;
+ case OWNER:
+ if (value == null) {
+ unsetOwner();
+ } else {
+ setOwner((UserInfo)value);
+ }
+ break;
+
}
}
@@ -729,8 +774,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
case CREATE_TIME:
return getCreateTime();
- case USER:
- return getUser();
+ case UPLOADER:
+ return getUploader();
case FILE_SIZE:
return getFileSize();
@@ -750,6 +795,9 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
case IS_TEMPLATE:
return isIsTemplate();
+ case OWNER:
+ return getOwner();
+
}
throw new IllegalStateException();
}
@@ -771,8 +819,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return isSetDescription();
case CREATE_TIME:
return isSetCreateTime();
- case USER:
- return isSetUser();
+ case UPLOADER:
+ return isSetUploader();
case FILE_SIZE:
return isSetFileSize();
case SOFTWARE:
@@ -785,6 +833,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return isSetVirtId();
case IS_TEMPLATE:
return isSetIsTemplate();
+ case OWNER:
+ return isSetOwner();
}
throw new IllegalStateException();
}
@@ -847,12 +897,12 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return false;
}
- boolean this_present_user = true && this.isSetUser();
- boolean that_present_user = true && that.isSetUser();
- if (this_present_user || that_present_user) {
- if (!(this_present_user && that_present_user))
+ boolean this_present_uploader = true && this.isSetUploader();
+ boolean that_present_uploader = true && that.isSetUploader();
+ if (this_present_uploader || that_present_uploader) {
+ if (!(this_present_uploader && that_present_uploader))
return false;
- if (!this.user.equals(that.user))
+ if (!this.uploader.equals(that.uploader))
return false;
}
@@ -910,6 +960,15 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return false;
}
+ boolean this_present_owner = true && this.isSetOwner();
+ boolean that_present_owner = true && that.isSetOwner();
+ if (this_present_owner || that_present_owner) {
+ if (!(this_present_owner && that_present_owner))
+ return false;
+ if (!this.owner.equals(that.owner))
+ return false;
+ }
+
return true;
}
@@ -942,10 +1001,10 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (present_createTime)
list.add(createTime);
- boolean present_user = true && (isSetUser());
- list.add(present_user);
- if (present_user)
- list.add(user);
+ boolean present_uploader = true && (isSetUploader());
+ list.add(present_uploader);
+ if (present_uploader)
+ list.add(uploader);
boolean present_fileSize = true;
list.add(present_fileSize);
@@ -977,6 +1036,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (present_isTemplate)
list.add(isTemplate);
+ boolean present_owner = true && (isSetOwner());
+ list.add(present_owner);
+ if (present_owner)
+ list.add(owner);
+
return list.hashCode();
}
@@ -1038,12 +1102,12 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser());
+ lastComparison = Boolean.valueOf(isSetUploader()).compareTo(other.isSetUploader());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetUser()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user);
+ if (isSetUploader()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uploader, other.uploader);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1108,6 +1172,16 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetOwner()).compareTo(other.isSetOwner());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOwner()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, other.owner);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -1164,11 +1238,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
sb.append(this.createTime);
first = false;
if (!first) sb.append(", ");
- sb.append("user:");
- if (this.user == null) {
+ sb.append("uploader:");
+ if (this.uploader == null) {
sb.append("null");
} else {
- sb.append(this.user);
+ sb.append(this.uploader);
}
first = false;
if (!first) sb.append(", ");
@@ -1207,6 +1281,14 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
sb.append("isTemplate:");
sb.append(this.isTemplate);
first = false;
+ if (!first) sb.append(", ");
+ sb.append("owner:");
+ if (this.owner == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.owner);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -1214,8 +1296,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
- if (user != null) {
- user.validate();
+ if (uploader != null) {
+ uploader.validate();
+ }
+ if (owner != null) {
+ owner.validate();
}
}
@@ -1295,11 +1380,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 6: // USER
+ case 6: // UPLOADER
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.user = new UserInfo();
- struct.user.read(iprot);
- struct.setUserIsSet(true);
+ struct.uploader = new UserInfo();
+ struct.uploader.read(iprot);
+ struct.setUploaderIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -1372,6 +1457,15 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 13: // OWNER
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.owner = new UserInfo();
+ struct.owner.read(iprot);
+ struct.setOwnerIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -1410,9 +1504,9 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
oprot.writeI64(struct.createTime);
oprot.writeFieldEnd();
- if (struct.user != null) {
- oprot.writeFieldBegin(USER_FIELD_DESC);
- struct.user.write(oprot);
+ if (struct.uploader != null) {
+ oprot.writeFieldBegin(UPLOADER_FIELD_DESC);
+ struct.uploader.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(FILE_SIZE_FIELD_DESC);
@@ -1453,6 +1547,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
oprot.writeFieldBegin(IS_TEMPLATE_FIELD_DESC);
oprot.writeBool(struct.isTemplate);
oprot.writeFieldEnd();
+ if (struct.owner != null) {
+ oprot.writeFieldBegin(OWNER_FIELD_DESC);
+ struct.owner.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -1486,7 +1585,7 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (struct.isSetCreateTime()) {
optionals.set(4);
}
- if (struct.isSetUser()) {
+ if (struct.isSetUploader()) {
optionals.set(5);
}
if (struct.isSetFileSize()) {
@@ -1507,7 +1606,10 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (struct.isSetIsTemplate()) {
optionals.set(11);
}
- oprot.writeBitSet(optionals, 12);
+ if (struct.isSetOwner()) {
+ optionals.set(12);
+ }
+ oprot.writeBitSet(optionals, 13);
if (struct.isSetImageBaseId()) {
oprot.writeString(struct.imageBaseId);
}
@@ -1523,8 +1625,8 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (struct.isSetCreateTime()) {
oprot.writeI64(struct.createTime);
}
- if (struct.isSetUser()) {
- struct.user.write(oprot);
+ if (struct.isSetUploader()) {
+ struct.uploader.write(oprot);
}
if (struct.isSetFileSize()) {
oprot.writeI64(struct.fileSize);
@@ -1556,12 +1658,15 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
if (struct.isSetIsTemplate()) {
oprot.writeBool(struct.isTemplate);
}
+ if (struct.isSetOwner()) {
+ struct.owner.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ImagePublishData struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(12);
+ BitSet incoming = iprot.readBitSet(13);
if (incoming.get(0)) {
struct.imageBaseId = iprot.readString();
struct.setImageBaseIdIsSet(true);
@@ -1583,9 +1688,9 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
struct.setCreateTimeIsSet(true);
}
if (incoming.get(5)) {
- struct.user = new UserInfo();
- struct.user.read(iprot);
- struct.setUserIsSet(true);
+ struct.uploader = new UserInfo();
+ struct.uploader.read(iprot);
+ struct.setUploaderIsSet(true);
}
if (incoming.get(6)) {
struct.fileSize = iprot.readI64();
@@ -1629,6 +1734,11 @@ public class ImagePublishData implements org.apache.thrift.TBase<ImagePublishDat
struct.isTemplate = iprot.readBool();
struct.setIsTemplateIsSet(true);
}
+ if (incoming.get(12)) {
+ struct.owner = new UserInfo();
+ struct.owner.read(iprot);
+ struct.setOwnerIsSet(true);
+ }
}
}
diff --git a/src/main/java/org/openslx/bwlp/thrift/iface/SatelliteServer.java b/src/main/java/org/openslx/bwlp/thrift/iface/SatelliteServer.java
index 1b8da61..88cda96 100644
--- a/src/main/java/org/openslx/bwlp/thrift/iface/SatelliteServer.java
+++ b/src/main/java/org/openslx/bwlp/thrift/iface/SatelliteServer.java
@@ -34,12 +34,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-01-04")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-04-18")
public class SatelliteServer {
public interface Iface {
- public long getVersion() throws org.apache.thrift.TException;
+ public long getVersion(long clientVersion) throws org.apache.thrift.TException;
public SatelliteConfig getConfiguration() throws org.apache.thrift.TException;
@@ -101,6 +101,8 @@ public class SatelliteServer {
public String requestImageReplication(String userToken, String imageVersionId) throws TAuthorizationException, TNotFoundException, TInvocationException, org.apache.thrift.TException;
+ public String publishImageVersion(String userToken, String imageVersionId) throws TAuthorizationException, TNotFoundException, TInvocationException, TTransferRejectedException, org.apache.thrift.TException;
+
public String createLecture(String userToken, LectureWrite lecture) throws TAuthorizationException, TInvocationException, TInvalidDateParam, TNotFoundException, org.apache.thrift.TException;
public void updateLecture(String userToken, String lectureId, LectureWrite lecture) throws TAuthorizationException, TNotFoundException, TInvocationException, TInvalidDateParam, org.apache.thrift.TException;
@@ -121,7 +123,7 @@ public class SatelliteServer {
public interface AsyncIface {
- public void getVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getVersion(long clientVersion, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getConfiguration(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -183,6 +185,8 @@ public class SatelliteServer {
public void requestImageReplication(String userToken, String imageVersionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void publishImageVersion(String userToken, String imageVersionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void createLecture(String userToken, LectureWrite lecture, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void updateLecture(String userToken, String lectureId, LectureWrite lecture, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -221,15 +225,16 @@ public class SatelliteServer {
super(iprot, oprot);
}
- public long getVersion() throws org.apache.thrift.TException
+ public long getVersion(long clientVersion) throws org.apache.thrift.TException
{
- send_getVersion();
+ send_getVersion(clientVersion);
return recv_getVersion();
}
- public void send_getVersion() throws org.apache.thrift.TException
+ public void send_getVersion(long clientVersion) throws org.apache.thrift.TException
{
getVersion_args args = new getVersion_args();
+ args.setClientVersion(clientVersion);
sendBase("getVersion", args);
}
@@ -1088,6 +1093,42 @@ public class SatelliteServer {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "requestImageReplication failed: unknown result");
}
+ public String publishImageVersion(String userToken, String imageVersionId) throws TAuthorizationException, TNotFoundException, TInvocationException, TTransferRejectedException, org.apache.thrift.TException
+ {
+ send_publishImageVersion(userToken, imageVersionId);
+ return recv_publishImageVersion();
+ }
+
+ public void send_publishImageVersion(String userToken, String imageVersionId) throws org.apache.thrift.TException
+ {
+ publishImageVersion_args args = new publishImageVersion_args();
+ args.setUserToken(userToken);
+ args.setImageVersionId(imageVersionId);
+ sendBase("publishImageVersion", args);
+ }
+
+ public String recv_publishImageVersion() throws TAuthorizationException, TNotFoundException, TInvocationException, TTransferRejectedException, org.apache.thrift.TException
+ {
+ publishImageVersion_result result = new publishImageVersion_result();
+ receiveBase(result, "publishImageVersion");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.authError != null) {
+ throw result.authError;
+ }
+ if (result.notFound != null) {
+ throw result.notFound;
+ }
+ if (result.serverError != null) {
+ throw result.serverError;
+ }
+ if (result.tre != null) {
+ throw result.tre;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "publishImageVersion failed: unknown result");
+ }
+
public String createLecture(String userToken, LectureWrite lecture) throws TAuthorizationException, TInvocationException, TInvalidDateParam, TNotFoundException, org.apache.thrift.TException
{
send_createLecture(userToken, lecture);
@@ -1364,21 +1405,24 @@ public class SatelliteServer {
super(protocolFactory, clientManager, transport);
}
- public void getVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ public void getVersion(long clientVersion, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
- getVersion_call method_call = new getVersion_call(resultHandler, this, ___protocolFactory, ___transport);
+ getVersion_call method_call = new getVersion_call(clientVersion, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class getVersion_call extends org.apache.thrift.async.TAsyncMethodCall {
- public getVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ private long clientVersion;
+ public getVersion_call(long clientVersion, 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.clientVersion = clientVersion;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getVersion", org.apache.thrift.protocol.TMessageType.CALL, 0));
getVersion_args args = new getVersion_args();
+ args.setClientVersion(clientVersion);
args.write(prot);
prot.writeMessageEnd();
}
@@ -2413,6 +2457,41 @@ public class SatelliteServer {
}
}
+ public void publishImageVersion(String userToken, String imageVersionId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ publishImageVersion_call method_call = new publishImageVersion_call(userToken, imageVersionId, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class publishImageVersion_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String userToken;
+ private String imageVersionId;
+ public publishImageVersion_call(String userToken, String imageVersionId, 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.userToken = userToken;
+ this.imageVersionId = imageVersionId;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("publishImageVersion", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ publishImageVersion_args args = new publishImageVersion_args();
+ args.setUserToken(userToken);
+ args.setImageVersionId(imageVersionId);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public String getResult() throws TAuthorizationException, TNotFoundException, TInvocationException, TTransferRejectedException, 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_publishImageVersion();
+ }
+ }
+
public void createLecture(String userToken, LectureWrite lecture, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
createLecture_call method_call = new createLecture_call(userToken, lecture, resultHandler, this, ___protocolFactory, ___transport);
@@ -2746,6 +2825,7 @@ public class SatelliteServer {
processMap.put("setImageOwner", new setImageOwner());
processMap.put("setImageVersionExpiry", new setImageVersionExpiry());
processMap.put("requestImageReplication", new requestImageReplication());
+ processMap.put("publishImageVersion", new publishImageVersion());
processMap.put("createLecture", new createLecture());
processMap.put("updateLecture", new updateLecture());
processMap.put("getLectureList", new getLectureList());
@@ -2772,7 +2852,7 @@ public class SatelliteServer {
public getVersion_result getResult(I iface, getVersion_args args) throws org.apache.thrift.TException {
getVersion_result result = new getVersion_result();
- result.success = iface.getVersion();
+ result.success = iface.getVersion(args.clientVersion);
result.setSuccessIsSet(true);
return result;
}
@@ -3542,6 +3622,36 @@ public class SatelliteServer {
}
}
+ public static class publishImageVersion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, publishImageVersion_args> {
+ public publishImageVersion() {
+ super("publishImageVersion");
+ }
+
+ public publishImageVersion_args getEmptyArgsInstance() {
+ return new publishImageVersion_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public publishImageVersion_result getResult(I iface, publishImageVersion_args args) throws org.apache.thrift.TException {
+ publishImageVersion_result result = new publishImageVersion_result();
+ try {
+ result.success = iface.publishImageVersion(args.userToken, args.imageVersionId);
+ } catch (TAuthorizationException authError) {
+ result.authError = authError;
+ } catch (TNotFoundException notFound) {
+ result.notFound = notFound;
+ } catch (TInvocationException serverError) {
+ result.serverError = serverError;
+ } catch (TTransferRejectedException tre) {
+ result.tre = tre;
+ }
+ return result;
+ }
+ }
+
public static class createLecture<I extends Iface> extends org.apache.thrift.ProcessFunction<I, createLecture_args> {
public createLecture() {
super("createLecture");
@@ -3812,6 +3922,7 @@ public class SatelliteServer {
processMap.put("setImageOwner", new setImageOwner());
processMap.put("setImageVersionExpiry", new setImageVersionExpiry());
processMap.put("requestImageReplication", new requestImageReplication());
+ processMap.put("publishImageVersion", new publishImageVersion());
processMap.put("createLecture", new createLecture());
processMap.put("updateLecture", new updateLecture());
processMap.put("getLectureList", new getLectureList());
@@ -3871,7 +3982,7 @@ public class SatelliteServer {
}
public void start(I iface, getVersion_args args, org.apache.thrift.async.AsyncMethodCallback<Long> resultHandler) throws TException {
- iface.getVersion(resultHandler);
+ iface.getVersion(args.clientVersion,resultHandler);
}
}
@@ -5706,6 +5817,78 @@ public class SatelliteServer {
}
}
+ public static class publishImageVersion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, publishImageVersion_args, String> {
+ public publishImageVersion() {
+ super("publishImageVersion");
+ }
+
+ public publishImageVersion_args getEmptyArgsInstance() {
+ return new publishImageVersion_args();
+ }
+
+ public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<String>() {
+ public void onComplete(String o) {
+ publishImageVersion_result result = new publishImageVersion_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;
+ publishImageVersion_result result = new publishImageVersion_result();
+ if (e instanceof TAuthorizationException) {
+ result.authError = (TAuthorizationException) e;
+ result.setAuthErrorIsSet(true);
+ msg = result;
+ }
+ else if (e instanceof TNotFoundException) {
+ result.notFound = (TNotFoundException) e;
+ result.setNotFoundIsSet(true);
+ msg = result;
+ }
+ else if (e instanceof TInvocationException) {
+ result.serverError = (TInvocationException) e;
+ result.setServerErrorIsSet(true);
+ msg = result;
+ }
+ else if (e instanceof TTransferRejectedException) {
+ result.tre = (TTransferRejectedException) e;
+ result.setTreIsSet(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, publishImageVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+ iface.publishImageVersion(args.userToken, args.imageVersionId,resultHandler);
+ }
+ }
+
public static class createLecture<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, createLecture_args, String> {
public createLecture() {
super("createLecture");
@@ -6248,6 +6431,7 @@ public class SatelliteServer {
public static class getVersion_args implements org.apache.thrift.TBase<getVersion_args, getVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getVersion_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getVersion_args");
+ private static final org.apache.thrift.protocol.TField CLIENT_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("clientVersion", org.apache.thrift.protocol.TType.I64, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -6255,10 +6439,11 @@ public class SatelliteServer {
schemes.put(TupleScheme.class, new getVersion_argsTupleSchemeFactory());
}
+ public long clientVersion; // 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 {
-;
+ CLIENT_VERSION((short)1, "clientVersion");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -6273,6 +6458,8 @@ public class SatelliteServer {
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
+ case 1: // CLIENT_VERSION
+ return CLIENT_VERSION;
default:
return null;
}
@@ -6311,9 +6498,15 @@ public class SatelliteServer {
return _fieldName;
}
}
+
+ // isset id assignments
+ private static final int __CLIENTVERSION_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.CLIENT_VERSION, new org.apache.thrift.meta_data.FieldMetaData("clientVersion", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "int")));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getVersion_args.class, metaDataMap);
}
@@ -6321,10 +6514,20 @@ public class SatelliteServer {
public getVersion_args() {
}
+ public getVersion_args(
+ long clientVersion)
+ {
+ this();
+ this.clientVersion = clientVersion;
+ setClientVersionIsSet(true);
+ }
+
/**
* Performs a deep copy on <i>other</i>.
*/
public getVersion_args(getVersion_args other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.clientVersion = other.clientVersion;
}
public getVersion_args deepCopy() {
@@ -6333,15 +6536,51 @@ public class SatelliteServer {
@Override
public void clear() {
+ setClientVersionIsSet(false);
+ this.clientVersion = 0;
+ }
+
+ public long getClientVersion() {
+ return this.clientVersion;
+ }
+
+ public getVersion_args setClientVersion(long clientVersion) {
+ this.clientVersion = clientVersion;
+ setClientVersionIsSet(true);
+ return this;
+ }
+
+ public void unsetClientVersion() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CLIENTVERSION_ISSET_ID);
+ }
+
+ /** Returns true if field clientVersion is set (has been assigned a value) and false otherwise */
+ public boolean isSetClientVersion() {
+ return EncodingUtils.testBit(__isset_bitfield, __CLIENTVERSION_ISSET_ID);
+ }
+
+ public void setClientVersionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CLIENTVERSION_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
+ case CLIENT_VERSION:
+ if (value == null) {
+ unsetClientVersion();
+ } else {
+ setClientVersion((Long)value);
+ }
+ break;
+
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
+ case CLIENT_VERSION:
+ return getClientVersion();
+
}
throw new IllegalStateException();
}
@@ -6353,6 +6592,8 @@ public class SatelliteServer {
}
switch (field) {
+ case CLIENT_VERSION:
+ return isSetClientVersion();
}
throw new IllegalStateException();
}
@@ -6370,6 +6611,15 @@ public class SatelliteServer {
if (that == null)
return false;
+ boolean this_present_clientVersion = true;
+ boolean that_present_clientVersion = true;
+ if (this_present_clientVersion || that_present_clientVersion) {
+ if (!(this_present_clientVersion && that_present_clientVersion))
+ return false;
+ if (this.clientVersion != that.clientVersion)
+ return false;
+ }
+
return true;
}
@@ -6377,6 +6627,11 @@ public class SatelliteServer {
public int hashCode() {
List<Object> list = new ArrayList<Object>();
+ boolean present_clientVersion = true;
+ list.add(present_clientVersion);
+ if (present_clientVersion)
+ list.add(clientVersion);
+
return list.hashCode();
}
@@ -6388,6 +6643,16 @@ public class SatelliteServer {
int lastComparison = 0;
+ lastComparison = Boolean.valueOf(isSetClientVersion()).compareTo(other.isSetClientVersion());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetClientVersion()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clientVersion, other.clientVersion);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -6408,6 +6673,9 @@ public class SatelliteServer {
StringBuilder sb = new StringBuilder("getVersion_args(");
boolean first = true;
+ sb.append("clientVersion:");
+ sb.append(this.clientVersion);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -6427,6 +6695,8 @@ public class SatelliteServer {
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);
@@ -6451,6 +6721,14 @@ public class SatelliteServer {
break;
}
switch (schemeField.id) {
+ case 1: // CLIENT_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.clientVersion = iprot.readI64();
+ struct.setClientVersionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -6466,6 +6744,9 @@ public class SatelliteServer {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(CLIENT_VERSION_FIELD_DESC);
+ oprot.writeI64(struct.clientVersion);
+ oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -6483,11 +6764,24 @@ public class SatelliteServer {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getVersion_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetClientVersion()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetClientVersion()) {
+ oprot.writeI64(struct.clientVersion);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getVersion_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.clientVersion = iprot.readI64();
+ struct.setClientVersionIsSet(true);
+ }
}
}
@@ -36065,6 +36359,1261 @@ public class SatelliteServer {
}
+ public static class publishImageVersion_args implements org.apache.thrift.TBase<publishImageVersion_args, publishImageVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<publishImageVersion_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("publishImageVersion_args");
+
+ private static final org.apache.thrift.protocol.TField USER_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("userToken", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField IMAGE_VERSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("imageVersionId", 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 publishImageVersion_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new publishImageVersion_argsTupleSchemeFactory());
+ }
+
+ public String userToken; // required
+ public String imageVersionId; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ USER_TOKEN((short)1, "userToken"),
+ IMAGE_VERSION_ID((short)2, "imageVersionId");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // USER_TOKEN
+ return USER_TOKEN;
+ case 2: // IMAGE_VERSION_ID
+ return IMAGE_VERSION_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.USER_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("userToken", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Token")));
+ tmpMap.put(_Fields.IMAGE_VERSION_ID, new org.apache.thrift.meta_data.FieldMetaData("imageVersionId", 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(publishImageVersion_args.class, metaDataMap);
+ }
+
+ public publishImageVersion_args() {
+ }
+
+ public publishImageVersion_args(
+ String userToken,
+ String imageVersionId)
+ {
+ this();
+ this.userToken = userToken;
+ this.imageVersionId = imageVersionId;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public publishImageVersion_args(publishImageVersion_args other) {
+ if (other.isSetUserToken()) {
+ this.userToken = other.userToken;
+ }
+ if (other.isSetImageVersionId()) {
+ this.imageVersionId = other.imageVersionId;
+ }
+ }
+
+ public publishImageVersion_args deepCopy() {
+ return new publishImageVersion_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.userToken = null;
+ this.imageVersionId = null;
+ }
+
+ public String getUserToken() {
+ return this.userToken;
+ }
+
+ public publishImageVersion_args setUserToken(String userToken) {
+ this.userToken = userToken;
+ return this;
+ }
+
+ public void unsetUserToken() {
+ this.userToken = null;
+ }
+
+ /** Returns true if field userToken is set (has been assigned a value) and false otherwise */
+ public boolean isSetUserToken() {
+ return this.userToken != null;
+ }
+
+ public void setUserTokenIsSet(boolean value) {
+ if (!value) {
+ this.userToken = null;
+ }
+ }
+
+ public String getImageVersionId() {
+ return this.imageVersionId;
+ }
+
+ public publishImageVersion_args setImageVersionId(String imageVersionId) {
+ this.imageVersionId = imageVersionId;
+ return this;
+ }
+
+ public void unsetImageVersionId() {
+ this.imageVersionId = null;
+ }
+
+ /** Returns true if field imageVersionId is set (has been assigned a value) and false otherwise */
+ public boolean isSetImageVersionId() {
+ return this.imageVersionId != null;
+ }
+
+ public void setImageVersionIdIsSet(boolean value) {
+ if (!value) {
+ this.imageVersionId = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case USER_TOKEN:
+ if (value == null) {
+ unsetUserToken();
+ } else {
+ setUserToken((String)value);
+ }
+ break;
+
+ case IMAGE_VERSION_ID:
+ if (value == null) {
+ unsetImageVersionId();
+ } else {
+ setImageVersionId((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case USER_TOKEN:
+ return getUserToken();
+
+ case IMAGE_VERSION_ID:
+ return getImageVersionId();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case USER_TOKEN:
+ return isSetUserToken();
+ case IMAGE_VERSION_ID:
+ return isSetImageVersionId();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof publishImageVersion_args)
+ return this.equals((publishImageVersion_args)that);
+ return false;
+ }
+
+ public boolean equals(publishImageVersion_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_userToken = true && this.isSetUserToken();
+ boolean that_present_userToken = true && that.isSetUserToken();
+ if (this_present_userToken || that_present_userToken) {
+ if (!(this_present_userToken && that_present_userToken))
+ return false;
+ if (!this.userToken.equals(that.userToken))
+ return false;
+ }
+
+ boolean this_present_imageVersionId = true && this.isSetImageVersionId();
+ boolean that_present_imageVersionId = true && that.isSetImageVersionId();
+ if (this_present_imageVersionId || that_present_imageVersionId) {
+ if (!(this_present_imageVersionId && that_present_imageVersionId))
+ return false;
+ if (!this.imageVersionId.equals(that.imageVersionId))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_userToken = true && (isSetUserToken());
+ list.add(present_userToken);
+ if (present_userToken)
+ list.add(userToken);
+
+ boolean present_imageVersionId = true && (isSetImageVersionId());
+ list.add(present_imageVersionId);
+ if (present_imageVersionId)
+ list.add(imageVersionId);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(publishImageVersion_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetUserToken()).compareTo(other.isSetUserToken());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserToken()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userToken, other.userToken);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetImageVersionId()).compareTo(other.isSetImageVersionId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetImageVersionId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageVersionId, other.imageVersionId);
+ 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("publishImageVersion_args(");
+ boolean first = true;
+
+ sb.append("userToken:");
+ if (this.userToken == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userToken);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("imageVersionId:");
+ if (this.imageVersionId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.imageVersionId);
+ }
+ 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 publishImageVersion_argsStandardSchemeFactory implements SchemeFactory {
+ public publishImageVersion_argsStandardScheme getScheme() {
+ return new publishImageVersion_argsStandardScheme();
+ }
+ }
+
+ private static class publishImageVersion_argsStandardScheme extends StandardScheme<publishImageVersion_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, publishImageVersion_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: // USER_TOKEN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.userToken = iprot.readString();
+ struct.setUserTokenIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // IMAGE_VERSION_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.imageVersionId = iprot.readString();
+ struct.setImageVersionIdIsSet(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, publishImageVersion_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.userToken != null) {
+ oprot.writeFieldBegin(USER_TOKEN_FIELD_DESC);
+ oprot.writeString(struct.userToken);
+ oprot.writeFieldEnd();
+ }
+ if (struct.imageVersionId != null) {
+ oprot.writeFieldBegin(IMAGE_VERSION_ID_FIELD_DESC);
+ oprot.writeString(struct.imageVersionId);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class publishImageVersion_argsTupleSchemeFactory implements SchemeFactory {
+ public publishImageVersion_argsTupleScheme getScheme() {
+ return new publishImageVersion_argsTupleScheme();
+ }
+ }
+
+ private static class publishImageVersion_argsTupleScheme extends TupleScheme<publishImageVersion_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, publishImageVersion_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetUserToken()) {
+ optionals.set(0);
+ }
+ if (struct.isSetImageVersionId()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetUserToken()) {
+ oprot.writeString(struct.userToken);
+ }
+ if (struct.isSetImageVersionId()) {
+ oprot.writeString(struct.imageVersionId);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, publishImageVersion_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.userToken = iprot.readString();
+ struct.setUserTokenIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.imageVersionId = iprot.readString();
+ struct.setImageVersionIdIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class publishImageVersion_result implements org.apache.thrift.TBase<publishImageVersion_result, publishImageVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<publishImageVersion_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("publishImageVersion_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+ private static final org.apache.thrift.protocol.TField AUTH_ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("authError", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField NOT_FOUND_FIELD_DESC = new org.apache.thrift.protocol.TField("notFound", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField SERVER_ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("serverError", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+ private static final org.apache.thrift.protocol.TField TRE_FIELD_DESC = new org.apache.thrift.protocol.TField("tre", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new publishImageVersion_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new publishImageVersion_resultTupleSchemeFactory());
+ }
+
+ public String success; // required
+ public TAuthorizationException authError; // required
+ public TNotFoundException notFound; // required
+ public TInvocationException serverError; // required
+ public TTransferRejectedException tre; // 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"),
+ AUTH_ERROR((short)1, "authError"),
+ NOT_FOUND((short)2, "notFound"),
+ SERVER_ERROR((short)3, "serverError"),
+ TRE((short)4, "tre");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ case 1: // AUTH_ERROR
+ return AUTH_ERROR;
+ case 2: // NOT_FOUND
+ return NOT_FOUND;
+ case 3: // SERVER_ERROR
+ return SERVER_ERROR;
+ case 4: // TRE
+ return TRE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "UUID")));
+ tmpMap.put(_Fields.AUTH_ERROR, new org.apache.thrift.meta_data.FieldMetaData("authError", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.NOT_FOUND, new org.apache.thrift.meta_data.FieldMetaData("notFound", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.SERVER_ERROR, new org.apache.thrift.meta_data.FieldMetaData("serverError", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.TRE, new org.apache.thrift.meta_data.FieldMetaData("tre", 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(publishImageVersion_result.class, metaDataMap);
+ }
+
+ public publishImageVersion_result() {
+ }
+
+ public publishImageVersion_result(
+ String success,
+ TAuthorizationException authError,
+ TNotFoundException notFound,
+ TInvocationException serverError,
+ TTransferRejectedException tre)
+ {
+ this();
+ this.success = success;
+ this.authError = authError;
+ this.notFound = notFound;
+ this.serverError = serverError;
+ this.tre = tre;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public publishImageVersion_result(publishImageVersion_result other) {
+ if (other.isSetSuccess()) {
+ this.success = other.success;
+ }
+ if (other.isSetAuthError()) {
+ this.authError = new TAuthorizationException(other.authError);
+ }
+ if (other.isSetNotFound()) {
+ this.notFound = new TNotFoundException(other.notFound);
+ }
+ if (other.isSetServerError()) {
+ this.serverError = new TInvocationException(other.serverError);
+ }
+ if (other.isSetTre()) {
+ this.tre = new TTransferRejectedException(other.tre);
+ }
+ }
+
+ public publishImageVersion_result deepCopy() {
+ return new publishImageVersion_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.authError = null;
+ this.notFound = null;
+ this.serverError = null;
+ this.tre = null;
+ }
+
+ public String getSuccess() {
+ return this.success;
+ }
+
+ public publishImageVersion_result setSuccess(String success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public TAuthorizationException getAuthError() {
+ return this.authError;
+ }
+
+ public publishImageVersion_result setAuthError(TAuthorizationException authError) {
+ this.authError = authError;
+ return this;
+ }
+
+ public void unsetAuthError() {
+ this.authError = null;
+ }
+
+ /** Returns true if field authError is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthError() {
+ return this.authError != null;
+ }
+
+ public void setAuthErrorIsSet(boolean value) {
+ if (!value) {
+ this.authError = null;
+ }
+ }
+
+ public TNotFoundException getNotFound() {
+ return this.notFound;
+ }
+
+ public publishImageVersion_result setNotFound(TNotFoundException notFound) {
+ this.notFound = notFound;
+ return this;
+ }
+
+ public void unsetNotFound() {
+ this.notFound = null;
+ }
+
+ /** Returns true if field notFound is set (has been assigned a value) and false otherwise */
+ public boolean isSetNotFound() {
+ return this.notFound != null;
+ }
+
+ public void setNotFoundIsSet(boolean value) {
+ if (!value) {
+ this.notFound = null;
+ }
+ }
+
+ public TInvocationException getServerError() {
+ return this.serverError;
+ }
+
+ public publishImageVersion_result setServerError(TInvocationException serverError) {
+ this.serverError = serverError;
+ return this;
+ }
+
+ public void unsetServerError() {
+ this.serverError = null;
+ }
+
+ /** Returns true if field serverError is set (has been assigned a value) and false otherwise */
+ public boolean isSetServerError() {
+ return this.serverError != null;
+ }
+
+ public void setServerErrorIsSet(boolean value) {
+ if (!value) {
+ this.serverError = null;
+ }
+ }
+
+ public TTransferRejectedException getTre() {
+ return this.tre;
+ }
+
+ public publishImageVersion_result setTre(TTransferRejectedException tre) {
+ this.tre = tre;
+ return this;
+ }
+
+ public void unsetTre() {
+ this.tre = null;
+ }
+
+ /** Returns true if field tre is set (has been assigned a value) and false otherwise */
+ public boolean isSetTre() {
+ return this.tre != null;
+ }
+
+ public void setTreIsSet(boolean value) {
+ if (!value) {
+ this.tre = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((String)value);
+ }
+ break;
+
+ case AUTH_ERROR:
+ if (value == null) {
+ unsetAuthError();
+ } else {
+ setAuthError((TAuthorizationException)value);
+ }
+ break;
+
+ case NOT_FOUND:
+ if (value == null) {
+ unsetNotFound();
+ } else {
+ setNotFound((TNotFoundException)value);
+ }
+ break;
+
+ case SERVER_ERROR:
+ if (value == null) {
+ unsetServerError();
+ } else {
+ setServerError((TInvocationException)value);
+ }
+ break;
+
+ case TRE:
+ if (value == null) {
+ unsetTre();
+ } else {
+ setTre((TTransferRejectedException)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case AUTH_ERROR:
+ return getAuthError();
+
+ case NOT_FOUND:
+ return getNotFound();
+
+ case SERVER_ERROR:
+ return getServerError();
+
+ case TRE:
+ return getTre();
+
+ }
+ 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 AUTH_ERROR:
+ return isSetAuthError();
+ case NOT_FOUND:
+ return isSetNotFound();
+ case SERVER_ERROR:
+ return isSetServerError();
+ case TRE:
+ return isSetTre();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof publishImageVersion_result)
+ return this.equals((publishImageVersion_result)that);
+ return false;
+ }
+
+ public boolean equals(publishImageVersion_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_authError = true && this.isSetAuthError();
+ boolean that_present_authError = true && that.isSetAuthError();
+ if (this_present_authError || that_present_authError) {
+ if (!(this_present_authError && that_present_authError))
+ return false;
+ if (!this.authError.equals(that.authError))
+ return false;
+ }
+
+ boolean this_present_notFound = true && this.isSetNotFound();
+ boolean that_present_notFound = true && that.isSetNotFound();
+ if (this_present_notFound || that_present_notFound) {
+ if (!(this_present_notFound && that_present_notFound))
+ return false;
+ if (!this.notFound.equals(that.notFound))
+ return false;
+ }
+
+ boolean this_present_serverError = true && this.isSetServerError();
+ boolean that_present_serverError = true && that.isSetServerError();
+ if (this_present_serverError || that_present_serverError) {
+ if (!(this_present_serverError && that_present_serverError))
+ return false;
+ if (!this.serverError.equals(that.serverError))
+ return false;
+ }
+
+ boolean this_present_tre = true && this.isSetTre();
+ boolean that_present_tre = true && that.isSetTre();
+ if (this_present_tre || that_present_tre) {
+ if (!(this_present_tre && that_present_tre))
+ return false;
+ if (!this.tre.equals(that.tre))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_success = true && (isSetSuccess());
+ list.add(present_success);
+ if (present_success)
+ list.add(success);
+
+ boolean present_authError = true && (isSetAuthError());
+ list.add(present_authError);
+ if (present_authError)
+ list.add(authError);
+
+ boolean present_notFound = true && (isSetNotFound());
+ list.add(present_notFound);
+ if (present_notFound)
+ list.add(notFound);
+
+ boolean present_serverError = true && (isSetServerError());
+ list.add(present_serverError);
+ if (present_serverError)
+ list.add(serverError);
+
+ boolean present_tre = true && (isSetTre());
+ list.add(present_tre);
+ if (present_tre)
+ list.add(tre);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(publishImageVersion_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(isSetAuthError()).compareTo(other.isSetAuthError());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthError()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authError, other.authError);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNotFound()).compareTo(other.isSetNotFound());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNotFound()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notFound, other.notFound);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServerError()).compareTo(other.isSetServerError());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServerError()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverError, other.serverError);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTre()).compareTo(other.isSetTre());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTre()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tre, other.tre);
+ 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("publishImageVersion_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("authError:");
+ if (this.authError == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authError);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("notFound:");
+ if (this.notFound == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.notFound);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serverError:");
+ if (this.serverError == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serverError);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("tre:");
+ if (this.tre == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tre);
+ }
+ 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 publishImageVersion_resultStandardSchemeFactory implements SchemeFactory {
+ public publishImageVersion_resultStandardScheme getScheme() {
+ return new publishImageVersion_resultStandardScheme();
+ }
+ }
+
+ private static class publishImageVersion_resultStandardScheme extends StandardScheme<publishImageVersion_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, publishImageVersion_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.success = iprot.readString();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // AUTH_ERROR
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.authError = new TAuthorizationException();
+ struct.authError.read(iprot);
+ struct.setAuthErrorIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // NOT_FOUND
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.notFound = new TNotFoundException();
+ struct.notFound.read(iprot);
+ struct.setNotFoundIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // SERVER_ERROR
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.serverError = new TInvocationException();
+ struct.serverError.read(iprot);
+ struct.setServerErrorIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // TRE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.tre = new TTransferRejectedException();
+ struct.tre.read(iprot);
+ struct.setTreIsSet(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, publishImageVersion_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeString(struct.success);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authError != null) {
+ oprot.writeFieldBegin(AUTH_ERROR_FIELD_DESC);
+ struct.authError.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.notFound != null) {
+ oprot.writeFieldBegin(NOT_FOUND_FIELD_DESC);
+ struct.notFound.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serverError != null) {
+ oprot.writeFieldBegin(SERVER_ERROR_FIELD_DESC);
+ struct.serverError.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.tre != null) {
+ oprot.writeFieldBegin(TRE_FIELD_DESC);
+ struct.tre.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class publishImageVersion_resultTupleSchemeFactory implements SchemeFactory {
+ public publishImageVersion_resultTupleScheme getScheme() {
+ return new publishImageVersion_resultTupleScheme();
+ }
+ }
+
+ private static class publishImageVersion_resultTupleScheme extends TupleScheme<publishImageVersion_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, publishImageVersion_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetAuthError()) {
+ optionals.set(1);
+ }
+ if (struct.isSetNotFound()) {
+ optionals.set(2);
+ }
+ if (struct.isSetServerError()) {
+ optionals.set(3);
+ }
+ if (struct.isSetTre()) {
+ optionals.set(4);
+ }
+ oprot.writeBitSet(optionals, 5);
+ if (struct.isSetSuccess()) {
+ oprot.writeString(struct.success);
+ }
+ if (struct.isSetAuthError()) {
+ struct.authError.write(oprot);
+ }
+ if (struct.isSetNotFound()) {
+ struct.notFound.write(oprot);
+ }
+ if (struct.isSetServerError()) {
+ struct.serverError.write(oprot);
+ }
+ if (struct.isSetTre()) {
+ struct.tre.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, publishImageVersion_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(5);
+ if (incoming.get(0)) {
+ struct.success = iprot.readString();
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.authError = new TAuthorizationException();
+ struct.authError.read(iprot);
+ struct.setAuthErrorIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.notFound = new TNotFoundException();
+ struct.notFound.read(iprot);
+ struct.setNotFoundIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.serverError = new TInvocationException();
+ struct.serverError.read(iprot);
+ struct.setServerErrorIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.tre = new TTransferRejectedException();
+ struct.tre.read(iprot);
+ struct.setTreIsSet(true);
+ }
+ }
+ }
+
+ }
+
public static class createLecture_args implements org.apache.thrift.TBase<createLecture_args, createLecture_args._Fields>, java.io.Serializable, Cloneable, Comparable<createLecture_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createLecture_args");
diff --git a/src/main/java/org/openslx/filetransfer/util/ChunkList.java b/src/main/java/org/openslx/filetransfer/util/ChunkList.java
index 1b33102..e00aa0e 100644
--- a/src/main/java/org/openslx/filetransfer/util/ChunkList.java
+++ b/src/main/java/org/openslx/filetransfer/util/ChunkList.java
@@ -2,12 +2,14 @@ package org.openslx.filetransfer.util;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.apache.log4j.Logger;
+import org.openslx.util.ThriftUtil;
public class ChunkList
{
@@ -33,7 +35,7 @@ public class ChunkList
// 0 = complete, 1 = missing, 2 = uploading, 3 = queued for copying, 4 = copying, 5 = hashing
private final ByteBuffer statusArray;
-
+
/**
* True if at least one block has a checksum set
*/
@@ -121,6 +123,35 @@ public class ChunkList
}
/**
+ * Set status of blocks according to given "ismissing" list. Intended to be called
+ * right after creating the list, in case we have a local file already and want to
+ * resume downloading.
+ */
+ public synchronized void resumeFromStatusList( List<Boolean> statusList, long fileLength )
+ {
+ if ( !completeChunks.isEmpty() || !pendingChunks.isEmpty() ) {
+ LOGGER.warn( "Inconsistent state: resume called when not all chunks are marked missing" );
+ }
+ int index = 0;
+ for ( Boolean missing : statusList ) {
+ FileChunk chunk = allChunks.get( index );
+ if ( fileLength != 0 && fileLength < chunk.range.endOffset )
+ break; // Stop, file is shorter than end of this chunk
+ if ( missingChunks.remove( chunk ) || pendingChunks.remove( chunk ) ) {
+ completeChunks.add( chunk );
+ }
+ if ( missing ) {
+ // Trigger hashing
+ chunk.setStatus( ChunkStatus.HASHING );
+ } else {
+ // Assume complete
+ chunk.setStatus( ChunkStatus.COMPLETE );
+ }
+ index++;
+ }
+ }
+
+ /**
* Get a chunk that is marked complete, has a sha1 hash, but has not been hash-checked yet.
*
* @return chunk
@@ -166,7 +197,7 @@ public class ChunkList
public synchronized int markFailed( FileChunk c )
{
if ( !pendingChunks.remove( c ) ) {
- LOGGER.warn( "Inconsistent state: markTransferred called for Chunk " + c.toString()
+ LOGGER.warn( "Inconsistent state: markFailed called for Chunk " + c.toString()
+ ", but chunk is not marked as currently transferring!" );
return -1;
}
@@ -178,6 +209,25 @@ public class ChunkList
}
/**
+ * Mark a missing chunk as complete.
+ */
+ private synchronized boolean markMissingAsComplete( int index )
+ {
+ FileChunk chunk = allChunks.get( index );
+ if ( completeChunks.contains( chunk ) )
+ return true;
+ if ( !missingChunks.remove( chunk ) ) {
+ LOGGER.warn( "Inconsistent state: markMissingAsComplete called for chunk " + chunk.toString() + " (indexed as " + index
+ + ") which is not missing" );
+ return false;
+ }
+ chunk.setStatus( ChunkStatus.COMPLETE );
+ completeChunks.add( chunk );
+ this.notifyAll();
+ return true;
+ }
+
+ /**
* Check if all blocks in this list are marked as successfully transfered. If a complete chunk is
* marked as "hashing", or if there are some complete chunks without a sha1sum and some with a
* sha1sum, the transfer is considered incomplete.
@@ -259,4 +309,48 @@ public class ChunkList
return allChunks;
}
+ public static boolean hashListsEqualFcBb( List<FileChunk> one, List<ByteBuffer> two )
+ {
+ return hashListsEqualFcArray( one, ThriftUtil.unwrapByteBufferList( two ) );
+ }
+
+ public static boolean hashListsEqualFcArray( List<FileChunk> one, List<byte[]> two )
+ {
+ if ( one.size() != two.size() )
+ return false;
+ FileChunk first = one.get( 0 );
+ if ( first == null || first.getSha1Sum() == null )
+ return false;
+ Iterator<byte[]> it = two.iterator();
+ for ( FileChunk existingChunk : one ) {
+ byte[] testChunk = it.next();
+ if ( !Arrays.equals( testChunk, existingChunk.getSha1Sum() ) )
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean hashListsEqualBbBb( List<ByteBuffer> list1, List<ByteBuffer> list2 )
+ {
+ return hashListsEqualBbArray( list1, ThriftUtil.unwrapByteBufferList( list2 ) );
+ }
+
+ public static boolean hashListsEqualBbArray( List<ByteBuffer> bufferList, List<byte[]> arrayList )
+ {
+ return hashListsEqualArray( ThriftUtil.unwrapByteBufferList( bufferList ), arrayList );
+ }
+
+ public static boolean hashListsEqualArray( List<byte[]> list1, List<byte[]> list2 )
+ {
+ if ( list1.size() != list2.size() )
+ return false;
+ Iterator<byte[]> it1 = list1.iterator();
+ Iterator<byte[]> it2 = list2.iterator();
+ while ( it1.hasNext() && it2.hasNext() ) {
+ if ( !Arrays.equals( it1.next(), it2.next() ) )
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/src/main/java/org/openslx/filetransfer/util/FileChunk.java b/src/main/java/org/openslx/filetransfer/util/FileChunk.java
index 62f7d46..0aff296 100644
--- a/src/main/java/org/openslx/filetransfer/util/FileChunk.java
+++ b/src/main/java/org/openslx/filetransfer/util/FileChunk.java
@@ -31,7 +31,7 @@ public class FileChunk
}
}
- public synchronized void setSha1Sum( byte[] sha1sum )
+ synchronized void setSha1Sum( byte[] sha1sum )
{
if ( this.sha1sum != null || sha1sum == null || sha1sum.length != SHA1_LENGTH )
return;
@@ -47,7 +47,7 @@ public class FileChunk
*
* @return Number of times the transfer failed now
*/
- public synchronized int incFailed()
+ synchronized int incFailed()
{
return ++failCount;
}
@@ -82,7 +82,7 @@ public class FileChunk
return writtenToDisk;
}
- protected synchronized void setStatus( ChunkStatus status )
+ synchronized void setStatus( ChunkStatus status )
{
if ( status != null ) {
if ( status == ChunkStatus.COMPLETE ) {
diff --git a/src/main/java/org/openslx/filetransfer/util/HashChecker.java b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
index 5b647aa..d9db7df 100644
--- a/src/main/java/org/openslx/filetransfer/util/HashChecker.java
+++ b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
@@ -75,7 +75,16 @@ public class HashChecker
}
}
- public void queue( FileChunk chunk, byte[] data, HashCheckCallback callback ) throws InterruptedException
+ /**
+ * Queue the given chunk for hashing. The chunk should be in pending state.
+ *
+ * @param chunk chunk to hash
+ * @param data binary data of this chunk
+ * @param callback callback to call when hashing is done
+ * @return true if the chunk was handled, false if the queue was full and rejected the chunk.
+ * @throws InterruptedException
+ */
+ public boolean queue( FileChunk chunk, byte[] data, HashCheckCallback callback, boolean blocking ) throws InterruptedException
{
byte[] sha1Sum = chunk.getSha1Sum();
if ( sha1Sum == null )
@@ -84,7 +93,7 @@ public class HashChecker
synchronized ( threads ) {
if ( invalid ) {
execCallback( task, HashResult.FAILURE );
- return;
+ return true;
}
if ( queue.remainingCapacity() <= 1 && threads.size() < Runtime.getRuntime().availableProcessors() ) {
try {
@@ -95,8 +104,18 @@ public class HashChecker
LOGGER.warn( "Could not create additional hash checking thread", e );
}
}
+ }
+ ChunkStatus old = chunk.getStatus();
+ chunk.setStatus( ChunkStatus.HASHING );
+ if ( blocking ) {
queue.put( task );
+ } else {
+ if ( !queue.offer( task ) ) {
+ chunk.setStatus( old );
+ return false;
+ }
}
+ return true;
}
// ############################################################# \\
@@ -171,7 +190,6 @@ public class HashChecker
this.data = data;
this.chunk = chunk;
this.callback = callback;
- chunk.setStatus( ChunkStatus.HASHING );
}
}
diff --git a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
index b738ef6..9406c27 100644
--- a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
+++ b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
@@ -1,5 +1,6 @@
package org.openslx.filetransfer.util;
+import java.io.EOFException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -181,16 +182,26 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
if ( hashChecker == null )
return;
FileChunk chunk;
- while ( null != ( chunk = chunks.getUnhashedComplete() ) ) {
- byte[] data = loadChunkFromFile( chunk );
+ int cnt = 0;
+ while ( null != ( chunk = chunks.getUnhashedComplete() ) && ++cnt <= 3 ) {
+ byte[] data;
+ try {
+ data = loadChunkFromFile( chunk );
+ } catch ( EOFException e1 ) {
+ LOGGER.warn( "blockhash update: file too short, marking chunk as invalid" );
+ chunks.markFailed( chunk );
+ chunkStatusChanged( chunk );
+ continue;
+ }
if ( data == null ) {
- LOGGER.warn( "Will mark unloadable chunk as valid :-(" );
+ LOGGER.warn( "blockhash update: Will mark unloadable unhashed chunk as valid :-(" );
chunks.markSuccessful( chunk );
chunkStatusChanged( chunk );
continue;
}
try {
- hashChecker.queue( chunk, data, this );
+ if ( !hashChecker.queue( chunk, data, this, false ) ) // false == blocked while adding, so stop
+ break;
} catch ( InterruptedException e ) {
Thread.currentThread().interrupt();
return;
@@ -198,7 +209,7 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
}
}
- private byte[] loadChunkFromFile( FileChunk chunk )
+ private byte[] loadChunkFromFile( FileChunk chunk ) throws EOFException
{
synchronized ( tmpFileHandle ) {
if ( state != TransferState.IDLE && state != TransferState.WORKING )
@@ -208,6 +219,8 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
byte[] buffer = new byte[ chunk.range.getLength() ];
tmpFileHandle.readFully( buffer );
return buffer;
+ } catch ( EOFException e ) {
+ throw e;
} catch ( IOException e ) {
LOGGER.error( "Could not read chunk " + chunk.getChunkIndex() + " of File " + getTmpFileName().toString(), e );
return null;
@@ -256,7 +269,7 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
if ( currentChunk != null ) {
if ( hashChecker != null && currentChunk.getSha1Sum() != null ) {
try {
- hashChecker.queue( currentChunk, buffer, IncomingTransferBase.this );
+ hashChecker.queue( currentChunk, buffer, IncomingTransferBase.this, true );
} catch ( InterruptedException e ) {
Thread.currentThread().interrupt();
return null;
@@ -341,7 +354,6 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
LOGGER.warn( "Download of " + getTmpFileName().getAbsolutePath() + " failed" );
}
if ( state != TransferState.FINISHED && state != TransferState.ERROR ) {
- LOGGER.debug( "Download from satellite complete" );
lastActivityTime.set( System.currentTimeMillis() );
}
synchronized ( downloads ) {
@@ -349,6 +361,9 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
}
if ( chunks.isComplete() ) {
finishUploadInternal();
+ } else {
+ // Keep pumping unhashed chunks into the hasher
+ queueUnhashedChunk();
}
}
} );
@@ -436,6 +451,38 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
chunkStatusChanged( chunk );
break;
}
+ // A block finished, see if we can queue a new one
+ queueUnhashedChunk();
+ }
+
+ /**
+ * Gets an unhashed chunk (if existent) and queues it for hashing
+ */
+ protected void queueUnhashedChunk()
+ {
+ FileChunk chunk = chunks.getUnhashedComplete();
+ if ( chunk == null )
+ return;
+ byte[] data;
+ try {
+ data = loadChunkFromFile( chunk );
+ } catch ( EOFException e1 ) {
+ LOGGER.warn( "Cannot queue unhashed chunk: file too short. Marking is invalid." );
+ chunks.markFailed( chunk );
+ chunkStatusChanged( chunk );
+ return;
+ }
+ if ( data == null ) {
+ LOGGER.warn( "Cannot queue unhashed chunk: Will mark unloadable unhashed chunk as valid :-(" );
+ chunks.markSuccessful( chunk );
+ chunkStatusChanged( chunk );
+ return;
+ }
+ try {
+ hashChecker.queue( chunk, data, this, true );
+ } catch ( InterruptedException e ) {
+ Thread.currentThread().interrupt();
+ }
}
private synchronized void finishUploadInternal()
diff --git a/src/main/java/org/openslx/sat/thrift/version/Version.java b/src/main/java/org/openslx/sat/thrift/version/Version.java
index c8e27a8..d239436 100644
--- a/src/main/java/org/openslx/sat/thrift/version/Version.java
+++ b/src/main/java/org/openslx/sat/thrift/version/Version.java
@@ -7,7 +7,9 @@ package org.openslx.sat.thrift.version;
* their dozentenmodul client.
*/
public class Version {
+
+ public static final long MIN_VERSION = 2;
- public static final long VERSION = 2;
+ public static final long VERSION = 3;
}
diff --git a/src/main/java/org/openslx/thrifthelper/ImagePublishDataEx.java b/src/main/java/org/openslx/thrifthelper/ImagePublishDataEx.java
new file mode 100644
index 0000000..39accef
--- /dev/null
+++ b/src/main/java/org/openslx/thrifthelper/ImagePublishDataEx.java
@@ -0,0 +1,9 @@
+package org.openslx.thrifthelper;
+
+import org.openslx.bwlp.thrift.iface.ImagePublishData;
+
+@SuppressWarnings( "serial" )
+public class ImagePublishDataEx extends ImagePublishData
+{
+ public String exImagePath;
+}
diff --git a/src/main/thrift/bwlp.thrift b/src/main/thrift/bwlp.thrift
index 4020be5..57afb0e 100644
--- a/src/main/thrift/bwlp.thrift
+++ b/src/main/thrift/bwlp.thrift
@@ -220,13 +220,14 @@ struct ImagePublishData {
3: string imageName,
4: string description,
5: UnixTimestamp createTime,
- 6: UserInfo user,
+ 6: UserInfo uploader,
7: i64 fileSize,
8: list<string> software,
9: list<string> tags,
10: i32 osId,
11: string virtId,
12: bool isTemplate,
+ 13: UserInfo owner,
}
struct NetRule {
@@ -402,7 +403,7 @@ exception TInvocationException {
service SatelliteServer {
// Get server (thrift interface) version
- int getVersion(),
+ int getVersion(1: int clientVersion),
// Get configuration parameters of this satellite server
SatelliteConfig getConfiguration(),
@@ -528,6 +529,10 @@ service SatelliteServer {
UUID requestImageReplication(1:Token userToken, 2: UUID imageVersionId)
throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError),
+ // Client asks the satellite to publish given image to master server
+ UUID publishImageVersion(1:Token userToken, 2: UUID imageVersionId)
+ throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError, 4:TTransferRejectedException tre),
+
/*
* Lecture related
*/