summaryrefslogtreecommitdiffstats
path: root/Dozentenmodulserver/src
diff options
context:
space:
mode:
authorunknown2014-05-08 12:46:57 +0200
committerunknown2014-05-08 12:46:57 +0200
commitc6b8f14dd17839b78c753999f2f73b7dfdc8d745 (patch)
tree60eca56f67a56aa901638ccaccd11b43a453a554 /Dozentenmodulserver/src
parentMinimale Änderungen für Move-Vorgang (diff)
downloadtutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.tar.gz
tutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.tar.xz
tutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.zip
-Kopieren von Temp zu Prod inkl. änderung des Pfades in SQL-DB
-Dateigröße zur DB hinzugefügt
Diffstat (limited to 'Dozentenmodulserver/src')
-rw-r--r--Dozentenmodulserver/src/models/Configuration.java39
-rw-r--r--Dozentenmodulserver/src/server/BinaryListener.java2
-rw-r--r--Dozentenmodulserver/src/server/Server.java448
-rw-r--r--Dozentenmodulserver/src/server/ServerHandler.java31
-rw-r--r--Dozentenmodulserver/src/server/startServer.java21
-rw-r--r--Dozentenmodulserver/src/sql/SQL.java39
-rw-r--r--Dozentenmodulserver/src/util/XMLCreator.java4
7 files changed, 535 insertions, 49 deletions
diff --git a/Dozentenmodulserver/src/models/Configuration.java b/Dozentenmodulserver/src/models/Configuration.java
new file mode 100644
index 00000000..1e616466
--- /dev/null
+++ b/Dozentenmodulserver/src/models/Configuration.java
@@ -0,0 +1,39 @@
+package models;
+
+public class Configuration {
+
+ private String absolute_path;
+ private String sql_connection;
+ private String sql_user;
+ private String sql_pass;
+
+ public static Configuration config =new Configuration();
+
+ public String getAbsolute_path() {
+ return absolute_path;
+ }
+ public void setAbsolute_path(String absolute_path) {
+ this.absolute_path = absolute_path;
+ }
+ public String getSql_connection() {
+ return sql_connection;
+ }
+ public void setSql_connection(String sql_connection) {
+ this.sql_connection = sql_connection;
+ }
+ public String getSql_user() {
+ return sql_user;
+ }
+ public void setSql_user(String sql_user) {
+ this.sql_user = sql_user;
+ }
+ public String getSql_pass() {
+ return sql_pass;
+ }
+ public void setSql_pass(String sql_pass) {
+ this.sql_pass = sql_pass;
+ }
+
+
+
+}
diff --git a/Dozentenmodulserver/src/server/BinaryListener.java b/Dozentenmodulserver/src/server/BinaryListener.java
index 97793778..a48b381e 100644
--- a/Dozentenmodulserver/src/server/BinaryListener.java
+++ b/Dozentenmodulserver/src/server/BinaryListener.java
@@ -31,5 +31,5 @@ public class BinaryListener implements Runnable
log.info(new Date() +" - Started running BinaryListener");
server.serve();
}
-
+
}
diff --git a/Dozentenmodulserver/src/server/Server.java b/Dozentenmodulserver/src/server/Server.java
index 7382e965..ef434865 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) 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 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) 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 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, 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 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, 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 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) 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
{
- send_writeVLdata(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath);
+ send_writeVLdata(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, isTemplate, filesize);
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) 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) throws org.apache.thrift.TException
{
writeVLdata_args args = new writeVLdata_args();
args.setImagename(imagename);
@@ -225,6 +225,8 @@ public class Server {
args.setRam(ram);
args.setCpu(cpu);
args.setImagePath(imagePath);
+ args.setIsTemplate(isTemplate);
+ args.setFilesize(filesize);
sendBase("writeVLdata", args);
}
@@ -411,13 +413,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) 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
{
- send_updateImageData(name, newName, image_path, license, internet, ram, cpu, id, version);
+ send_updateImageData(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize);
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) 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) throws org.apache.thrift.TException
{
updateImageData_args args = new updateImageData_args();
args.setName(name);
@@ -429,6 +431,8 @@ public class Server {
args.setCpu(cpu);
args.setId(id);
args.setVersion(version);
+ args.setIsTemplate(isTemplate);
+ args.setFilesize(filesize);
sendBase("updateImageData", args);
}
@@ -713,9 +717,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, 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 {
checkReady();
- writeVLdata_call method_call = new writeVLdata_call(imagename, login, firstname, lastname, university, Mail, Tel, Fak, license, internet, ram, cpu, imagePath, 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, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -734,7 +738,9 @@ public class Server {
private long ram;
private long cpu;
private String imagePath;
- 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, 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 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 {
super(client, protocolFactory, transport, resultHandler, false);
this.imagename = imagename;
this.login = login;
@@ -749,6 +755,8 @@ public class Server {
this.ram = ram;
this.cpu = cpu;
this.imagePath = imagePath;
+ this.isTemplate = isTemplate;
+ this.filesize = filesize;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -767,6 +775,8 @@ public class Server {
args.setRam(ram);
args.setCpu(cpu);
args.setImagePath(imagePath);
+ args.setIsTemplate(isTemplate);
+ args.setFilesize(filesize);
args.write(prot);
prot.writeMessageEnd();
}
@@ -1041,9 +1051,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, 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 {
checkReady();
- updateImageData_call method_call = new updateImageData_call(name, newName, image_path, license, internet, ram, cpu, id, version, resultHandler, this, ___protocolFactory, ___transport);
+ updateImageData_call method_call = new updateImageData_call(name, newName, image_path, license, internet, ram, cpu, id, version, isTemplate, filesize, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -1058,7 +1068,9 @@ public class Server {
private long cpu;
private String id;
private String version;
- public updateImageData_call(String name, String newName, String image_path, boolean license, boolean internet, long ram, long cpu, String 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 {
+ 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 {
super(client, protocolFactory, transport, resultHandler, false);
this.name = name;
this.newName = newName;
@@ -1069,6 +1081,8 @@ public class Server {
this.cpu = cpu;
this.id = id;
this.version = version;
+ this.isTemplate = isTemplate;
+ this.filesize = filesize;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -1083,6 +1097,8 @@ public class Server {
args.setCpu(cpu);
args.setId(id);
args.setVersion(version);
+ args.setIsTemplate(isTemplate);
+ args.setFilesize(filesize);
args.write(prot);
prot.writeMessageEnd();
}
@@ -1456,7 +1472,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);
+ 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.setSuccessIsSet(true);
return result;
}
@@ -1619,7 +1635,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);
+ 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.setSuccessIsSet(true);
return result;
}
@@ -1986,7 +2002,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,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,resultHandler);
}
}
@@ -2397,7 +2413,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,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,resultHandler);
}
}
@@ -4851,6 +4867,8 @@ public class Server {
private static final org.apache.thrift.protocol.TField RAM_FIELD_DESC = new org.apache.thrift.protocol.TField("ram", org.apache.thrift.protocol.TType.I64, (short)-11);
private static final org.apache.thrift.protocol.TField CPU_FIELD_DESC = new org.apache.thrift.protocol.TField("cpu", org.apache.thrift.protocol.TType.I64, (short)-12);
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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -4871,6 +4889,8 @@ public class Server {
public long ram; // required
public long cpu; // required
public String imagePath; // required
+ public boolean isTemplate; // required
+ public long filesize; // 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 {
@@ -4886,7 +4906,9 @@ public class Server {
INTERNET((short)-10, "internet"),
RAM((short)-11, "ram"),
CPU((short)-12, "cpu"),
- IMAGE_PATH((short)-13, "imagePath");
+ IMAGE_PATH((short)-13, "imagePath"),
+ IS_TEMPLATE((short)-14, "isTemplate"),
+ FILESIZE((short)-15, "filesize");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -4927,6 +4949,10 @@ public class Server {
return CPU;
case -13: // IMAGE_PATH
return IMAGE_PATH;
+ case -14: // IS_TEMPLATE
+ return IS_TEMPLATE;
+ case -15: // FILESIZE
+ return FILESIZE;
default:
return null;
}
@@ -4971,6 +4997,8 @@ public class Server {
private static final int __INTERNET_ISSET_ID = 1;
private static final int __RAM_ISSET_ID = 2;
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 byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -5001,6 +5029,10 @@ public class Server {
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "int")));
tmpMap.put(_Fields.IMAGE_PATH, new org.apache.thrift.meta_data.FieldMetaData("imagePath", org.apache.thrift.TFieldRequirementType.DEFAULT,
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.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)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeVLdata_args.class, metaDataMap);
}
@@ -5021,7 +5053,9 @@ public class Server {
boolean internet,
long ram,
long cpu,
- String imagePath)
+ String imagePath,
+ boolean isTemplate,
+ long filesize)
{
this();
this.imagename = imagename;
@@ -5041,6 +5075,10 @@ public class Server {
this.cpu = cpu;
setCpuIsSet(true);
this.imagePath = imagePath;
+ this.isTemplate = isTemplate;
+ setIsTemplateIsSet(true);
+ this.filesize = filesize;
+ setFilesizeIsSet(true);
}
/**
@@ -5079,6 +5117,8 @@ public class Server {
if (other.isSetImagePath()) {
this.imagePath = other.imagePath;
}
+ this.isTemplate = other.isTemplate;
+ this.filesize = other.filesize;
}
public writeVLdata_args deepCopy() {
@@ -5104,6 +5144,10 @@ public class Server {
setCpuIsSet(false);
this.cpu = 0;
this.imagePath = null;
+ setIsTemplateIsSet(false);
+ this.isTemplate = false;
+ setFilesizeIsSet(false);
+ this.filesize = 0;
}
public String getImagename() {
@@ -5414,6 +5458,52 @@ public class Server {
}
}
+ public boolean isIsTemplate() {
+ return this.isTemplate;
+ }
+
+ public writeVLdata_args setIsTemplate(boolean isTemplate) {
+ this.isTemplate = isTemplate;
+ setIsTemplateIsSet(true);
+ return this;
+ }
+
+ public void unsetIsTemplate() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID);
+ }
+
+ /** Returns true if field isTemplate is set (has been assigned a value) and false otherwise */
+ public boolean isSetIsTemplate() {
+ return EncodingUtils.testBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID);
+ }
+
+ public void setIsTemplateIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID, value);
+ }
+
+ public long getFilesize() {
+ return this.filesize;
+ }
+
+ public writeVLdata_args setFilesize(long filesize) {
+ this.filesize = filesize;
+ setFilesizeIsSet(true);
+ return this;
+ }
+
+ public void unsetFilesize() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FILESIZE_ISSET_ID);
+ }
+
+ /** Returns true if field filesize is set (has been assigned a value) and false otherwise */
+ public boolean isSetFilesize() {
+ return EncodingUtils.testBit(__isset_bitfield, __FILESIZE_ISSET_ID);
+ }
+
+ public void setFilesizeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESIZE_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case IMAGENAME:
@@ -5520,6 +5610,22 @@ public class Server {
}
break;
+ case IS_TEMPLATE:
+ if (value == null) {
+ unsetIsTemplate();
+ } else {
+ setIsTemplate((Boolean)value);
+ }
+ break;
+
+ case FILESIZE:
+ if (value == null) {
+ unsetFilesize();
+ } else {
+ setFilesize((Long)value);
+ }
+ break;
+
}
}
@@ -5564,6 +5670,12 @@ public class Server {
case IMAGE_PATH:
return getImagePath();
+ case IS_TEMPLATE:
+ return Boolean.valueOf(isIsTemplate());
+
+ case FILESIZE:
+ return Long.valueOf(getFilesize());
+
}
throw new IllegalStateException();
}
@@ -5601,6 +5713,10 @@ public class Server {
return isSetCpu();
case IMAGE_PATH:
return isSetImagePath();
+ case IS_TEMPLATE:
+ return isSetIsTemplate();
+ case FILESIZE:
+ return isSetFilesize();
}
throw new IllegalStateException();
}
@@ -5735,6 +5851,24 @@ public class Server {
return false;
}
+ boolean this_present_isTemplate = true;
+ boolean that_present_isTemplate = true;
+ if (this_present_isTemplate || that_present_isTemplate) {
+ if (!(this_present_isTemplate && that_present_isTemplate))
+ return false;
+ if (this.isTemplate != that.isTemplate)
+ return false;
+ }
+
+ boolean this_present_filesize = true;
+ boolean that_present_filesize = true;
+ if (this_present_filesize || that_present_filesize) {
+ if (!(this_present_filesize && that_present_filesize))
+ return false;
+ if (this.filesize != that.filesize)
+ return false;
+ }
+
return true;
}
@@ -5881,6 +6015,26 @@ public class Server {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetIsTemplate()).compareTo(other.isSetIsTemplate());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIsTemplate()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isTemplate, other.isTemplate);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetFilesize()).compareTo(other.isSetFilesize());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetFilesize()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filesize, other.filesize);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -5988,6 +6142,14 @@ public class Server {
sb.append(this.imagePath);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("isTemplate:");
+ sb.append(this.isTemplate);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("filesize:");
+ sb.append(this.filesize);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -6137,6 +6299,22 @@ public class Server {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case -14: // IS_TEMPLATE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.isTemplate = iprot.readBool();
+ struct.setIsTemplateIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case -15: // FILESIZE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.filesize = iprot.readI64();
+ struct.setFilesizeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -6152,6 +6330,12 @@ public class Server {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(FILESIZE_FIELD_DESC);
+ oprot.writeI64(struct.filesize);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(IS_TEMPLATE_FIELD_DESC);
+ oprot.writeBool(struct.isTemplate);
+ oprot.writeFieldEnd();
if (struct.imagePath != null) {
oprot.writeFieldBegin(IMAGE_PATH_FIELD_DESC);
oprot.writeString(struct.imagePath);
@@ -6266,7 +6450,13 @@ public class Server {
if (struct.isSetImagePath()) {
optionals.set(12);
}
- oprot.writeBitSet(optionals, 13);
+ if (struct.isSetIsTemplate()) {
+ optionals.set(13);
+ }
+ if (struct.isSetFilesize()) {
+ optionals.set(14);
+ }
+ oprot.writeBitSet(optionals, 15);
if (struct.isSetImagename()) {
oprot.writeString(struct.imagename);
}
@@ -6306,12 +6496,18 @@ public class Server {
if (struct.isSetImagePath()) {
oprot.writeString(struct.imagePath);
}
+ if (struct.isSetIsTemplate()) {
+ oprot.writeBool(struct.isTemplate);
+ }
+ if (struct.isSetFilesize()) {
+ oprot.writeI64(struct.filesize);
+ }
}
@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(13);
+ BitSet incoming = iprot.readBitSet(15);
if (incoming.get(0)) {
struct.imagename = iprot.readString();
struct.setImagenameIsSet(true);
@@ -6364,6 +6560,14 @@ public class Server {
struct.imagePath = iprot.readString();
struct.setImagePathIsSet(true);
}
+ if (incoming.get(13)) {
+ struct.isTemplate = iprot.readBool();
+ struct.setIsTemplateIsSet(true);
+ }
+ if (incoming.get(14)) {
+ struct.filesize = iprot.readI64();
+ struct.setFilesizeIsSet(true);
+ }
}
}
@@ -13126,6 +13330,8 @@ public class Server {
private static final org.apache.thrift.protocol.TField CPU_FIELD_DESC = new org.apache.thrift.protocol.TField("cpu", org.apache.thrift.protocol.TType.I64, (short)-7);
private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)-8);
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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -13142,6 +13348,8 @@ public class Server {
public long cpu; // required
public String id; // required
public String version; // required
+ public boolean isTemplate; // required
+ public long filesize; // 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 {
@@ -13153,7 +13361,9 @@ public class Server {
RAM((short)-6, "ram"),
CPU((short)-7, "cpu"),
ID((short)-8, "id"),
- VERSION((short)-9, "version");
+ VERSION((short)-9, "version"),
+ IS_TEMPLATE((short)-10, "isTemplate"),
+ FILESIZE((short)-11, "filesize");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -13186,6 +13396,10 @@ public class Server {
return ID;
case -9: // VERSION
return VERSION;
+ case -10: // IS_TEMPLATE
+ return IS_TEMPLATE;
+ case -11: // FILESIZE
+ return FILESIZE;
default:
return null;
}
@@ -13230,6 +13444,8 @@ public class Server {
private static final int __INTERNET_ISSET_ID = 1;
private static final int __RAM_ISSET_ID = 2;
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 byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -13252,6 +13468,10 @@ public class Server {
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)));
+ 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.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)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateImageData_args.class, metaDataMap);
}
@@ -13268,7 +13488,9 @@ public class Server {
long ram,
long cpu,
String id,
- String version)
+ String version,
+ boolean isTemplate,
+ long filesize)
{
this();
this.name = name;
@@ -13284,6 +13506,10 @@ public class Server {
setCpuIsSet(true);
this.id = id;
this.version = version;
+ this.isTemplate = isTemplate;
+ setIsTemplateIsSet(true);
+ this.filesize = filesize;
+ setFilesizeIsSet(true);
}
/**
@@ -13310,6 +13536,8 @@ public class Server {
if (other.isSetVersion()) {
this.version = other.version;
}
+ this.isTemplate = other.isTemplate;
+ this.filesize = other.filesize;
}
public updateImageData_args deepCopy() {
@@ -13331,6 +13559,10 @@ public class Server {
this.cpu = 0;
this.id = null;
this.version = null;
+ setIsTemplateIsSet(false);
+ this.isTemplate = false;
+ setFilesizeIsSet(false);
+ this.filesize = 0;
}
public String getName() {
@@ -13545,6 +13777,52 @@ public class Server {
}
}
+ public boolean isIsTemplate() {
+ return this.isTemplate;
+ }
+
+ public updateImageData_args setIsTemplate(boolean isTemplate) {
+ this.isTemplate = isTemplate;
+ setIsTemplateIsSet(true);
+ return this;
+ }
+
+ public void unsetIsTemplate() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID);
+ }
+
+ /** Returns true if field isTemplate is set (has been assigned a value) and false otherwise */
+ public boolean isSetIsTemplate() {
+ return EncodingUtils.testBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID);
+ }
+
+ public void setIsTemplateIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTEMPLATE_ISSET_ID, value);
+ }
+
+ public long getFilesize() {
+ return this.filesize;
+ }
+
+ public updateImageData_args setFilesize(long filesize) {
+ this.filesize = filesize;
+ setFilesizeIsSet(true);
+ return this;
+ }
+
+ public void unsetFilesize() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FILESIZE_ISSET_ID);
+ }
+
+ /** Returns true if field filesize is set (has been assigned a value) and false otherwise */
+ public boolean isSetFilesize() {
+ return EncodingUtils.testBit(__isset_bitfield, __FILESIZE_ISSET_ID);
+ }
+
+ public void setFilesizeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESIZE_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
@@ -13619,6 +13897,22 @@ public class Server {
}
break;
+ case IS_TEMPLATE:
+ if (value == null) {
+ unsetIsTemplate();
+ } else {
+ setIsTemplate((Boolean)value);
+ }
+ break;
+
+ case FILESIZE:
+ if (value == null) {
+ unsetFilesize();
+ } else {
+ setFilesize((Long)value);
+ }
+ break;
+
}
}
@@ -13651,6 +13945,12 @@ public class Server {
case VERSION:
return getVersion();
+ case IS_TEMPLATE:
+ return Boolean.valueOf(isIsTemplate());
+
+ case FILESIZE:
+ return Long.valueOf(getFilesize());
+
}
throw new IllegalStateException();
}
@@ -13680,6 +13980,10 @@ public class Server {
return isSetId();
case VERSION:
return isSetVersion();
+ case IS_TEMPLATE:
+ return isSetIsTemplate();
+ case FILESIZE:
+ return isSetFilesize();
}
throw new IllegalStateException();
}
@@ -13778,6 +14082,24 @@ public class Server {
return false;
}
+ boolean this_present_isTemplate = true;
+ boolean that_present_isTemplate = true;
+ if (this_present_isTemplate || that_present_isTemplate) {
+ if (!(this_present_isTemplate && that_present_isTemplate))
+ return false;
+ if (this.isTemplate != that.isTemplate)
+ return false;
+ }
+
+ boolean this_present_filesize = true;
+ boolean that_present_filesize = true;
+ if (this_present_filesize || that_present_filesize) {
+ if (!(this_present_filesize && that_present_filesize))
+ return false;
+ if (this.filesize != that.filesize)
+ return false;
+ }
+
return true;
}
@@ -13884,6 +14206,26 @@ public class Server {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetIsTemplate()).compareTo(other.isSetIsTemplate());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIsTemplate()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isTemplate, other.isTemplate);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetFilesize()).compareTo(other.isSetFilesize());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetFilesize()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filesize, other.filesize);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -13959,6 +14301,14 @@ public class Server {
sb.append(this.version);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("isTemplate:");
+ sb.append(this.isTemplate);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("filesize:");
+ sb.append(this.filesize);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -14076,6 +14426,22 @@ public class Server {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case -10: // IS_TEMPLATE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.isTemplate = iprot.readBool();
+ struct.setIsTemplateIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case -11: // FILESIZE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.filesize = iprot.readI64();
+ struct.setFilesizeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -14091,6 +14457,12 @@ public class Server {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(FILESIZE_FIELD_DESC);
+ oprot.writeI64(struct.filesize);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(IS_TEMPLATE_FIELD_DESC);
+ oprot.writeBool(struct.isTemplate);
+ oprot.writeFieldEnd();
if (struct.version != null) {
oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeString(struct.version);
@@ -14173,7 +14545,13 @@ public class Server {
if (struct.isSetVersion()) {
optionals.set(8);
}
- oprot.writeBitSet(optionals, 9);
+ if (struct.isSetIsTemplate()) {
+ optionals.set(9);
+ }
+ if (struct.isSetFilesize()) {
+ optionals.set(10);
+ }
+ oprot.writeBitSet(optionals, 11);
if (struct.isSetName()) {
oprot.writeString(struct.name);
}
@@ -14201,12 +14579,18 @@ public class Server {
if (struct.isSetVersion()) {
oprot.writeString(struct.version);
}
+ if (struct.isSetIsTemplate()) {
+ oprot.writeBool(struct.isTemplate);
+ }
+ if (struct.isSetFilesize()) {
+ oprot.writeI64(struct.filesize);
+ }
}
@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(9);
+ BitSet incoming = iprot.readBitSet(11);
if (incoming.get(0)) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
@@ -14243,6 +14627,14 @@ public class Server {
struct.version = iprot.readString();
struct.setVersionIsSet(true);
}
+ if (incoming.get(9)) {
+ struct.isTemplate = iprot.readBool();
+ struct.setIsTemplateIsSet(true);
+ }
+ if (incoming.get(10)) {
+ struct.filesize = iprot.readI64();
+ struct.setFilesizeIsSet(true);
+ }
}
}
diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java
index bf71607a..95b261d3 100644
--- a/Dozentenmodulserver/src/server/ServerHandler.java
+++ b/Dozentenmodulserver/src/server/ServerHandler.java
@@ -18,19 +18,23 @@ import java.util.UUID;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+import models.Configuration;
+
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
+import org.ini4j.Wini;
import sql.SQL;
import util.XMLCreator;
public class ServerHandler implements Server.Iface {
-
static SQL sql = new SQL();
static Connection con = sql.getConnection();
private static Logger log = Logger.getLogger(ServerHandler.class);
+
+
@Override
public User getFtpUser() throws TException {
log.info(new Date() + " - returing FTPUser...");
@@ -38,7 +42,7 @@ public class ServerHandler implements Server.Iface {
user.setUserName(UUID.randomUUID().toString().substring(0, 8));
user.setPassword(getEncodedSha1Sum(UUID.randomUUID().toString()
.substring(0, 8)));
- user.setPath("/srv/openslx/nfs/temp");
+ user.setPath(Configuration.config.getAbsolute_path());
SQL sql = new SQL();
Connection con = sql.getConnection();
sql.writeFTPUser(con, user.getUserName(), user.getPassword());
@@ -85,7 +89,7 @@ public class ServerHandler implements Server.Iface {
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) throws TException {
+ long ram, long cpu, String imagePath, boolean isTemplate ,long filesize) throws TException {
String pk_institution = sql.setInstitution(con, university);
@@ -93,7 +97,7 @@ public class ServerHandler implements Server.Iface {
new Date(), pk_institution);
sql.setImageData(con, pk_person, license, internet, cpu, ram,
- imagename, imagePath);
+ imagename, imagePath,isTemplate ,filesize);
log.info(new Date() + " - written VLdata");
// TODO Auto-generated method stub
@@ -216,7 +220,8 @@ public class ServerHandler implements Server.Iface {
}
@Override
- public boolean startFileCopy(String file) throws TException {
+ public boolean startFileCopy(String filename) throws TException {
+ String file=Configuration.config.getAbsolute_path()+"temp/"+filename;
File tmpFile = new File(file);
log.info(new Date() + " - Trying to move file to '/srv/openslx/nfs/prod/"+tmpFile.getName() +"'");
@@ -227,10 +232,9 @@ public class ServerHandler implements Server.Iface {
// eingelesen?
//FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"
// + tmpFile.getName()));
- FileUtils.moveFile(tmpFile, new File("/srv/openslx/nfs/prod/"
- + tmpFile.getName()));
-
-
+ FileUtils.moveFile(tmpFile, new File(Configuration.config.getAbsolute_path()+"prod/"+filename));
+ int ret=sql.UpdateImagePath(con, filename);
+ log.info(new Date() + " - update "+ret);
log.info(new Date() + " - file moved");
} catch (IOException e) {
@@ -277,9 +281,9 @@ public class ServerHandler implements Server.Iface {
@Override
public boolean updateImageData(String name, String newName, String image_path,
boolean license, boolean internet, long ram, long cpu, String id,
- String version) throws TException {
+ String version, boolean isTemplate, long filesize) throws TException {
sql.UpdateImageData(con, name, newName,image_path, license, internet, cpu, ram,
- id, version);
+ id, version, isTemplate, filesize);
return false;
}
@@ -360,7 +364,7 @@ public class ServerHandler implements Server.Iface {
String stringFile = sql.getFile(con, imageid, imageversion);
log.info(new Date() + " - File to Delete: " + stringFile);
- File tmpFile = new File(stringFile);
+ File tmpFile = new File(Configuration.config.getAbsolute_path()+stringFile);
try {
// File wird von Server gelöscht
@@ -396,7 +400,7 @@ public class ServerHandler implements Server.Iface {
String date = rs.getString("admin_createTime").replace(" ", "")
.replace("-", "").replace(":", "");
String name = rs.getString("name");
- String path = "/srv/openslx/nfs/temp/"
+ String path = Configuration.config.getAbsolute_path()+"temp/"
+ date.substring(0, date.length() - 2) + "_" + hs + "_"
+ user + "_" + name + ".xml";
File xmlFile = new File(path);
@@ -412,4 +416,5 @@ public class ServerHandler implements Server.Iface {
}
+
}
diff --git a/Dozentenmodulserver/src/server/startServer.java b/Dozentenmodulserver/src/server/startServer.java
index 542c92b8..949b3538 100644
--- a/Dozentenmodulserver/src/server/startServer.java
+++ b/Dozentenmodulserver/src/server/startServer.java
@@ -1,11 +1,17 @@
package server;
+import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import models.Configuration;
+
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
+import org.ini4j.InvalidFileFormatException;
+import org.ini4j.Wini;
import server.BinaryListener;
@@ -22,6 +28,21 @@ public class startServer {
public static void main(String[] args) {
+ //get Configuration
+ try {
+ Wini ini=new Wini(new File("Server_Config.ini"));
+ Configuration.config.setAbsolute_path(ini.get("ftp", "path_absolute"));
+ Configuration.config.setSql_connection(ini.get("sql", "connection"));
+ Configuration.config.setSql_pass(ini.get("sql", "pass"));
+ Configuration.config.setSql_user(ini.get("sql", "user"));
+ } catch (InvalidFileFormatException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ //Start Server
BasicConfigurator.configure();
log.info( new Date() + " - starting Application\n" );
Thread t;
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index 36aadd89..69843988 100644
--- a/Dozentenmodulserver/src/sql/SQL.java
+++ b/Dozentenmodulserver/src/sql/SQL.java
@@ -8,6 +8,8 @@ import java.util.Date;
import java.util.Random;
import java.util.UUID;
+import models.Configuration;
+
import org.apache.log4j.Logger;
import server.BinaryListener;
@@ -25,7 +27,7 @@ public class SQL {
}
try {
Connection con = DriverManager
- .getConnection("jdbc:mysql://127.0.0.1/bwLehrpool?user=root&password=slx-ng-open");
+ .getConnection("jdbc:mysql://"+Configuration.config.getSql_connection()+"?user="+Configuration.config.getSql_user()+"&password="+Configuration.config.getSql_pass()+"");
con.setAutoCommit(false);
log.info(new Date() + " - Connection returned to Client.");
return con;
@@ -47,7 +49,7 @@ public class SQL {
+ user
+ "',SHA1('"
+ pass
- + "'),'10001','12345','/srv/openslx/nfs/temp');");
+ + "'),'10001','12345','"+Configuration.config.getAbsolute_path()+"temp/');");
con.commit();
log.info(new Date() + " - created FTPUser " + user + " : " + pass
+ ".");
@@ -201,7 +203,7 @@ public class SQL {
public boolean setImageData(Connection con, String pk_person, boolean license,
boolean internet, long cpu, long ram, String imagename,
- String imagePath) {
+ String imagePath, boolean isTemplate, long filesize) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -218,7 +220,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`)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`)VALUES('"
+ uid // GUID_imageID
+ "',1,'" // imageVersion
+ imagename // image_name
@@ -244,6 +246,8 @@ public class SQL {
+ "','" + internet_bol // cond_hasInternetRestriction
+ "','" + ram // cond_minRAM
+ "','" + cpu // cond_minCPUs
+ + "','" + isTemplate //image_isTemplate
+ + "','" + filesize //image_filesize
+ "');");
con.commit();
@@ -390,7 +394,6 @@ public class SQL {
public ResultSet getImageData(Connection con, String id, String version) {
try {
Statement stm = con.createStatement();
- System.out.println("Test");
return stm
.executeQuery("SELECT image_name,cond_hasInternetRestriction,cond_hasLicenseRestriction, cond_minCPUs, cond_minRAM FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
+ id + "' and imageVersion = '" + version + "' ;");
@@ -404,7 +407,7 @@ public class SQL {
public int UpdateImageData(Connection con, String name, String newName,String image_path,
boolean license, boolean internet, long cpu, long ram, String id,
- String version) {
+ String version, boolean isTemplate, long filesize) {
try {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Statement stm = con.createStatement();
@@ -438,6 +441,10 @@ public class SQL {
+ ram
+ "',`cond_minCPUs` = '"
+ cpu
+ + "',`image_isTemplate` = '"
+ + isTemplate
+ + "',`image_filesize` = '"
+ + filesize
+ "' WHERE `GUID_imageID` = '"
+ id
+ "' AND `imageVersion` = '" + version + "';");
@@ -599,4 +606,24 @@ public class SQL {
return null;
}
+
+ public int UpdateImagePath(Connection con, String name) {
+ try {
+
+ Statement stm = con.createStatement();
+ String image_path="prod/"+name;
+
+ stm.executeUpdate("UPDATE `bwLehrpool`.`m_VLData_imageInfo` SET `image_path` = '"
+ + image_path
+ + "' WHERE `image_path` = '"
+ + "temp/"+name + "';");
+ con.commit();
+ return 0;
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to UpdateImageData.");
+ e.printStackTrace();
+ }
+ return -1;
+ }
}
diff --git a/Dozentenmodulserver/src/util/XMLCreator.java b/Dozentenmodulserver/src/util/XMLCreator.java
index 111a6337..bf49dfe3 100644
--- a/Dozentenmodulserver/src/util/XMLCreator.java
+++ b/Dozentenmodulserver/src/util/XMLCreator.java
@@ -18,6 +18,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import models.Configuration;
+
import org.apache.log4j.Logger;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
@@ -36,7 +38,7 @@ public class XMLCreator {
private Statement st = null;
private ResultSet rs = null;
private String vmName;
- private String filePath = "/srv/openslx/nfs/temp/";
+ private String filePath = Configuration.config.getAbsolute_path()+"prod/";
private String imageName;
private String xmlName;
private static Logger log = Logger.getLogger( BinaryListener.class );