diff options
| author | Michael Wilson | 2014-10-29 13:11:43 +0100 |
|---|---|---|
| committer | Michael Wilson | 2014-10-29 13:11:43 +0100 |
| commit | 6c69c0971a81028c9a3f046b75e1eedb37f451f9 (patch) | |
| tree | d7576d131286f23e7b6308012cce007a095f74ef /dozentenmodulserver/src/main/java/server | |
| parent | Radiobutton "Lecture is active" holt jetzt korrekte Werte aus Model (diff) | |
| download | tutor-module-6c69c0971a81028c9a3f046b75e1eedb37f451f9.tar.gz tutor-module-6c69c0971a81028c9a3f046b75e1eedb37f451f9.tar.xz tutor-module-6c69c0971a81028c9a3f046b75e1eedb37f451f9.zip | |
Ausgaben etwas verkürzt
Diffstat (limited to 'dozentenmodulserver/src/main/java/server')
| -rw-r--r-- | dozentenmodulserver/src/main/java/server/ServerHandler.java | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index 1aeb8820..a6412e24 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -38,7 +38,7 @@ public class ServerHandler implements Server.Iface { @Override public User getFtpUser() throws TException { - log.info(new Date() + " - returning FTPUser..."); + log.info("returning FTPUser..."); User user = new User(); user.setUserName(UUID.randomUUID().toString().substring(0, 8)); user.setPassword(getEncodedSha1Sum(UUID.randomUUID().toString() @@ -54,7 +54,7 @@ public class ServerHandler implements Server.Iface { sql.writeFTPUser(user.getUserName(), user.getPassword()); return user; } else { - log.info(new Date() + " - returning null user"); + log.info("Error: returning null user"); return null; } } @@ -69,15 +69,14 @@ public class ServerHandler implements Server.Iface { } if (Files.exists(path) == true) { - log.info(new Date() + " - folder '" + path - + "' exists, no further action"); + log.info("folder '" + path + "' exists, no further action"); return true; } else { // create directory and set permissions boolean success = (new File(path + "")).mkdirs(); if (!success) { - log.info(new Date() + " - failed to create folder '" + path + log.info("failed to create folder '" + path + "'"); return false; } else { @@ -88,8 +87,7 @@ public class ServerHandler implements Server.Iface { // TODO Auto-generated catch block e.printStackTrace(); } - log.info(new Date() + " - folder '" + path - + "' successfully created"); + log.info("folder '" + path + "' successfully created"); return true; } } @@ -106,15 +104,14 @@ public class ServerHandler implements Server.Iface { } if (Files.exists(path) == true) { - log.info(new Date() + " - folder '" + path - + "' exists, no further action"); + log.info("folder '" + path + "' exists, no further action"); return true; } else { // create directory and set permissions boolean success = (new File(path + "")).mkdirs(); if (!success) { - log.info(new Date() + " - failed to create folder '" + path + log.info("failed to create folder '" + path + "'"); return false; } else { @@ -125,7 +122,7 @@ public class ServerHandler implements Server.Iface { // TODO Auto-generated catch block e.printStackTrace(); } - log.info(new Date() + " - folder '" + path + log.info("folder '" + path + "' successfully created"); return true; } @@ -137,7 +134,7 @@ public class ServerHandler implements Server.Iface { try { MessageDigest md = MessageDigest.getInstance("SHA1"); md.update(key.getBytes()); - log.info(new Date() + " - successfully returned EncodedSha1Sum"); + log.info("successfully returned EncodedSha1Sum"); return new BigInteger(1, md.digest()).toString(16); } catch (NoSuchAlgorithmException e) { // handle error case to taste @@ -153,7 +150,7 @@ public class ServerHandler implements Server.Iface { @Override public String getPathOfImage(String image_id, String version) throws TException { - log.info(new Date() + " - successfully returned PathOfImage: " + log.info("successfully returned PathOfImage: " + sql.getPathOfImage(image_id, version)); return sql.getPathOfImage(image_id, version); @@ -196,7 +193,7 @@ public class ServerHandler implements Server.Iface { sql.setImageData(login, license, internet, cpu, ram, imagename, desc, imagePath, filesize, mode, pk_os); - log.info(new Date() + " - written VLdata"); + log.info("written VLdata"); // TODO Auto-generated method stub return true; } @@ -266,7 +263,7 @@ public class ServerHandler implements Server.Iface { XMLCreator xml = new XMLCreator(sql.getConnection(), name); try { xml.create(name); - log.info(new Date() + " - XML created."); + log.info("XML created."); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -288,8 +285,7 @@ public class ServerHandler implements Server.Iface { + filename; File tmpFile = new File(file); - log.info(new Date() - + " - Trying to move file to '/srv/openslx/nfs/prod/" + log.info("Trying to move file to '/srv/openslx/nfs/prod/" + tmpFile.getName() + "'"); try { FileUtils.moveFile(tmpFile, @@ -297,12 +293,12 @@ public class ServerHandler implements Server.Iface { + filename)); // int ret = sql.UpdateImagePath(filename); if (sql.UpdateImagePath(filename) == 0) { - log.info(new Date() + " - file moved and database updated."); + log.info("file moved and database updated."); } } catch (IOException e) { // TODO Auto-generated catch block - log.info(new Date() + " - Failed to move file."); + log.info("Failed to move file."); e.printStackTrace(); } return true; @@ -311,7 +307,7 @@ public class ServerHandler implements Server.Iface { @Override public Map<String, String> getImageData(String imageid, String imageversion) throws TException { - log.info(new Date() + " - returning ImageData: " + log.info("returning ImageData: " + sql.getImageData(imageid, imageversion).size() + "items."); return sql.getImageData(imageid, imageversion); } @@ -339,33 +335,26 @@ public class ServerHandler implements Server.Iface { @Override public List<Lecture> getLectureList() throws TException { - log.info(new Date().toString() + " - returning LectureList: " - + sql.getLectureList().size() + " items."); + log.info("returning LectureList"); return sql.getLectureList(); } @Override public List<Lecture> getLectureListPermissionRead(String userID) { - log.info(new Date().toString() + " - returning LectureListRead: " - + sql.getLectureListPermissionRead(userID).size() - + " items for user " + userID); + log.info("returning LectureListRead"); return sql.getLectureListPermissionRead(userID); }// end getLectureListPermissionRead @Override public List<Lecture> getLectureListPermissionWrite(String userID) { - log.info(new Date().toString() + " - returning LectureListWrite: " - + sql.getLectureListPermissionWrite(userID).size() - + " items for user " + userID); + log.info("returning LectureListWrite"); return sql.getLectureListPermissionWrite(userID); }// end getLectureListPermissionRead @Override public List<Lecture> getLectureListPermissionAdmin(String userID) { - log.info(new Date().toString() + " - returning LectureListAdmin: " - + sql.getLectureListPermissionAdmin(userID).size() - + " items for user " + userID); + log.info("returning LectureListAdmin"); return sql.getLectureListPermissionAdmin(userID); }// end getLectureListPermissionRead @@ -479,8 +468,7 @@ public class ServerHandler implements Server.Iface { @Override public Map<String, String> getLectureData(String lectureid) throws TException { - log.info(new Date() + " - returning LectureData: " - + sql.getLectureData(lectureid).size() + "items."); + log.info("returning LectureData"); return sql.getLectureData(lectureid); } @@ -559,7 +547,7 @@ public class ServerHandler implements Server.Iface { linkallowed); } - log.info(new Date() + " - written image rights"); + log.info("written image rights"); return true; } @@ -625,8 +613,7 @@ public class ServerHandler implements Server.Iface { sql.writeAdditionalImageRights(imageID, userID, isRead, isWrite, isLinkAllowed, isAdmin); - log.info(new Date() + " - written additional image rights for " - + userID); + log.info("written additional image rights for " + userID); return success; } @@ -638,8 +625,7 @@ public class ServerHandler implements Server.Iface { sql.writeAdditionalLectureRights(lectureID, userID, isRead, isWrite, isAdmin); - log.info(new Date() + " - written additional lecture rights for " - + userID); + log.info("written additional lecture rights for "+ userID); return true; } |
