summaryrefslogtreecommitdiffstats
path: root/Dozentenmodulserver
diff options
context:
space:
mode:
authorunknown2014-04-28 18:12:51 +0200
committerunknown2014-04-28 18:12:51 +0200
commit3240a29571e807a146a65578c98d0f32c7e67e3e (patch)
treeeb042ebcdbabc4538be5df34e405ea0b1e7944a0 /Dozentenmodulserver
parentDie XML Datei wird beim Löschen der Lecture nun auch gelöscht (diff)
downloadtutor-module-3240a29571e807a146a65578c98d0f32c7e67e3e.tar.gz
tutor-module-3240a29571e807a146a65578c98d0f32c7e67e3e.tar.xz
tutor-module-3240a29571e807a146a65578c98d0f32c7e67e3e.zip
Logging Ausgaben verändert
Diffstat (limited to 'Dozentenmodulserver')
-rw-r--r--Dozentenmodulserver/bin/server/ServerHandler.classbin15482 -> 14803 bytes
-rw-r--r--Dozentenmodulserver/bin/sql/SQL.classbin16432 -> 17797 bytes
-rw-r--r--Dozentenmodulserver/src/server/ServerHandler.java132
-rw-r--r--Dozentenmodulserver/src/sql/SQL.java64
4 files changed, 98 insertions, 98 deletions
diff --git a/Dozentenmodulserver/bin/server/ServerHandler.class b/Dozentenmodulserver/bin/server/ServerHandler.class
index 7276cd94..918d9244 100644
--- a/Dozentenmodulserver/bin/server/ServerHandler.class
+++ b/Dozentenmodulserver/bin/server/ServerHandler.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/sql/SQL.class b/Dozentenmodulserver/bin/sql/SQL.class
index 254cc4d7..b6efa4e5 100644
--- a/Dozentenmodulserver/bin/sql/SQL.class
+++ b/Dozentenmodulserver/bin/sql/SQL.class
Binary files differ
diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java
index 9529ec22..dddc0bd7 100644
--- a/Dozentenmodulserver/src/server/ServerHandler.java
+++ b/Dozentenmodulserver/src/server/ServerHandler.java
@@ -31,16 +31,6 @@ public class ServerHandler implements Server.Iface {
static Connection con = sql.getConnection();
private static Logger log = Logger.getLogger(ServerHandler.class);
- /**
- * @param args
- */
- /*
- * public static void main(String[] args) { // TODO Auto-generated method
- * stub
- *
- * }
- */
-
@Override
public User getFtpUser() throws TException {
log.info(new Date() + " - returing FTPUser...");
@@ -52,13 +42,11 @@ public class ServerHandler implements Server.Iface {
SQL sql = new SQL();
Connection con = sql.getConnection();
sql.writeFTPUser(con, user.getUserName(), user.getPassword());
- log.info(new Date() + " - successfully returned FTPUser");
return user;
}
public String getEncodedSha1Sum(String key) {
try {
- log.info(new Date() + " - returned EncodedSha1Sum...");
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(key.getBytes());
log.info(new Date() + " - successfully returned EncodedSha1Sum");
@@ -72,7 +60,6 @@ public class ServerHandler implements Server.Iface {
@Override
public long DeleteFtpUser(String user) throws TException {
int ret = sql.DeleteUser(con, user);
- log.info(new Date() + " - deleting FTPUser");
return ret;
}
@@ -81,11 +68,8 @@ public class ServerHandler implements Server.Iface {
throws TException {
try {
- log.info(new Date() + " - returning PathOfImage...");
ResultSet rs = sql.getPathOfImage(con, image_id, version);
- System.out.println("Path SQL erfolgreich");
rs.next();
- System.out.println(rs.getString("image_path"));
log.info(new Date() + " - successfully returned PathOfImage: "
+ rs.getString("image_path"));
return rs.getString("image_path");
@@ -98,11 +82,10 @@ public class ServerHandler implements Server.Iface {
}
@Override
- 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 {
-
+ 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 {
int pk_institution = sql.setInstitution(con, university);
@@ -112,7 +95,7 @@ public class ServerHandler implements Server.Iface {
sql.setImageData(con, pk_person, license, internet, cpu, ram,
imagename, imagePath);
- log.info(new Date() + " - writing VLdata");
+ log.info(new Date() + " - written VLdata");
// TODO Auto-generated method stub
return true;
}
@@ -137,13 +120,13 @@ public class ServerHandler implements Server.Iface {
}
- log.info(new Date() + " - returning ImageList: " + list.size());
return list;
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
- log.info(new Date() + " - returning ImageList: " + list.size());
+ log.info(new Date() + " - returning ImageList: " + list.size()
+ + " items.");
return null;
}
@@ -155,13 +138,11 @@ public class ServerHandler implements Server.Iface {
while (rs.next()) {
list.add(rs.getString("name"));
}
- log.info(new Date() + " - returning AllOS: " + list.size());
return list;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- log.info(new Date() + " - returning AllOS: " + list.size());
return null;
}
@@ -180,24 +161,24 @@ public class ServerHandler implements Server.Iface {
map.put("Hochschule", rs.getString("name"));
}
- log.info(new Date() + " - returning PersonData: " + map.size());
return map;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- log.info(new Date() + " - returning PersonData: " + map.size());
+ log.info(new Date() + " - returning PersonData: " + map.size()
+ + " items.");
return null;
}
@Override
public boolean writeLecturedata(String name, String shortdesc, String desc,
String startDate, String endDate, boolean isActive,
- String imagename, String login ,String firstname, String lastname,
+ String imagename, String login, String firstname, String lastname,
String university, String Mail, String Tel, String Fak)
throws TException {
int pk_image = 0;
-
+
int imageversion = 0;
int pk_institution = sql.setInstitution(con, university);
int pk_person = sql.setPerson(con, login, lastname, firstname, Mail,
@@ -215,13 +196,12 @@ public class ServerHandler implements Server.Iface {
e.printStackTrace();
}
- System.out.println(startDate);
sql.setLectureData(con, pk_person, pk_image, imageversion, name, desc,
shortdesc, startDate, endDate, isActive);
XMLCreator xml = new XMLCreator(con, name);
try {
xml.create(name);
- log.info(new Date() + " - XML created");
+ log.info(new Date() + " - XML created.");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -239,14 +219,19 @@ public class ServerHandler implements Server.Iface {
public boolean startFileCopy(String file) throws TException {
File tmpFile = new File(file);
- System.out.println("Vor Move" + new Date());
try {
- //der übergebene Filename ist falsch - hier muss der generierte name geholt werden, nicht der ursprüngliche name. wo wird dieser eingelesen?
- FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"+tmpFile.getName()));
+ // der übergebene Filename ist falsch - hier muss der generierte
+ // name geholt werden, nicht der ursprüngliche name. wo wird dieser
+ // eingelesen?
+ FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"
+ + tmpFile.getName()));
- //der übergebene Filename ist falsch - hier muss der generierte name geholt werden, nicht der ursprüngliche name. wo wird dieser eingelesen?
- FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"+tmpFile.getName()));
+ // der übergebene Filename ist falsch - hier muss der generierte
+ // name geholt werden, nicht der ursprüngliche name. wo wird dieser
+ // eingelesen?
+ FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"
+ + tmpFile.getName()));
// der übergebene Filename ist falsch - hier muss der generierte
// name geholt werden, nicht der ursprüngliche name. wo wird dieser
@@ -257,6 +242,7 @@ public class ServerHandler implements Server.Iface {
} catch (IOException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to move file.");
e.printStackTrace();
}
return true;
@@ -284,14 +270,13 @@ public class ServerHandler implements Server.Iface {
map.put("ram", data.getString("cond_minRAM"));
}
- System.out.println("return success");
- log.info(new Date() + " - returning ImageData: "+map.size());
return map;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- log.info(new Date() + " - returning ImageData: "+map.size());
+ log.info(new Date() + " - returning ImageData: " + map.size()
+ + "items.");
return null;
}
@@ -300,10 +285,8 @@ public class ServerHandler implements Server.Iface {
public boolean updateImageData(String name, String newName,
boolean license, boolean internet, long ram, long cpu, String id,
String version) throws TException {
- System.out.println("Server: Vor Update");
sql.UpdateImageData(con, name, newName, license, internet, cpu, ram,
id, version);
- System.out.println("Update erfolgreich");
log.info(new Date() + " - updated ImageData");
return false;
}
@@ -332,13 +315,13 @@ public class ServerHandler implements Server.Iface {
res.getString("image_name"), res.getString("user")));
}
- log.info(new Date() + " - returning LectureList: "+list.size());
return list;
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
- log.info(new Date() + " - returning LectureList: "+list.size());
+ log.info(new Date() + " - returning LectureList: " + list.size()
+ + " items.");
return null;
}
@@ -361,9 +344,10 @@ public class ServerHandler implements Server.Iface {
// TODO Auto-generated catch block
e.printStackTrace();
}
- sql.updateLectureData(con, pk_image, imageversion, lastname, newName, desc, shortdesc, startDate, endDate, isActive, id);
-
- XMLCreator xml=new XMLCreator(con, newName);
+ sql.updateLectureData(con, pk_image, imageversion, lastname, newName,
+ desc, shortdesc, startDate, endDate, isActive, id);
+
+ XMLCreator xml = new XMLCreator(con, newName);
try {
xml.create(newName);
} catch (SQLException | ParserConfigurationException
@@ -371,37 +355,36 @@ public class ServerHandler implements Server.Iface {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
sql.updateLectureData(con, pk_image, imageversion, lastname, newName,
desc, shortdesc, startDate, endDate, isActive, id);
- log.info(new Date() + " - updated LectureData");
+ log.info(new Date() + " - Failed to execute updateLecturedata.");
return false;
}
-
+
@Override
- public boolean deleteImageServer(String imageid, String imageversion) throws TException{
+ public boolean deleteImageServer(String imageid, String imageversion)
+ throws TException {
String stringFile = sql.getFile(con, imageid, imageversion);
- log.info(new Date()+" - File to Delete: "+stringFile);
-
+ log.info(new Date() + " - File to Delete: " + stringFile);
+
File tmpFile = new File(stringFile);
-
+
try {
- //File wird von Server gelöscht
+ // File wird von Server gelöscht
FileUtils.forceDelete(tmpFile);
-
- log.info(new Date()+" - Delete Successful");
return true;
-
+
} catch (IOException e) {
- log.info(new Date()+" - Delete Failed");
+ log.info(new Date() + " - Failed to execute deleteImageServer.");
e.printStackTrace();
}
-
+
return false;
}
-
+
@Override
public boolean deleteImageData(String id, String version) throws TException {
@@ -414,29 +397,28 @@ public class ServerHandler implements Server.Iface {
// TODO Auto-generated method stub
return sql.connectedToLecture(con, id, version);
}
-
- public boolean deleteLecture(String id, String hs, String user){
- ResultSet rs=sql.getDeleteXMLData(con, id);
+
+ public boolean deleteLecture(String id, String hs, String user) {
+ ResultSet rs = sql.getDeleteXMLData(con, id);
try {
rs.next();
- String date=rs.getString("admin_createTime").replace(" ", "").replace("-", "").replace(":", "");
- String name=rs.getString("name");
- String path="/srv/openslx/nfs/temp/"+date.substring(0, date.length()-2)+"_"+hs+"_"+user+"_"+name+".xml";
- log.info(new Date()+" - File to Delete: "+path);
- File xmlFile=new File(path);
+ String date = rs.getString("admin_createTime").replace(" ", "")
+ .replace("-", "").replace(":", "");
+ String name = rs.getString("name");
+ String path = "/srv/openslx/nfs/temp/"
+ + date.substring(0, date.length() - 2) + "_" + hs + "_"
+ + user + "_" + name + ".xml";
+ File xmlFile = new File(path);
FileUtils.forceDelete(xmlFile);
- log.info(new Date()+" - Delete Successful");
} catch (SQLException e) {
- log.info(new Date()+" - Delete Failed");
+ log.info(new Date() + " - Failed to execute deleteLecture");
e.printStackTrace();
} catch (IOException e) {
- log.info(new Date()+" - Delete Failed");
+ log.info(new Date() + " - Failed to execute deleteLecture");
e.printStackTrace();
}
return sql.deleteLecture(con, id);
-
- }
-
+ }
}
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index ab5f28aa..8132e52d 100644
--- a/Dozentenmodulserver/src/sql/SQL.java
+++ b/Dozentenmodulserver/src/sql/SQL.java
@@ -29,7 +29,7 @@ public class SQL {
return con;
} catch (SQLException e) {
// TODO Auto-generated catch block
- log.info(new Date() + " - Could not return connection to Client.");
+ log.info(new Date() + " - Failed to return connection to Client.");
e.printStackTrace();
}
return null;
@@ -52,7 +52,7 @@ public class SQL {
return ret;
} catch (SQLException e) {
// TODO Auto-generated catch block
- log.info(new Date() + " - FTPUser not created.");
+ log.info(new Date() + " - Failed to writeFTPUser.");
e.printStackTrace();
}
return -1;
@@ -71,7 +71,7 @@ public class SQL {
return ret;
} catch (SQLException e) {
// TODO Auto-generated catch block
- log.info(new Date() + " - Could not delete FTPUser " + user + ".");
+ log.info(new Date() + " - Failed to DeleteUser.");
e.printStackTrace();
}
return -1;
@@ -86,6 +86,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getImage.");
e.printStackTrace();
}
@@ -106,6 +107,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getPathOfImage.");
e.printStackTrace();
}
@@ -136,6 +138,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setInstitution.");
e.printStackTrace();
}
return -1;
@@ -159,8 +162,8 @@ public class SQL {
stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_user`(`userID`,`loginName`,`nachname`,`vorname`,`mail`,`lastLogin`,`institution`)VALUES('"
+ id
+ "','"
- +login
- +"','"
+ + login
+ + "','"
+ lastname
+ "','"
+ firstname
@@ -186,6 +189,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setPerson.");
e.printStackTrace();
}
return -1;
@@ -241,6 +245,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setImageData.");
e.printStackTrace();
}
return true;
@@ -256,6 +261,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getImageList.");
e.printStackTrace();
}
return null;
@@ -270,6 +276,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getLectureList.");
e.printStackTrace();
}
return null;
@@ -283,6 +290,7 @@ public class SQL {
.executeQuery("SELECT name FROM bwLehrpool.m_operatingSystem;");
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getAllOS.");
e.printStackTrace();
}
@@ -302,6 +310,7 @@ public class SQL {
+ "' and u.institution=i.institutionID;");
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getPersonData.");
e.printStackTrace();
}
return null;
@@ -353,6 +362,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setLectureData.");
e.printStackTrace();
}
return 0;
@@ -367,6 +377,7 @@ public class SQL {
+ name + "';");
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getImageIDandVersion.");
e.printStackTrace();
}
return null;
@@ -381,6 +392,7 @@ public class SQL {
+ id + "' and imageVersion = '" + version + "' ;");
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getImageData.");
e.printStackTrace();
}
return null;
@@ -427,18 +439,12 @@ public class SQL {
return 0;
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to UpdateImageData.");
e.printStackTrace();
}
return -1;
}
- /**
- *
- * @param id
- * @param version
- * @return
- */
-
public boolean deleteImage(Connection con, String id, String version) {
try {
@@ -454,6 +460,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to deleteImage.");
e.printStackTrace();
}
@@ -494,6 +501,7 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to updateLectureData.");
e.printStackTrace();
}
@@ -515,6 +523,8 @@ public class SQL {
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date()
+ + " - Failed to execute method connectedToLecture.");
e.printStackTrace();
}
@@ -523,52 +533,60 @@ public class SQL {
}
public boolean deleteLecture(Connection con, String id) {
-
+
try {
Statement stm = con.createStatement();
- stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_lecture WHERE lectureID = '"+ id + "';");
+ stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_lecture WHERE lectureID = '"
+ + id + "';");
con.commit();
return true;
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to deleteLecture.");
e.printStackTrace();
}
-
+
return false;
}
public String getFile(Connection con, String imageid, String imageversion) {
-
+
try {
Statement stm = con.createStatement();
- ResultSet rs=stm.executeQuery("SELECT image_path FROM bwLehrpool.m_VLData_imageInfo WHERE GUID_imageID = '" + imageid
- + "' AND imageVersion = '" + imageversion + "';");
+ ResultSet rs = stm
+ .executeQuery("SELECT image_path FROM bwLehrpool.m_VLData_imageInfo WHERE GUID_imageID = '"
+ + imageid
+ + "' AND imageVersion = '"
+ + imageversion
+ + "';");
rs.next();
return rs.getString("image_path");
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getFile.");
e.printStackTrace();
}
return null;
}
-
- public ResultSet getDeleteXMLData(Connection con, String id)
- {
+
+ public ResultSet getDeleteXMLData(Connection con, String id) {
try {
Statement stm = con.createStatement();
- ResultSet rs=stm.executeQuery("SELECT name, admin_createTime FROM bwLehrpool.m_VLData_lecture where lectureID='"+id+"';");
-
+ ResultSet rs = stm
+ .executeQuery("SELECT name, admin_createTime FROM bwLehrpool.m_VLData_lecture where lectureID='"
+ + id + "';");
return rs;
} catch (SQLException e) {
// TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getDeleteXMLData.");
e.printStackTrace();
}