diff options
| author | Simon Rettberg | 2015-06-11 18:40:49 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-06-11 18:40:49 +0200 |
| commit | e0005ceecfd9281230c4add7575b18ee88307774 (patch) | |
| tree | a73bbcfc213df478c701aac120ae2b7c6e52bb1b /dozentenmodulserver/src/main/java/models | |
| parent | [server] db stuff, new interface, ... (diff) | |
| download | tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.tar.gz tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.tar.xz tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.zip | |
[server] On mah way (lots of restructuring, some early db classes, sql dump of current schema)
Diffstat (limited to 'dozentenmodulserver/src/main/java/models')
| -rw-r--r-- | dozentenmodulserver/src/main/java/models/Configuration.java | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/dozentenmodulserver/src/main/java/models/Configuration.java b/dozentenmodulserver/src/main/java/models/Configuration.java deleted file mode 100644 index 244e542b..00000000 --- a/dozentenmodulserver/src/main/java/models/Configuration.java +++ /dev/null @@ -1,72 +0,0 @@ -package models; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.apache.log4j.Logger; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -public class Configuration { - - private static final Logger LOGGER = Logger.getLogger(Configuration.class); - private static final DateTimeFormatter subdirDate = DateTimeFormat.forPattern("yy-MM"); - - private static File vmStoreBasePath; - private static File vmStoreProdPath; - private static String dbUri; - private static String dbUsername; - private static String dbPassword; - - public static boolean load() throws IOException { - // Load configuration from java properties file - Properties prop = new Properties(); - InputStream in = new FileInputStream("./config.properties"); - try { - prop.load(in); - } finally { - in.close(); - } - - vmStoreBasePath = new File(prop.getProperty("vmstore.path")); - vmStoreProdPath = new File(vmStoreBasePath, "prod"); - dbUri = prop.getProperty("db.uri"); - dbUsername = prop.getProperty("db.username"); - dbPassword = prop.getProperty("db.password"); - - // Currently all fields are mandatory but there might be optional settings in the future - return vmStoreBasePath != null && dbUri != null && dbUsername != null && dbPassword != null; - } - - // Static ("real") fields - - public static File getVmStoreBasePath() { - return vmStoreBasePath; - } - - public static String getDbUri() { - return dbUri; - } - - public static String getDbUsername() { - return dbUsername; - } - - public static String getDbPassword() { - return dbPassword; - } - - public static File getVmStoreProdPath() { - return vmStoreProdPath; - } - - // Dynamically Computed fields - - public static File getCurrentVmStorePath() { - return new File(vmStoreProdPath, subdirDate.print(System.currentTimeMillis())); - } - -} |
