diff --git a/src/main/.DS_Store b/src/main/.DS_Store
new file mode 100644
index 0000000..d94e183
--- /dev/null
+++ b/src/main/.DS_Store
Binary files differ
diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store
new file mode 100644
index 0000000..e282944
--- /dev/null
+++ b/src/main/java/.DS_Store
Binary files differ
diff --git a/src/main/java/de/.DS_Store b/src/main/java/de/.DS_Store
new file mode 100644
index 0000000..b276992
--- /dev/null
+++ b/src/main/java/de/.DS_Store
Binary files differ
diff --git a/src/main/java/de/ids_mannheim/.DS_Store b/src/main/java/de/ids_mannheim/.DS_Store
new file mode 100644
index 0000000..07256f1
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/.DS_Store
Binary files differ
diff --git a/src/main/java/de/ids_mannheim/korap/.DS_Store b/src/main/java/de/ids_mannheim/korap/.DS_Store
new file mode 100644
index 0000000..e540d83
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/.DS_Store
Binary files differ
diff --git a/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java b/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java
new file mode 100644
index 0000000..28f915d
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java
@@ -0,0 +1,157 @@
+package de.ids_mannheim.korap.auditing;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.TimeUtils;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Arrays;
+
+/**
+ * @author hanl
+ *         <p/>
+ *         Record holder for auditing requests. Holds the data until it can be persisted to a database
+ */
+@Getter
+@Setter
+public class AuditRecord {
+
+    // fixme: handle via status codes
+    @Deprecated
+    public enum Operation {
+        GET, INSERT, UPDATE, DELETE, CREATE
+    }
+
+    public enum CATEGORY {
+        SECURITY, DATABASE, RESOURCE, QUERY, SERVICE
+    }
+
+    @JsonIgnore
+    private Integer id;
+    //security access describes changes in user authorities and access control permissions of resources
+    private String userid;
+    private String target;
+
+    //fixme: replace with more specific error codes
+    private CATEGORY category;
+    private String loc;
+    private Long timestamp;
+    private Integer status = -1;
+    private String args;
+    private String field_1 = "None";
+
+    private AuditRecord() {
+        this.timestamp = TimeUtils.getNow().getMillis();
+    }
+
+    public AuditRecord(CATEGORY category) {
+        this();
+        this.category = category;
+    }
+
+    public AuditRecord(CATEGORY cat, Object userID, Integer status) {
+        this(cat);
+        this.status = status;
+        if (userID != null) {
+            //todo: client info!
+            //            this.loc = clientInfoToString(user.getTokenContext().getHostAddress(),
+            //                    user.getTokenContext().getUserAgent());
+            this.loc = clientInfoToString("null", "null");
+            userid = String.valueOf(userID);
+        }else {
+            this.loc = clientInfoToString("null", "null");
+            userid = "-1";
+        }
+    }
+
+    public static AuditRecord serviceRecord(Object user, Integer status,
+            String... args) {
+        AuditRecord r = new AuditRecord(CATEGORY.SERVICE);
+        r.setArgs(Arrays.asList(args).toString());
+        r.setUserid(String.valueOf(user));
+        r.setStatus(status);
+        return r;
+    }
+
+    public static AuditRecord dbRecord(Object user, Integer status,
+            String... args) {
+        AuditRecord r = new AuditRecord(CATEGORY.DATABASE);
+        r.setArgs(Arrays.asList(args).toString());
+        r.setUserid(String.valueOf(user));
+        r.setStatus(status);
+        return r;
+    }
+
+    public AuditRecord fromJson(String json) {
+        JsonNode n = JsonUtils.readTree(json);
+        AuditRecord r = new AuditRecord();
+        r.setCategory(CATEGORY.valueOf(n.path("category").asText()));
+        r.setTarget(n.path("target").asText());
+        r.setField_1(n.path("field_1").asText());
+        r.setUserid(n.path("account").asText());
+        r.setStatus(n.path("status").asInt());
+        r.setLoc(n.path("loc").asText());
+        return r;
+    }
+
+    private String clientInfoToString(String IP, String userAgent) {
+        return userAgent + "@" + IP;
+    }
+
+    @Override
+    public String toString() {
+        return "Record{" +
+                "account='" + userid + '\'' +
+                ", category=" + category +
+                ", loc='" + loc + '\'' +
+                ", timestamp=" + timestamp +
+                ", status='" + status + '\'' +
+                ", field_1='" + field_1 + '\'' +
+                '}';
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        AuditRecord that = (AuditRecord) o;
+
+        if (userid != null ? !userid.equals(that.userid) : that.userid != null)
+            return false;
+        if (category != that.category)
+            return false;
+        if (status != null ? !status.equals(that.status) : that.status != null)
+            return false;
+        if (field_1 != null ?
+                !field_1.equals(that.field_1) :
+                that.field_1 != null)
+            return false;
+        if (loc != null ? !loc.equals(that.loc) : that.loc != null)
+            return false;
+        if (target != null ? !target.equals(that.target) : that.target != null)
+            return false;
+        if (timestamp != null ?
+                !timestamp.equals(that.timestamp) :
+                that.timestamp != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = userid != null ? userid.hashCode() : 0;
+        result = 31 * result + (target != null ? target.hashCode() : 0);
+        result = 31 * result + category.hashCode();
+        result = 31 * result + (loc != null ? loc.hashCode() : 0);
+        result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0);
+        result = 31 * result + (status != null ? status.hashCode() : 0);
+        result = 31 * result + (field_1 != null ? field_1.hashCode() : 0);
+        return result;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java
new file mode 100644
index 0000000..f4b72b1
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java
@@ -0,0 +1,69 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.interfaces.AuditingIface;
+import de.ids_mannheim.korap.plugins.PluginManager;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+import java.net.URL;
+
+/**
+ * User: hanl
+ * Date: 10/9/13
+ * Time: 11:20 AM
+ */
+public class BeanConfiguration {
+
+    private static final String config_file = "default-config.xml";
+
+    private static ApplicationContext context = null;
+    private static PluginManager plugins;
+
+    private static void loadPlugins() {
+        plugins = new PluginManager();
+        plugins.loadPluginInterfaces();
+    }
+
+    public static void loadContext() {
+        URL url = BeanConfiguration.class.getClassLoader()
+                .getResource(config_file);
+        if (url != null && context == null)
+            context = new ClassPathXmlApplicationContext(config_file);
+    }
+
+    public static void loadContext(String filepath) {
+        if (filepath == null)
+            loadContext();
+        else {
+            if (context == null)
+                context = new FileSystemXmlApplicationContext(
+                        "file:" + filepath);
+        }
+    }
+
+    public static <T extends KustvaktConfiguration> T getConfiguration() {
+        return (T) getBean("config");
+    }
+
+    public static <T extends KustvaktConfiguration> T getConfiguration(
+            Class<T> clazz) {
+        return getBean(clazz);
+    }
+
+    public static boolean hasContext() {
+        return context != null;
+    }
+
+    protected static <T> T getBean(Class<T> clazz) {
+        return context.getBean(clazz);
+    }
+
+    protected static <T> T getBean(String name) {
+        return (T) context.getBean(name);
+    }
+
+    public static AuditingIface getAuditingProvider() {
+        return (AuditingIface) context.getBean("auditingProvider");
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
new file mode 100644
index 0000000..de4748e
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
@@ -0,0 +1,26 @@
+package de.ids_mannheim.korap.config;
+
+import org.reflections.Reflections;
+
+import java.util.Set;
+
+/**
+ * @author hanl
+ * @date 10/06/2015
+ */
+public class KustvaktClassLoader {
+
+    private static final Reflections reflections = new Reflections(
+            "de.ids_mannheim.korap");
+
+    /**
+     * loads interface implementations in current classpath
+     *
+     * @param iface
+     * @param <T>
+     * @return
+     */
+    public static <T> Set<Class<? extends T>> load(Class<T> iface) {
+        return reflections.getSubTypesOf(iface);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
new file mode 100644
index 0000000..52ac3c7
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -0,0 +1,116 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.utils.KorAPLogger;
+import lombok.Getter;
+import org.apache.log4j.PropertyConfigurator;
+import org.slf4j.Logger;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * if configuration class is extended, load method should be overriden
+ * @author hanl
+ * @date 05/02/2014
+ */
+
+@Getter
+public class KustvaktConfiguration {
+
+    private final Logger jlog = KorAPLogger
+            .initiate(KustvaktConfiguration.class);
+
+    // deprec?!
+    private final BACKENDS DEFAULT_ENGINE = BACKENDS.LUCENE;
+    private int maxhits;
+
+    private int port;
+    private int returnhits;
+    private String serverHost;
+    private String indexDir;
+
+    private List<String> queryLanguages;
+    private String host;
+
+    private URL issuer;
+
+    /**
+     * loading of the properties and mapping to parameter variables
+     *
+     * @param korap
+     * @return
+     */
+    protected Properties load(Properties korap) {
+        String log4jconfig = korap
+                .getProperty("log4jconfig", "log4j.properties");
+        loadLog4jLogger(log4jconfig);
+        maxhits = new Integer(korap.getProperty("maxhits", "50000"));
+        returnhits = new Integer(korap.getProperty("returnhits", "50000"));
+        indexDir = korap.getProperty("lucene.indexDir", "");
+        port = new Integer(korap.getProperty("server.port", "8080"));
+        // server options
+        serverHost = String
+                .valueOf(korap.getProperty("server.host", "localhost"));
+        String queries = korap.getProperty("korap.ql", "");
+        String[] qls = queries.split(",");
+        queryLanguages = new ArrayList<>();
+        for (String querylang : qls)
+            queryLanguages.add(querylang.trim().toUpperCase());
+        //        issuer = new URL(korap.getProperty("korap.issuer", ""));
+        return korap;
+    }
+
+    public void setProperties(Properties props) {
+        this.load(props);
+    }
+
+    public BACKENDS chooseBackend(String value) {
+        if (value == null || value.equals("null"))
+            return DEFAULT_ENGINE;
+        else
+            return Enum.valueOf(BACKENDS.class, value.toUpperCase());
+    }
+
+    private void loadLog4jLogger(String log4jconfig) {
+        /** load log4j configuration file programmatically */
+        Properties log4j = new Properties();
+        try {
+            if (!log4jconfig.equals("")) {
+                log4j.load(new FileInputStream(log4jconfig));
+                PropertyConfigurator.configure(log4j);
+                jlog.info(
+                        "using local logging properties file ({}) to configure logging system",
+                        log4jconfig);
+            }else
+                loadClassLogger();
+        }catch (Exception e) {
+            loadClassLogger();
+        }
+    }
+
+    public void loadClassLogger() {
+        Properties log4j = new Properties();
+        jlog.info(
+                "using class path logging properties file to configure logging system");
+
+        try {
+            log4j.load(KustvaktConfiguration.class.getClassLoader()
+                    .getResourceAsStream("log4j.properties"));
+        }catch (IOException e) {
+            // do nothing
+        }
+
+        PropertyConfigurator.configure(log4j);
+        jlog.warn(
+                "No logger properties detected. Using default logger properties");
+    }
+
+    public enum BACKENDS {
+        NEO4J, LUCENE
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/BaseException.java b/src/main/java/de/ids_mannheim/korap/exceptions/BaseException.java
new file mode 100644
index 0000000..408f591
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/BaseException.java
@@ -0,0 +1,47 @@
+package de.ids_mannheim.korap.exceptions;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 29/01/2014
+ */
+@Getter
+public abstract class BaseException extends Exception {
+
+    protected List<AuditRecord> records = new ArrayList<>();
+    private Integer statusCode;
+    private String entity;
+
+
+    public BaseException(int code) {
+        this.statusCode = code;
+    }
+
+    public BaseException(int status, String message, String entity) {
+        super(message);
+        this.statusCode = status;
+        this.entity = entity;
+    }
+
+    public BaseException(int status, String entity) {
+        this(status);
+        this.entity = entity;
+    }
+
+    public BaseException(Throwable cause, int status) {
+        super(cause);
+        this.statusCode = status;
+
+    }
+
+    public BaseException(String message, Throwable cause, int status) {
+        super(message, cause);
+        this.statusCode = status;
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java b/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java
new file mode 100644
index 0000000..5541695
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java
@@ -0,0 +1,13 @@
+package de.ids_mannheim.korap.exceptions;
+
+/**
+ * @author hanl
+ * @date 25/03/2014
+ */
+public class EmptyResultException extends BaseException {
+
+    public EmptyResultException(String entity) {
+        super(StatusCodes.EMPTY_RESULTS, entity);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/KorAPException.java b/src/main/java/de/ids_mannheim/korap/exceptions/KorAPException.java
new file mode 100644
index 0000000..a050770
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/KorAPException.java
@@ -0,0 +1,52 @@
+package de.ids_mannheim.korap.exceptions;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author hanl
+ * @date 11/12/2013
+ */
+@Setter
+@Getter
+public class KorAPException extends BaseException {
+
+    private String userid;
+
+    public KorAPException(Integer status) {
+        super(status);
+    }
+
+    public KorAPException(Object userid, Integer status) {
+        this(status);
+        this.userid = String.valueOf(userid);
+    }
+
+    public KorAPException(Object userid, Integer status, String message,
+            String entity) {
+        super(status, message, entity);
+        this.userid = String.valueOf(userid);
+    }
+
+    public KorAPException(Integer status, String message, String entity) {
+        super(status, message, entity);
+    }
+
+    public KorAPException(Throwable cause, Integer status) {
+        super(cause, status);
+    }
+
+    public KorAPException(String message, Throwable cause, Integer status) {
+        super(message, cause, status);
+    }
+
+    @Override
+    public String toString() {
+        return "Excpt{" +
+                "status=" + getStatusCode() +
+                ", message=" + getMessage() +
+                ", args=" + getEntity() +
+                ", userid=" + userid +
+                '}';
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/Message.java b/src/main/java/de/ids_mannheim/korap/exceptions/Message.java
new file mode 100644
index 0000000..f9021b4
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/Message.java
@@ -0,0 +1,109 @@
+package de.ids_mannheim.korap.exceptions;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * @author hanl
+ * @date 03/12/2014
+ */
+public class Message implements Cloneable {
+
+    ObjectMapper mapper = new ObjectMapper();
+    private String msg;
+    private int code = 0;
+    private LinkedList<String> parameters;
+
+    public Message(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public Message() {
+    }
+
+    @JsonIgnore
+    public Message setMessage(String msg) {
+        this.msg = msg;
+        return this;
+    }
+
+    @JsonIgnore
+    public String getMessage() {
+        return this.msg;
+    }
+
+    @JsonIgnore
+    public Message setCode(int code) {
+        this.code = code;
+        return this;
+    }
+
+    @JsonIgnore
+    public int getCode() {
+        return this.code;
+    }
+
+    public Message addParameter(String param) {
+        if (this.parameters == null) {
+            this.parameters = new LinkedList();
+        }
+
+        this.parameters.add(param);
+        return this;
+    }
+
+    public Object clone() throws CloneNotSupportedException {
+        Message clone = new Message();
+        if (this.msg != null) {
+            clone.msg = this.msg;
+        }
+
+        clone.code = this.code;
+        if (this.parameters != null) {
+            Iterator i$ = this.parameters.iterator();
+
+            while (i$.hasNext()) {
+                String p = (String) i$.next();
+                clone.addParameter(p);
+            }
+        }
+
+        return clone;
+    }
+
+    public JsonNode toJSONnode() {
+        ArrayNode message = this.mapper.createArrayNode();
+        if (this.code != 0) {
+            message.add(this.getCode());
+        }
+
+        message.add(this.getMessage());
+        if (this.parameters != null) {
+            Iterator i$ = this.parameters.iterator();
+
+            while (i$.hasNext()) {
+                String p = (String) i$.next();
+                message.add(p);
+            }
+        }
+
+        return message;
+    }
+
+    public String toJSON() {
+        String msg = "";
+
+        try {
+            return this.mapper.writeValueAsString(this.toJSONnode());
+        } catch (Exception var3) {
+            msg = ", \"" + var3.getLocalizedMessage() + "\"";
+            return "[620, \"Unable to generate JSON\"" + msg + "]";
+        }
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/Messages.java b/src/main/java/de/ids_mannheim/korap/exceptions/Messages.java
new file mode 100644
index 0000000..0729448
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/Messages.java
@@ -0,0 +1,167 @@
+package de.ids_mannheim.korap.exceptions;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import de.ids_mannheim.korap.utils.JsonUtils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 03/12/2014
+ */
+public class Messages implements Cloneable, Iterable<Message> {
+
+    private ArrayList<Message> messages = new ArrayList(3);
+
+    public Messages() {
+    }
+
+    public Iterator<Message> iterator() {
+        return new Messages.MessageIterator();
+    }
+
+    public Message add(int code, String message, String... terms) {
+        Message newMsg = new Message(code, message);
+        this.messages.add(newMsg);
+        if (terms != null) {
+            String[] arr$ = terms;
+            int len$ = terms.length;
+
+            for (int i$ = 0; i$ < len$; ++i$) {
+                String t = arr$[i$];
+                newMsg.addParameter(t);
+            }
+        }
+
+        return newMsg;
+    }
+
+    public Message add(Message msg) {
+        try {
+            Message e = (Message) msg.clone();
+            this.messages.add(e);
+            return e;
+        } catch (CloneNotSupportedException var3) {
+            return (Message) null;
+        }
+    }
+
+    public Message add(JsonNode msg) throws KorAPException {
+        if (msg.isArray() && msg.has(0)) {
+            Message newMsg = new Message();
+            short i = 1;
+            if (msg.get(0).isNumber()) {
+                newMsg.setCode(msg.get(0).asInt());
+                if (!msg.has(1)) {
+                    throw new KorAPException(750, "Passed notifications are not well formed", null);
+                }
+
+                newMsg.setMessage(msg.get(1).asText());
+                ++i;
+            } else {
+                newMsg.setMessage(msg.get(0).asText());
+            }
+
+            while (msg.has(i)) {
+                newMsg.addParameter(msg.get(i++).asText());
+            }
+
+            this.add((Message) newMsg);
+            return newMsg;
+        } else {
+            throw new KorAPException(750, "Passed notifications are not well formed", null);
+        }
+    }
+
+    public Messages add(Messages msgs) {
+        try {
+            Iterator e = msgs.getMessages().iterator();
+
+            while (e.hasNext()) {
+                Message msg = (Message) e.next();
+                this.add((Message) ((Message) msg.clone()));
+            }
+        } catch (CloneNotSupportedException var4) {
+            ;
+        }
+
+        return this;
+    }
+
+    public Messages clear() {
+        this.messages.clear();
+        return this;
+    }
+
+    public int size() {
+        return this.messages.size();
+    }
+
+    @JsonIgnore
+    public Message get(int index) {
+        return index >= this.size() ? (Message) null : (Message) this.messages.get(index);
+    }
+
+    @JsonIgnore
+    public List<Message> getMessages() {
+        return this.messages;
+    }
+
+    public Object clone() throws CloneNotSupportedException {
+        Messages clone = new Messages();
+        Iterator i$ = this.messages.iterator();
+
+        while (i$.hasNext()) {
+            Message m = (Message) i$.next();
+            clone.add((Message) ((Message) m.clone()));
+        }
+
+        return clone;
+    }
+
+    public JsonNode toJSONnode() {
+        ArrayNode messageArray = JsonUtils.createArrayNode();
+        Iterator i$ = this.messages.iterator();
+
+        while (i$.hasNext()) {
+            Message msg = (Message) i$.next();
+            messageArray.add(msg.toJSONnode());
+        }
+
+        return messageArray;
+    }
+
+    public String toJSON() {
+        String msg = "";
+
+        try {
+            return JsonUtils.toJSON(this.toJSONnode());
+        } catch (Exception var3) {
+            msg = ", \"" + var3.getLocalizedMessage() + "\"";
+            return "[620, \"Unable to generate JSON\"" + msg + "]";
+        }
+    }
+
+    private class MessageIterator implements Iterator<Message> {
+        int index = 0;
+
+        public MessageIterator() {
+        }
+
+        public boolean hasNext() {
+            return this.index < Messages.this.messages.size();
+        }
+
+        public Message next() {
+            return (Message) Messages.this.messages.get(this.index++);
+        }
+
+        public void remove() {
+            Messages.this.messages.remove(this.index);
+        }
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java b/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
new file mode 100644
index 0000000..2b499c7
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
@@ -0,0 +1,33 @@
+package de.ids_mannheim.korap.exceptions;
+
+import lombok.Data;
+
+/**
+ * @author hanl
+ * @date 11/12/2013
+ */
+// a security table registers all these exceptions (failed authentication, failed access to a resource, etc.)
+@Data
+@Deprecated
+public class NotAuthorizedException extends BaseException {
+
+    public NotAuthorizedException(int status) {
+        super(status);
+    }
+
+    public NotAuthorizedException(int status, String entity) {
+        super(status, "", entity);
+    }
+
+    public NotAuthorizedException(int status, String message, String entity) {
+        super(status, message, entity);
+    }
+
+    public NotAuthorizedException(Throwable cause, int status) {
+        super(cause, status);
+    }
+
+    public NotAuthorizedException(String message, Throwable cause, int status) {
+        super(message, cause, status);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java b/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
new file mode 100644
index 0000000..6db7b0e
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
@@ -0,0 +1,103 @@
+package de.ids_mannheim.korap.exceptions;
+
+/**
+ * @author hanl
+ * @date 07/09/2014
+ */
+public class StatusCodes {
+
+    /**
+     * 100 status codes for standard system errors
+     */
+    public static final Integer EMPTY_RESULTS = 100;
+    public static final Integer REQUEST_INVALID = 101;
+    //fixme: redundancy?!
+    public static final Integer ENTRY_EXISTS = 102;
+    public static final Integer STATUS_OK = 103;
+    public static final Integer UNSUPPORTED_OPERATION = 104;
+    public static final Integer ILLEGAL_ARGUMENT = 105;
+    public static final Integer CONNECTION_ERROR = 106;
+    public static final Integer NOTHING_CHANGED = 107;
+    public static final Integer PARAMETER_VALIDATION_ERROR = 108;
+    public static final Integer DEFAULT_ERROR = 109;
+    public static final Integer NOT_SUPPORTED = 110;
+
+    /**
+     * 400 status codes for account/authentication relevant components
+     */
+
+    public static final Integer ACCOUNT_DEACTIVATED = 200;
+    public static final Integer ACCOUNT_CONFIRMATION_FAILED = 201;
+    public static final Integer ALREADY_LOGGED_IN = 202;
+    public static final Integer EXPIRED = 204;
+    public static final Integer BAD_CREDENTIALS = 205;
+    public static final Integer UNCONFIRMED_ACCOUNT = 206;
+    public static final Integer NAME_EXISTS = 207;
+    public static final Integer PASSWORD_RESET_FAILED = 208;
+    // fixme: ?!
+    public static final Integer AUTHENTICATION_DENIED = 209;
+
+    public static final Integer LOGIN_SUCCESSFUL = 210;
+    public static final Integer LOGIN_FAILED = 211;
+    public static final Integer LOGOUT_SUCCESSFUL = 212;
+    public static final Integer LOGOUT_FAILED = 213;
+
+    public static final Integer CLIENT_REGISTRATION_FAILURE = 214;
+    public static final Integer CLIENT_REMOVAL_FAILURE = 215;
+    public static final Integer CLIENT_AUTHORIZATION_FAILURE = 216;
+
+
+    /**
+     * 500 status codes for access control related components (also policy rewrite)
+     */
+    public static final Integer PERMISSION_DENIED = 401;
+    public static final Integer UNSUPPORTED_RESOURCE = 402;
+    public static final Integer UNSUPPORTED_FOUNDRY = 403;
+    public static final Integer UNSUPPORTED_CORPUS = 404;
+    public static final Integer UNSUPPORTED_LAYER = 405;
+    // make a distinction between no and invalid vc?
+    public static final Integer UNSUPPORTED_VIRTUALCOLLECTION = 406;
+    public static final Integer CORPUS_REWRITE = 407;
+    public static final Integer FOUNDRY_REWRITE = 408;
+    public static final Integer FOUNDRY_INJECTION = 409;
+    public static final Integer MISSING_ARGUMENTS = 410;
+    public static final Integer MISSING_VIRTUALCOLLECTION = 411;
+    public static final Integer MISSING_POLICY_TARGET = 412;
+    public static final Integer MISSING_POLICY_CONDITIONS = 413;
+    public static final Integer MISSING_POLICY_PERMISSION = 414;
+
+    // todo: extend according to policy rewrite possible!
+    // policy errors
+    public static final Integer POLICY_ERROR_DEFAULT = 500;
+    public static final Integer POLICY_CREATE_ERROR = 501;
+    public static final Integer NO_POLICIES = 502;
+
+    // database codes
+    public static final Integer DB_GET_FAILED = 601;
+    public static final Integer DB_INSERT_FAILED = 602;
+    public static final Integer DB_DELETE_FAILED = 603;
+    public static final Integer DB_UPDATE_FAILED = 604;
+
+    public static final Integer DB_GET_SUCCESSFUL = 605;
+    public static final Integer DB_INSERT_SUCCESSFUL = 606;
+    public static final Integer DB_DELETE_SUCCESSFUL = 607;
+    public static final Integer DB_UPDATE_SUCCESSFUL = 608;
+
+    // service status codes
+    public static final Integer CREATE_ACCOUNT_SUCCESSFUL = 700;
+    public static final Integer CREATE_ACCOUNT_FAILED = 701;
+    public static final Integer DELETE_ACCOUNT_SUCCESSFUL = 702;
+    public static final Integer DELETE_ACCOUNT_FAILED = 703;
+    public static final Integer UPDATE_ACCOUNT_SUCCESSFUL = 704;
+    public static final Integer UPDATE_ACCOUNT_FAILED = 705;
+
+    public static final Integer GET_ACCOUNT_SUCCESSFUL = 706;
+    public static final Integer GET_ACCOUNT_FAILED = 707;
+
+    /**
+     * 300 status codes for query language and serialization
+     */
+
+    public static final Integer NO_QUERY = 301;
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java b/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java
new file mode 100644
index 0000000..c180f1b
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java
@@ -0,0 +1,35 @@
+package de.ids_mannheim.korap.exceptions;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+
+import java.util.Arrays;
+
+/**
+ * @author hanl
+ * @date 08/04/2015
+ */
+// should be a http exception that responds to a service point
+// is the extension of the notauthorized exception!
+public class WrappedException extends KorAPException {
+
+    private WrappedException(Object userid, Integer status, String message,
+            String args) {
+        super(String.valueOf(userid), status, message, args);
+    }
+
+    public WrappedException(Object userid, Integer status, String... args) {
+        this(userid, status, "", Arrays.asList(args).toString());
+        AuditRecord record = AuditRecord.serviceRecord(userid, status, args);
+        this.records.add(record);
+    }
+
+    public WrappedException(KorAPException e, Integer status, String... args) {
+        this(e.getUserid(), e.getStatusCode(), e.getMessage(), e.getEntity());
+        AuditRecord record = AuditRecord
+                .serviceRecord(e.getUserid(), status, args);
+        record.setField_1(e.toString());
+        this.records.addAll(e.getRecords());
+        this.records.add(record);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java b/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java
new file mode 100644
index 0000000..d505e13
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java
@@ -0,0 +1,48 @@
+package de.ids_mannheim.korap.exceptions;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+
+import java.util.Arrays;
+
+/**
+ * @author hanl
+ * @date 08/04/2015
+ */
+public class dbException extends KorAPException {
+
+    private dbException(Object userid, Integer status, String message,
+            String args) {
+        super(String.valueOf(userid), status, message, args);
+    }
+
+    public dbException(Object userid, String target, Integer status,
+            String... args) {
+        this(userid, status, "",
+                Arrays.asList(args).toString());
+        AuditRecord record = new AuditRecord(AuditRecord.CATEGORY.DATABASE);
+        record.setUserid(String.valueOf(userid));
+        record.setStatus(status);
+        record.setTarget(target);
+        record.setArgs(this.getEntity());
+        this.records.add(record);
+    }
+
+    public dbException(KorAPException e, Integer status, String... args) {
+        this(e.getUserid(), e.getStatusCode(), e.getMessage(), e.getEntity());
+        AuditRecord record = AuditRecord
+                .dbRecord(e.getUserid(), status, args);
+        record.setField_1(e.toString());
+        this.records.addAll(e.getRecords());
+        this.records.add(record);
+    }
+
+    @Override
+    public String toString() {
+        return "DBExcpt{" +
+                "status=" + getStatusCode() +
+                ", message=" + getMessage() +
+                ", args=" + getEntity() +
+                ", userid=" + this.getUserid() +
+                '}';
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuditingIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuditingIface.java
new file mode 100644
index 0000000..82bdd55
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuditingIface.java
@@ -0,0 +1,56 @@
+package de.ids_mannheim.korap.interfaces;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+import de.ids_mannheim.korap.user.User;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * User: hanl
+ * Date: 8/20/13
+ * Time: 10:45 AM
+ */
+//fixme: move table to different database!
+public abstract class AuditingIface implements Runnable {
+
+    protected static int BATCH_SIZE = 15;
+    protected final List<AuditRecord> records = new ArrayList<>(BATCH_SIZE + 5);
+    private final List<AuditRecord> buffer = new ArrayList<>(BATCH_SIZE + 5);
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+            AuditRecord.CATEGORY category, DateTime day, DateTime until,
+            boolean exact, int limit);
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+            AuditRecord.CATEGORY category, User user, int limit);
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+            LocalDate day, int hitMax);
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+            String userID, LocalDate start, LocalDate end, int hitMax);
+
+    private void addAndRun(AuditRecord record) {
+        if (buffer.size() > BATCH_SIZE) {
+            records.clear();
+            records.addAll(buffer);
+            run();
+            buffer.clear();
+        }
+        if (buffer.size() <= BATCH_SIZE)
+            buffer.add(record);
+    }
+
+    public <T extends AuditRecord> void audit(T request) {
+        addAndRun(request);
+    }
+
+    public <T extends AuditRecord> void audit(List<T> requests) {
+        for (T rec : requests)
+            addAndRun(rec);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
new file mode 100644
index 0000000..e02933e
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
@@ -0,0 +1,25 @@
+package de.ids_mannheim.korap.interfaces;
+
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.ext.security.AccessLevel;
+import de.ids_mannheim.korap.user.TokenContext;
+import de.ids_mannheim.korap.user.User;
+
+import java.util.Map;
+
+public abstract class AuthenticationIface {
+
+    public abstract TokenContext getUserStatus(String authToken)
+            throws KorAPException;
+
+    public abstract TokenContext createUserSession(User user,
+            Map<String, Object> attr) throws KorAPException;
+
+    public abstract void removeUserSession(String token) throws KorAPException;
+
+    public abstract AccessLevel[] retrieveLevelAccess(String authToken)
+            throws KorAPException;
+
+    public abstract String getIdentifier();
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
new file mode 100644
index 0000000..0b00b31
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -0,0 +1,78 @@
+package de.ids_mannheim.korap.interfaces;
+
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.user.User;
+
+import java.io.UnsupportedEncodingException;
+import java.security.NoSuchAlgorithmException;
+import java.util.Map;
+
+public interface EncryptionIface {
+
+    public enum Encryption {
+        SIMPLE, ESAPICYPHER, BCRYPT
+    }
+
+    /**
+     * One-way hashing of String input. Used to canonicalize
+     *
+     * @param input
+     * @param salt
+     * @return
+     * @throws java.security.NoSuchAlgorithmException
+     * @throws java.io.UnsupportedEncodingException
+     */
+    public String produceSecureHash(String input, String salt)
+            throws NoSuchAlgorithmException, UnsupportedEncodingException,
+            KorAPException;
+
+    public String produceSecureHash(String input)
+            throws NoSuchAlgorithmException, UnsupportedEncodingException,
+            KorAPException;
+
+    public String hash(String value);
+
+    /**
+     * @param plain
+     * @param hash
+     * @param salt
+     * @return
+     */
+    public boolean checkHash(String plain, String hash, String salt);
+
+    public boolean checkHash(String plain, String hash);
+
+    public String getSalt(User user);
+
+    /**
+     * create random String to be used as authentication token
+     *
+     * @return
+     */
+    public String createToken(boolean hash, Object... obj);
+
+    public String createToken();
+
+    /**
+     * create a random Integer to be used as ID for databases
+     *
+     * @return
+     */
+    public String createID(Object... obj);
+
+    public String encodeBase();
+
+    public String validateIPAddress(String ipaddress) throws KorAPException;
+
+    public String validateEmail(String email) throws KorAPException;
+
+    public Map<String, Object> validateMap(Map<String, Object> map)
+            throws KorAPException;
+
+    public String validateString(String input) throws KorAPException;
+
+    public void validate(Object instance) throws KorAPException;
+
+    public String validatePassphrase(String pw) throws KorAPException;
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EntityHandlerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EntityHandlerIface.java
new file mode 100644
index 0000000..01cab35
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EntityHandlerIface.java
@@ -0,0 +1,44 @@
+package de.ids_mannheim.korap.interfaces;
+
+import de.ids_mannheim.korap.exceptions.EmptyResultException;
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.UserDetails;
+import de.ids_mannheim.korap.user.UserSettings;
+
+/**
+ * User: hanl
+ * Date: 8/19/13
+ * Time: 11:04 AM
+ */
+public interface EntityHandlerIface {
+    public UserSettings getUserSettings(Integer userid) throws KorAPException;
+
+    public int updateSettings(UserSettings settings) throws KorAPException;
+
+    public UserDetails getUserDetails(Integer userid) throws KorAPException;
+
+    public int updateUserDetails(UserDetails details) throws KorAPException;
+
+    //    public List<UserQuery> getUserQueries(User user) throws KorAPException;
+
+    //    public UserQuery getUserQuery(String id) throws KorAPException;
+
+    //    public void updateUserQueries(User user, List<UserQuery> newOnes) throws KorAPException;
+
+    public User getAccount(String username) throws
+            EmptyResultException, KorAPException;
+
+    public int updateAccount(User user) throws KorAPException;
+
+    public int createAccount(User user) throws KorAPException;
+
+    public int deleteAccount(Integer userid) throws KorAPException;
+
+    public int resetPassphrase(String username, String uriToken,
+            String passphrase) throws KorAPException;
+
+    public int activateAccount(String username, String uriToken)
+            throws KorAPException;
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/UserControllerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/UserControllerIface.java
new file mode 100644
index 0000000..67d6545
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/UserControllerIface.java
@@ -0,0 +1,59 @@
+package de.ids_mannheim.korap.interfaces;
+
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.user.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author hanl
+ * @date 15/06/2015
+ */
+public abstract class UserControllerIface {
+
+    private Map<String, AuthenticationIface> providers;
+
+    //todo: test if constr actually called
+    public UserControllerIface() {
+        this.providers = new HashMap<>();
+    }
+
+    public void setProviders(Set<AuthenticationIface> providers) {
+        for (AuthenticationIface i : providers)
+            this.providers.put(i.getIdentifier(), i);
+    }
+
+    protected AuthenticationIface getProvider(String key) {
+        AuthenticationIface iface;
+        if (key == null)
+            iface = this.providers.get(Attributes.API_AUTHENTICATION);
+        else
+            iface = this.providers.get(key.toUpperCase());
+        return iface;
+    }
+
+    public abstract User authenticate(int type, String username,
+            String password, Map<String, Object> attributes)
+            throws KorAPException;
+
+    public abstract void logout(TokenContext context) throws KorAPException;
+
+    public abstract void lockAccount(User user) throws KorAPException;
+
+    public abstract boolean updateAccount(User user) throws KorAPException;
+
+    public abstract boolean deleteAccount(User user) throws KorAPException;
+
+    public abstract UserDetails getUserDetails(User user) throws KorAPException;
+
+    public abstract UserSettings getUserSettings(User user)
+            throws KorAPException;
+
+    public abstract void updateUserDetails(User user, UserDetails details)
+            throws KorAPException;
+
+    public abstract void updateUserSettings(User user, UserSettings settings)
+            throws KorAPException;
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java
new file mode 100644
index 0000000..cb0eef7
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java
@@ -0,0 +1,50 @@
+package de.ids_mannheim.korap.interfaces.defaults;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+import de.ids_mannheim.korap.interfaces.AuditingIface;
+import de.ids_mannheim.korap.user.User;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 05/06/2015
+ */
+public class DefaultAuditing extends AuditingIface {
+
+    public DefaultAuditing() {
+
+    }
+
+    @Override
+    public <T extends AuditRecord> List<T> retrieveRecords(
+            AuditRecord.CATEGORY category, DateTime day, DateTime until,
+            boolean exact, int limit) {
+        return null;
+    }
+
+    @Override
+    public <T extends AuditRecord> List<T> retrieveRecords(
+            AuditRecord.CATEGORY category, User user, int limit) {
+        return null;
+    }
+
+    @Override
+    public <T extends AuditRecord> List<T> retrieveRecords(LocalDate day,
+            int hitMax) {
+        return null;
+    }
+
+    @Override
+    public <T extends AuditRecord> List<T> retrieveRecords(String userID,
+            LocalDate start, LocalDate end, int hitMax) {
+        return null;
+    }
+
+    @Override
+    public void run() {
+        //todo: append to logging file or other auditing file
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
new file mode 100644
index 0000000..8c787db
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
@@ -0,0 +1,110 @@
+package de.ids_mannheim.korap.interfaces.defaults;
+
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.user.User;
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigInteger;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 05/06/2015
+ */
+public class DefaultEncryption implements EncryptionIface {
+
+    private SecureRandom randomizer;
+
+    public DefaultEncryption() {
+        randomizer = new SecureRandom();
+    }
+
+    @Override
+    public String produceSecureHash(String input, String salt)
+            throws NoSuchAlgorithmException, UnsupportedEncodingException,
+            KorAPException {
+        return null;
+    }
+
+    @Override
+    public String produceSecureHash(String input)
+            throws NoSuchAlgorithmException, UnsupportedEncodingException,
+            KorAPException {
+        return null;
+    }
+
+    @Override
+    public String hash(String value) {
+        return null;
+    }
+
+    @Override
+    public boolean checkHash(String plain, String hash, String salt) {
+        return false;
+    }
+
+    @Override
+    public boolean checkHash(String plain, String hash) {
+        return false;
+    }
+
+    @Override
+    public String getSalt(User user) {
+        return null;
+    }
+
+    @Override
+    public String createToken(boolean hash, Object... obj) {
+        return createToken();
+
+    }
+
+    @Override
+    public String createToken() {
+        return new BigInteger(100, randomizer).toString(20);
+    }
+
+    @Override
+    public String createID(Object... obj) {
+        return createToken();
+    }
+
+    @Override
+    public String encodeBase() {
+        return null;
+    }
+
+    @Override
+    public String validateIPAddress(String ipaddress) throws KorAPException {
+        return null;
+    }
+
+    @Override
+    public String validateEmail(String email) throws KorAPException {
+        return null;
+    }
+
+    @Override
+    public Map<String, Object> validateMap(Map<String, Object> map)
+            throws KorAPException {
+        return null;
+    }
+
+    @Override
+    public String validateString(String input) throws KorAPException {
+        return null;
+    }
+
+    @Override
+    public void validate(Object instance) throws KorAPException {
+
+    }
+
+    @Override
+    public String validatePassphrase(String pw) throws KorAPException {
+        return null;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/plugins/PluginManager.java b/src/main/java/de/ids_mannheim/korap/plugins/PluginManager.java
new file mode 100644
index 0000000..262985f
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/plugins/PluginManager.java
@@ -0,0 +1,31 @@
+package de.ids_mannheim.korap.plugins;
+
+import de.ids_mannheim.korap.interfaces.EntityHandlerIface;
+import de.ids_mannheim.korap.interfaces.UserControllerIface;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 15/06/2015
+ */
+// via spring a list of implementations is inserted, for which there will be default constructors loaded
+public class PluginManager {
+
+    private Map<String, Class> plugins;
+
+    public PluginManager() {
+        plugins = new HashMap<>();
+    }
+
+    public void loadPluginInterfaces() {
+        plugins.put("userdb", EntityHandlerIface.class);
+        plugins.put("usercontroller", UserControllerIface.class);
+        plugins.put("encrytion", EntityHandlerIface.class);
+    }
+
+    public void register(String key, Class cl) {
+        plugins.put(key, cl);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/Attributes.java b/src/main/java/de/ids_mannheim/korap/user/Attributes.java
new file mode 100644
index 0000000..0bba5b7
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/Attributes.java
@@ -0,0 +1,143 @@
+package de.ids_mannheim.korap.user;
+
+public class Attributes {
+
+    public static final String AUTHORIZATION = "Authorization";
+    public static final String SESSION_AUTHENTICATION = "session_token";
+    public static final String API_AUTHENTICATION = "api_token";
+    public static final String OAUTH2_AUTHORIZATION = "bearer";
+    public static final String OPENID_AUTHENTICATION = "id_token";
+    public static final String BASIC_AUTHENTICATION = "basic";
+
+    public static final String CLIENT_ID = "client_id";
+    public static final String CLIENT_SECRET = "client_secret";
+    public static final String SCOPES = "scopes";
+
+    public static final String SERVICE_ACCESS = "service_access";
+    public static final String USER = "KorapUser";
+    public static final String SHIBUSER = "ShibUser";
+    public static final String DEMO_DISPLAY = "Anonymous";
+    public static final String DEMOUSER_PASSWORD = "demo";
+
+    public static final String SETTINGS = "LocalSettings";
+    //    public static final String STORAGE_SETTINGS = "StorageSettings";
+
+    public static final String QUERY_ABBREVIATION = "Q";
+    public static final String LAYER = "layer";
+
+    public static final String TYPE = "type";
+
+    public static final String UID = "accountID";
+    public static final String USERNAME = "username";
+    public static final String PASSWORD = "password";
+    public static final String GENDER = "gender";
+    public static final String FIRSTNAME = "firstName";
+    public static final String LASTNAME = "lastName";
+    public static final String PHONE = "phone";
+    public static final String INSTITUTION = "institution";
+    public static final String EMAIL = "email";
+    public static final String ADDRESS = "address";
+    public static final String COUNTRY = "country";
+    public static final String ACCOUNT_CREATION = "accountCreation";
+    public static final String ACCOUNTLOCK = "accountLock";
+    public static final String ACCOUNTLINK = "accountLink";
+    public static final String URI = "uri";
+    public static final String URI_FRAGMENT = "URIFragment";
+    public static final String URI_EXPIRATION = "uriExpiration";
+    public static final String PRIVATE_USAGE = "privateUsage";
+
+    /**
+     * token context
+     */
+    public static final String TOKEN = "authToken";
+    public static final String TOKEN_EXPIRATION = "tokenExpires";
+    public static final String TOKEN_CREATION = "tokenCreated";
+    public static final String USER_AGENT = "User-Agent";
+    public static final String HOST = "userIP";
+
+    public static final String QUERY_PARAM_URI = "uri";
+    public static final String QUERY_PARAM_USER = "user";
+
+    /**
+     * shibboleth attribute names
+     */
+    public static final String EPPN = "eppn";
+    public static final String COMMON_NAME = "cn";
+    public static final String SURNAME = "sn";
+
+    public static final String EDUPERSON = "eduPersonPrincipalName";
+    public static final String CN = "cn";
+    public static final String MAIL = "mail";
+    public static final String EDU_AFFIL = "eduPersonScopedAffiliation";
+
+    /**
+     * resource mappings
+     */
+
+    public static final String RID = "id";
+    public static final String OWNER = "owner";
+    public static final String NAME = "name";
+    public static final String DESCRIPTION = "description";
+
+    public static final String REF_CORPUS = "refCorpus";
+    public static final String QUERY = "query";
+    public static final String CACHE = "cache";
+    public static final String DOCIDS = "docIDs";
+    public static final String FOUNDRIES = "foundries";
+    public static final String DEFAULT_VALUE = "defaultColl";
+
+    public static final String FILE_FORMAT_FOR_EXPORT = "fileFormatForExport";
+    public static final String FILENAME_FOR_EXPORT = "fileNameForExport";
+    @Deprecated
+    public static final String ITEM_FOR_SIMPLE_ANNOTATION = "itemForSimpleAnnotation";
+    public static final String LEFT_CONTEXT_ITEM_FOR_EXPORT = "leftContextItemForExport";
+    public static final String LEFT_CONTEXT_SIZE_FOR_EXPORT = "leftContextSizeForExport";
+    public static final String LOCALE = "locale";
+    public static final String LEFT_CONTEXT_ITEM = "leftContextItem";
+    public static final String LEFT_CONTEXT_SIZE = "leftContextSize";
+    public static final String RIGHT_CONTEXT_ITEM = "rightContextItem";
+    public static final String RIGHT_CONTEXT_ITEM_FOR_EXPORT = "rightContextItemForExport";
+    public static final String RIGHT_CONTEXT_SIZE = "rightContextSize";
+    public static final String RIGHT_CONTEXT_SIZE_FOR_EXPORT = "rightContextSizeForExport";
+    public static final String SELECTED_COLLECTION = "selectedCollection";
+    public static final String QUERY_LANGUAGE = "queryLanguage";
+    public static final String PAGE_LENGTH = "pageLength";
+    public static final String METADATA_QUERY_EXPERT_MODUS = "metadataQueryExpertModus";
+    @Deprecated
+    public static final String SEARCH_SETTINGS_TAB = "searchSettingsTab";
+    @Deprecated
+    public static final String SELECTED_BROWSER_PROPERTY = "selectedBrowserProperty";
+    @Deprecated
+    public static final String SELECTED_CONTEXT_ITEM = "selectedContextItem";
+    @Deprecated
+    public static final String SELECTED_GRAPH_TYPE = "selectedGraphType";
+    @Deprecated
+    public static final String SELECTED_SORT_TYPE = "selectedSortType";
+    @Deprecated
+    public static final String SELECTED_VIEW_FOR_SEARCH_RESULTS = "selectedViewForSearchResults";
+    public static final String COLLECT_AUDITING_DATA = "collectData";
+
+    /**
+     * default layers
+     */
+    public static final String DEFAULT_POS_FOUNDRY = "POSFoundry";
+    public static final String DEFAULT_LEMMA_FOUNDRY = "lemmaFoundry";
+    public static final String DEFAULT_CONST_FOUNDRY = "constFoundry";
+    public static final String DEFAULT_REL_FOUNDRY = "relFoundry";
+
+    /**
+     * db column keys
+     */
+
+    public static final String SELF_REF = "self";
+
+    public static final String SYM_USE = "sym_use";
+    public static final String COMMERCIAL = "commercial";
+    public static final String LICENCE = "licence";
+    public static final String QUERY_ONLY = "query_only";
+    public static final String EXPORT = "export";
+    public static final String TIME_SPANS = "spans";
+    public static final String RANGE = "range";
+
+}
+
diff --git a/src/main/java/de/ids_mannheim/korap/user/DemoUser.java b/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
new file mode 100644
index 0000000..c88f5e1
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
@@ -0,0 +1,29 @@
+package de.ids_mannheim.korap.user;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+@Getter
+@Setter
+public class DemoUser extends User implements Serializable {
+    private static final long serialVersionUID = -5015206272520970500L;
+    public static final String DEMOUSER_NAME = "demo";
+    public static final Integer DEMOUSER_ID = 1654234534;
+    private static final long ACCOUNT_CREATED = 1377102171202L;
+    public static final String PASSPHRASE = "$2a$15$rGPvLWm5JJ1iYj0V61e5guYIGmSo.rjdBkAVIU1vWS/xdybmABxRa";
+
+    protected DemoUser() {
+        super(DEMOUSER_NAME, 2);
+        this.setDetails(new UserDetails());
+        this.setSettings(new UserSettings());
+        this.setAccountCreation(ACCOUNT_CREATED);
+        this.setQueries(UserQuery.demoUserQueries());
+    }
+
+    protected User clone() {
+        return new DemoUser();
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
new file mode 100644
index 0000000..5eb6932
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
@@ -0,0 +1,76 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.utils.KorAPLogger;
+import lombok.Getter;
+import lombok.Setter;
+import org.slf4j.Logger;
+
+@Getter
+@Setter
+public class KorAPUser extends User {
+    private static Logger jlog = KorAPLogger.initiate(KorAPUser.class);
+    private static final long serialVersionUID = -7108308497625884584L;
+
+    //fixme: accountlink to shibboleth account
+    private String accountLink;
+
+    private String password;
+    private String URIFragment;
+    private Long URIExpiration;
+
+    protected KorAPUser(String username) {
+        super(username, 0);
+        this.URIFragment = "";
+        this.URIExpiration = 0L;
+    }
+
+    public KorAPUser(Integer id, String username) {
+        this(username);
+        this.setId(id);
+    }
+
+    public KorAPUser() {
+        super();
+    }
+
+    @Override
+    protected User clone() {
+        KorAPUser user = new KorAPUser(this.getUsername());
+        user.setUsername(this.getUsername());
+        user.setAccountCreation(this.getAccountCreation());
+        return user;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (jlog != null ? jlog.hashCode() : 0);
+        result = 31 * result + (password != null ? password.hashCode() : 0);
+        result = 31 * result + (URIFragment != null ?
+                URIFragment.hashCode() :
+                0);
+        result = 31 * result + (URIExpiration != null ?
+                URIExpiration.hashCode() :
+                0);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (!(o instanceof KorAPUser))
+            return false;
+        if (!super.equals(o))
+            return false;
+
+        KorAPUser korAPUser = (KorAPUser) o;
+        if (URIExpiration != korAPUser.URIExpiration)
+            return false;
+        if (URIFragment != null ?
+                !URIFragment.equals(korAPUser.URIFragment) :
+                korAPUser.URIFragment != null)
+            return false;
+        return true;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/ShibUser.java b/src/main/java/de/ids_mannheim/korap/user/ShibUser.java
new file mode 100644
index 0000000..f3f60b1
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/ShibUser.java
@@ -0,0 +1,48 @@
+package de.ids_mannheim.korap.user;
+
+import lombok.Data;
+
+/**
+ * User: hanl
+ * Date: 10/16/13
+ * Time: 2:02 PM
+ */
+@Data
+public class ShibUser extends User {
+
+    private String mail;
+    private String affiliation;
+    private String cn;
+
+    protected ShibUser() {
+        super(1);
+    }
+
+    private ShibUser(String eduPersonID, String mail, String cn, String affiliation) {
+        this(eduPersonID);
+        this.setUsername(eduPersonID);
+        this.mail = mail;
+        this.affiliation = affiliation;
+        this.cn = cn;
+    }
+
+    public ShibUser(String username) {
+        super(username, 1);
+
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("ShibUser{");
+        sb.append(", mail='").append(mail).append('\'');
+        sb.append(", affiliation='").append(affiliation).append('\'');
+        sb.append(", cn='").append(cn).append('\'');
+        sb.append('}');
+        return sb.toString();
+    }
+
+    @Override
+    protected User clone() {
+        return new ShibUser(this.getUsername(), this.getMail(), this.getCn(), this.getAffiliation());
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
new file mode 100644
index 0000000..8f244d3
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
@@ -0,0 +1,116 @@
+package de.ids_mannheim.korap.user;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 27/01/2014
+ */
+@Data
+public class TokenContext implements java.security.Principal {
+
+    /**
+     * session relevant data. Are never persisted into a database
+     */
+    private String username;
+    private Date expirationTime;
+    // either "session_token " / "api_token
+    private String tokenType;
+    private String token;
+
+    private boolean secureRequired;
+
+    private Map<String, Object> parameters;
+    private String hostAddress;
+    private String userAgent;
+
+    public TokenContext(String username) {
+        this();
+        this.username = username;
+    }
+
+    private TokenContext() {
+        this.parameters = new HashMap<>();
+        this.setUsername("");
+        this.setToken("");
+        this.setSecureRequired(false);
+    }
+
+    private Map statusMap() {
+        Map m = new HashMap();
+        if (username != null && !username.isEmpty())
+            m.put(Attributes.USERNAME, username);
+        m.put(Attributes.TOKEN_EXPIRATION,
+                new DateTime(expirationTime).toString());
+        m.put(Attributes.TOKEN, this.token);
+        return m;
+    }
+
+    public boolean match(TokenContext other) {
+        if (other.getToken().equals(this.token))
+            if (this.getHostAddress().equals(this.hostAddress))
+                // user agent should be irrelvant -- what about os system version?
+                //                if (other.getUserAgent().equals(this.userAgent))
+                return true;
+        return false;
+    }
+
+    public void addContextParameter(String key, String value) {
+        this.parameters.put(key, value);
+    }
+
+    public void removeContextParameter(String key) {
+        this.parameters.remove(key);
+    }
+
+    public void setExpirationTime(long date) {
+        this.expirationTime = new Date(date);
+    }
+
+    public static TokenContext fromJSON(String s) {
+        JsonNode node = JsonUtils.readTree(s);
+        TokenContext c = new TokenContext(
+                node.path(Attributes.USERNAME).asText());
+        c.setToken(node.path(Attributes.TOKEN).asText());
+        return c;
+    }
+
+    public static TokenContext fromOAuth(String s) {
+        JsonNode node = JsonUtils.readTree(s);
+        TokenContext c = new TokenContext();
+        c.setToken(node.path("token").asText());
+        c.setTokenType(node.path("token_type").asText());
+        c.setExpirationTime(node.path("expires_in").asLong());
+        return c;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public String toJSON() {
+        return JsonUtils.toJSON(this.statusMap());
+    }
+
+    public String toResponse() {
+        ObjectNode node = JsonUtils.createObjectNode();
+        node.put("token", this.getToken());
+        node.put("expires", this.getExpirationTime().getTime());
+        node.put("token_type", this.getTokenType());
+        return JsonUtils.toJSON(node);
+    }
+
+    @Override
+    public String getName() {
+        return this.getUsername();
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/User.java b/src/main/java/de/ids_mannheim/korap/user/User.java
new file mode 100644
index 0000000..2b28edd
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/User.java
@@ -0,0 +1,214 @@
+package de.ids_mannheim.korap.user;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.TimeUtils;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public abstract class User implements Serializable {
+
+    public static final int ADMINISTRATOR_ID = 34349733;
+    public static final String ADMINISTRATOR_NAME = "admin";
+
+    private Integer id;
+    // in local its username, in shib it's edupersonPrincipalName
+    private String username;
+    private Long accountCreation;
+    private boolean isAccountLocked;
+    private int type;
+    private Map<String, Object> fields;
+    private UserSettings settings;
+    private UserDetails details;
+    private List<UserQuery> queries;
+
+    protected User() {
+        this.accountCreation = TimeUtils.getNow().getMillis();
+        this.isAccountLocked = false;
+        this.username = "";
+        this.fields = new HashMap<>();
+        this.id = -1;
+    }
+
+    protected User(int type) {
+        this();
+        this.type = type;
+    }
+
+    protected User(String username, int type) {
+        this(type);
+        this.username = username;
+    }
+
+    public void setField(String key, Object value) {
+        this.fields.put(key, value);
+    }
+
+    public Object getField(String key) {
+        return this.fields.get(key);
+    }
+
+    //todo: repair transfer
+    public void transfer(User user) {
+        this.setSettings(user.getSettings());
+        this.setDetails(user.getDetails());
+        //        this.setQueries(user.getQueries());
+        if (this instanceof KorAPUser) {
+            this.getSettings().setUserID(this.id);
+            this.getDetails().setUserID(this.id);
+            //            for (UserQuery q : this.getQueries())
+            //                q.setOwner(this.accountID);
+        }
+    }
+
+    public void setDetails(UserDetails details) {
+        if (details != null)
+            details.setUserID(this.id);
+        this.details = details;
+    }
+
+    public void setSettings(UserSettings settings) {
+        if (settings != null)
+            settings.setUserID(this.id);
+        this.settings = settings;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+        if (this.settings != null)
+            this.settings.setUserID(this.id);
+        if (this.details != null)
+            this.details.setUserID(this.id);
+    }
+
+    public Map<String, Object> toMap() {
+        Map map = new HashMap();
+        map.put(Attributes.USERNAME, this.username);
+        //TimeUtils.format(new DateTime(this.accountCreation))
+        map.put(Attributes.ACCOUNT_CREATION, this.accountCreation);
+
+        if (this.getDetails() != null)
+            map.putAll(this.getDetails().toMap());
+        return map;
+    }
+
+    public String toJson() {
+        return JsonUtils.toJSON(this.toMap());
+    }
+
+    public Map toCache() {
+        Map map = new HashMap();
+        map.put(Attributes.UID, this.id);
+        map.put(Attributes.USERNAME, this.username);
+        map.put(Attributes.ACCOUNT_CREATION,
+                TimeUtils.format(new DateTime(this.accountCreation)));
+        map.put(Attributes.ACCOUNTLOCK, this.isAccountLocked);
+        map.put(Attributes.TYPE, this.type);
+        return map;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (!(o instanceof User))
+            return false;
+        User user = (User) o;
+        if (!username.equals(user.username))
+            return false;
+        return true;
+    }
+
+    public boolean isDemo() {
+        return this.getUsername().equalsIgnoreCase(DemoUser.DEMOUSER_NAME);
+    }
+
+    public boolean isAdmin() {
+        return this.getUsername().equals(ADMINISTRATOR_ID);
+    }
+
+    protected abstract User clone();
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("id='").append(id).append('\'');
+        sb.append(", username='").append(username).append('\'');
+        return sb.toString();
+    }
+
+    public static class UserFactory {
+
+        public static KorAPUser getUser(String username) {
+            return new KorAPUser(username);
+        }
+
+        public static KorAPUser getAdmin() {
+            return new KorAPUser(ADMINISTRATOR_ID, ADMINISTRATOR_NAME);
+        }
+
+        public static DemoUser getDemoUser() {
+            return new DemoUser();
+        }
+
+        public static DemoUser getDemoUser(Integer id) {
+            DemoUser demo = new DemoUser();
+            demo.setId(id);
+            return demo;
+        }
+
+        public static ShibUser getShibInstance(String eduPersonID, String mail,
+                String cn) {
+            ShibUser u = new ShibUser(eduPersonID);
+            u.setAffiliation("");
+            u.setMail(mail);
+            u.setUsername(eduPersonID);
+            u.setCn(cn);
+            return u;
+        }
+
+        public static User toUser(Map map) {
+            int type = map.get(Attributes.TYPE) == null ?
+                    0 :
+                    (int) map.get(Attributes.TYPE);
+            User user;
+            DateTime dateTime = DateTime
+                    .parse((String) map.get(Attributes.ACCOUNT_CREATION));
+            switch (type) {
+                case 0:
+                    user = UserFactory
+                            .getUser((String) map.get(Attributes.USERNAME));
+                    user.setId((Integer) map.get(Attributes.UID));
+                    user.setAccountLocked(
+                            (Boolean) map.get(Attributes.ACCOUNTLOCK));
+                    user.setAccountCreation(dateTime.getMillis());
+                    break;
+                default:
+                    user = UserFactory
+                            .getDemoUser((Integer) map.get(Attributes.UID));
+                    user.setAccountCreation(dateTime.getMillis());
+            }
+            return user;
+        }
+
+        public static KorAPUser toUser(String value) {
+            JsonNode node = JsonUtils.readTree(value);
+            KorAPUser user = UserFactory
+                    .getUser(node.path(Attributes.USERNAME).asText());
+            user.setAccountLocked(
+                    node.path(Attributes.ACCOUNTLOCK).asBoolean());
+            user.setAccountLink(node.path(Attributes.ACCOUNTLINK).asText());
+            user.setAccountCreation(
+                    node.path(Attributes.ACCOUNT_CREATION).asLong());
+            user.setPassword(node.path(Attributes.PASSWORD).asText());
+            return user;
+        }
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
new file mode 100644
index 0000000..6b2ffdb
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
@@ -0,0 +1,111 @@
+package de.ids_mannheim.korap.user;
+
+import lombok.Data;
+import org.apache.commons.collections.map.CaseInsensitiveMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: hanl
+ * Date: 8/14/13
+ * Time: 10:32 AM
+ */
+
+@Data
+public class UserDetails {
+
+    private Integer Id;
+    private Integer userID;
+    private String firstName;
+    private String lastName;
+    private String gender;
+    private String phone;
+    private String institution;
+    private String email;
+    private String address;
+    private String country;
+    private boolean privateUsage;
+
+    public UserDetails() {
+        setFirstName("");
+        setLastName("");
+        setPhone("");
+        setEmail("");
+        setGender("");
+        setAddress("");
+        setCountry("");
+        setInstitution("");
+        setPrivateUsage(true);
+    }
+
+    public static UserDetails newDetailsIterator(Map<String, Object> d) {
+        UserDetails details = new UserDetails();
+        Map<String, Object> detailMap = new CaseInsensitiveMap(d);
+
+        if (!detailMap.isEmpty()) {
+            details.setFirstName((String) detailMap.get(Attributes.FIRSTNAME));
+            details.setLastName((String) detailMap.get(Attributes.LASTNAME));
+            details.setPhone((String) detailMap.get(Attributes.PHONE));
+            details.setEmail((String) detailMap.get(Attributes.EMAIL));
+            details.setGender((String) detailMap.get(Attributes.GENDER));
+            details.setAddress((String) detailMap.get(Attributes.ADDRESS));
+            details.setCountry((String) detailMap.get(Attributes.COUNTRY));
+            details.setInstitution(
+                    (String) detailMap.get(Attributes.INSTITUTION));
+            details.setPrivateUsage(
+                    detailMap.get(Attributes.PRIVATE_USAGE) == null ?
+                            true :
+                            (Boolean) detailMap.get(Attributes.PRIVATE_USAGE));
+        }
+        return details;
+    }
+
+    public void updateDetails(Map<String, String> d) {
+        Map<String, String> detailMap = new CaseInsensitiveMap(d);
+
+        if (!detailMap.isEmpty()) {
+            if (detailMap.containsKey(Attributes.FIRSTNAME))
+                this.setFirstName(detailMap.get(Attributes.FIRSTNAME));
+            if (detailMap.containsKey(Attributes.LASTNAME))
+                this.setLastName(detailMap.get(Attributes.LASTNAME));
+            if (detailMap.containsKey(Attributes.PHONE))
+                this.setPhone(detailMap.get(Attributes.PHONE));
+            if (detailMap.containsKey(Attributes.EMAIL))
+                this.setEmail(detailMap.get(Attributes.EMAIL));
+            if (detailMap.containsKey(Attributes.GENDER))
+                this.setGender(detailMap.get(Attributes.GENDER));
+            if (detailMap.containsKey(Attributes.ADDRESS))
+                this.setAddress(detailMap.get(Attributes.ADDRESS));
+            if (detailMap.containsKey(Attributes.COUNTRY))
+                this.setCountry(detailMap.get(Attributes.COUNTRY));
+            if (detailMap.containsKey(Attributes.INSTITUTION))
+                this.setInstitution(detailMap.get(Attributes.INSTITUTION));
+            this.setPrivateUsage(
+                    Boolean.valueOf(detailMap.get(Attributes.PRIVATE_USAGE)));
+        }
+    }
+
+    public Map<String, Object> toMap() {
+        Map<String, Object> details = new HashMap<>();
+        // shouldnt there be a mechanism that prevents the retrieval of all information if no scopes are given?
+        // and if so, are the access_tokens specific to the scopes then?
+        details.put(Attributes.EMAIL, this.email);
+        details.put(Attributes.FIRSTNAME, this.firstName);
+        details.put(Attributes.LASTNAME, this.lastName);
+        details.put(Attributes.GENDER, this.gender);
+        details.put(Attributes.PHONE, this.phone);
+        details.put(Attributes.INSTITUTION, this.institution);
+        details.put(Attributes.ADDRESS, this.address);
+        details.put(Attributes.COUNTRY, this.country);
+        details.put(Attributes.PRIVATE_USAGE, this.privateUsage);
+
+        for (Map.Entry<String, Object> pair : details.entrySet()) {
+            if (pair.getValue() == null || pair.getValue().equals("null"))
+                pair.setValue("");
+        }
+        return details;
+    }
+
+}
+
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserQuery.java b/src/main/java/de/ids_mannheim/korap/user/UserQuery.java
new file mode 100644
index 0000000..0e53aa0
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserQuery.java
@@ -0,0 +1,136 @@
+package de.ids_mannheim.korap.user;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * User: hanl
+ * Date: 9/16/13
+ * Time: 4:38 PM
+ */
+@Data
+public class UserQuery {
+
+    private Integer id;
+    private String queryLanguage;
+    private String query;
+    private String name;
+    private String description;
+    private Integer creator;
+
+    public UserQuery(Integer id, int creator) {
+        setId(id);
+        setCreator(creator);
+        setName("");
+        setDescription("");
+        setQuery("");
+        setQueryLanguage("");
+    }
+
+    public UserQuery(String ql, String query, String description) {
+        setDescription(description);
+        setQuery(query);
+        setQueryLanguage(ql);
+    }
+
+    public UserQuery() {
+        setDescription("");
+        setQuery("");
+        setQueryLanguage("");
+        setName("");
+    }
+
+    public void setQuery(String query) {
+        this.query = query;
+        setName("Query: " + query
+                .substring(0, query.length() > 20 ? 20 : query.length()));
+    }
+
+    // todo: use example queries or store in database
+    public static List<UserQuery> demoUserQueries() {
+
+        List<UserQuery> queries = new ArrayList<>();
+        UserQuery q1 = new UserQuery();
+        q1.setQueryLanguage("COSMAS2");
+        q1.setQuery("$wegen #IN(L) <s>");
+        q1.setDescription(
+                "Findet 'wegen' an Satzanfängen. Berücksichtigt auch Groß- und Kleinschreibung");
+
+        //todo: change query
+        UserQuery q2 = new UserQuery();
+        q2.setQueryLanguage("COSMAS2");
+        q2.setQuery("base/cons:Buchstabe base/aggr:Buchstabe");
+
+        UserQuery q3 = new UserQuery();
+        q3.setQueryLanguage("COSMAS2");
+        q3.setDescription("Regular Expression Search");
+        q3.setQuery("id:/WPD_AAA.*/ AND textClass:sport");
+
+        UserQuery q4 = new UserQuery();
+        q4.setQueryLanguage("COSMAS2");
+        q4.setQuery("mpt/syntax_pos:@CC\\|und");
+
+        UserQuery q5 = new UserQuery();
+        q5.setQueryLanguage("COSMAS2");
+        q5.setQuery("VVINF\\|.*en");
+
+        queries.add(q1);
+        //        queries.add(q2);
+        //        queries.add(q3);
+        queries.add(q4);
+        queries.add(q5);
+        return queries;
+    }
+
+    //id is irrevelant, since data was coming
+    // from frontend and thus this object does not contain a id that could be compared!
+    // same with the userAccount. Not set yet!
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (!(o instanceof UserQuery))
+            return false;
+        UserQuery userQuery = (UserQuery) o;
+        if (!query.equals(userQuery.query))
+            return false;
+        if (!queryLanguage.equals(userQuery.queryLanguage))
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = getId() != null ? getId().hashCode() : 0;
+        result = 31 * result + (queryLanguage != null ?
+                queryLanguage.hashCode() :
+                0);
+        result = 31 * result + (query != null ? query.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("UserQuery{");
+        sb.append("id=").append(getId());
+        //        sb.append(", owner=").append(getOwner());
+        sb.append(", queryLanguage='").append(queryLanguage).append('\'');
+        sb.append(", query='").append(query).append('\'');
+        sb.append(", description='").append(getDescription()).append('\'');
+        sb.append('}');
+        return sb.toString();
+    }
+
+    public Map toMap() {
+        Map map = new HashMap();
+        map.put("name", this.name);
+        map.put("description", this.description);
+        map.put("query", this.query);
+        map.put("queryLanguage", this.queryLanguage);
+        return map;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
new file mode 100644
index 0000000..365e69a
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
@@ -0,0 +1,467 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.utils.BooleanUtils;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: hanl
+ * Date: 8/14/13
+ * Time: 10:26 AM
+ */
+
+@Getter
+@Setter
+public class UserSettings {
+
+    private Integer id;
+    private Integer userID;
+    private String fileNameForExport;
+    //    @Deprecated
+    //    private Integer itemForSimpleAnnotation;
+    private String leftContextItemForExport;
+    private Integer leftContextSizeForExport;
+    private String locale;
+    private String leftContextItem;
+    private Integer leftContextSize;
+    private String rightContextItem;
+    private String rightContextItemForExport;
+    private Integer rightContextSize;
+    private Integer rightContextSizeForExport;
+    private String selectedCollection;
+    private String queryLanguage;
+    private Integer pageLength;
+    private boolean metadataQueryExpertModus;
+    //    @Deprecated
+    //    private Integer searchSettingsTab;
+    //    @Deprecated
+    //    private Integer selectedGraphType;
+    //    @Deprecated
+    //    private String selectedSortType;
+    //    @Deprecated
+    //    private String selectedViewForSearchResults;
+
+    /**
+     * default values for foundry specification! of structure ff/lay
+     */
+    private String defaultPOSfoundry;
+    private String defaultLemmafoundry;
+    //default foundry for constituent information (syntax trees) --> there is no actual layer for this information
+    private String defaultConstfoundry;
+    private String defaultRelfoundry;
+
+    //todo: refactor to anonymous -- since data is collected either way!
+    private boolean collectData;
+
+    /**
+     * creates an instance of this object with default values, mapped from a database/configuration file
+     */
+    public UserSettings() {
+        setupDefaultSettings();
+    }
+
+    public static UserSettings fromObjectMap(Map<String, Object> m) {
+        UserSettings s = new UserSettings();
+        s.setFileNameForExport((String) m.get(Attributes.FILENAME_FOR_EXPORT));
+        //        s.setItemForSimpleAnnotation(
+        //                (Integer) m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION));
+        s.setLeftContextItemForExport(
+                (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setLeftContextSizeForExport(
+                (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT));
+        s.setLocale((String) m.get(Attributes.LOCALE));
+        s.setLeftContextItem((String) m.get(Attributes.LEFT_CONTEXT_ITEM));
+        s.setLeftContextSize((Integer) m.get(Attributes.LEFT_CONTEXT_SIZE));
+        s.setRightContextItem((String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        s.setRightContextItemForExport(
+                (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setRightContextSize((Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE));
+        s.setRightContextSizeForExport(
+                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT));
+        s.setSelectedCollection((String) m.get(Attributes.SELECTED_COLLECTION));
+        s.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
+        s.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
+        s.setMetadataQueryExpertModus((Boolean) BooleanUtils
+                .getBoolean(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
+        //        s.setSearchSettingsTab((Integer) m.get(Attributes.SEARCH_SETTINGS_TAB));
+        //        s.setSelectedGraphType((Integer) m.get(Attributes.SELECTED_GRAPH_TYPE));
+        //        s.setSelectedSortType((String) m.get(Attributes.SELECTED_SORT_TYPE));
+        //        s.setSelectedViewForSearchResults(
+        //                (String) m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+        s.setCollectData((Boolean) BooleanUtils
+                .getBoolean(m.get(Attributes.COLLECT_AUDITING_DATA)));
+
+        s.setDefaultConstfoundry(
+                (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        s.setDefaultRelfoundry((String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
+        s.setDefaultPOSfoundry((String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        s.setDefaultLemmafoundry(
+                (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+
+        s.setId((Integer) m.get("Id"));
+        s.setUserID((Integer) m.get("userID"));
+        return s;
+    }
+
+    public static UserSettings fromMap(Map<String, String> m) {
+        UserSettings s = new UserSettings();
+        s.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
+        //        s.setItemForSimpleAnnotation(
+        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
+        s.setLeftContextItemForExport(
+                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setLeftContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
+        s.setLocale(m.get(Attributes.LOCALE));
+        s.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
+        s.setLeftContextSize(
+                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
+        s.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        s.setRightContextItemForExport(
+                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setRightContextSize(
+                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
+        s.setRightContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
+        s.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
+        s.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
+        s.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
+        s.setMetadataQueryExpertModus(
+                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
+        //        s.setSearchSettingsTab(
+        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
+        //        s.setSelectedGraphType(
+        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
+        //        s.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
+        //        s.setSelectedViewForSearchResults(
+        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+
+        s.setCollectData(
+                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
+        s.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        s.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
+        s.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        s.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        return s;
+    }
+
+    public static UserSettings newSettingsIterator(Map<String, String> m) {
+        UserSettings s = new UserSettings();
+        if (m.isEmpty())
+            return s;
+
+        s.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
+        //        s.setItemForSimpleAnnotation(
+        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
+        s.setLeftContextItemForExport(
+                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setLeftContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
+        s.setLocale(m.get(Attributes.LOCALE));
+        s.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
+        s.setLeftContextSize(
+                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
+        s.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        s.setRightContextItemForExport(
+                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        s.setRightContextSize(
+                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
+        s.setRightContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
+        s.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
+        s.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
+        s.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
+        s.setMetadataQueryExpertModus(
+                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
+        //        s.setSearchSettingsTab(
+        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
+        //        s.setSelectedGraphType(
+        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
+        //        s.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
+        //        s.setSelectedViewForSearchResults(
+        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+
+        s.setCollectData(
+                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
+        s.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        s.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
+        s.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        s.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        return s;
+    }
+
+    public void updateStringSettings(Map<String, String> m) {
+        this.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
+        //        this.setItemForSimpleAnnotation(
+        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
+        this.setLeftContextItemForExport(
+                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        this.setLeftContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
+        this.setLocale(m.get(Attributes.LOCALE));
+        this.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
+        this.setLeftContextSize(
+                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
+        this.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        this.setRightContextItemForExport(
+                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        this.setRightContextSize(
+                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
+        this.setRightContextSizeForExport(Integer.valueOf(
+                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
+        this.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
+        this.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
+        this.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
+        this.setMetadataQueryExpertModus(
+                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
+        //        this.setSearchSettingsTab(
+        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
+        //        this.setSelectedGraphType(
+        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
+        //        this.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
+        //        this.setSelectedViewForSearchResults(
+        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+
+        this.setCollectData(
+                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
+        this.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        this.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        this.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        this.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
+    }
+
+    public void updateObjectSettings(Map<String, Object> m) {
+        this.setFileNameForExport(
+                (String) m.get(Attributes.FILENAME_FOR_EXPORT));
+        //        this.setItemForSimpleAnnotation(
+        //                (Integer) m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION));
+        this.setLeftContextItemForExport(
+                (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        this.setLeftContextSizeForExport(
+                (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT));
+        this.setLocale((String) m.get(Attributes.LOCALE));
+        this.setLeftContextItem((String) m.get(Attributes.LEFT_CONTEXT_ITEM));
+        this.setLeftContextSize((Integer) m.get(Attributes.LEFT_CONTEXT_SIZE));
+        this.setRightContextItem((String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        this.setRightContextItemForExport(
+                (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        this.setRightContextSize(
+                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE));
+        this.setRightContextSizeForExport(
+                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT));
+        this.setSelectedCollection(
+                (String) m.get(Attributes.SELECTED_COLLECTION));
+        this.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
+        this.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
+        this.setMetadataQueryExpertModus(
+                (Boolean) m.get(Attributes.METADATA_QUERY_EXPERT_MODUS));
+        //        this.setSearchSettingsTab(
+        //                (Integer) m.get(Attributes.SEARCH_SETTINGS_TAB));
+        //        this.setSelectedGraphType(
+        //                (Integer) m.get(Attributes.SELECTED_GRAPH_TYPE));
+        //        this.setSelectedSortType((String) m.get(Attributes.SELECTED_SORT_TYPE));
+        //        this.setSelectedViewForSearchResults(
+        //                (String) m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+
+        this.setCollectData((Boolean) m.get(Attributes.COLLECT_AUDITING_DATA));
+        this.setDefaultPOSfoundry(
+                (String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        this.setDefaultLemmafoundry(
+                (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        this.setDefaultConstfoundry(
+                (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        this.setDefaultRelfoundry(
+                (String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
+    }
+
+    //load from configuration?
+    private void setupDefaultSettings() {
+        this.setFileNameForExport("export");
+        //        this.setItemForSimpleAnnotation(0);
+        this.setLocale("de");
+        this.setLeftContextItemForExport("char");
+        this.setLeftContextSizeForExport(100);
+        this.setLeftContextItem("char");
+        this.setLeftContextSize(200);
+        this.setRightContextItem("char");
+        this.setRightContextItemForExport("char");
+        this.setRightContextSize(200);
+        this.setRightContextSizeForExport(100);
+        // persistent id for wikipedia!
+        this.setSelectedCollection(
+                "ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ==");
+        this.setQueryLanguage("COSMAS2");
+        this.setPageLength(25);
+        this.setMetadataQueryExpertModus(true);
+        //        this.setSearchSettingsTab(0);
+        //        this.setSelectedGraphType(1);
+        //        this.setSelectedSortType("FIFO");
+        //        this.setSelectedViewForSearchResults("KWIC");
+
+        this.setCollectData(true);
+        this.setDefaultConstfoundry("mate");
+        this.setDefaultRelfoundry("mate");
+        this.setDefaultPOSfoundry("tt");
+        this.setDefaultLemmafoundry("tt");
+    }
+
+    public Map toStringMap() {
+        Map<String, String> m = new HashMap<>();
+        m.put(Attributes.FILENAME_FOR_EXPORT, this.getFileNameForExport());
+        //        m.put(Attributes.ITEM_FOR_SIMPLE_ANNOTATION,
+        //                String.valueOf(this.getItemForSimpleAnnotation()));
+        m.put(Attributes.LEFT_CONTEXT_SIZE,
+                String.valueOf(this.getLeftContextSize()));
+        m.put(Attributes.LEFT_CONTEXT_ITEM,
+                String.valueOf(this.getLeftContextItem()));
+        m.put(Attributes.LOCALE, this.getLocale());
+        m.put(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT,
+                String.valueOf(this.getLeftContextSizeForExport()));
+        m.put(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT,
+                String.valueOf(this.getLeftContextItemForExport()));
+        m.put(Attributes.RIGHT_CONTEXT_ITEM,
+                String.valueOf(this.getRightContextItem()));
+        m.put(Attributes.RIGHT_CONTEXT_SIZE,
+                String.valueOf(this.getRightContextSize()));
+        m.put(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT,
+                String.valueOf(this.getRightContextItemForExport()));
+        m.put(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT,
+                String.valueOf(this.getRightContextSizeForExport()));
+        m.put(Attributes.SELECTED_COLLECTION, this.getSelectedCollection());
+        m.put(Attributes.QUERY_LANGUAGE, this.getQueryLanguage());
+        m.put(Attributes.PAGE_LENGTH, String.valueOf(this.getPageLength()));
+        m.put(Attributes.METADATA_QUERY_EXPERT_MODUS,
+                String.valueOf(this.isMetadataQueryExpertModus()));
+        //        m.put(Attributes.SEARCH_SETTINGS_TAB,
+        //                String.valueOf(this.getSearchSettingsTab()));
+        //        m.put(Attributes.SELECTED_GRAPH_TYPE,
+        //                String.valueOf(this.getSelectedGraphType()));
+        //        m.put(Attributes.SELECTED_SORT_TYPE, this.getSelectedSortType());
+        //        m.put(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS,
+        //                this.getSelectedViewForSearchResults());
+        m.put(Attributes.DEFAULT_POS_FOUNDRY, this.getDefaultPOSfoundry());
+        m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, this.getDefaultLemmafoundry());
+        m.put(Attributes.DEFAULT_CONST_FOUNDRY, this.getDefaultConstfoundry());
+        m.put(Attributes.DEFAULT_REL_FOUNDRY, this.getDefaultRelfoundry());
+        m.put(Attributes.COLLECT_AUDITING_DATA,
+                String.valueOf(this.isCollectData()));
+
+        for (Map.Entry pair : m.entrySet()) {
+            if (pair.getValue() == null)
+                pair.setValue("");
+        }
+        return m;
+    }
+
+    public Map toObjectMap() {
+        Map<String, Object> m = new HashMap<>();
+        m.put(Attributes.FILENAME_FOR_EXPORT, this.getFileNameForExport());
+        //        m.put(Attributes.ITEM_FOR_SIMPLE_ANNOTATION,
+        //                this.getItemForSimpleAnnotation());
+        m.put(Attributes.LEFT_CONTEXT_SIZE, this.getLeftContextSize());
+        m.put(Attributes.LEFT_CONTEXT_ITEM, this.getLeftContextItem());
+        m.put(Attributes.LOCALE, this.getLocale());
+        m.put(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT,
+                this.getLeftContextSizeForExport());
+        m.put(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT,
+                this.getLeftContextItemForExport());
+        m.put(Attributes.RIGHT_CONTEXT_ITEM, this.getRightContextItem());
+        m.put(Attributes.RIGHT_CONTEXT_SIZE, this.getRightContextSize());
+        m.put(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT,
+                this.getRightContextItemForExport());
+        m.put(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT,
+                this.getRightContextSizeForExport());
+        m.put(Attributes.SELECTED_COLLECTION, this.getSelectedCollection());
+        m.put(Attributes.QUERY_LANGUAGE, this.getQueryLanguage());
+        m.put(Attributes.PAGE_LENGTH, this.getPageLength());
+        m.put(Attributes.METADATA_QUERY_EXPERT_MODUS,
+                this.isMetadataQueryExpertModus());
+        //        m.put(Attributes.SEARCH_SETTINGS_TAB, this.getSearchSettingsTab());
+        //        m.put(Attributes.SELECTED_GRAPH_TYPE, this.getSelectedGraphType());
+        //        m.put(Attributes.SELECTED_SORT_TYPE, this.getSelectedSortType());
+        //        m.put(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS,
+        //                this.getSelectedViewForSearchResults());
+        m.put(Attributes.DEFAULT_POS_FOUNDRY, this.getDefaultPOSfoundry());
+        m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, this.getDefaultLemmafoundry());
+        m.put(Attributes.DEFAULT_CONST_FOUNDRY, this.getDefaultConstfoundry());
+        m.put(Attributes.DEFAULT_REL_FOUNDRY, this.getDefaultRelfoundry());
+        m.put(Attributes.COLLECT_AUDITING_DATA, this.isCollectData());
+        for (Map.Entry pair : m.entrySet()) {
+            if (pair.getValue() == null)
+                pair.setValue("");
+        }
+        return m;
+    }
+
+    @Override
+    public String toString() {
+        return "UserSettings{" +
+                "id=" + id +
+                ", userid=" + userID +
+                ", fileNameForExport='" + fileNameForExport + '\'' +
+                ", leftContextItemForExport='" + leftContextItemForExport + '\''
+                +
+                ", leftContextSizeForExport=" + leftContextSizeForExport +
+                ", locale='" + locale + '\'' +
+                ", leftContextItem='" + leftContextItem + '\'' +
+                ", leftContextSize=" + leftContextSize +
+                ", rightContextItem='" + rightContextItem + '\'' +
+                ", rightContextItemForExport='" + rightContextItemForExport
+                + '\'' +
+                ", rightContextSize=" + rightContextSize +
+                ", rightContextSizeForExport=" + rightContextSizeForExport +
+                ", selectedCollection='" + selectedCollection + '\'' +
+                ", queryLanguage='" + queryLanguage + '\'' +
+                ", pageLength=" + pageLength +
+                ", metadataQueryExpertModus=" + metadataQueryExpertModus +
+                ", defaultPOSfoundry='" + defaultPOSfoundry + '\'' +
+                ", defaultLemmafoundry='" + defaultLemmafoundry + '\'' +
+                ", defaultConstfoundry='" + defaultConstfoundry + '\'' +
+                ", defaultRelfoundry='" + defaultRelfoundry + '\'' +
+                ", collectData='" + collectData + "\'" +
+                '}';
+    }
+
+    public static UserSettings fromString(String value) {
+        Map<String, Object> map;
+        try {
+            map = JsonUtils.read(value, Map.class);
+        }catch (IOException e) {
+            return new UserSettings();
+        }
+        return UserSettings.fromObjectMap(map);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        UserSettings that = (UserSettings) o;
+
+        if (userID != null ? userID != that.userID : that.userID != null)
+            return false;
+        if (id != null ? !id.equals(that.id) : that.id != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = id != null ? id.hashCode() : 0;
+        result = 31 * result + (userID != null ? userID.hashCode() : 0);
+        return result;
+    }
+
+    public String toJSON() {
+        return JsonUtils.toJSON(this);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/Benchmark.java b/src/main/java/de/ids_mannheim/korap/utils/Benchmark.java
new file mode 100644
index 0000000..1f06897
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/Benchmark.java
@@ -0,0 +1,15 @@
+package de.ids_mannheim.korap.utils;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author hanl
+ * @date 29/04/2014
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface Benchmark {
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java b/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java
new file mode 100644
index 0000000..2e767ed
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java
@@ -0,0 +1,23 @@
+package de.ids_mannheim.korap.utils;
+
+/**
+ * @author hanl
+ * @date 19/02/2014
+ */
+public class BooleanUtils {
+
+    public static String dbname;
+
+    public static Object getBoolean(Object val) {
+        if (val == null) val = false;
+        if (dbname != null
+                && dbname.equalsIgnoreCase("sqlite")) {
+            if (val instanceof Boolean) {
+                return (val == true) ? 1 : 0;
+            } else if (val instanceof Integer) {
+                return ((Integer) val == 1);
+            }
+        }
+        return val;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder.java
new file mode 100644
index 0000000..b68feac
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder.java
@@ -0,0 +1,319 @@
+package de.ids_mannheim.korap.utils;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multiset;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author hanl
+ * @date 06/12/2013
+ */
+@Deprecated
+public class CollectionQueryBuilder {
+
+    private enum Relation {
+        OR, AND
+    }
+
+    private CollectionTypes types;
+    private List<Map> rq;
+    private Multimap<String, String> mfilter;
+    private Multimap<String, String> mextension;
+    private Relation simpleFilterRel = Relation.OR;
+    private Relation simpleExtendRel = Relation.OR;
+
+
+    public CollectionQueryBuilder() {
+        this.rq = new ArrayList<>();
+        this.mfilter = ArrayListMultimap.create();
+        this.mextension = ArrayListMultimap.create();
+        this.types = new CollectionTypes();
+    }
+
+    public CollectionQueryBuilder addResource(String query) {
+        try {
+            List v = JsonUtils.read(query, LinkedList.class);
+            this.rq.addAll(v);
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Conversion went wrong!");
+        }
+        return this;
+    }
+
+    public CollectionQueryBuilder addResources(List<String> queries) {
+        for (String query : queries)
+            addResource(query);
+        return this;
+    }
+
+    public CollectionQueryBuilder addMetaFilter(String key, String value) {
+        this.mfilter.put(key, value);
+        return this;
+    }
+
+
+    public CollectionQueryBuilder addMetaFilterQuery(String queries) {
+        this.mfilter.putAll(resRel(queries));
+        return this;
+    }
+
+    public CollectionQueryBuilder addMetaExtend(String key, String value) {
+        this.mextension.put(key, value);
+        return this;
+    }
+
+
+    public CollectionQueryBuilder setFilterAttributeRelation(Relation rel) {
+        simpleFilterRel = rel;
+        return this;
+    }
+
+
+    public CollectionQueryBuilder setExtendAttributeRelation(Relation rel) {
+        simpleExtendRel = rel;
+        return this;
+    }
+
+    public CollectionQueryBuilder addMetaExtendQuery(String queries) {
+        this.mextension.putAll(resRel(queries));
+        return this;
+    }
+
+
+    @Deprecated
+    private List<Map> createFilter(Relation rel) {
+        String relation = rel == Relation.AND ? "and" : "or";
+        List<Map> mfil = new ArrayList<>();
+        boolean multypes = this.mfilter.keySet().size() > 1;
+        String def_key = null;
+
+        if (!multypes) {
+            Multiset<String> keys = this.mfilter.keys();
+            def_key = keys.toArray(new String[keys.size()])[0];
+        }
+
+        List value = this.createValue(this.mfilter);
+
+        if (mfilter.values().size() == 1)
+            Collections.addAll(mfil, types.createMetaFilter((Map) value.get(0)));
+        else {
+            Map group;
+            if (!multypes)
+                group = types.createGroup(relation, def_key, value);
+            else
+                group = types.createGroup(relation, null, value);
+            Collections.addAll(mfil, types.createMetaFilter(group));
+        }
+        return mfil;
+    }
+
+    @Deprecated
+    private List<Map> createExtender(Relation rel) {
+        String relation = rel == Relation.AND ? "and" : "or";
+        List<Map> mex = new ArrayList();
+        boolean multypes = this.mextension.keys().size() > 1;
+        String def_key = null;
+
+        if (!multypes)
+            def_key = this.mextension.keys().toArray(new String[0])[0];
+
+        List value = this.createValue(this.mextension);
+        // todo: missing: - takes only one resource, but resources can be chained!
+        if (this.mextension.values().size() == 1)
+            Collections.addAll(mex, types.createMetaExtend((Map) value.get(0)));
+        else {
+            Map group;
+            if (!multypes)
+                group = types.createGroup(relation, def_key, value);
+            else
+                group = types.createGroup(relation, null, value);
+            Collections.addAll(mex, types.createMetaExtend(group));
+        }
+        return mex;
+    }
+
+    private List<Map> join() {
+        List<Map> cursor = new ArrayList<>(this.rq);
+        if (!this.mfilter.isEmpty())
+            cursor.addAll(this.createFilter(simpleFilterRel));
+        if (!this.mextension.isEmpty())
+            cursor.addAll(this.createExtender(simpleExtendRel));
+        return cursor;
+    }
+
+    private List createValue(Multimap<String, String> map) {
+        List value = new ArrayList<>();
+        String[] dates = new String[3];
+        for (String key : map.keySet()) {
+            if (key.equals("pubDate")) {
+                dates = processDates((List<String>) map.get(key));
+                continue;
+            }
+
+            if (map.get(key).size() == 1) {
+                Map term = types.createTerm(key, null,
+                        map.get(key).toArray(new String[0])[0], null);
+                value.add(term);
+            } else {
+                boolean multypes = map.keySet().size() > 1;
+                List g = new ArrayList();
+                for (String v : map.get(key))
+                    g.add(types.createTerm(null, v, null));
+
+                if (multypes) {
+                    Map group = types.createGroup("and", key, g);
+                    value.add(group);
+                } else
+                    value.addAll(g);
+
+            }
+        }
+
+        int idx = 3;
+        if (dates[0] != null && dates[0].equals("r")) {
+            Map term1 = types.createTerm(null, dates[1], "korap:date");
+            Map term2 = types.createTerm(null, dates[2], "korap:date");
+            Map group = types.createGroup("between", "pubDate", Arrays.asList(term1, term2));
+            value.add(group);
+        } else if (dates[1] != null) {
+            Map term1 = types.createTerm(null, dates[1], "korap:date");
+            Map group = types.createGroup("since", "pubDate", Arrays.asList(term1));
+            value.add(group);
+        } else if (dates[2] != null) {
+            Map term1 = types.createTerm(null, dates[2], "korap:date");
+            Map group = types.createGroup("until", "pubDate", Arrays.asList(term1));
+            value.add(group);
+        }
+
+        for (int i = idx; i < dates.length; i++) {
+            if (dates[i] != null) {
+                Map term1 = types.createTerm(dates[i], "korap:date");
+                Map group = types.createGroup("exact", "pubDate", Arrays.asList(term1));
+                value.add(group);
+            }
+        }
+        return value;
+    }
+
+    private String[] processDates(List<String> dates) {
+        if (dates.isEmpty())
+            return new String[3];
+        String[] el = new String[dates.size() + 3];
+        int idx = 3;
+        for (String value : dates) {
+            if (value.contains("<")) {
+                String[] sp = value.split("<");
+                el[1] = sp[1];
+            } else if (value.contains(">")) {
+                String[] sp = value.split(">");
+                el[2] = sp[1];
+            } else {
+                el[idx] = value;
+                idx++;
+            }
+        }
+        if (el[1] != null && el[2] != null)
+            el[0] = "r";
+        return el;
+    }
+
+    public List<Map> raw() {
+        return join();
+    }
+
+    public String toCollections() {
+        Map meta = new LinkedHashMap();
+        meta.put("collections", join());
+        return JsonUtils.toJSON(meta);
+    }
+
+    /**
+     * returns all references to parents and meta query as string representation
+     *
+     * @return
+     */
+    public JsonNode toNode() {
+        return JsonUtils.valueToTree(join());
+    }
+
+    public String toJSON() {
+        return JsonUtils.toJSON(join());
+    }
+
+
+    /**
+     * resolves all queries as equal (hierarchy) AND/OR relations
+     * grouping is not supported!
+     *
+     * @param queries
+     * @return
+     */
+    private Multimap<String, String> resRel(String queries) {
+        Multimap<String, String> qmap = ArrayListMultimap.create();
+        String op = null;
+        if (queries.contains("AND") | queries.contains("OR"))
+            op = queries.contains("AND") ? "AND" : "OR";
+        else if (queries.contains("&") | queries.contains("|"))
+            op = queries.contains("&") ? "&" : "|";
+
+        if (op == null)
+            return qmap;
+
+        String[] spl = queries.trim().split(op);
+        for (String query : spl) {
+            String[] q = query.split("=");
+            if (q.length > 1) {
+                String attr = q[0].trim();
+                String val = q[1].trim();
+                qmap.put(attr, val);
+            }
+            // todo: return error when query not well-formed
+        }
+        return qmap;
+    }
+
+    /**
+     * resolve relations and allow grouping of attributes: (tc1 and tc1) or (tc3)
+     *
+     * @param queries
+     * @param filter  flag if either filter or extend collection
+     * @return
+     */
+    private void resRelation(String queries, boolean filter) {
+        Pattern p = Pattern.compile("\\(([\\w\\s:]+)\\)");
+        List _fill = new ArrayList();
+        Matcher m = p.matcher(queries);
+        while (m.find()) {
+            String gr = m.group(1);
+            _fill.add(gr);
+            String whole = "(" + gr + ")";
+            int fin = queries.lastIndexOf(whole);
+            String sub = queries.substring(queries.indexOf(whole), queries.lastIndexOf(whole));
+            queries.replace(whole, "");
+        }
+    }
+
+    private void v(String queries, boolean filter) {
+        // and exclude sub-groups?? : ((tc=121))
+        Pattern p = Pattern.compile("\\(([\\w\\s=]+)\\)");
+        List _fill = new ArrayList();
+        Matcher m = p.matcher(queries);
+        while (m.find()) {
+            String gr = m.group(1);
+
+        }
+
+    }
+
+    public void clear() {
+        this.rq.clear();
+        this.mfilter.clear();
+        this.mextension.clear();
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder2.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder2.java
new file mode 100644
index 0000000..1058f5b
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder2.java
@@ -0,0 +1,86 @@
+package de.ids_mannheim.korap.utils;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @author hanl
+ * @date 13/05/2014
+ */
+@Deprecated
+public class CollectionQueryBuilder2 {
+
+    private List<Map> rq;
+    private Map groups;
+    private CollectionTypes types;
+    private boolean verbose;
+
+    public CollectionQueryBuilder2() {
+        this.verbose = false;
+        this.rq = new ArrayList<>();
+        this.groups = new HashMap();
+        this.types = new CollectionTypes();
+    }
+
+    public CollectionQueryBuilder2(boolean verbose) {
+        this();
+        this.verbose = verbose;
+    }
+
+
+    public CollectionQueryBuilder2 addResource(String collections) {
+        try {
+            List v = JsonUtils.read(collections, LinkedList.class);
+            this.rq.addAll(v);
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Conversion went wrong!");
+        }
+        return this;
+    }
+
+    public CollectionQueryBuilder2 addResources(List<String> queries) {
+        for (String query : queries)
+            addResource(query);
+        return this;
+    }
+
+//    public CollectionQueryBuilder2 setQuery(String query) {
+//        CollectionQueryProcessor tree = new CollectionQueryProcessor();
+//        tree.process(query);
+//        this.groups = tree.getRequestMap();
+//        return this;
+//    }
+
+    public List raw() {
+        List list = new ArrayList(this.rq);
+        list.add(types.createMetaFilter(this.groups));
+        return list;
+    }
+
+    private Object raw2() {
+        return this.groups;
+    }
+
+    public String toCollections() {
+        Map value = new HashMap();
+        value.put("collections", raw2());
+        return JsonUtils.toJSON(value);
+    }
+
+    public JsonNode toNode() {
+        return JsonUtils.valueToTree(raw2());
+    }
+
+    public String toJSON() {
+        return JsonUtils.toJSON(raw2());
+    }
+
+
+    // add public filter to original query
+    private void addToGroup() {
+        Map first = this.rq.get(0);
+
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java
new file mode 100644
index 0000000..1217085
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java
@@ -0,0 +1,79 @@
+package de.ids_mannheim.korap.utils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * convenience builder class for collection query -- new one
+ *
+ * @author hanl
+ * @date 16/09/2014
+ */
+public class CollectionQueryBuilder3 {
+
+    private boolean verbose;
+    private List<Map> rq;
+    private StringBuilder builder;
+
+    public CollectionQueryBuilder3() {
+        this(false);
+    }
+
+    public CollectionQueryBuilder3(boolean verbose) {
+        this.verbose = verbose;
+        this.builder = new StringBuilder();
+        this.rq = new LinkedList<>();
+    }
+
+
+    public CollectionQueryBuilder3 addSegment(String field, String value) {
+        String f = field + "=" + value;
+        this.builder.append(f);
+        return this;
+    }
+
+    public CollectionQueryBuilder3 add(String query) {
+        this.builder.append(query);
+        return this;
+    }
+
+    public CollectionQueryBuilder3 and() {
+        this.builder.append(" & ");
+        return this;
+    }
+
+    public CollectionQueryBuilder3 or() {
+        this.builder.append(" | ");
+        return this;
+    }
+
+    public CollectionQueryBuilder3 addResource(String collection) {
+        try {
+            List v = JsonUtils.read(collection, LinkedList.class);
+            this.rq.addAll(v);
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Conversion went wrong!");
+        }
+        return this;
+    }
+
+    public List getRequest() {
+        List list = new ArrayList();
+        if (!this.rq.isEmpty())
+            list.addAll(this.rq);
+        System.out.println("RAW QUERY " + this.builder.toString());
+//        CollectionQueryProcessor tree = new CollectionQueryProcessor(this.verbose);
+//        tree.process(this.builder.toString());
+//        list.add(tree.getRequestMap());
+        return list;
+    }
+
+    public String toJSON() {
+        return JsonUtils.toJSON(getRequest());
+    }
+
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java
new file mode 100644
index 0000000..2f90f57
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java
@@ -0,0 +1,95 @@
+package de.ids_mannheim.korap.utils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 04/12/2013
+ */
+public class CollectionTypes {
+
+    private ObjectMapper mapper;
+
+    public CollectionTypes() {
+        this.mapper = new ObjectMapper();
+    }
+
+    public Map createGroup(String relation, String field, List terms) {
+        if (relation == null)
+            return null;
+
+        Map kgroup = new LinkedHashMap<>();
+        kgroup.put("@type", "korap:group");
+        if (field != null)
+            kgroup.put("@field", "korap:field#" + field);
+        kgroup.put("relation", relation);
+        kgroup.put("operands", terms);
+        return kgroup;
+    }
+
+    public Map createTerm(String field, String subtype, String value, String type) {
+        Map term = new LinkedHashMap<>();
+        if (type == null)
+            type = "korap:term";
+        term.put("@type", type);
+        if (field != null)
+            term.put("@field", "korap:field#" + field);
+        if (subtype != null)
+            term.put("@subtype", "korap:value#" + subtype);
+        term.put("@value", value);
+        return term;
+    }
+
+    public Map createTerm(String field, String value, String type) {
+        return createTerm(field, null, value, type);
+    }
+
+    public Map createTerm(String field, String value) {
+        return createTerm(field, value, null);
+    }
+
+    public Map createResourceFilter(String resource, Map value) {
+        Map meta = new LinkedHashMap();
+        meta.put("@type", "korap:meta-filter");
+        meta.put("@id", "korap-filter#" + resource);
+        meta.put("@value", value);
+        return meta;
+    }
+
+    public Map createResourceFilter(String resource, String value) throws IOException {
+        return createResourceFilter(resource, mapify(value));
+    }
+
+    public Map createResourceExtend(String resource, Map value) {
+        Map meta = new LinkedHashMap();
+        meta.put("@type", "korap:meta-extend");
+        meta.put("@id", "korap-filter#" + resource);
+        meta.put("@value", value);
+        return meta;
+    }
+
+    public Map createMetaFilter(Map value) {
+        Map meta = new LinkedHashMap();
+        meta.put("@type", "korap:meta-filter");
+        meta.put("@value", value);
+        return meta;
+    }
+
+    public Map createMetaExtend(Map value) {
+        Map meta = new LinkedHashMap();
+        meta.put("@type", "korap:meta-extend");
+        meta.put("@value", value);
+        return meta;
+    }
+
+
+    public Map mapify(String s) throws IOException {
+        return mapper.readValue(s, Map.class);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java b/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java
new file mode 100644
index 0000000..5bb811e
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java
@@ -0,0 +1,132 @@
+package de.ids_mannheim.korap.utils;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.MapMaker;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+
+import com.google.common.collect.Sets;
+
+import java.util.Collection;
+import java.util.Set;
+
+
+/**
+ * A general purpose Multimap implementation for delayed processing and concurrent insertion/deletes.
+ * This code is based on an implementation by Guido Medina!
+ *
+ * @param <K> A comparable Key
+ * @param <V> A comparable Value
+ */
+
+/**
+ * User: hanl
+ * Date: 8/27/13
+ * Time: 11:18 AM
+ */
+
+public class ConcurrentMultiMap<K extends Comparable, V extends Comparable> {
+
+    private final int initialCapacity;
+    private final LockMap<K> locks;
+    private final ConcurrentMap<K, List<V>> cache;
+
+    public ConcurrentMultiMap() {
+        this(16, 64);
+    }
+
+    public ConcurrentMultiMap(final int concurrencyLevel) {
+        this(concurrencyLevel, 64);
+    }
+
+    public ConcurrentMultiMap(final int concurrencyLevel, final int initialCapacity) {
+        this.initialCapacity = initialCapacity;
+        cache = new MapMaker().concurrencyLevel(concurrencyLevel).initialCapacity(initialCapacity).makeMap();
+        locks = new LockMap<K>(concurrencyLevel, initialCapacity);
+    }
+
+    public void put(final K key, final V value) {
+        synchronized (locks.getLock(key)) {
+            List<V> set = cache.get(key);
+            if (set == null) {
+                set = Lists.newArrayListWithExpectedSize(initialCapacity);
+                cache.put(key, set);
+            }
+            set.add(value);
+        }
+    }
+
+    public void putAll(final K key, final Collection<V> values) {
+        synchronized (locks.getLock(key)) {
+            List<V> set = cache.get(key);
+            if (set == null) {
+                set = Lists.newArrayListWithExpectedSize(initialCapacity);
+                cache.put(key, set);
+            }
+            set.addAll(values);
+        }
+    }
+
+    public List<V> remove(final K key) {
+        synchronized (locks.getLock(key)) {
+            return cache.remove(key);
+        }
+    }
+
+
+    public void remove(final K key, final V value) {
+        List<V> values = cache.get(key);
+        synchronized (locks.getLock(key)) {
+            values.remove(value);
+        }
+    }
+
+
+    public Set<K> getKeySet() {
+        return cache.keySet();
+    }
+
+    public int size() {
+        return cache.size();
+    }
+
+    public boolean containsKey(K key) {
+        return cache.containsKey(key);
+    }
+
+    public List<V> get(K key) {
+        return cache.get(key);
+    }
+
+
+    public class LockMap<K extends Comparable> {
+        private final ConcurrentMap<K, Object> locks;
+
+        public LockMap() {
+            this(16, 64);
+        }
+
+        public LockMap(final int concurrencyLevel) {
+            this(concurrencyLevel, 64);
+        }
+
+        public LockMap(final int concurrencyLevel, final int initialCapacity) {
+            locks = new MapMaker().concurrencyLevel(concurrencyLevel).initialCapacity(initialCapacity).weakValues().makeMap();
+        }
+
+        public Object getLock(final K key) {
+            final Object object = new Object();
+            Object lock = locks.putIfAbsent(key, object);
+            return lock == null ? object : lock;
+        }
+
+    }
+
+
+    public String toString() {
+        return cache.toString();
+    }
+
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
new file mode 100644
index 0000000..85c7e3e
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
@@ -0,0 +1,93 @@
+package de.ids_mannheim.korap.utils;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 28/01/2014
+ */
+public class JsonUtils {
+    private static ObjectMapper mapper = new ObjectMapper();
+
+    private JsonUtils() {
+    }
+
+    public static String toJSON(Object values) {
+        try {
+            return mapper.writeValueAsString(values);
+        }catch (JsonProcessingException e) {
+            return "";
+        }
+    }
+
+    public static JsonNode readTree(String s) {
+        try {
+            return mapper.readTree(s);
+        }catch (IOException e) {
+            return null;
+        }
+    }
+
+    public static ObjectNode createObjectNode() {
+        return mapper.createObjectNode();
+    }
+
+    public static ArrayNode createArrayNode() {
+        return mapper.createArrayNode();
+    }
+
+    public static JsonNode valueToTree(Object value) {
+        return mapper.valueToTree(value);
+    }
+
+    public static <T> T read(String json, Class<T> cl) throws IOException {
+        return mapper.readValue(json, cl);
+    }
+
+    public static <T> T readFile(String path, Class<T> clazz)
+            throws IOException {
+        return mapper.readValue(new File(path), clazz);
+    }
+
+    public static void writeFile(String path, String content) throws IOException {
+        mapper.writeValue(new File(path), content);
+    }
+
+    public static <T> T readSimple(String json, Class<T> cl) {
+        try {
+            return mapper.readValue(json, cl);
+        }catch (IOException e) {
+            return null;
+        }
+    }
+
+    public static List<Map<String, Object>> convertToList(String json)
+            throws JsonProcessingException {
+        List d = new ArrayList();
+        JsonNode node = JsonUtils.readTree(json);
+        if (node.isArray()) {
+            Iterator<JsonNode> nodes = node.iterator();
+            while (nodes.hasNext()) {
+                Map<String, Object> map = mapper
+                        .treeToValue(nodes.next(), Map.class);
+                d.add(map);
+            }
+        }else if (node.isObject()) {
+            Map<String, Object> map = mapper.treeToValue(node, Map.class);
+            d.add(map);
+        }
+        return d;
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/KorAPLogger.java b/src/main/java/de/ids_mannheim/korap/utils/KorAPLogger.java
new file mode 100644
index 0000000..5fc876f
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/KorAPLogger.java
@@ -0,0 +1,373 @@
+package de.ids_mannheim.korap.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+
+/**
+ * @author hanl
+ * @date 28/03/2014
+ */
+
+public class KorAPLogger implements Logger {
+    // debugging flag, info, warn, error will always be logged though!
+    public static boolean DEBUG = false;
+
+    public static final String ERROR_LOG = "errorLog";
+    public static final String SECURITY_LOG = "securityLog";
+
+    //fixme:
+    public static final KorAPLogger ERROR_LOGGER = KorAPLogger
+            .initiate(ERROR_LOG);
+    public static final KorAPLogger QUERY_LOGGER = KorAPLogger.initiate("ql");
+
+    @Deprecated
+    public static final KorAPLogger SECURITY_LOGGER = KorAPLogger
+            .initiate("security");
+    private Logger log;
+
+    public static KorAPLogger initiate(Class cl) {
+        KorAPLogger l = new KorAPLogger();
+        l.log = LoggerFactory.getLogger(cl);
+        return l;
+    }
+
+    public static KorAPLogger initiate(String name) {
+        KorAPLogger l = new KorAPLogger();
+        l.log = LoggerFactory.getLogger(name);
+        return l;
+    }
+
+    private KorAPLogger() {
+    }
+
+    @Override
+    public String getName() {
+        return log.getName();
+    }
+
+    @Override
+    public boolean isTraceEnabled() {
+        return log.isTraceEnabled();
+    }
+
+    @Override
+    public void trace(String s) {
+        if (DEBUG)
+            this.log.trace(s);
+
+    }
+
+    @Override
+    public void trace(String s, Object o) {
+        if (DEBUG)
+            this.log.trace(s, o);
+    }
+
+    @Override
+    public void trace(String s, Object o, Object o2) {
+        if (DEBUG)
+            this.log.trace(s, o, o2);
+    }
+
+    @Override
+    public void trace(String s, Object... objects) {
+        if (DEBUG)
+            this.log.trace(s, objects);
+    }
+
+    @Override
+    public void trace(String s, Throwable throwable) {
+        if (DEBUG)
+            this.log.trace(s, throwable);
+    }
+
+    @Override
+    public boolean isTraceEnabled(Marker marker) {
+        if (DEBUG)
+            return true;
+        return false;
+    }
+
+    @Override
+    public void trace(Marker marker, String s) {
+        if (DEBUG)
+            this.log.trace(marker, s);
+    }
+
+    @Override
+    public void trace(Marker marker, String s, Object o) {
+        if (DEBUG)
+            this.log.trace(marker, s, o);
+    }
+
+    @Override
+    public void trace(Marker marker, String s, Object o, Object o2) {
+        if (DEBUG)
+            this.log.trace(marker, s, o, o2);
+    }
+
+    @Override
+    public void trace(Marker marker, String s, Object... objects) {
+        if (DEBUG)
+            this.log.trace(marker, s, objects);
+    }
+
+    @Override
+    public void trace(Marker marker, String s, Throwable throwable) {
+        if (DEBUG)
+            this.log.trace(marker, s, throwable);
+    }
+
+    @Override
+    public boolean isDebugEnabled() {
+        if (DEBUG)
+            return true;
+        return false;
+    }
+
+    @Override
+    public void debug(String s) {
+        if (DEBUG)
+            this.log.debug(s);
+    }
+
+    @Override
+    public void debug(String s, Object o) {
+        if (DEBUG)
+            this.log.debug(s, o);
+    }
+
+    @Override
+    public void debug(String s, Object o, Object o2) {
+        if (DEBUG)
+            this.log.debug(s, o, o2);
+    }
+
+    @Override
+    public void debug(String s, Object... objects) {
+        if (DEBUG)
+            this.log.debug(s);
+    }
+
+    @Override
+    public void debug(String s, Throwable throwable) {
+        if (DEBUG)
+            this.log.debug(s, throwable);
+    }
+
+    @Override
+    public boolean isDebugEnabled(Marker marker) {
+        return this.log.isDebugEnabled(marker);
+    }
+
+    @Override
+    public void debug(Marker marker, String s) {
+        if (DEBUG)
+            this.log.debug(marker, s);
+    }
+
+    @Override
+    public void debug(Marker marker, String s, Object o) {
+        if (DEBUG)
+            this.log.debug(marker, s, o);
+    }
+
+    @Override
+    public void debug(Marker marker, String s, Object o, Object o2) {
+        if (DEBUG)
+            this.log.debug(marker, s, o, o2);
+    }
+
+    @Override
+    public void debug(Marker marker, String s, Object... objects) {
+        if (DEBUG)
+            this.log.debug(marker, s, objects);
+    }
+
+    @Override
+    public void debug(Marker marker, String s, Throwable throwable) {
+        if (DEBUG)
+            this.log.debug(marker, s, throwable);
+    }
+
+    @Override
+    public boolean isInfoEnabled() {
+        return this.log.isInfoEnabled();
+    }
+
+    @Override
+    public void info(String s) {
+        this.log.info(s);
+    }
+
+    @Override
+    public void info(String s, Object o) {
+        this.log.info(s, o);
+    }
+
+    @Override
+    public void info(String s, Object o, Object o2) {
+        this.log.info(s, o, o2);
+    }
+
+    @Override
+    public void info(String s, Object... objects) {
+        this.log.info(s, objects);
+    }
+
+    @Override
+    public void info(String s, Throwable throwable) {
+        this.log.info(s, throwable);
+    }
+
+    @Override
+    public boolean isInfoEnabled(Marker marker) {
+        return this.log.isInfoEnabled(marker);
+    }
+
+    @Override
+    public void info(Marker marker, String s) {
+        this.log.info(marker, s);
+    }
+
+    @Override
+    public void info(Marker marker, String s, Object o) {
+        this.log.info(marker, s, o);
+    }
+
+    @Override
+    public void info(Marker marker, String s, Object o, Object o2) {
+        this.log.info(marker, s, o, o2);
+    }
+
+    @Override
+    public void info(Marker marker, String s, Object... objects) {
+        this.log.info(marker, s, objects);
+    }
+
+    @Override
+    public void info(Marker marker, String s, Throwable throwable) {
+        this.log.info(marker, s, throwable);
+    }
+
+    @Override
+    public boolean isWarnEnabled() {
+        return this.log.isWarnEnabled();
+    }
+
+    @Override
+    public void warn(String s) {
+        this.log.warn(s);
+    }
+
+    @Override
+    public void warn(String s, Object o) {
+        this.log.warn(s, o);
+    }
+
+    @Override
+    public void warn(String s, Object... objects) {
+        this.log.warn(s, objects);
+    }
+
+    @Override
+    public void warn(String s, Object o, Object o2) {
+        this.log.warn(s, o, o2);
+    }
+
+    @Override
+    public void warn(String s, Throwable throwable) {
+        this.log.warn(s, throwable);
+    }
+
+    @Override
+    public boolean isWarnEnabled(Marker marker) {
+        return this.log.isTraceEnabled(marker);
+    }
+
+    @Override
+    public void warn(Marker marker, String s) {
+        this.log.warn(marker, s);
+    }
+
+    @Override
+    public void warn(Marker marker, String s, Object o) {
+        this.log.warn(marker, s, o);
+    }
+
+    @Override
+    public void warn(Marker marker, String s, Object o, Object o2) {
+        this.log.warn(marker, s, o, o2);
+    }
+
+    @Override
+    public void warn(Marker marker, String s, Object... objects) {
+        this.log.warn(marker, s, objects);
+    }
+
+    @Override
+    public void warn(Marker marker, String s, Throwable throwable) {
+        this.log.warn(marker, s, throwable);
+    }
+
+    @Override
+    public boolean isErrorEnabled() {
+        return this.log.isErrorEnabled();
+    }
+
+    @Override
+    public void error(String s) {
+        this.log.error(s);
+    }
+
+    @Override
+    public void error(String s, Object o) {
+        this.log.error(s, o);
+    }
+
+    @Override
+    public void error(String s, Object o, Object o2) {
+        this.log.error(s, o, o2);
+    }
+
+    @Override
+    public void error(String s, Object... objects) {
+        this.log.error(s, objects);
+    }
+
+    @Override
+    public void error(String s, Throwable throwable) {
+        this.log.error(s, throwable);
+    }
+
+    @Override
+    public boolean isErrorEnabled(Marker marker) {
+        return this.log.isErrorEnabled(marker);
+    }
+
+    @Override
+    public void error(Marker marker, String s) {
+        this.log.error(marker, s);
+    }
+
+    @Override
+    public void error(Marker marker, String s, Object o) {
+        this.log.error(marker, s, o);
+    }
+
+    @Override
+    public void error(Marker marker, String s, Object o, Object o2) {
+        this.log.error(marker, s, o, o2);
+    }
+
+    @Override
+    public void error(Marker marker, String s, Object... objects) {
+        this.log.error(marker, s, objects);
+    }
+
+    @Override
+    public void error(Marker marker, String s, Throwable throwable) {
+        this.log.error(marker, s, throwable);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java b/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java
new file mode 100644
index 0000000..493a574
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java
@@ -0,0 +1,46 @@
+package de.ids_mannheim.korap.utils;
+
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author hanl
+ * @date 01/07/2014
+ */
+public class PrefixTreeMap<V> extends TreeMap<String, V> {
+
+
+    public SortedMap<String, V> getPrefixSubMap(String prefix) {
+        if (prefix.length() > 0) {
+            SortedMap d = this.subMap(prefix, getEnd(prefix));
+            if (d.isEmpty())
+                return null;
+            return d;
+        }
+        return null;
+    }
+
+    private String getEnd(String prefix) {
+        char nextLetter = (char) (prefix.charAt(prefix.length() - 1) + 1);
+        return prefix.substring(0, prefix.length() - 1) + nextLetter;
+
+    }
+
+    public V getFirstValue(String prefix) {
+        if (prefix.length() > 0) {
+            String first = this.subMap(prefix, getEnd(prefix)).firstKey();
+            return this.get(first);
+        }
+        return null;
+    }
+
+    public V getLastValue(String prefix) {
+        if (prefix.length() > 0) {
+            String last = this.subMap(prefix, getEnd(prefix)).lastKey();
+            return this.get(last);
+        }
+        return null;
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
new file mode 100644
index 0000000..a7120aa
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
@@ -0,0 +1,191 @@
+package de.ids_mannheim.korap.utils;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.slf4j.Logger;
+
+import java.util.*;
+
+public class StringUtils {
+    private final static Logger jlog = KorAPLogger.initiate(StringUtils.class);
+
+    private static final String SLASH = "/";
+    private static final String SEP = ";";
+
+    public static Collection<UUID> stringToUUIDList(String s) {
+        String[] array = s.split(SEP);
+        List<UUID> list = new LinkedList<>();
+        for (String att : array) {
+            list.add(UUID.fromString(att));
+        }
+        return list;
+    }
+
+    public static List<String> toList(String values) {
+        List<String> list = new ArrayList<>();
+        StringTokenizer tokenizer = new StringTokenizer(values, SEP);
+        while (tokenizer.hasMoreTokens())
+            list.add(tokenizer.nextToken());
+        return list;
+    }
+
+    public static Set<String> toSet(String values, String sep) {
+        Set<String> set = new HashSet<>();
+        StringTokenizer tokenizer = new StringTokenizer(values, sep);
+        while (tokenizer.hasMoreTokens())
+            set.add(tokenizer.nextToken());
+        return set;
+    }
+
+    public static Set<String> toSet(String values) {
+        return toSet(values, SEP);
+    }
+
+    public static String toString(Collection<String> values) {
+        return StringUtils.toString(values, SEP);
+    }
+
+    public static String toString(Collection<String> values, String sep) {
+        StringBuffer b = new StringBuffer();
+        for (String s : values)
+            b.append(s).append(sep);
+
+        if (b.length() > 0)
+            b.deleteCharAt(b.length() - 1);
+        return b.toString();
+    }
+
+    public static String orderedToString(Collection<String> hash) {
+        Set<String> orderedSet = new TreeSet<>();
+        orderedSet.addAll(hash);
+        if (orderedSet.isEmpty()) {
+            return "";
+        }else {
+            StringBuilder builder = new StringBuilder();
+            for (String s : orderedSet) {
+                builder.append(s);
+                builder.append(SEP);
+            }
+            builder.deleteCharAt(builder.length() - 1);
+            return builder.toString();
+        }
+    }
+
+    public static String UUIDsetToString(Collection<UUID> hash) {
+        Set<UUID> orderedSet = new TreeSet<>();
+        orderedSet.addAll(hash);
+        if (orderedSet.isEmpty()) {
+            return "";
+        }else {
+            StringBuilder builder = new StringBuilder();
+            for (UUID s : orderedSet) {
+                builder.append(s);
+                builder.append(SEP);
+            }
+            builder.deleteCharAt(builder.length() - 1);
+            return builder.toString();
+        }
+    }
+
+    public static String buildSQLRegex(String path) {
+        StringBuilder b = new StringBuilder();
+        String[] match = path.split("/");
+        b.append(match[0]);
+        b.append("(" + "/" + match[1] + ")");
+        b.append("*$");
+        return b.toString();
+    }
+
+    public static Collection<String> joinStringSet(Collection<String> source,
+            String other) {
+        Set<String> set = new HashSet<>(source);
+        set.add(other);
+        return set;
+    }
+
+    public static Collection<UUID> joinUUIDSet(Collection<UUID> source,
+            UUID other) {
+        Set<UUID> set = new HashSet<>(source);
+        set.add(other);
+        return set;
+    }
+
+    public static String joinResources(String first, String second) {
+        String res;
+        if (first != null && !first.isEmpty())
+            res = first + SLASH + second;
+        else
+            res = second;
+        return res.replaceAll("\\s", "");
+    }
+
+    public static String[] splitAnnotations(String joined) {
+        String[] spl = joined.split(SLASH);
+        if (spl.length == 2)
+            return spl;
+        else
+            return null;
+    }
+
+    public static String stripTokenType(String token) {
+        int idx = token.lastIndexOf(" ");
+        if (idx == -1)
+            return token;
+        return token.substring(idx).replaceAll("\\s", "");
+    }
+
+    public static String getTokenType(String token) {
+        return token.substring(0, token.lastIndexOf(" ")).replaceAll("\\s", "")
+                .toLowerCase();
+    }
+
+    public static boolean isInteger(String value) {
+        try {
+            Integer.valueOf(value);
+            return true;
+        }catch (IllegalArgumentException e) {
+            // do nothing!
+            return false;
+        }
+    }
+
+    public static String normalize(String value) {
+        return value.trim().toLowerCase();
+    }
+
+    public static String normalizeHTML(String value) {
+        return StringEscapeUtils.escapeHtml4(value);
+    }
+
+    public static String decodeHTML(String value) {
+        return StringEscapeUtils.unescapeHtml4(value);
+    }
+
+    /**
+     * constructs a lucene query from query string and corpus parameters as set
+     *
+     * @param query
+     * @param corpusIDs
+     * @return
+     */
+    public static String queryBuilder(String query,
+            Collection<String> corpusIDs) {
+        String completeQuery; // holds original query and corpus
+        // selection
+        /**
+         * find documents with metadataquery TODO: does not intercept with
+         * parameters foundries and corpusIDs
+         */
+
+        /* add corpus ids to corpus query */
+        StringBuilder corpusQuery = new StringBuilder("corpus:/(");
+        for (String corpusId : corpusIDs) {
+            corpusQuery.append(corpusId + "|");
+        }
+        corpusQuery.deleteCharAt(corpusQuery.length() - 1);
+        corpusQuery.append(")/");
+        completeQuery = "(" + query + ") AND " + corpusQuery.toString();
+        jlog.debug("Searching documents matching '" + completeQuery + "'.");
+        return completeQuery;
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
new file mode 100644
index 0000000..b4f1d30
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
@@ -0,0 +1,207 @@
+package de.ids_mannheim.korap.utils;
+
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
+import org.slf4j.Logger;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author hanl
+ *         <p/>
+ *         calculates current, expiration and inactive time for security
+ *         purposes.
+ * @return
+ */
+public class TimeUtils {
+
+    private static DecimalFormat df = new DecimalFormat("#.#############");
+    private static final DateTimeZone dtz = DateTimeZone.forID("Europe/Berlin");
+    private static Logger jlog = KorAPLogger.initiate(TimeUtils.class);
+
+    public static int convertTimeToSeconds(String expirationVal) {
+        expirationVal = expirationVal.trim();
+        int finIndex = expirationVal.length() - 1;
+        char entity = expirationVal.charAt(finIndex);
+        int returnSec = Integer.valueOf(expirationVal.substring(0, finIndex));
+        jlog.debug("setting time value to {} with time in {}", returnSec,
+                entity);
+        switch (entity) {
+            case 'D':
+                return returnSec * 60 * 60 * 24;
+            case 'H':
+                return returnSec * 60 * 60;
+            case 'M':
+                return returnSec * 60;
+            case 'S':
+                return returnSec;
+            default:
+                jlog.debug(
+                        "no time unit specified. Trying to read from default (minutes)");
+                return Integer.valueOf(expirationVal) * 60;
+        }
+
+    }
+
+    //todo: time zone is wrong!
+    public static DateTime getNow() {
+        return DateTime.now().withZone(dtz);
+    }
+
+    //returns difference in milliseconds
+    public static long calcDiff(DateTime now, DateTime future) {
+        long diff = (future.withZone(dtz).getMillis() - now.withZone(dtz)
+                .getMillis());
+        return diff;
+    }
+
+    public static boolean isPassed(long time) {
+        return getNow().isAfter(time);
+
+    }
+
+    public static boolean isPassed(DateTime time) {
+        return isPassed(time.getMillis());
+    }
+
+    // returns difference in seconds in floating number
+    public static float floating(DateTime past, DateTime now) {
+        long diff = (now.withZone(dtz).getMillis() - past.withZone(dtz)
+                .getMillis());
+        double fin = diff / 1000.0;
+        BigDecimal bd = new BigDecimal(fin).setScale(8, RoundingMode.HALF_EVEN);
+        return bd.floatValue();
+    }
+
+    public static DateTime fromCosmas(String date) {
+        int idx = date.length();
+        try {
+            Integer sec = Integer.valueOf(
+                    date.substring((idx = idx - 2), date.length()).trim());
+            Integer min = Integer
+                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
+            Integer hours = Integer
+                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
+            Integer day = Integer
+                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
+            Integer month = Integer
+                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
+            Integer year = Integer
+                    .valueOf(date.substring((idx = idx - 4), idx + 4).trim());
+            return new DateTime(year, month, day, hours, min, sec);
+        }catch (NumberFormatException e) {
+            return getNow().toDateTime();
+        }
+    }
+
+    public static String formatDiff(DateTime now, DateTime after) {
+        return df.format(calcDiff(now, after));
+    }
+
+    /**
+     * converts time to the ISO8601 standard.
+     *
+     * @param time
+     * @return
+     */
+    public static String format(DateTime time) {
+        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
+        return fmt.print(time);
+    }
+
+    public static String format(long time) {
+        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
+        return fmt.print(time);
+    }
+
+    /**
+     * calculate expiration time
+     *
+     * @param creation
+     * @param plus     time in seconds
+     * @return
+     */
+    public static DateTime plusSeconds(long creation, int plus) {
+        return new DateTime(creation).withZone(dtz).plusSeconds(plus);
+    }
+
+    public static DateTime getExpiration(long now, int exp) {
+        return new DateTime(now).withZone(dtz).plusSeconds(exp);
+    }
+
+    /**
+     * @param plus
+     * @return
+     */
+    public static DateTime plusSeconds(int plus) {
+        return getNow().withZone(dtz).plusSeconds(plus);
+    }
+
+    public static DateTime plusHours(int hours) {
+        return getNow().withZone(dtz).plusHours(hours);
+    }
+
+    public static DateTime plusMinutes(int minutes) {
+        return getNow().withZone(dtz).plusMinutes(minutes);
+    }
+
+    /**
+     * create time stamp from long value
+     *
+     * @param t time
+     * @return Timestamp
+     */
+    public static LocalDate getTimeStamp(long t) {
+        return new DateTime(t).withZone(dtz).toLocalDate();
+    }
+
+    public static DateTime getDate(int day, int month, int year) {
+        DateTime date = new DateTime().withZone(dtz);
+        return date.withDate(year, month, day);
+    }
+
+    public static String toString(long val, Locale locale) {
+        if (locale == Locale.GERMAN)
+            return new DateTime(val)
+                    .toString("dd. MMMM yyyy, HH:mm", Locale.GERMAN);
+        else
+            return new DateTime(val)
+                    .toString("MM-dd-yyyy, hh:mm", Locale.ENGLISH);
+
+    }
+
+    public static String dateToString(long val, int i) {
+        switch (i) {
+            case 1:
+                return new DateTime(val).toString("yyyy-MM");
+            case 2:
+                return new DateTime(val).toString("yyyy-MM-dd");
+            default:
+                return new DateTime(val).toString("yyyy");
+        }
+    }
+
+    private static final List<DateTime> times = new ArrayList<>();
+
+    @Deprecated
+    public static float benchmark(boolean getFinal) {
+        float value = 0;
+        times.add(getNow());
+        if (getFinal && times.size() > 1) {
+            value = floating(times.get(0), times.get(times.size() - 1));
+            times.clear();
+        }else if (times.size() > 1)
+            value = floating(times.get(times.size() - 2),
+                    times.get(times.size() - 1));
+        return value;
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/.DS_Store b/src/main/java/de/ids_mannheim/korap/web/.DS_Store
new file mode 100644
index 0000000..32f11f9
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/.DS_Store
Binary files differ
diff --git a/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java b/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
new file mode 100644
index 0000000..8b846eb
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
@@ -0,0 +1,52 @@
+package de.ids_mannheim.korap.web;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.UniformInterfaceException;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.net.URI;
+
+/**
+ * @author hanl
+ * @date 10/12/2013
+ */
+// use for Piotr Ps. rest api connection
+public class ClientsHandler {
+
+    private WebResource service;
+
+    public ClientsHandler(URI address) {
+        ClientConfig config = new DefaultClientConfig();
+        Client client = Client.create(config);
+        this.service = client.resource(address);
+    }
+
+    public String getResponse(String path, String key, Object value) throws KorAPException {
+        MultivaluedMap map = new MultivaluedMapImpl();
+        map.add(key, value);
+        try {
+            return service.path(path).queryParams(map).get(String.class);
+        } catch (UniformInterfaceException e) {
+            throw new KorAPException(StatusCodes.REQUEST_INVALID);
+        }
+    }
+
+    public String getResponse(MultivaluedMap map, String... paths) throws KorAPException {
+        try {
+            WebResource resource = service;
+            for (String p : paths)
+                resource = resource.path(p);
+            resource = resource.queryParams(map);
+            return resource.get(String.class);
+        } catch (UniformInterfaceException e) {
+            throw new KorAPException(StatusCodes.REQUEST_INVALID);
+        }
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/Kustvakt.java b/src/main/java/de/ids_mannheim/korap/web/Kustvakt.java
new file mode 100644
index 0000000..f9349e6
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/Kustvakt.java
@@ -0,0 +1,54 @@
+package de.ids_mannheim.korap.web;
+
+import com.sun.grizzly.http.embed.GrizzlyWebServer;
+import com.sun.grizzly.http.servlet.ServletAdapter;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.utils.KorAPLogger;
+
+import java.io.IOException;
+
+/**
+ * @author hanl
+ * @date 01/06/2015
+ */
+public class Kustvakt {
+
+    private static Integer PORT = -1;
+
+    public static void main(String[] args) throws Exception {
+        attributes(args);
+        BeanConfiguration.loadContext();
+        grizzlyServer(PORT);
+    }
+
+    public static void grizzlyServer(int port) throws IOException {
+        if (port == -1)
+            port = BeanConfiguration.getConfiguration().getPort();
+        System.out.println("Starting grizzly on port " + port + " ...");
+        GrizzlyWebServer gws = new GrizzlyWebServer(port);
+        ServletAdapter jerseyAdapter = new ServletAdapter();
+        jerseyAdapter
+                .addInitParameter("com.sun.jersey.config.property.packages",
+                        "de.ids_mannheim.korap.web.service");
+        jerseyAdapter.setContextPath("/api");
+        jerseyAdapter.setServletInstance(new ServletContainer());
+
+        gws.addGrizzlyAdapter(jerseyAdapter, new String[] { "/api" });
+        gws.start();
+    }
+
+    private static void attributes(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            switch ((args[i])) {
+                case "--debug":
+                    KorAPLogger.DEBUG = true;
+                    break;
+                case "--port":
+                    PORT = Integer.valueOf(args[i + 1]);
+                    break;
+            }
+        }
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchLucene.java b/src/main/java/de/ids_mannheim/korap/web/SearchLucene.java
new file mode 100644
index 0000000..be19540
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchLucene.java
@@ -0,0 +1,313 @@
+// Connector to the Lucene Backend
+package de.ids_mannheim.korap.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.Krill;
+import de.ids_mannheim.korap.KrillCollection;
+import de.ids_mannheim.korap.KrillIndex;
+import de.ids_mannheim.korap.response.Match;
+import de.ids_mannheim.korap.response.Result;
+import de.ids_mannheim.korap.util.QueryException;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.KorAPLogger;
+import org.apache.lucene.store.MMapDirectory;
+import org.slf4j.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * The SearchLucene class allows for searching in the Lucene backend
+ * by JSON-LD serialized queries.
+ * It supports span queries, virtual collections, and paging.
+ *
+ * @author Nils Diewald
+ */
+public class SearchLucene {
+    private final static Logger qlog = KorAPLogger.initiate("queryLogger");
+    private final static Logger log = KorAPLogger.initiate(SearchLucene.class);
+    // Temporary
+    String indexDir = "/data/prep_corpus/index/";
+    String i = "/Users/hanl/Projects/prep_corpus";
+    String klinux10 = "/vol/work/hanl/indices";
+
+    private KrillIndex index;
+
+    /**
+     * Constructor
+     */
+    // todo: use korap.config to get index location
+    public SearchLucene(String path) {
+        try {
+            File f = new File(path);
+            log.info("Loading index from " + path);
+            if (!f.exists()) {
+                KorAPLogger.ERROR_LOGGER.error("Index not found!");
+                System.exit(-1);
+            }
+            this.index = new KrillIndex(new MMapDirectory(new File(path)));
+        }catch (IOException e) {
+            KorAPLogger.ERROR_LOGGER
+                    .error("Unable to load index: {}", e.getMessage());
+        }
+    }
+
+    /**
+     * Search in the Lucene index.
+     *
+     * @param json JSON-LD string with search and potential meta filters.
+     */
+    public String search(String json) {
+        qlog.trace(json);
+        if (this.index != null)
+            return new Krill(json).setIndex(this.index).toJsonString();
+
+        Result kr = new Result();
+        //        kr.setError("Index not found");
+        return kr.toJsonString();
+    }
+
+    ;
+
+    /**
+     * Search in the Lucene index and return matches as token lists.
+     *
+     * @param json JSON-LD string with search and potential meta filters.
+     */
+    public String searchTokenList(String json) {
+        qlog.trace(json);
+        if (this.index != null)
+            return new Krill(json).setIndex(this.index).toJsonString();
+
+        Result kr = new Result();
+        //        kr.setError("Index not found");
+        return kr.toJsonString();
+    }
+
+    ;
+
+    /**
+     * Get info on a match - by means of a richly annotated html snippet.
+     *
+     * @param id match id
+     */
+    public String getMatch(String id) {
+
+        if (this.index != null) {
+            try {
+                return this.index.getMatch(id).toJsonString();
+            }catch (QueryException qe) {
+                Match km = new Match();
+                km.setError(qe.getMessage());
+                return km.toJsonString();
+            }
+        }
+
+        Match km = new Match();
+        km.setError("Index not found");
+        return km.toJsonString();
+    }
+
+    public String getMatch(String id, List<String> foundries,
+            List<String> layers, boolean includeSpans,
+            boolean includeHighlights, boolean sentenceExpansion) {
+        if (this.index != null) {
+            try {
+
+                return this.index
+                        .getMatchInfo(id, "tokens", true, foundries, layers,
+                                includeSpans, includeHighlights,
+                                sentenceExpansion).toJsonString();
+            }catch (QueryException qe) {
+                Match km = new Match();
+                km.setError(qe.getMessage());
+                return km.toJsonString();
+            }
+        }
+
+        Match km = new Match();
+        km.setError("Index not found");
+        return km.toJsonString();
+
+    }
+
+    /**
+     * Get info on a match - by means of a richly annotated html snippet.
+     *
+     * @param id                match id
+     * @param foundry           the foundry of interest - may be null
+     * @param layer             the layer of interest - may be null
+     * @param includeSpans      Should spans be included (or only token infos)?
+     * @param includeHighlights Should highlight markup be included?
+     */
+    public String getMatch(String id, String foundry, String layer,
+            boolean includeSpans, boolean includeHighlights,
+            boolean sentenceExpansion) {
+
+        if (this.index != null) {
+            try {
+
+		/*
+          For multiple foundries/layers use
+		  String idString,
+		  "tokens",
+		  true,
+		  ArrayList<String> foundry,
+		  ArrayList<String> layer,
+		  boolean includeSpans,
+		  boolean includeHighlights,
+		  boolean extendToSentence
+		 */
+
+                return this.index.getMatchInfo(id, "tokens", foundry, layer,
+                        includeSpans, includeHighlights, sentenceExpansion)
+                        .toJsonString();
+            }catch (QueryException qe) {
+                Match km = new Match();
+                km.setError(qe.getMessage());
+                return km.toJsonString();
+            }
+        }
+
+        Match km = new Match();
+        km.setError("Index not found");
+        return km.toJsonString();
+    }
+
+    /**
+     * Get statistics on (virtual) collections.
+     *
+     * @param json JSON-LD string with potential meta filters.
+     */
+    public String getStatisticsLegacy(JsonNode json) throws QueryException {
+        qlog.trace(JsonUtils.toJSON(json));
+        System.out.println("THE NODE BEFORE GETTING STATISTICS " + json);
+
+        if (this.index == null) {
+            return "{\"documents\" : -1, error\" : \"No index given\" }";
+        }
+
+        // Create Virtula VCollection from json search
+        KrillCollection kc = new KrillCollection();
+        kc.fromJsonLegacy(json);
+
+        // Set index
+        kc.setIndex(this.index);
+
+        long docs = 0,
+                tokens = 0,
+                sentences = 0,
+                paragraphs = 0;
+
+        // Get numbers from index (currently slow)
+        try {
+            docs = kc.numberOf("documents");
+            tokens = kc.numberOf("tokens");
+            sentences = kc.numberOf("sentences");
+            paragraphs = kc.numberOf("paragraphs");
+        }catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+	/*
+    KorAPLogger.ERROR_LOGGER.error("Unable to retrieve statistics: {}", e.getMessage());
+	*/
+
+        // Build json response
+        StringBuilder sb = new StringBuilder("{");
+        sb.append("\"documents\":").append(docs).append(",\"tokens\":")
+                .append(tokens).append(",\"sentences\":").append(sentences)
+                .append(",\"paragraphs\":").append(paragraphs).append("}");
+        return sb.toString();
+    }
+
+    /**
+     * Get statistics on (virtual) collections.
+     *
+     * @param json JSON-LD string with potential meta filters.
+     */
+    public String getStatistics(String json) {
+        qlog.trace(json);
+
+        if (this.index == null) {
+            return "{\"documents\" : -1, error\" : \"No index given\" }";
+        }
+
+        // Create Virtual collection from json search
+        KrillCollection kc = new KrillCollection(json);
+
+        // Set index
+        kc.setIndex(this.index);
+
+        long docs = 0,
+                tokens = 0,
+                sentences = 0,
+                paragraphs = 0;
+
+        // Get numbers from index (currently slow)
+        try {
+            docs = kc.numberOf("documents");
+            tokens = kc.numberOf("tokens");
+            sentences = kc.numberOf("sentences");
+            paragraphs = kc.numberOf("paragraphs");
+        }catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+	/*
+    KorAPLogger.ERROR_LOGGER.error("Unable to retrieve statistics: {}", e.getMessage());
+	*/
+
+        // Build json response
+        StringBuilder sb = new StringBuilder("{");
+        sb.append("\"documents\":").append(docs).append(",\"tokens\":")
+                .append(tokens).append(",\"sentences\":").append(sentences)
+                .append(",\"paragraphs\":").append(paragraphs).append("}");
+        return sb.toString();
+    }
+
+    /**
+     * Get set relations on field terms of (virtual) collections.
+     *
+     * @param json JSON-LD string with potential meta filters.
+     */
+    public String getTermRelation(String json, String field) {
+        qlog.trace(json);
+
+        if (this.index == null) {
+            return "{\"documents\" : -1, \"error\" : \"No index given\" }";
+        }
+
+        // Create Virtula VCollection from json search
+        KrillCollection kc = new KrillCollection(json);
+
+        // Set index
+        kc.setIndex(this.index);
+        long v = 0L;
+        try {
+            v = kc.numberOf("documents");
+        }catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            // Get term relations as a json string
+            return kc.getTermRelationJSON(field);
+        }catch (IOException e) {
+            KorAPLogger.ERROR_LOGGER
+                    .error("Unable to retrieve term relations: {}",
+                            e.getMessage());
+            return "{\"documents\" : -1, \"error\" : \"IO error\" }";
+        }
+    }
+
+    public String getMatchId(String type, String docid, String tofrom) {
+        return new StringBuilder().append("contains-").append(type).append("!")
+                .append(type).append("_").append(docid).append("-")
+                .append(tofrom).toString();
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/TRACE.java b/src/main/java/de/ids_mannheim/korap/web/TRACE.java
new file mode 100644
index 0000000..e33089d
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/TRACE.java
@@ -0,0 +1,17 @@
+package de.ids_mannheim.korap.web;
+
+import javax.ws.rs.HttpMethod;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author hanl
+ * @date 03/07/2014
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@HttpMethod("TRACE")
+public @interface TRACE {
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/LightService.java
new file mode 100644
index 0000000..bd1be22
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/service/LightService.java
@@ -0,0 +1,346 @@
+package de.ids_mannheim.korap.web.service;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.graphdb.collo.ColloQuery;
+import de.ids_mannheim.korap.graphdb.collo.Dependency;
+import de.ids_mannheim.korap.query.serialize.IdWriter;
+import de.ids_mannheim.korap.query.serialize.MetaQueryBuilder;
+import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.utils.CollectionQueryBuilder;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.KorAPLogger;
+import de.ids_mannheim.korap.utils.StringUtils;
+import de.ids_mannheim.korap.web.ClientsHandler;
+import de.ids_mannheim.korap.web.SearchLucene;
+import de.ids_mannheim.korap.web.TRACE;
+import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
+import org.slf4j.Logger;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author hanl
+ * @date 29/01/2014
+ */
+@Path("v0.1" + "/")
+@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
+public class LightService {
+
+    private static Logger jlog = KorAPLogger.initiate(LightService.class);
+
+    private SearchLucene searchLucene;
+    private ClientsHandler graphDBhandler;
+
+    public LightService() {
+        this.searchLucene = new SearchLucene(
+                BeanConfiguration.getConfiguration().getIndexDir());
+        UriBuilder builder = UriBuilder.fromUri("http://10.0.10.13").port(9997);
+        this.graphDBhandler = new ClientsHandler(builder.build());
+    }
+
+    /**
+     * @param properties
+     * @param sfs
+     * @param limit
+     * @param query
+     * @param ql
+     * @param context
+     * @param foundry
+     * @param wPaths
+     * @return
+     */
+    //todo: add entry point where a json collection can be injected as well
+    @GET
+    @Path("colloc")
+    public Response getCollocationsAll(@QueryParam("props") String properties,
+            @QueryParam("sfskip") Integer sfs,
+            @QueryParam("sflimit") Integer limit, @QueryParam("q") String query,
+            @QueryParam("ql") String ql, @QueryParam("context") Integer context,
+            @QueryParam("foundry") String foundry,
+            @QueryParam("paths") Boolean wPaths) {
+        ColloQuery.ColloQueryBuilder builder;
+        String result;
+        try {
+            builder = new ColloQuery.ColloQueryBuilder();
+            QuerySerializer s = new QuerySerializer().setQuery(query, ql);
+            //todo: fix collectionbuilder
+            //        s.setDeprCollection(builder);
+            IdWriter writer = new IdWriter(s.toJSON()).process();
+            List collprops = JsonUtils.convertToList(properties);
+
+            if (context != null)
+                builder.context(context).collocateProps(collprops);
+            if (limit != null)
+                builder.surfaceLimit(limit);
+            if (sfs != null)
+                builder.surfaceSkip(sfs);
+            if (foundry != null)
+                builder.foundry(foundry);
+            builder.nodeQueryJS(writer.toJSON())
+                    .dep(new ArrayList<Dependency>()).withPaths(wPaths);
+
+            result = graphDBhandler
+                    .getResponse("distCollo", "q", builder.build().toJSON());
+        }catch (KorAPException e) {
+            throw KustvaktResponseHandler.throwit(e);
+        }catch (JsonProcessingException e) {
+            throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT);
+        }
+        return Response.ok(result).build();
+    }
+
+    @POST
+    @Path("colloc")
+    public Response getCollocatioBase(@QueryParam("q") String query) {
+        String result;
+        try {
+            result = graphDBhandler.getResponse("distCollo", "q", query);
+        }catch (KorAPException e) {
+            throw KustvaktResponseHandler.throwit(e);
+        }
+        return Response.ok(result).build();
+    }
+
+    public Response postMatchFavorite() {
+        return Response.ok().build();
+    }
+
+    @TRACE
+    @Path("search")
+    public Response buildQuery(@QueryParam("q") String q,
+            @QueryParam("ql") String ql, @QueryParam("v") String v,
+            @QueryParam("context") String context,
+            @QueryParam("cutoff") Boolean cutoff,
+            @QueryParam("count") Integer pageLength,
+            @QueryParam("offset") Integer pageIndex,
+            @QueryParam("page") Integer startPage,
+            @QueryParam("ref") String reference, @QueryParam("cq") String cq) {
+        QuerySerializer ss = new QuerySerializer().setQuery(q, ql, v);
+
+        MetaQueryBuilder meta = new MetaQueryBuilder();
+        if (pageIndex != null)
+            meta.addEntry("startIndex", pageIndex);
+        if (pageIndex == null && startPage != null)
+            meta.addEntry("startPage", startPage);
+        if (pageLength != null)
+            meta.addEntry("count", pageLength);
+        if (context != null)
+            meta.setSpanContext(context);
+        meta.addEntry("cutOff", cutoff);
+        ss.addMeta(meta);
+        //todo: test this
+        ss.setCollection(cq);
+        return Response.ok(ss.toJSON()).build();
+    }
+
+    @POST
+    @Path("search")
+    public Response queryRaw(@QueryParam("engine") String engine,
+            String jsonld) {
+        KustvaktConfiguration.BACKENDS eng = BeanConfiguration
+                .getConfiguration().chooseBackend(engine);
+
+        // todo: should be possible to add the meta part to the query serialization
+        jlog.info("Serialized search: {}", jsonld);
+
+        // todo: Security Parsing and rewrite
+        // fixme: to use the systemarchitecture pointcut thingis, searchlucene must be injected via
+        String result = searchLucene.search(jsonld);
+        KorAPLogger.QUERY_LOGGER.trace("The result set: {}", result);
+        return Response.ok(result).build();
+    }
+
+    @GET
+    @Path("search")
+    public Response searchbyNameAll(@Context SecurityContext securityContext,
+            @QueryParam("q") String q, @QueryParam("ql") String ql,
+            @QueryParam("v") String v, @QueryParam("context") String ctx,
+            @QueryParam("cutoff") Boolean cutoff,
+            @QueryParam("count") Integer pageLength,
+            @QueryParam("offset") Integer pageIndex,
+            @QueryParam("page") Integer pageInteger,
+            @QueryParam("cq") String cq, @QueryParam("engine") String engine) {
+        KustvaktConfiguration.BACKENDS eng = BeanConfiguration
+                .getConfiguration().chooseBackend(engine);
+
+        String result;
+        QuerySerializer serializer = new QuerySerializer().setQuery(q, ql, v);
+        MetaQueryBuilder meta = new MetaQueryBuilder();
+        meta.fillMeta(pageIndex, pageInteger, pageLength, ctx, cutoff);
+        // fixme: should only apply to CQL queries per default!
+        //        meta.addEntry("itemsPerResource", 1);
+        serializer.addMeta(meta);
+
+        // policy rewrite!
+        String query = serializer.toJSON();
+        jlog.info("the serialized query {}", query);
+
+        if (eng.equals(KustvaktConfiguration.BACKENDS.NEO4J)) {
+            MultivaluedMap map = new MultivaluedMapImpl();
+            map.add("q", query);
+            map.add("count", String.valueOf(pageLength));
+            map.add("lctxs",
+                    String.valueOf(meta.getSpanContext().getLeft_size()));
+            map.add("rctxs",
+                    String.valueOf(meta.getSpanContext().getRight_size()));
+            try {
+                result = this.graphDBhandler.getResponse(map, "distKwic");
+            }catch (KorAPException e) {
+                throw KustvaktResponseHandler.throwit(e);
+            }
+        }else
+            result = searchLucene.search(query);
+        KorAPLogger.QUERY_LOGGER.trace("The result set: {}", result);
+        return Response.ok(result).build();
+    }
+
+    /**
+     * param context will be like this: context: "3-t,2-c"
+     * <p/>
+     * id does not have to be an integer. name is also possible, in which case a type reference is required
+     *
+     * @param query
+     * @param ql
+     * @param v
+     * @param ctx
+     * @param cutoff
+     * @param pageLength
+     * @param pageIndex
+     * @param pageInteger
+     * @param id
+     * @param type
+     * @param cq
+     * @param raw
+     * @param engine
+     * @return
+     */
+    //fixme: does not use policyrewrite!
+    @GET
+    @Path("/{type}/{id}/search")
+    public Response searchbyName(@QueryParam("q") String query,
+            @QueryParam("ql") String ql, @QueryParam("v") String v,
+            @QueryParam("context") String ctx,
+            @QueryParam("cutoff") Boolean cutoff,
+            @QueryParam("count") Integer pageLength,
+            @QueryParam("offset") Integer pageIndex,
+            @QueryParam("page") Integer pageInteger, @PathParam("id") String id,
+            @PathParam("type") String type, @QueryParam("cq") String cq,
+            @QueryParam("raw") Boolean raw,
+            @QueryParam("engine") String engine) {
+        // ref is a virtual collection id!
+        KustvaktConfiguration.BACKENDS eng = BeanConfiguration
+                .getConfiguration().chooseBackend(engine);
+        raw = raw == null ? false : raw;
+        MetaQueryBuilder meta = new MetaQueryBuilder();
+        if (!raw) {
+            QuerySerializer s = new QuerySerializer().setQuery(query, ql, v);
+            meta.fillMeta(pageIndex, pageInteger, pageLength, ctx, cutoff);
+            // should only apply to CQL queries
+            //                meta.addEntry("itemsPerResource", 1);
+            s.addMeta(meta);
+            query = s.toJSON();
+        }
+        String result;
+        try {
+            if (eng.equals(KustvaktConfiguration.BACKENDS.NEO4J)) {
+                if (raw)
+                    throw KustvaktResponseHandler
+                            .throwit(StatusCodes.ILLEGAL_ARGUMENT,
+                                    "raw not supported!", null);
+                MultivaluedMap map = new MultivaluedMapImpl();
+                map.add("q", query);
+                map.add("count", String.valueOf(pageLength));
+                map.add("lctxs",
+                        String.valueOf(meta.getSpanContext().getLeft_size()));
+                map.add("rctxs",
+                        String.valueOf(meta.getSpanContext().getRight_size()));
+                result = this.graphDBhandler.getResponse(map, "distKwic");
+            }else
+                result = searchLucene.search(query);
+
+        }catch (Exception e) {
+            KorAPLogger.ERROR_LOGGER
+                    .error("Exception for serialized query: " + query, e);
+            throw KustvaktResponseHandler.throwit(500, e.getMessage(), null);
+        }
+
+        KorAPLogger.QUERY_LOGGER.trace("The result set: {}", result);
+        return Response.ok(result).build();
+    }
+
+    //todo: switch to new serialization
+    @POST
+    @Path("stats")
+    public Response getStats(String json) {
+        CollectionQueryBuilder builder = new CollectionQueryBuilder();
+        builder.addResource(json);
+
+        String stats = searchLucene.getStatistics(builder.toCollections());
+        if (stats.contains("-1"))
+            throw KustvaktResponseHandler.throwit(StatusCodes.EMPTY_RESULTS);
+
+        return Response.ok(stats).build();
+    }
+
+    //fixme: only allowed for corpus?!
+    @GET
+    @Path("/corpus/{id}/{docid}/{rest}/matchInfo")
+    public Response getMatchInfo(@PathParam("id") String id,
+            @PathParam("docid") String docid, @PathParam("rest") String rest,
+            @QueryParam("foundry") Set<String> foundries,
+            @QueryParam("layer") Set<String> layers,
+            @QueryParam("spans") Boolean spans) {
+        spans = spans != null ? spans : false;
+        String matchid = searchLucene.getMatchId(id, docid, rest);
+
+        if (layers == null || layers.isEmpty())
+            layers = new HashSet<>();
+
+        boolean match_only = foundries == null || foundries.isEmpty();
+
+        String results;
+        // fixme: checks for policy matching
+        // fixme: currently disabled, due to mishab in foundry/layer spec
+        // fixme:
+        if (foundries != null && foundries.size() > 1000) {
+            Set<String> f_list = new HashSet<>();
+            Set<String> l_list = new HashSet<>();
+
+            for (String spl : new ArrayList<>(foundries)) {
+
+                String[] sep = StringUtils.splitAnnotations(spl);
+                if (spl != null) {
+                    f_list.add(sep[0]);
+                    l_list.add(sep[1]);
+                }
+                results = searchLucene
+                        .getMatch(matchid, new ArrayList<>(f_list),
+                                new ArrayList<>(l_list), spans, false, true);
+
+            }
+        }
+        try {
+            if (!match_only)
+                results = searchLucene
+                        .getMatch(matchid, new ArrayList<>(foundries),
+                                new ArrayList<>(layers), spans, false, true);
+            else
+                results = searchLucene.getMatch(matchid);
+        }catch (Exception e) {
+            KorAPLogger.ERROR_LOGGER.error("Exception encountered!", e);
+            throw KustvaktResponseHandler
+                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, e.getMessage(), "");
+        }
+        return Response.ok(results).build();
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/FormWrapper.java b/src/main/java/de/ids_mannheim/korap/web/utils/FormWrapper.java
new file mode 100644
index 0000000..b1dad85
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/FormWrapper.java
@@ -0,0 +1,35 @@
+package de.ids_mannheim.korap.web.utils;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author hanl
+ * @date 18/05/2015
+ * Helper class to wrapp multivaluedmap into a hashmap. Depending on the strict parameter,
+ * list values are retained in the resulting wrapper map.
+ */
+public class FormWrapper extends HashMap<String, Object> {
+
+    public FormWrapper(MultivaluedMap form, boolean strict) {
+        super(toMap(form, strict));
+    }
+
+    public FormWrapper(MultivaluedMap form) {
+        super(toMap(form, true));
+    }
+
+    private static HashMap<String, Object> toMap(MultivaluedMap<String, Object> form,
+            boolean strict) {
+        HashMap<String, Object> map = new HashMap<>();
+        for (Map.Entry<String, List<Object>> e : form.entrySet()) {
+            if (e.getValue().size() == 1)
+                map.put(e.getKey(), e.getValue().get(0));
+            else if (!strict)
+                map.put(e.getKey(), e.getValue());
+        }
+        return map;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java b/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java
new file mode 100644
index 0000000..f6da418
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java
@@ -0,0 +1,56 @@
+package de.ids_mannheim.korap.web.utils;
+
+/**
+ * @author hanl
+ * @date 12/04/2014
+ */
+public class HTMLBuilder {
+
+    private StringBuilder html;
+    private StringBuilder body;
+    private String bodyAttr;
+
+    public HTMLBuilder() {
+        html = new StringBuilder();
+        body = new StringBuilder();
+        bodyAttr = "";
+        html.append("<html>");
+    }
+
+
+    public void addHeader(String header, int h) {
+        html.append("<h" + h + ">");
+        html.append(header);
+        html.append("</h" + h + ">");
+    }
+
+    public void addToBody(String body) {
+        this.body.append(body);
+    }
+
+    public void addToBody(String body, String attributes) {
+        this.body.append(body);
+        bodyAttr = attributes;
+    }
+
+    public String build() {
+        if (bodyAttr.isEmpty())
+            html.append("<body>");
+        else {
+            html.append("<body ");
+            html.append(bodyAttr);
+            html.append(">");
+        }
+
+        html.append(body);
+        html.append("</body>");
+        html.append("</html>");
+        return html.toString();
+    }
+
+
+    @Override
+    public String toString() {
+        return build();
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java
new file mode 100644
index 0000000..f99a520
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java
@@ -0,0 +1,77 @@
+package de.ids_mannheim.korap.web.utils;
+
+import de.ids_mannheim.korap.auditing.AuditRecord;
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.exceptions.BaseException;
+import de.ids_mannheim.korap.exceptions.KorAPException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.interfaces.AuditingIface;
+import de.ids_mannheim.korap.response.Notifications;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 29/01/2014
+ */
+public class KustvaktResponseHandler {
+
+    private static AuditingIface auditing = BeanConfiguration
+            .getAuditingProvider();
+
+    private static void register(List<AuditRecord> records) {
+        if (auditing != null && !records.isEmpty())
+            auditing.audit(records);
+    }
+
+    public static WebApplicationException throwit(BaseException e) {
+        //fixme: ??!
+        e.printStackTrace();
+        return new WebApplicationException(
+                Response.status(Response.Status.BAD_REQUEST)
+                        .entity(buildNotification(e)).build());
+    }
+
+    @Deprecated
+    public static WebApplicationException throwit(int code) {
+        KorAPException e = new KorAPException(code);
+        return new WebApplicationException(
+                Response.status(Response.Status.OK).entity(buildNotification(e))
+                        .build());
+    }
+
+    @Deprecated
+    public static WebApplicationException throwit(int code, String message,
+            String entity) {
+        KorAPException e = new KorAPException(code, message, entity);
+        return new WebApplicationException(
+                Response.status(Response.Status.OK).entity(buildNotification(e))
+                        .build());
+    }
+
+    private static String buildNotification(BaseException e) {
+        KustvaktResponseHandler.register(e.getRecords());
+        return buildNotification(e.getStatusCode(), e.getMessage(),
+                e.getEntity());
+    }
+
+    private static String buildNotification(int code, String message,
+            String entity) {
+        Notifications notif = new Notifications();
+        notif.addError(code, message, entity);
+        return notif.toJsonString() + "\n";
+    }
+
+    public static WebApplicationException throwAuthenticationException() {
+        KorAPException e = new KorAPException(StatusCodes.BAD_CREDENTIALS);
+        return new WebApplicationException(
+                Response.status(Response.Status.UNAUTHORIZED)
+                        .header(HttpHeaders.WWW_AUTHENTICATE,
+                                "Basic realm=Kustvakt Authentication Service")
+                        .entity(buildNotification(e)).build());
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java b/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
new file mode 100644
index 0000000..47e8e03
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
@@ -0,0 +1,45 @@
+package de.ids_mannheim.korap.web.utils;
+
+import com.sun.jersey.api.core.HttpContext;
+import com.sun.jersey.core.spi.component.ComponentContext;
+import com.sun.jersey.core.spi.component.ComponentScope;
+import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
+import com.sun.jersey.spi.inject.Injectable;
+import com.sun.jersey.spi.inject.InjectableProvider;
+
+import javax.ws.rs.core.Context;
+import javax.ws.rs.ext.Provider;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author hanl
+ * @date 04/02/2014
+ */
+@Provider
+public class LocaleProvider
+        extends AbstractHttpContextInjectable<Locale>
+        implements InjectableProvider<Context, Type> {
+
+    @Override
+    public Locale getValue(HttpContext httpContext) {
+        final List<Locale> locales = httpContext.getRequest().getAcceptableLanguages();
+        if (locales.isEmpty())
+            return Locale.US;
+        return locales.get(0);
+    }
+
+    @Override
+    public ComponentScope getScope() {
+        return ComponentScope.PerRequest;
+    }
+
+    @Override
+    public Injectable getInjectable(ComponentContext ic, Context context, Type type) {
+        if (type.equals(Locale.class))
+            return this;
+        return null;
+    }
+}
+
diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store
new file mode 100644
index 0000000..5008ddf
--- /dev/null
+++ b/src/main/resources/.DS_Store
Binary files differ
diff --git a/src/main/resources/changelog b/src/main/resources/changelog
new file mode 100644
index 0000000..50f47a7
--- /dev/null
+++ b/src/main/resources/changelog
@@ -0,0 +1,6 @@
+=== CHANGELOG FILE ===
+
+05/05/2015
+    - ADD: rest test suite for user service
+    - MOD: setup parameter modification
+    - ADD: oauth2 client unique constraint
diff --git a/src/main/resources/default-config.xml b/src/main/resources/default-config.xml
new file mode 100644
index 0000000..7e3c557
--- /dev/null
+++ b/src/main/resources/default-config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                            http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+                            http://www.springframework.org/schema/util
+                            http://www.springframework.org/schema/util/spring-util-4.0.xsd">
+
+
+    <!--<context:property-placeholder location="classpath:kustvakt.conf"/>-->
+
+    <util:properties id="props" location="classpath:kustvakt.conf"/>
+
+    <bean id="auditingProvider"
+          class="de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing">
+    </bean>
+
+    <bean id="config"
+          class="de.ids_mannheim.korap.config.KustvaktConfiguration">
+        <property name="properties" ref="props"/>
+    </bean>
+
+    <bean name="encryption"
+          class="de.ids_mannheim.korap.interfaces.defaults.DefaultEncryption">
+    </bean>
+</beans>
\ No newline at end of file
