summaryrefslogtreecommitdiffstats
path: root/Dozentenmodulserver
diff options
context:
space:
mode:
authorMichael Wilson2014-06-03 14:32:14 +0200
committerMichael Wilson2014-06-03 14:32:14 +0200
commit29ff534b05ff2d1be4ffc13477e6576da2bf303c (patch)
tree13e8fb16098997c3c438572e113e20420c5f9926 /Dozentenmodulserver
parentNeues Package util und Klasse OpenLinks erzeugt (diff)
downloadtutor-module-29ff534b05ff2d1be4ffc13477e6576da2bf303c.tar.gz
tutor-module-29ff534b05ff2d1be4ffc13477e6576da2bf303c.tar.xz
tutor-module-29ff534b05ff2d1be4ffc13477e6576da2bf303c.zip
Check auf Ordner "prod" implementiert
Diffstat (limited to 'Dozentenmodulserver')
-rw-r--r--Dozentenmodulserver/src/server/ServerHandler.java43
1 files changed, 41 insertions, 2 deletions
diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java
index 5ce72615..b6a50952 100644
--- a/Dozentenmodulserver/src/server/ServerHandler.java
+++ b/Dozentenmodulserver/src/server/ServerHandler.java
@@ -43,8 +43,8 @@ public class ServerHandler implements Server.Iface {
user.setPath(Configuration.config.getAbsolute_path() + "/");
}
- // check if folder temp exists
- if (folderTempExists() == true) {
+ // check if folder temp and folder prod exist
+ if (folderTempExists() == true && folderProdExists() == true) {
sql.writeFTPUser(user.getUserName(), user.getPassword());
return user;
} else {
@@ -89,6 +89,45 @@ public class ServerHandler implements Server.Iface {
}
}// end folderTempExists()
+
+ public boolean folderProdExists() {
+ // check if folder temp exists, otherwise create it
+ Path path = null;
+ if (Configuration.config.getAbsolute_path().endsWith("/")) {
+ path = Paths.get(Configuration.config.getAbsolute_path() + "prod");
+ } else {
+ path = Paths.get(Configuration.config.getAbsolute_path() + "/prod");
+ }
+
+ if (Files.exists(path) == true) {
+ log.info(new Date() + " - 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
+ + "'");
+ return false;
+ } else {
+ // set permissions
+ try {
+ Runtime.getRuntime().exec("chmod 777 " + path);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ log.info(new Date() + " - folder '" + path
+ + "' successfully created");
+ return true;
+ }
+ }
+
+ }// end folderProdExists()
+
+
public String getEncodedSha1Sum(String key) {
try {