diff --git a/src/main/java/de/ids_mannheim/korap/resources/Corpus.java b/src/main/java/de/ids_mannheim/korap/resources/Corpus.java
new file mode 100755
index 0000000..6c8dd75
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Corpus.java
@@ -0,0 +1,43 @@
+package de.ids_mannheim.korap.resources;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Map;
+
+/**
+ * User: hanl
+ * Date: 11/8/13
+ * Time: 5:15 PM
+ */
+@Getter
+@Setter
+public class Corpus extends KustvaktResource {
+
+    private Map stats;
+
+    public Corpus() {
+        super();
+    }
+
+    public Corpus(Integer id, long created, int creator) {
+        super(id, creator, created);
+    }
+
+    public Corpus(Integer id, int creator) {
+        super(id, creator);
+    }
+
+    public Corpus(String pers_id, int creator) {
+        super(pers_id, creator);
+        // deprecated
+        this.setName(pers_id);
+    }
+
+    @Override
+    public Map toMap() {
+        Map res = super.toMap();
+        res.put("statistics", stats);
+        return res;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Document.java b/src/main/java/de/ids_mannheim/korap/resources/Document.java
new file mode 100644
index 0000000..3700a1b
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Document.java
@@ -0,0 +1,69 @@
+package de.ids_mannheim.korap.resources;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author hanl
+ * @date 05/11/2014
+ */
+@Getter
+@Setter
+public class Document extends KustvaktResource {
+
+    private String corpus;
+    private boolean disabled;
+
+    public Document(String persistentID) {
+        this.setId(-1);
+        this.setPersistentID(persistentID);
+        this.corpus = getCorpusID();
+        this.setDisabled(true);
+    }
+
+    public Document(String persistentID, boolean disabled) {
+        this(persistentID);
+        this.setDisabled(disabled);
+    }
+
+    private String getCorpusID() {
+        //WPD_SSS.07367
+        if (this.getPersistentID() != null)
+            return this.getPersistentID().split("_")[0];
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "Document{" +
+                "id='" + this.getId() + "'" +
+                "persistentid='" + this.getPersistentID() + "'" +
+                "corpus='" + corpus + '\'' +
+                ", disabled=" + disabled +
+                '}';
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        Document document = (Document) o;
+
+        if (disabled != document.disabled)
+            return false;
+        if (!getPersistentID().equals(document.getPersistentID()))
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = getPersistentID().hashCode();
+        result = 31 * result + (disabled ? 1 : 0);
+        return result;
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Foundry.java b/src/main/java/de/ids_mannheim/korap/resources/Foundry.java
new file mode 100644
index 0000000..b86874d
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Foundry.java
@@ -0,0 +1,32 @@
+package de.ids_mannheim.korap.resources;
+
+/**
+ * @author hanl
+ * @date 25/06/2014
+ */
+public class Foundry extends KustvaktResource {
+
+    public Foundry() {
+        super();
+    }
+
+    public Foundry(Integer id, int creator, long created) {
+        super(id, creator, created);
+    }
+
+    public Foundry(Integer id, int creator) {
+        super(id, creator);
+    }
+
+    public Foundry(Integer id, String persistentID, int creator) {
+        super(id, creator);
+        this.setName(persistentID);
+        this.setPersistentID(persistentID);
+    }
+
+    public Foundry(String persistentID,int creator) {
+        super(persistentID, creator);
+        this.setName(persistentID);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java b/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
new file mode 100644
index 0000000..ba76ad2
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
@@ -0,0 +1,192 @@
+package de.ids_mannheim.korap.resources;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import de.ids_mannheim.korap.utils.TimeUtils;
+import lombok.Getter;
+import lombok.Setter;
+import org.joda.time.DateTime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by hanl on 5/21/14.
+ */
+@Getter
+@Setter
+public abstract class KustvaktResource {
+
+    @JsonIgnore
+    private Integer id;
+    private String persistentID;
+    private String name;
+    private String description;
+    @JsonIgnore
+    private Integer owner;
+    protected long created;
+    @Deprecated
+    private boolean managed;
+    @Deprecated
+    private boolean shared;
+    private String path;
+    // parents persistentid
+    private String parentID;
+
+    //    private static RandomStringUtils utils = new RandomStringUtils();
+
+    protected KustvaktResource() {
+        this.created = TimeUtils.getNow().getMillis();
+        this.id = -1;
+        this.parentID = null;
+    }
+
+    public KustvaktResource(Integer id, int creator, long created) {
+        this.created = created;
+        this.owner = creator;
+        this.id = id;
+        this.parentID = null;
+    }
+
+    public KustvaktResource(Integer id, int creator) {
+        this.created = TimeUtils.getNow().getMillis();
+        this.id = id;
+        this.owner = creator;
+        this.parentID = null;
+    }
+
+    public KustvaktResource(String persistentID, int creator) {
+        this();
+        this.owner = creator;
+        this.persistentID = persistentID;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof KustvaktResource && this.id
+                .equals(((KustvaktResource) other).getId());
+    }
+
+    @Override
+    public int hashCode() {
+        int result = id.hashCode();
+        return result;
+    }
+
+    /**
+     * Merges another resource with this resource instance
+     * Every implementation of KorAPResource should override this method!
+     *
+     * @param other
+     */
+    public void merge(KustvaktResource other) {
+        if (other == null)
+            return;
+
+        this.setId(this.getId() == null || this.getId() == -1 ?
+                other.getId() :
+                other.getId());
+        this.setPersistentID(this.getPersistentID() == null ?
+                other.getPersistentID() :
+                this.getPersistentID());
+        this.setName(this.getName() == null || this.getName().isEmpty() ?
+                other.getName() :
+                this.getName());
+        this.setDescription(
+                this.getDescription() == null || this.getDescription()
+                        .isEmpty() ?
+                        other.getDescription() :
+                        this.getDescription());
+        this.setCreated(this.getCreated() < other.getCreated() ?
+                this.getCreated() :
+                other.getCreated());
+        this.setPath(this.getPath() == null ? other.getPath() : this.getPath());
+        this.setOwner(
+                this.getOwner() == null ? other.getOwner() : this.getOwner());
+        this.setManaged(
+                !this.isManaged() ? other.isManaged() : this.isManaged());
+        this.setShared(!this.isShared() ? other.isShared() : this.isShared());
+    }
+
+    /**
+     * Checks this instance for null parameter and replaces them with default values.
+     * Every implementation of KorAPResource should override this method!
+     *
+     * @return
+     */
+    public void checkNull() {
+        setCreated(this.getCreated() == 0L ?
+                TimeUtils.getNow().getMillis() :
+                this.getCreated());
+        setName(this.getName() == null ? "" : this.getName());
+    }
+
+    protected String createID() {
+        //        return utils.randomAlphanumeric(10);
+        return "";
+    }
+
+    /**
+     * this method is used to return field information about the class
+     * All subclasses should override this method
+     *
+     * @return
+     */
+    public Map toMap() {
+        Map m = new HashMap();
+        m.put("id", persistentID);
+        m.put("name", name);
+        m.put("path", path);
+        m.put("description", description);
+        m.put("created", TimeUtils.format(new DateTime(created)));
+        m.put("managed", managed);
+        m.put("shared", shared);
+        return m;
+    }
+
+    @Override
+    public String toString() {
+        return "Resource{" +
+                "id='" + id + '\'' +
+                "persistentID='" + persistentID + '\'' +
+                ", name='" + name + '\'' +
+                ", created=" + created +
+                ", path=" + path +
+                ", owner=" + owner +
+                '}';
+    }
+
+    @Getter
+    public static class Container {
+        private final Class type;
+        //        private final Integer id;
+        private final String persistentID;
+        private final boolean set;
+
+        public Container(String persistentID, Class type) {
+            this.type = type;
+            //            this.id = id;
+            this.set = true;
+            this.persistentID = persistentID;
+        }
+
+        public Container(Class type) {
+            this.type = type;
+            //            this.id = id;
+            this.set = true;
+            this.persistentID = null;
+        }
+
+        public Container() {
+            this.set = false;
+            this.type = null;
+            //            this.id = null;
+            this.persistentID = null;
+        }
+
+        @Override
+        public String toString() {
+            return persistentID + "@" + type.getSimpleName();
+        }
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Layer.java b/src/main/java/de/ids_mannheim/korap/resources/Layer.java
new file mode 100644
index 0000000..df464c0
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Layer.java
@@ -0,0 +1,37 @@
+package de.ids_mannheim.korap.resources;
+
+/**
+ * @author hanl
+ * @date 25/06/2014
+ */
+public class Layer extends KustvaktResource {
+
+    public Layer() {
+        super();
+    }
+
+    public Layer(Integer id, int creator, long created) {
+        super(id, creator, created);
+    }
+
+    public Layer(Integer id, int creator) {
+        super(id, creator);
+    }
+
+    // layer name must not be unique!
+    public Layer(Integer id, String name, int creator) {
+        super(id, creator);
+        this.setName(name);
+    }
+
+    public Layer(String persistentID, String name, int creator) {
+        super(persistentID, creator);
+        this.setPersistentID(persistentID);
+        this.setName(name);
+    }
+
+    public Layer(String persistentID, int creator) {
+        super(persistentID, creator);
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Permissions.java b/src/main/java/de/ids_mannheim/korap/resources/Permissions.java
new file mode 100644
index 0000000..f039c61
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Permissions.java
@@ -0,0 +1,45 @@
+package de.ids_mannheim.korap.resources;
+
+/**
+ * @author hanl
+ * @date 21/01/2014
+ */
+public class Permissions {
+
+   public static enum PERMISSIONS {
+        //fixme: add read_policy permission to allow read policy permissions
+        READ, WRITE, DELETE, READ_POLICY, CREATE_POLICY, MODIFY_POLICY, DELETE_POLICY
+    }
+
+    public static final byte READ = 1;
+    public static final byte WRITE = 2;
+    public static final byte DELETE = 4;
+    public static final byte READ_POLICY = 8;
+    public static final byte CREATE_POLICY = 16;
+    public static final byte MODIFY_POLICY = 32;
+    public static final byte DELETE_POLICY = 64;
+
+
+    public static Byte getByte(PERMISSIONS perm) {
+        switch (perm) {
+            case READ:
+                return READ;
+            case WRITE:
+                return WRITE;
+            case DELETE:
+                return DELETE;
+            case READ_POLICY:
+                return READ_POLICY;
+            case DELETE_POLICY:
+                return DELETE_POLICY;
+            case MODIFY_POLICY:
+                return MODIFY_POLICY;
+            case CREATE_POLICY:
+                return CREATE_POLICY;
+            default:
+                return 0;
+        }
+    }
+
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Relation.java b/src/main/java/de/ids_mannheim/korap/resources/Relation.java
new file mode 100644
index 0000000..1d2c7a8
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/Relation.java
@@ -0,0 +1,9 @@
+package de.ids_mannheim.korap.resources;
+
+/**
+ * @author hanl
+ * @date 29/04/2014
+ */
+public enum Relation {
+    OR, AND
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java b/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java
new file mode 100755
index 0000000..1148ac0
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java
@@ -0,0 +1,137 @@
+package de.ids_mannheim.korap.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("all")
+public class ResourceFactory {
+
+    public static final List<Class<? extends KustvaktResource>> subTypes = new ArrayList<>();
+    public static final int CORPUS = 0;
+    public static final int FOUNDRY = 1;
+    public static final int LAYER = 2;
+    public static final int VIRTUALCOLLECTION = 3;
+    public static final int USERQUERY = 4;
+
+    static {
+        subTypes.add(CORPUS, Corpus.class);
+        subTypes.add(FOUNDRY, Foundry.class);
+        subTypes.add(LAYER, Layer.class);
+        subTypes.add(VIRTUALCOLLECTION, VirtualCollection.class);
+//        subTypes.add(USERQUERY, UserQuery.class);
+    }
+
+    public static KustvaktResource getResource(
+            Class<? extends KustvaktResource> clazz) {
+        try {
+            return (KustvaktResource) clazz.newInstance();
+        }catch (InstantiationException | IllegalAccessException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static int getResourceMapping(Class<? extends KustvaktResource> r) {
+        int value = -1;
+        if (r != null) {
+            for (int i = 0; i < subTypes.size(); i++) {
+                if (subTypes.get(i).getName().equals(r.getName()))
+                    value = i;
+            }
+        }
+        return value;
+    }
+
+    public static KustvaktResource getResource(String type) {
+        return getResource(getResourceClass(type));
+    }
+
+    public static KustvaktResource getResource(int j) {
+        Class s = subTypes.get(j);
+        if (s != null) {
+            return getResource(s);
+        }
+        return null;
+    }
+
+
+    public static <T extends KustvaktResource> Class<T> getResourceClass(
+            String type) {
+        for (Class value : subTypes) {
+            if (value == VirtualCollection.class && type
+                    .equalsIgnoreCase("collection"))
+                return (Class<T>) VirtualCollection.class;
+                    //todo
+//            else if (value == UserQuery.class && type.equalsIgnoreCase("query"))
+//                return (Class<T>) UserQuery.class;
+            else if (value.getSimpleName().equalsIgnoreCase(type.trim())) {
+                return value; // do nothing
+            }
+        }
+        return null;
+    }
+    // all deprecated!
+
+    public static VirtualCollection getCachedCollection(String query) {
+        VirtualCollection v = new VirtualCollection();
+        v.setQuery(query);
+        v.setName("");
+        v.setDescription("");
+        v.setPersistentID(v.createID());
+        return v;
+    }
+
+    public static VirtualCollection getPermanentCollection(
+            VirtualCollection mergable, String corpusName, String description,
+            Integer owner) {
+        VirtualCollection v = new VirtualCollection();
+        v.merge(mergable);
+        v.setPersistentID(v.createID());
+        v.setName(corpusName);
+        v.setDescription(description);
+        v.setOwner(owner);
+        return v;
+    }
+
+    public static VirtualCollection createCollection(String name, String query,
+            Integer owner) {
+        VirtualCollection v = new VirtualCollection();
+        v.setName(name);
+        v.setQuery(query);
+        v.setOwner(owner);
+        return v;
+    }
+
+    public static VirtualCollection createCollection(String name, String query,
+            long time, Integer owner) {
+        VirtualCollection v = new VirtualCollection(0, owner, time);
+        v.setName(name);
+        v.setQuery(query);
+        return v;
+    }
+
+    public static VirtualCollection getCollection(Integer collectionID,
+            boolean cache) {
+        VirtualCollection v = new VirtualCollection();
+        v.setId(collectionID);
+        v.setDescription("");
+        v.setName("");
+        return v;
+    }
+
+    public static VirtualCollection createContainer(String name,
+            String description, String query, Integer owner) {
+        VirtualCollection v = new VirtualCollection();
+        v.setName(name);
+        v.setDescription(description);
+        v.setQuery(query);
+        v.setOwner(owner);
+        v.setManaged(true);
+        v.setPersistentID(v.createID());
+        return v;
+    }
+
+    public static VirtualCollection getIDContainer(Integer id, Integer owner) {
+        return new VirtualCollection(id, owner);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java b/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java
new file mode 100755
index 0000000..c4d74e2
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java
@@ -0,0 +1,95 @@
+package de.ids_mannheim.korap.resources;
+
+import de.ids_mannheim.korap.utils.JsonUtils;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.util.Map;
+
+@Getter
+@Setter
+public class VirtualCollection extends KustvaktResource {
+
+    private String query;
+    // use ehcache instead and only save persisted values in the database
+    //    @Deprecated
+    //    private boolean cache = false;
+    private Map stats;
+
+    protected VirtualCollection() {
+        super();
+        this.setPersistentID(this.createID());
+    }
+
+    protected VirtualCollection(Integer id, int creator, long created) {
+        super(id, creator, created);
+    }
+
+    public VirtualCollection(Integer id, int creator) {
+        super(id, creator);
+    }
+
+    public VirtualCollection(String persistentID, int creator) {
+        super(persistentID, creator);
+    }
+
+    public VirtualCollection(String query) {
+        this();
+        this.setQuery(query);
+        this.setPersistentID(this.createID());
+    }
+
+    @Override
+    protected String createID() {
+        if (this.query != null) {
+            String s = this.getQuery();
+            return DigestUtils.sha1Hex(s);
+        }
+        return super.createID();
+    }
+
+    @Override
+    public void merge(KustvaktResource resource) {
+        super.merge(resource);
+        if (resource == null | !(resource instanceof VirtualCollection))
+            return;
+        VirtualCollection other = (VirtualCollection) resource;
+        this.setStats(
+                this.getStats() == null ? other.getStats() : this.getStats());
+        this.setQuery(
+                this.getQuery() == null ? other.getQuery() : this.getQuery());
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void checkNull() {
+        super.checkNull();
+        this.setDescription(
+                this.getDescription() == null ? "" : this.getDescription());
+        this.setQuery(this.query == null ? "" : this.getQuery());
+    }
+
+    @Override
+    public String toString() {
+        return "VirtualCollection{" +
+                "id='" + this.getId() + '\'' +
+                ", persistentID='" + this.getPersistentID() + '\'' +
+                ", created=" + created +
+                ", path=" + this.getPath() +
+                ", owner=" + this.getOwner() +
+                ", name='" + this.getName() + '\'' +
+                ", query='" + query + '\'' +
+                ", stats='" + stats + '\'' +
+                '}';
+    }
+
+    @Override
+    public Map toMap() {
+        Map res = super.toMap();
+        res.put("query", JsonUtils.readTree(query));
+        res.put("statistics", stats);
+        return res;
+    }
+
+}
