From 7a31f13cd386669298dfa0f91f90af63c9c2874a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2014 12:03:03 +0200 Subject: Bearbeiten von Images funktioniert nun vollständig --- Dozentenmodulserver/src/server/Server.java | 238 +++++++++++++++++++++-------- 1 file changed, 171 insertions(+), 67 deletions(-) (limited to 'Dozentenmodulserver/src/server/Server.java') diff --git a/Dozentenmodulserver/src/server/Server.java b/Dozentenmodulserver/src/server/Server.java index 9994fcb4..558729d1 100644 --- a/Dozentenmodulserver/src/server/Server.java +++ b/Dozentenmodulserver/src/server/Server.java @@ -40,7 +40,7 @@ public class Server { public long DeleteFtpUser(String user) throws org.apache.thrift.TException; - public String getPathOfImage(String name) throws org.apache.thrift.TException; + public String getPathOfImage(String image_id, String version) throws org.apache.thrift.TException; public boolean writeVLdata(String imagename, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath) throws org.apache.thrift.TException; @@ -68,7 +68,7 @@ public class Server { public void DeleteFtpUser(String user, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getPathOfImage(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getPathOfImage(String image_id, String version, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void writeVLdata(String imagename, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -155,16 +155,17 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "DeleteFtpUser failed: unknown result"); } - public String getPathOfImage(String name) throws org.apache.thrift.TException + public String getPathOfImage(String image_id, String version) throws org.apache.thrift.TException { - send_getPathOfImage(name); + send_getPathOfImage(image_id, version); return recv_getPathOfImage(); } - public void send_getPathOfImage(String name) throws org.apache.thrift.TException + public void send_getPathOfImage(String image_id, String version) throws org.apache.thrift.TException { getPathOfImage_args args = new getPathOfImage_args(); - args.setName(name); + args.setImage_id(image_id); + args.setVersion(version); sendBase("getPathOfImage", args); } @@ -494,24 +495,27 @@ public class Server { } } - public void getPathOfImage(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getPathOfImage(String image_id, String version, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getPathOfImage_call method_call = new getPathOfImage_call(name, resultHandler, this, ___protocolFactory, ___transport); + getPathOfImage_call method_call = new getPathOfImage_call(image_id, version, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getPathOfImage_call extends org.apache.thrift.async.TAsyncMethodCall { - private String name; - public getPathOfImage_call(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String image_id; + private String version; + public getPathOfImage_call(String image_id, String version, 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.name = name; + this.image_id = image_id; + this.version = version; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPathOfImage", org.apache.thrift.protocol.TMessageType.CALL, 0)); getPathOfImage_args args = new getPathOfImage_args(); - args.setName(name); + args.setImage_id(image_id); + args.setVersion(version); args.write(prot); prot.writeMessageEnd(); } @@ -988,7 +992,7 @@ public class Server { public getPathOfImage_result getResult(I iface, getPathOfImage_args args) throws org.apache.thrift.TException { getPathOfImage_result result = new getPathOfImage_result(); - result.success = iface.getPathOfImage(args.name); + result.success = iface.getPathOfImage(args.image_id, args.version); return result; } } @@ -1355,7 +1359,7 @@ public class Server { } public void start(I iface, getPathOfImage_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.getPathOfImage(args.name,resultHandler); + iface.getPathOfImage(args.image_id, args.version,resultHandler); } } @@ -3140,7 +3144,8 @@ public class Server { public static class getPathOfImage_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPathOfImage_args"); - private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)-1); + private static final org.apache.thrift.protocol.TField IMAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("image_id", org.apache.thrift.protocol.TType.STRING, (short)-1); + private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.STRING, (short)-2); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -3148,11 +3153,13 @@ public class Server { schemes.put(TupleScheme.class, new getPathOfImage_argsTupleSchemeFactory()); } - public String name; // required + public String image_id; // required + public String version; // 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 { - NAME((short)-1, "name"); + IMAGE_ID((short)-1, "image_id"), + VERSION((short)-2, "version"); private static final Map byName = new HashMap(); @@ -3167,8 +3174,10 @@ public class Server { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case -1: // NAME - return NAME; + case -1: // IMAGE_ID + return IMAGE_ID; + case -2: // VERSION + return VERSION; default: return null; } @@ -3212,7 +3221,9 @@ public class Server { 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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, + tmpMap.put(_Fields.IMAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("image_id", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPathOfImage_args.class, metaDataMap); @@ -3222,18 +3233,23 @@ public class Server { } public getPathOfImage_args( - String name) + String image_id, + String version) { this(); - this.name = name; + this.image_id = image_id; + this.version = version; } /** * Performs a deep copy on other. */ public getPathOfImage_args(getPathOfImage_args other) { - if (other.isSetName()) { - this.name = other.name; + if (other.isSetImage_id()) { + this.image_id = other.image_id; + } + if (other.isSetVersion()) { + this.version = other.version; } } @@ -3243,40 +3259,73 @@ public class Server { @Override public void clear() { - this.name = null; + this.image_id = null; + this.version = null; } - public String getName() { - return this.name; + public String getImage_id() { + return this.image_id; } - public getPathOfImage_args setName(String name) { - this.name = name; + public getPathOfImage_args setImage_id(String image_id) { + this.image_id = image_id; return this; } - public void unsetName() { - this.name = null; + public void unsetImage_id() { + this.image_id = null; } - /** Returns true if field name is set (has been assigned a value) and false otherwise */ - public boolean isSetName() { - return this.name != null; + /** Returns true if field image_id is set (has been assigned a value) and false otherwise */ + public boolean isSetImage_id() { + return this.image_id != null; } - public void setNameIsSet(boolean value) { + public void setImage_idIsSet(boolean value) { if (!value) { - this.name = null; + this.image_id = null; + } + } + + public String getVersion() { + return this.version; + } + + public getPathOfImage_args setVersion(String version) { + this.version = version; + return this; + } + + public void unsetVersion() { + this.version = null; + } + + /** Returns true if field version is set (has been assigned a value) and false otherwise */ + public boolean isSetVersion() { + return this.version != null; + } + + public void setVersionIsSet(boolean value) { + if (!value) { + this.version = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { - case NAME: + case IMAGE_ID: if (value == null) { - unsetName(); + unsetImage_id(); } else { - setName((String)value); + setImage_id((String)value); + } + break; + + case VERSION: + if (value == null) { + unsetVersion(); + } else { + setVersion((String)value); } break; @@ -3285,8 +3334,11 @@ public class Server { public Object getFieldValue(_Fields field) { switch (field) { - case NAME: - return getName(); + case IMAGE_ID: + return getImage_id(); + + case VERSION: + return getVersion(); } throw new IllegalStateException(); @@ -3299,8 +3351,10 @@ public class Server { } switch (field) { - case NAME: - return isSetName(); + case IMAGE_ID: + return isSetImage_id(); + case VERSION: + return isSetVersion(); } throw new IllegalStateException(); } @@ -3318,12 +3372,21 @@ public class Server { if (that == null) return false; - boolean this_present_name = true && this.isSetName(); - boolean that_present_name = true && that.isSetName(); - if (this_present_name || that_present_name) { - if (!(this_present_name && that_present_name)) + boolean this_present_image_id = true && this.isSetImage_id(); + boolean that_present_image_id = true && that.isSetImage_id(); + if (this_present_image_id || that_present_image_id) { + if (!(this_present_image_id && that_present_image_id)) return false; - if (!this.name.equals(that.name)) + if (!this.image_id.equals(that.image_id)) + return false; + } + + boolean this_present_version = true && this.isSetVersion(); + boolean that_present_version = true && that.isSetVersion(); + if (this_present_version || that_present_version) { + if (!(this_present_version && that_present_version)) + return false; + if (!this.version.equals(that.version)) return false; } @@ -3343,12 +3406,22 @@ public class Server { int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + lastComparison = Boolean.valueOf(isSetImage_id()).compareTo(other.isSetImage_id()); if (lastComparison != 0) { return lastComparison; } - if (isSetName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (isSetImage_id()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image_id, other.image_id); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetVersion()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version); if (lastComparison != 0) { return lastComparison; } @@ -3373,11 +3446,19 @@ public class Server { StringBuilder sb = new StringBuilder("getPathOfImage_args("); boolean first = true; - sb.append("name:"); - if (this.name == null) { + sb.append("image_id:"); + if (this.image_id == null) { sb.append("null"); } else { - sb.append(this.name); + sb.append(this.image_id); + } + first = false; + if (!first) sb.append(", "); + sb.append("version:"); + if (this.version == null) { + sb.append("null"); + } else { + sb.append(this.version); } first = false; sb.append(")"); @@ -3423,10 +3504,18 @@ public class Server { break; } switch (schemeField.id) { - case -1: // NAME + case -1: // IMAGE_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); + struct.image_id = iprot.readString(); + struct.setImage_idIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case -2: // VERSION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.version = iprot.readString(); + struct.setVersionIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -3446,9 +3535,14 @@ public class Server { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(struct.name); + if (struct.version != null) { + oprot.writeFieldBegin(VERSION_FIELD_DESC); + oprot.writeString(struct.version); + oprot.writeFieldEnd(); + } + if (struct.image_id != null) { + oprot.writeFieldBegin(IMAGE_ID_FIELD_DESC); + oprot.writeString(struct.image_id); oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -3469,22 +3563,32 @@ public class Server { public void write(org.apache.thrift.protocol.TProtocol prot, getPathOfImage_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); - if (struct.isSetName()) { + if (struct.isSetImage_id()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); - if (struct.isSetName()) { - oprot.writeString(struct.name); + if (struct.isSetVersion()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetImage_id()) { + oprot.writeString(struct.image_id); + } + if (struct.isSetVersion()) { + oprot.writeString(struct.version); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, getPathOfImage_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); + struct.image_id = iprot.readString(); + struct.setImage_idIsSet(true); + } + if (incoming.get(1)) { + struct.version = iprot.readString(); + struct.setVersionIsSet(true); } } } -- cgit v1.2.3-55-g7522