summaryrefslogtreecommitdiffstats
path: root/Dozentenmodulserver/src
diff options
context:
space:
mode:
authorTobias Spitzer2014-05-23 11:31:42 +0200
committerTobias Spitzer2014-05-23 11:31:42 +0200
commit5d24cdec4d239f473ee2359493ab47d1ef3273dd (patch)
tree872bfaae8ef25df70f5d140fbf33df2a8dd5d9f8 /Dozentenmodulserver/src
parentBug: Fehler beim Download wirde behoben (diff)
downloadtutor-module-5d24cdec4d239f473ee2359493ab47d1ef3273dd.tar.gz
tutor-module-5d24cdec4d239f473ee2359493ab47d1ef3273dd.tar.xz
tutor-module-5d24cdec4d239f473ee2359493ab47d1ef3273dd.zip
Freigabe Mechanismus implementiert, nun sollte die notwendige Grundlage für die Syncronisation vorhanden sein.
Diffstat (limited to 'Dozentenmodulserver/src')
-rw-r--r--Dozentenmodulserver/src/server/Image.java2
-rw-r--r--Dozentenmodulserver/src/server/Server.java252
-rw-r--r--Dozentenmodulserver/src/server/ServerHandler.java29
-rw-r--r--Dozentenmodulserver/src/sql/SQL.java19
4 files changed, 259 insertions, 43 deletions
diff --git a/Dozentenmodulserver/src/server/Image.java b/Dozentenmodulserver/src/server/Image.java
index e82aca0f..34c2b45c 100644
--- a/Dozentenmodulserver/src/server/Image.java
+++ b/Dozentenmodulserver/src/server/Image.java
@@ -43,7 +43,7 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav
private static final org.apache.thrift.protocol.TField LECTURE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lectureName", org.apache.thrift.protocol.TType.STRING, (short)-6);
private static final org.apache.thrift.protocol.TField UPDATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updateTime", org.apache.thrift.protocol.TType.STRING, (short)-7);
private static final org.apache.thrift.protocol.TField USER_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("userData", org.apache.thrift.protocol.TType.STRING, (short)-8);
-
+
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ImageStandardSchemeFactory());
diff --git a/Dozentenmodulserver/src/server/Server.java b/Dozentenmodulserver/src/server/Server.java
index ef434865..b652bf7a 100644
--- a/Dozentenmodulserver/src/server/Server.java
+++ b/Dozentenmodulserver/src/server/Server.java
@@ -42,7 +42,7 @@ public class Server {
public String getPathOfImage(String image_id, String version) throws org.apache.thrift.TException;
- public boolean writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize) throws org.apache.thrift.TException;
+ public boolean writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException;
public List<Image> getImageList() throws org.apache.thrift.TException;
@@ -58,7 +58,7 @@ public class Server {
public Map<String,String> getImageData(String imageid, String imageversion) throws org.apache.thrift.TException;
- public boolean updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize) throws org.apache.thrift.TException;
+ public boolean updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException;
public Map<String,String> getLectureData(String lecturename) throws org.apache.thrift.TException;
@@ -82,7 +82,7 @@ public class Server {
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 login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getImageList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -98,7 +98,7 @@ public class Server {
public void getImageData(String imageid, String imageversion, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- public void updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getLectureData(String lecturename, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -203,13 +203,13 @@ public class Server {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPathOfImage failed: unknown result");
}
- public boolean writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize) throws org.apache.thrift.TException
+ public boolean writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException
{
- send_writeVLdata(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, isTemplate, filesize);
+ send_writeVLdata(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, isTemplate, filesize, shareMode);
return recv_writeVLdata();
}
- public void send_writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize) throws org.apache.thrift.TException
+ public void send_writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException
{
writeVLdata_args args = new writeVLdata_args();
args.setImagename(imagename);
@@ -227,6 +227,7 @@ public class Server {
args.setImagePath(imagePath);
args.setIsTemplate(isTemplate);
args.setFilesize(filesize);
+ args.setShareMode(shareMode);
sendBase("writeVLdata", args);
}
@@ -413,13 +414,13 @@ public class Server {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageData failed: unknown result");
}
- public boolean updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize) throws org.apache.thrift.TException
+ public boolean updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException
{
- send_updateImageData(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize);
+ send_updateImageData(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize, shareMode);
return recv_updateImageData();
}
- public void send_updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize) throws org.apache.thrift.TException
+ public void send_updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode) throws org.apache.thrift.TException
{
updateImageData_args args = new updateImageData_args();
args.setName(name);
@@ -433,6 +434,7 @@ public class Server {
args.setVersion(version);
args.setIsTemplate(isTemplate);
args.setFilesize(filesize);
+ args.setShareMode(shareMode);
sendBase("updateImageData", args);
}
@@ -717,9 +719,9 @@ public class Server {
}
}
- public void writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ public void writeVLdata(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
- writeVLdata_call method_call = new writeVLdata_call(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, isTemplate, filesize, resultHandler, this, ___protocolFactory, ___transport);
+ writeVLdata_call method_call = new writeVLdata_call(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, isTemplate, filesize, shareMode, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -740,7 +742,8 @@ public class Server {
private String imagePath;
private boolean isTemplate;
private long filesize;
- public writeVLdata_call(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, 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 shareMode;
+ public writeVLdata_call(String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode, 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.imagename = imagename;
this.login = login;
@@ -757,6 +760,7 @@ public class Server {
this.imagePath = imagePath;
this.isTemplate = isTemplate;
this.filesize = filesize;
+ this.shareMode = shareMode;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -777,6 +781,7 @@ public class Server {
args.setImagePath(imagePath);
args.setIsTemplate(isTemplate);
args.setFilesize(filesize);
+ args.setShareMode(shareMode);
args.write(prot);
prot.writeMessageEnd();
}
@@ -1051,9 +1056,9 @@ public class Server {
}
}
- public void updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ public void updateImageData(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
- updateImageData_call method_call = new updateImageData_call(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize, resultHandler, this, ___protocolFactory, ___transport);
+ updateImageData_call method_call = new updateImageData_call(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize, shareMode, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -1070,7 +1075,8 @@ public class Server {
private String version;
private boolean isTemplate;
private long filesize;
- public updateImageData_call(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, 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 shareMode;
+ public updateImageData_call(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode, 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.newName = newName;
@@ -1083,6 +1089,7 @@ public class Server {
this.version = version;
this.isTemplate = isTemplate;
this.filesize = filesize;
+ this.shareMode = shareMode;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -1099,6 +1106,7 @@ public class Server {
args.setVersion(version);
args.setIsTemplate(isTemplate);
args.setFilesize(filesize);
+ args.setShareMode(shareMode);
args.write(prot);
prot.writeMessageEnd();
}
@@ -1472,7 +1480,7 @@ public class Server {
public writeVLdata_result getResult(I iface, writeVLdata_args args) throws org.apache.thrift.TException {
writeVLdata_result result = new writeVLdata_result();
- result.success = iface.writeVLdata(args.imagename, args.login, args.firstname, args.lastname, args.university, args.Mail, args.Tel, args.Fak, args.license, args.internet, args.ram, args.cpu, args.imagePath, args.isTemplate, args.filesize);
+ result.success = iface.writeVLdata(args.imagename, args.login, args.firstname, args.lastname, args.university, args.Mail, args.Tel, args.Fak, args.license, args.internet, args.ram, args.cpu, args.imagePath, args.isTemplate, args.filesize, args.shareMode);
result.setSuccessIsSet(true);
return result;
}
@@ -1635,7 +1643,7 @@ public class Server {
public updateImageData_result getResult(I iface, updateImageData_args args) throws org.apache.thrift.TException {
updateImageData_result result = new updateImageData_result();
- result.success = iface.updateImageData(args.name, args.newName, args.image_path, args.license, args.internet, args.ram, args.cpu, args.id, args.version, args.isTemplate, args.filesize);
+ result.success = iface.updateImageData(args.name, args.newName, args.image_path, args.license, args.internet, args.ram, args.cpu, args.id, args.version, args.isTemplate, args.filesize, args.shareMode);
result.setSuccessIsSet(true);
return result;
}
@@ -2002,7 +2010,7 @@ public class Server {
}
public void start(I iface, writeVLdata_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
- iface.writeVLdata(args.imagename, args.login, args.firstname, args.lastname, args.university, args.Mail, args.Tel, args.Fak, args.license, args.internet, args.ram, args.cpu, args.imagePath, args.isTemplate, args.filesize,resultHandler);
+ iface.writeVLdata(args.imagename, args.login, args.firstname, args.lastname, args.university, args.Mail, args.Tel, args.Fak, args.license, args.internet, args.ram, args.cpu, args.imagePath, args.isTemplate, args.filesize, args.shareMode,resultHandler);
}
}
@@ -2413,7 +2421,7 @@ public class Server {
}
public void start(I iface, updateImageData_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
- iface.updateImageData(args.name, args.newName, args.image_path, args.license, args.internet, args.ram, args.cpu, args.id, args.version, args.isTemplate, args.filesize,resultHandler);
+ iface.updateImageData(args.name, args.newName, args.image_path, args.license, args.internet, args.ram, args.cpu, args.id, args.version, args.isTemplate, args.filesize, args.shareMode,resultHandler);
}
}
@@ -4869,6 +4877,7 @@ public class Server {
private static final org.apache.thrift.protocol.TField IMAGE_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("imagePath", org.apache.thrift.protocol.TType.STRING, (short)-13);
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)-14);
private static final org.apache.thrift.protocol.TField FILESIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("filesize", org.apache.thrift.protocol.TType.I64, (short)-15);
+ private static final org.apache.thrift.protocol.TField SHARE_MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("shareMode", org.apache.thrift.protocol.TType.I64, (short)-16);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -4891,6 +4900,7 @@ public class Server {
public String imagePath; // required
public boolean isTemplate; // required
public long filesize; // required
+ public long shareMode; // 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 {
@@ -4908,7 +4918,8 @@ public class Server {
CPU((short)-12, "cpu"),
IMAGE_PATH((short)-13, "imagePath"),
IS_TEMPLATE((short)-14, "isTemplate"),
- FILESIZE((short)-15, "filesize");
+ FILESIZE((short)-15, "filesize"),
+ SHARE_MODE((short)-16, "shareMode");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -4953,6 +4964,8 @@ public class Server {
return IS_TEMPLATE;
case -15: // FILESIZE
return FILESIZE;
+ case -16: // SHARE_MODE
+ return SHARE_MODE;
default:
return null;
}
@@ -4999,6 +5012,7 @@ public class Server {
private static final int __CPU_ISSET_ID = 3;
private static final int __ISTEMPLATE_ISSET_ID = 4;
private static final int __FILESIZE_ISSET_ID = 5;
+ private static final int __SHAREMODE_ISSET_ID = 6;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -5033,6 +5047,8 @@ public class Server {
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.FILESIZE, 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)));
+ tmpMap.put(_Fields.SHARE_MODE, new org.apache.thrift.meta_data.FieldMetaData("shareMode", 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(writeVLdata_args.class, metaDataMap);
}
@@ -5055,7 +5071,8 @@ public class Server {
long cpu,
String imagePath,
boolean isTemplate,
- long filesize)
+ long filesize,
+ long shareMode)
{
this();
this.imagename = imagename;
@@ -5079,6 +5096,8 @@ public class Server {
setIsTemplateIsSet(true);
this.filesize = filesize;
setFilesizeIsSet(true);
+ this.shareMode = shareMode;
+ setShareModeIsSet(true);
}
/**
@@ -5119,6 +5138,7 @@ public class Server {
}
this.isTemplate = other.isTemplate;
this.filesize = other.filesize;
+ this.shareMode = other.shareMode;
}
public writeVLdata_args deepCopy() {
@@ -5148,6 +5168,8 @@ public class Server {
this.isTemplate = false;
setFilesizeIsSet(false);
this.filesize = 0;
+ setShareModeIsSet(false);
+ this.shareMode = 0;
}
public String getImagename() {
@@ -5504,6 +5526,29 @@ public class Server {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESIZE_ISSET_ID, value);
}
+ public long getShareMode() {
+ return this.shareMode;
+ }
+
+ public writeVLdata_args setShareMode(long shareMode) {
+ this.shareMode = shareMode;
+ setShareModeIsSet(true);
+ return this;
+ }
+
+ public void unsetShareMode() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SHAREMODE_ISSET_ID);
+ }
+
+ /** Returns true if field shareMode is set (has been assigned a value) and false otherwise */
+ public boolean isSetShareMode() {
+ return EncodingUtils.testBit(__isset_bitfield, __SHAREMODE_ISSET_ID);
+ }
+
+ public void setShareModeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SHAREMODE_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case IMAGENAME:
@@ -5626,6 +5671,14 @@ public class Server {
}
break;
+ case SHARE_MODE:
+ if (value == null) {
+ unsetShareMode();
+ } else {
+ setShareMode((Long)value);
+ }
+ break;
+
}
}
@@ -5676,6 +5729,9 @@ public class Server {
case FILESIZE:
return Long.valueOf(getFilesize());
+ case SHARE_MODE:
+ return Long.valueOf(getShareMode());
+
}
throw new IllegalStateException();
}
@@ -5717,6 +5773,8 @@ public class Server {
return isSetIsTemplate();
case FILESIZE:
return isSetFilesize();
+ case SHARE_MODE:
+ return isSetShareMode();
}
throw new IllegalStateException();
}
@@ -5869,6 +5927,15 @@ public class Server {
return false;
}
+ boolean this_present_shareMode = true;
+ boolean that_present_shareMode = true;
+ if (this_present_shareMode || that_present_shareMode) {
+ if (!(this_present_shareMode && that_present_shareMode))
+ return false;
+ if (this.shareMode != that.shareMode)
+ return false;
+ }
+
return true;
}
@@ -6035,6 +6102,16 @@ public class Server {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetShareMode()).compareTo(other.isSetShareMode());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetShareMode()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareMode, other.shareMode);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -6150,6 +6227,10 @@ public class Server {
sb.append("filesize:");
sb.append(this.filesize);
first = false;
+ if (!first) sb.append(", ");
+ sb.append("shareMode:");
+ sb.append(this.shareMode);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -6315,6 +6396,14 @@ public class Server {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case -16: // SHARE_MODE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.shareMode = iprot.readI64();
+ struct.setShareModeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -6330,6 +6419,9 @@ public class Server {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SHARE_MODE_FIELD_DESC);
+ oprot.writeI64(struct.shareMode);
+ oprot.writeFieldEnd();
oprot.writeFieldBegin(FILESIZE_FIELD_DESC);
oprot.writeI64(struct.filesize);
oprot.writeFieldEnd();
@@ -6456,7 +6548,10 @@ public class Server {
if (struct.isSetFilesize()) {
optionals.set(14);
}
- oprot.writeBitSet(optionals, 15);
+ if (struct.isSetShareMode()) {
+ optionals.set(15);
+ }
+ oprot.writeBitSet(optionals, 16);
if (struct.isSetImagename()) {
oprot.writeString(struct.imagename);
}
@@ -6502,12 +6597,15 @@ public class Server {
if (struct.isSetFilesize()) {
oprot.writeI64(struct.filesize);
}
+ if (struct.isSetShareMode()) {
+ oprot.writeI64(struct.shareMode);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, writeVLdata_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(15);
+ BitSet incoming = iprot.readBitSet(16);
if (incoming.get(0)) {
struct.imagename = iprot.readString();
struct.setImagenameIsSet(true);
@@ -6568,6 +6666,10 @@ public class Server {
struct.filesize = iprot.readI64();
struct.setFilesizeIsSet(true);
}
+ if (incoming.get(15)) {
+ struct.shareMode = iprot.readI64();
+ struct.setShareModeIsSet(true);
+ }
}
}
@@ -13332,6 +13434,7 @@ public class Server {
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)-9);
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)-10);
private static final org.apache.thrift.protocol.TField FILESIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("filesize", org.apache.thrift.protocol.TType.I64, (short)-11);
+ private static final org.apache.thrift.protocol.TField SHARE_MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("shareMode", org.apache.thrift.protocol.TType.I64, (short)-12);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -13350,6 +13453,7 @@ public class Server {
public String version; // required
public boolean isTemplate; // required
public long filesize; // required
+ public long shareMode; // 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 {
@@ -13363,7 +13467,8 @@ public class Server {
ID((short)-8, "id"),
VERSION((short)-9, "version"),
IS_TEMPLATE((short)-10, "isTemplate"),
- FILESIZE((short)-11, "filesize");
+ FILESIZE((short)-11, "filesize"),
+ SHARE_MODE((short)-12, "shareMode");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -13400,6 +13505,8 @@ public class Server {
return IS_TEMPLATE;
case -11: // FILESIZE
return FILESIZE;
+ case -12: // SHARE_MODE
+ return SHARE_MODE;
default:
return null;
}
@@ -13446,6 +13553,7 @@ public class Server {
private static final int __CPU_ISSET_ID = 3;
private static final int __ISTEMPLATE_ISSET_ID = 4;
private static final int __FILESIZE_ISSET_ID = 5;
+ private static final int __SHAREMODE_ISSET_ID = 6;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -13472,6 +13580,8 @@ public class Server {
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.FILESIZE, 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)));
+ tmpMap.put(_Fields.SHARE_MODE, new org.apache.thrift.meta_data.FieldMetaData("shareMode", 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(updateImageData_args.class, metaDataMap);
}
@@ -13490,7 +13600,8 @@ public class Server {
String id,
String version,
boolean isTemplate,
- long filesize)
+ long filesize,
+ long shareMode)
{
this();
this.name = name;
@@ -13510,6 +13621,8 @@ public class Server {
setIsTemplateIsSet(true);
this.filesize = filesize;
setFilesizeIsSet(true);
+ this.shareMode = shareMode;
+ setShareModeIsSet(true);
}
/**
@@ -13538,6 +13651,7 @@ public class Server {
}
this.isTemplate = other.isTemplate;
this.filesize = other.filesize;
+ this.shareMode = other.shareMode;
}
public updateImageData_args deepCopy() {
@@ -13563,6 +13677,8 @@ public class Server {
this.isTemplate = false;
setFilesizeIsSet(false);
this.filesize = 0;
+ setShareModeIsSet(false);
+ this.shareMode = 0;
}
public String getName() {
@@ -13823,6 +13939,29 @@ public class Server {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESIZE_ISSET_ID, value);
}
+ public long getShareMode() {
+ return this.shareMode;
+ }
+
+ public updateImageData_args setShareMode(long shareMode) {
+ this.shareMode = shareMode;
+ setShareModeIsSet(true);
+ return this;
+ }
+
+ public void unsetShareMode() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SHAREMODE_ISSET_ID);
+ }
+
+ /** Returns true if field shareMode is set (has been assigned a value) and false otherwise */
+ public boolean isSetShareMode() {
+ return EncodingUtils.testBit(__isset_bitfield, __SHAREMODE_ISSET_ID);
+ }
+
+ public void setShareModeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SHAREMODE_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
@@ -13913,6 +14052,14 @@ public class Server {
}
break;
+ case SHARE_MODE:
+ if (value == null) {
+ unsetShareMode();
+ } else {
+ setShareMode((Long)value);
+ }
+ break;
+
}
}
@@ -13951,6 +14098,9 @@ public class Server {
case FILESIZE:
return Long.valueOf(getFilesize());
+ case SHARE_MODE:
+ return Long.valueOf(getShareMode());
+
}
throw new IllegalStateException();
}
@@ -13984,6 +14134,8 @@ public class Server {
return isSetIsTemplate();
case FILESIZE:
return isSetFilesize();
+ case SHARE_MODE:
+ return isSetShareMode();
}
throw new IllegalStateException();
}
@@ -14100,6 +14252,15 @@ public class Server {
return false;
}
+ boolean this_present_shareMode = true;
+ boolean that_present_shareMode = true;
+ if (this_present_shareMode || that_present_shareMode) {
+ if (!(this_present_shareMode && that_present_shareMode))
+ return false;
+ if (this.shareMode != that.shareMode)
+ return false;
+ }
+
return true;
}
@@ -14226,6 +14387,16 @@ public class Server {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetShareMode()).compareTo(other.isSetShareMode());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetShareMode()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareMode, other.shareMode);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -14309,6 +14480,10 @@ public class Server {
sb.append("filesize:");
sb.append(this.filesize);
first = false;
+ if (!first) sb.append(", ");
+ sb.append("shareMode:");
+ sb.append(this.shareMode);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -14442,6 +14617,14 @@ public class Server {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case -12: // SHARE_MODE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.shareMode = iprot.readI64();
+ struct.setShareModeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -14457,6 +14640,9 @@ public class Server {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SHARE_MODE_FIELD_DESC);
+ oprot.writeI64(struct.shareMode);
+ oprot.writeFieldEnd();
oprot.writeFieldBegin(FILESIZE_FIELD_DESC);
oprot.writeI64(struct.filesize);
oprot.writeFieldEnd();
@@ -14551,7 +14737,10 @@ public class Server {
if (struct.isSetFilesize()) {
optionals.set(10);
}
- oprot.writeBitSet(optionals, 11);
+ if (struct.isSetShareMode()) {
+ optionals.set(11);
+ }
+ oprot.writeBitSet(optionals, 12);
if (struct.isSetName()) {
oprot.writeString(struct.name);
}
@@ -14585,12 +14774,15 @@ public class Server {
if (struct.isSetFilesize()) {
oprot.writeI64(struct.filesize);
}
+ if (struct.isSetShareMode()) {
+ oprot.writeI64(struct.shareMode);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, updateImageData_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(11);
+ BitSet incoming = iprot.readBitSet(12);
if (incoming.get(0)) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
@@ -14635,6 +14827,10 @@ public class Server {
struct.filesize = iprot.readI64();
struct.setFilesizeIsSet(true);
}
+ if (incoming.get(11)) {
+ struct.shareMode = iprot.readI64();
+ struct.setShareModeIsSet(true);
+ }
}
}
diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java
index dad9b1a8..5ce72615 100644
--- a/Dozentenmodulserver/src/server/ServerHandler.java
+++ b/Dozentenmodulserver/src/server/ServerHandler.java
@@ -121,15 +121,25 @@ public class ServerHandler implements Server.Iface {
String firstname, String lastname, String university, String Mail,
String Tel, String Fak, boolean license, boolean internet,
long ram, long cpu, String imagePath, boolean isTemplate,
- long filesize) throws TException {
+ long filesize, long shareMode) throws TException {
+
+ String mode=null;
+
+ if(shareMode==0)
+ {
+ mode="only_local";
+ }
+ else{
+ mode="to_be_published";
+ }
String pk_institution = sql.setInstitution(university);
String pk_person = sql.setPerson(login, lastname, firstname, Mail,
new Date(), pk_institution);
-
+
sql.setImageData(pk_person, license, internet, cpu, ram, imagename,
- imagePath, isTemplate, filesize);
+ imagePath, isTemplate, filesize,mode);
log.info(new Date() + " - written VLdata");
// TODO Auto-generated method stub
@@ -230,9 +240,18 @@ public class ServerHandler implements Server.Iface {
public boolean updateImageData(String name, String newName,
String image_path, boolean license, boolean internet, long ram,
long cpu, String id, String version, boolean isTemplate,
- long filesize) throws TException {
+ long filesize, long shareMode) throws TException {
+ String mode=null;
+
+ if(shareMode==0)
+ {
+ mode="only_local";
+ }
+ else{
+ mode="to_be_published";
+ }
sql.UpdateImageData(name, newName, image_path, license, internet, cpu,
- ram, id, version, isTemplate, filesize);
+ ram, id, version, isTemplate, filesize,mode);
return false;
}
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index 9a746093..98fc8ef7 100644
--- a/Dozentenmodulserver/src/sql/SQL.java
+++ b/Dozentenmodulserver/src/sql/SQL.java
@@ -231,7 +231,7 @@ public class SQL {
public boolean setImageData(String pk_person, boolean license,
boolean internet, long cpu, long ram, String imagename,
- String imagePath, boolean isTemplate, long filesize) {
+ String imagePath, boolean isTemplate, long filesize, String shareMode) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -249,7 +249,7 @@ public class SQL {
Statement stm = con.createStatement();
String uid = UUID.randomUUID().toString();
- stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_VLData_imageInfo`(`GUID_imageID`,`imageVersion`,`image_name`,`image_path`,`image_lastCall`,`image_create_time`,`image_update_time`,`image_owner`,`image_change_by`,`rec_create_time`,`rec_change_time`,`rec_owner`,`rec_change_by`,`content_operatingSystem`,`status_isCompressed`,`status_isSecure`,`status_isOptimzed`,`status_isValid`,`status_isReady`,`status_isDeleted`,`status_isLastOfficialVersion`,`cond_hasLicenseRestriction`,`cond_hasInternetRestriction`,`cond_minRAM`,`cond_minCPUs`,`image_isTemplate`,`image_filesize`)VALUES('"
+ stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_VLData_imageInfo`(`GUID_imageID`,`imageVersion`,`image_name`,`image_path`,`image_lastCall`,`image_create_time`,`image_update_time`,`image_owner`,`image_change_by`,`rec_create_time`,`rec_change_time`,`rec_owner`,`rec_change_by`,`content_operatingSystem`,`status_isCompressed`,`status_isSecure`,`status_isOptimzed`,`status_isValid`,`status_isReady`,`status_isDeleted`,`status_isLastOfficialVersion`,`cond_hasLicenseRestriction`,`cond_hasInternetRestriction`,`cond_minRAM`,`cond_minCPUs`,`image_isTemplate`,`image_filesize`,`image_syncMode`)VALUES('"
+ uid // GUID_imageID
+ "',1,'" // imageVersion
+ imagename // image_name
@@ -277,6 +277,7 @@ public class SQL {
+ "','" + cpu // cond_minCPUs
+ "','" + isTemplate //image_isTemplate
+ "','" + filesize //image_filesize
+ + "','" + shareMode //shareMode
+ "');");
con.commit();
con.close();
@@ -486,20 +487,18 @@ public class SQL {
Connection con=getConnection();
Statement stm = con.createStatement();
ResultSet data=stm
- .executeQuery("SELECT image_name,cond_hasInternetRestriction,cond_hasLicenseRestriction, cond_minCPUs, cond_minRAM FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
+ .executeQuery("SELECT image_name,cond_hasInternetRestriction,cond_hasLicenseRestriction, cond_minCPUs, cond_minRAM, image_syncMode,image_filesize,image_path FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
+ id + "' and imageVersion = '" + version + "' ;");
while (data.next()) {
- System.out.println(data
- .getString("cond_hasInternetRestriction")
- + data.getString("cond_hasLicenseRestriction")
- + data.getString("cond_minCPUs")
- + data.getString("cond_minRAM"));
map.put("name", data.getString("image_name"));
map.put("internet",
data.getString("cond_hasInternetRestriction"));
map.put("license", data.getString("cond_hasLicenseRestriction"));
map.put("cpu", data.getString("cond_minCPUs"));
map.put("ram", data.getString("cond_minRAM"));
+ map.put("shareMode", data.getString("image_syncMode"));
+ map.put("filesize", data.getString("image_filesize"));
+ map.put("path", data.getString("image_path"));
}
con.close();
return map;
@@ -513,7 +512,7 @@ public class SQL {
public int UpdateImageData(String name, String newName,String image_path,
boolean license, boolean internet, long cpu, long ram, String id,
- String version, boolean isTemplate, long filesize) {
+ String version, boolean isTemplate, long filesize, String shareMode) {
try {
Connection con=getConnection();
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -552,6 +551,8 @@ public class SQL {
+ isTemplate
+ "',`image_filesize` = '"
+ filesize
+ + "',`image_syncMode` = '"
+ + shareMode
+ "' WHERE `GUID_imageID` = '"
+ id
+ "' AND `imageVersion` = '" + version + "';");