Added data folder

containing super_client_info and database for mounting into docker

Change-Id: I2183d67cd3185f99f1ca4843ad26bd3aa5dcaf90
diff --git a/core/Changes b/core/Changes
index 19ccb7f..04ac2a9 100644
--- a/core/Changes
+++ b/core/Changes
@@ -1,5 +1,8 @@
 # version 0.70
 
+- Added data folder containing super_client_info and database 
+  for mounting into docker
+  
 # version 0.69.4
 
 - Support token array in matchinfo (fixes #570; diewald)
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index b020c9e..40073b8 100644
--- a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -38,6 +38,7 @@
 public class KustvaktConfiguration {
 
     public static final Map<String, Object> KUSTVAKT_USER = new HashMap<>();
+    public static final String DATA_FOLDER = "data";
 
     private String vcInCaching;
     
@@ -120,7 +121,7 @@
     public KustvaktConfiguration () {}
     
     public void loadBasicProperties (Properties properties) {
-        port = new Integer(properties.getProperty("server.port", "8095"));
+        port = Integer.valueOf(properties.getProperty("server.port", "8095"));
         baseURL = properties.getProperty("kustvakt.base.url", "/api/*");
         setSecureRandomAlgorithm(properties
                 .getProperty("security.secure.random.algorithm", ""));
@@ -151,8 +152,8 @@
         }
         this.supportedVersions.add(currentVersion);
 
-        maxhits = new Integer(properties.getProperty("maxhits", "50000"));
-        returnhits = new Integer(properties.getProperty("returnhits", "50000"));
+        maxhits = Integer.valueOf(properties.getProperty("maxhits", "50000"));
+        returnhits = Integer.valueOf(properties.getProperty("returnhits", "50000"));
         indexDir = properties.getProperty("krill.indexDir", "");
         
         // server options
diff --git a/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java b/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
index d113e6e..172a22c 100644
--- a/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
+++ b/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
@@ -43,6 +43,11 @@
     public KustvaktBaseServer () {
         rootPackages = "de.ids_mannheim.korap.web; "
                 + "com.fasterxml.jackson.jaxrs.json;";
+        
+        File d = new File(KustvaktConfiguration.DATA_FOLDER);
+        if (!d.exists()) {
+            d.mkdir();
+        }
     }
 
     protected KustvaktArgs readAttributes (String[] args) {
diff --git a/full/Changes b/full/Changes
index 095fdd8..2b7484f 100644
--- a/full/Changes
+++ b/full/Changes
@@ -1,5 +1,8 @@
 # version 0.70
 
+- Added data folder containing super_client_info and database 
+  for mounting into docker
+
 # version 0.69.4
 
 - Support token array in matchinfo (fixes #570; diewald)
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2InitClientService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2InitClientService.java
index e35b0e4..3846cdf 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2InitClientService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2InitClientService.java
@@ -11,6 +11,7 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
 import de.ids_mannheim.korap.oauth2.dao.OAuth2ClientDao;
@@ -26,7 +27,6 @@
             LogManager.getLogger(OAuth2InitClientService.class);
     public static String OAUTH2_CLIENT_JSON_INPUT_FILE =
             "initial_super_client.json";
-    public static String OUTPUT_FOLDER = "client";
     public static String OUTPUT_FILENAME = "super_client_info";
     public static String TEST_OUTPUT_FILENAME = "test_super_client_info";
 
@@ -40,12 +40,12 @@
     public void createInitialSuperClient (String outputFilename)
             throws IOException, KustvaktException {
 
-        File dir = new File(OUTPUT_FOLDER);
+        File dir = new File(KustvaktConfiguration.DATA_FOLDER);
         if (!dir.exists()) {
             dir.mkdir();
         }
 
-        String path = OUTPUT_FOLDER + "/" + outputFilename;
+        String path = KustvaktConfiguration.DATA_FOLDER + "/" + outputFilename;
         File f = new File(path);
 
         if (!f.exists()) {
diff --git a/full/src/main/resources/properties/jdbc.properties b/full/src/main/resources/properties/jdbc.properties
index 026ad0e..4b4a572 100644
--- a/full/src/main/resources/properties/jdbc.properties
+++ b/full/src/main/resources/properties/jdbc.properties
@@ -17,7 +17,7 @@
 
 jdbc.database=sqlite
 jdbc.driverClassName=org.sqlite.JDBC
-jdbc.url=jdbc:sqlite:db.sqlite
+jdbc.url=jdbc:sqlite:data/db.sqlite
 # jdbc.url=jdbc:sqlite:kustvakt_init_test.sqlite
 jdbc.username=pc
 jdbc.password=pc
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java b/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
index fbb1d19..c15da2d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
@@ -15,6 +15,7 @@
 import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.FullConfiguration;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.oauth2.dao.OAuth2ClientDao;
 import de.ids_mannheim.korap.oauth2.entity.OAuth2Client;
@@ -29,7 +30,7 @@
     @Autowired
     private OAuth2ClientDao clientDao;
     
-    private String path = OAuth2InitClientService.OUTPUT_FOLDER + "/"
+    private String path = KustvaktConfiguration.DATA_FOLDER + "/"
             + OAuth2InitClientService.TEST_OUTPUT_FILENAME;
 
     @Test
diff --git a/lite/Changes b/lite/Changes
index ff00018..fc463e8 100644
--- a/lite/Changes
+++ b/lite/Changes
@@ -1,5 +1,8 @@
 # version 0.70
 
+- Added data folder containing super_client_info and database 
+  for mounting into docker
+
 # version 0.69.4
 
 - Support token array in matchinfo (fixes #570; diewald)
diff --git a/lite/src/main/resources/lite-jdbc.properties b/lite/src/main/resources/lite-jdbc.properties
index 99e2e54..a6924c8 100644
--- a/lite/src/main/resources/lite-jdbc.properties
+++ b/lite/src/main/resources/lite-jdbc.properties
@@ -3,7 +3,7 @@
 
 jdbc.database=sqlite
 jdbc.driverClassName=org.sqlite.JDBC
-jdbc.url=jdbc:sqlite:liteDB.sqlite
+jdbc.url=jdbc:sqlite:data/liteDB.sqlite
 jdbc.username=pc
 jdbc.password=pc
 jdbc.schemaPath=db
\ No newline at end of file