Generalized kustvakt.conf
Change-Id: I9b1f217d661ad278f90c8cfefe5b64c3fccc5c5f
diff --git a/src/main/java/de/ids_mannheim/korap/web/KustvaktServer.java b/src/main/java/de/ids_mannheim/korap/web/KustvaktServer.java
new file mode 100644
index 0000000..86e9da9
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/KustvaktServer.java
@@ -0,0 +1,88 @@
+package de.ids_mannheim.korap.web;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import de.ids_mannheim.korap.config.BeansFactory;
+import de.ids_mannheim.korap.config.ContextHolder;
+import de.ids_mannheim.korap.config.KustvaktClassLoader;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.web.service.BootableBeanInterface;
+
+/**
+ * pu
+ *
+ * @author hanl
+ * @date 28/01/2014
+ */
+public class KustvaktServer extends KustvaktBaseServer {
+
+ public static final String API_VERSION = "v0.1";
+
+ public static void main (String[] args) throws Exception {
+ KustvaktServer server = new KustvaktServer();
+ kargs = server.readAttributes(args);
+
+ if (kargs.getConfig() != null)
+ BeansFactory.loadFileContext(kargs.getConfig());
+ else
+ BeansFactory.loadClasspathContext("default-config.xml");
+
+ kargs.setRootPackages(new String[] { "de.ids_mannheim.korap.web.utils",
+ "de.ids_mannheim.korap.web.service.full" });
+ rootPackages = "de.ids_mannheim.korap.web.utils;"
+ + "de.ids_mannheim.korap.web.service.full";
+ server.start();
+ }
+
+ @Override
+ protected void setup () {
+ Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
+ .loadSubTypes(BootableBeanInterface.class);
+
+ ContextHolder context = BeansFactory.getKustvaktContext();
+ if (context == null)
+ throw new RuntimeException("Beans could not be loaded!");
+
+ List<BootableBeanInterface> list = new ArrayList<>(set.size());
+// for (Class cl : set) {
+// BootableBeanInterface iface;
+//
+// try {
+// iface = (BootableBeanInterface) cl.newInstance();
+// if (iface instanceof CollectionLoader){
+// continue;
+// }
+// list.add(iface);
+// }
+// catch (InstantiationException | IllegalAccessException e) {
+// continue;
+// }
+// }
+ System.out.println("Found boot loading interfaces: " + list);
+
+ while (!list.isEmpty()) {
+ loop: for (BootableBeanInterface iface : new ArrayList<>(list)) {
+ try {
+ for (Class dep : iface.getDependencies()) {
+ if (set.contains(dep))
+ continue loop;
+ }
+ iface.load(context);
+ list.remove(iface);
+ set.remove(iface.getClass());
+ System.out.println("Done with interface "
+ + iface.getClass().getSimpleName());
+ }
+ catch (KustvaktException e) {
+ // don't do anything!
+ System.out.println("An error occurred in class "
+ + iface.getClass().getSimpleName() + "!\n");
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/resources/kustvakt.conf b/src/main/resources/kustvakt.conf
new file mode 100644
index 0000000..3ef0604
--- /dev/null
+++ b/src/main/resources/kustvakt.conf
@@ -0,0 +1,55 @@
+## index dir
+krill.indexDir= src/test/resources/sample-index
+
+krill.index.commit.count = 134217000
+krill.index.commit.log = log/krill.commit.log
+krill.index.commit.auto = 500
+krill.index.relations.max = 100
+
+kustvakt.default.pos = tt
+kustvakt.default.lemma = tt
+kustvakt.default.token = opennlp
+kustvakt.default.dep = mate
+kustvakt.default.const = mate
+
+kustvakt.management.registration=enable
+
+kustvakt.regex.free = CC-BY.*
+kustvakt.regex.public = CC-BY.*|ACA.*
+kustvakt.regex.all = CC-BY.*|ACA.*|QAO.*
+
+# server
+server.port=8089
+server.host=localhost
+
+# user configuration
+# user.config = user.conf
+
+ldap.config = file-path-to-ldap-config
+
+## options referring to the security module!
+
+## token expiration time in minutes!
+security.longTokenTTL=150D
+security.tokenTTL=72H
+security.shortTokenTTL=45M
+
+kustvakt.security.jwt.issuer=korap.ids-mannheim.de
+
+## specifies the user data field that is used to salt user passwords
+security.passcode.salt=salt
+
+security.idleTimeoutDuration = 25M
+security.multipleLogIn = true
+security.loginAttemptNum = 3
+security.authAttemptTTL = 45M
+
+security.encryption.loadFactor = 8
+security.validation.stringLength = 150
+security.validation.emailLength = 50
+security.encryption.algo=BCRYPT
+security.sharedSecret=sharedSecret
+security.adminToken=adminToken
+
+## applicable: rewrite, foundry, filter, deny
+security.rewrite.strategies=filter, foundry, rewrite
\ No newline at end of file