You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/02/19 13:52:01 UTC

[14/52] [partial] code contribution, initial import of relevant modules of LMF-3.0.0-SNAPSHOT based on revision 4bf944319368 of the default branch at https://code.google.com/p/lmf/

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/jndi/LMFContext.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/jndi/LMFContext.java b/lmf-core/src/main/java/kiwi/core/jndi/LMFContext.java
new file mode 100644
index 0000000..3f88798
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/jndi/LMFContext.java
@@ -0,0 +1,813 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.jndi;
+
+import javax.naming.*;
+import javax.naming.spi.ObjectFactory;
+
+import java.util.*;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFContext implements Context {
+
+    private Hashtable<Object, Object>      environment;
+
+    private HashMap<Name,Object> bindings;
+
+    private HashMap<String,ObjectFactory> factories;
+
+    private static Properties parseProperties = new Properties();
+    static {
+        parseProperties.put("jndi.syntax.direction","left_to_right");
+        parseProperties.put("jndi.syntax.separator","/");
+    }
+
+    public LMFContext(Hashtable<Object, Object> environment) {
+        this.environment = environment;
+
+        this.bindings  = new HashMap<Name, Object>();
+        this.factories = new HashMap<String, ObjectFactory>();
+    }
+
+    private ObjectFactory getObjectFactory(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        if(factories.containsKey(className))
+            return factories.get(className);
+        else {
+            ObjectFactory factory = (ObjectFactory) Class.forName(className).newInstance();
+            factories.put(className,factory);
+            return factory;
+        }
+    }
+
+    /**
+     * Retrieves the named object.
+     * If <tt>name</tt> is empty, returns a new instance of this context
+     * (which represents the same naming context as this context, but its
+     * environment may be modified independently and it may be accessed
+     * concurrently).
+     *
+     * @param name the name of the object to look up
+     * @return the object bound to <tt>name</tt>
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #lookup(String)
+     * @see #lookupLink(javax.naming.Name)
+     */
+    @Override
+    public Object lookup(Name name) throws NamingException {
+        if(name.size() == 0) {
+            // clone current context
+            LMFContext clone = new LMFContext(new Hashtable<Object, Object>(this.environment));
+            clone.bindings = new HashMap<Name, Object>(this.bindings);
+            return clone;
+        } else if(name.size() > 1) {
+            // look in subcontexts
+            if(bindings.containsKey(name.getPrefix(1))) {
+                Object subcontext = bindings.get(name.getPrefix(1));
+                if(subcontext instanceof Context) return ((Context) subcontext).lookup(name.getSuffix(1));
+                else
+                    throw new NotContextException("the name "+name.getPrefix(1)+" does not identify a context");
+            } else
+                throw new NameNotFoundException("the name "+name.getPrefix(1)+" is not bound");
+
+        } else if(bindings.containsKey(name)) {
+            Object value = bindings.get(name);
+            try {
+                if(value instanceof Reference) {
+                    ObjectFactory factory = getObjectFactory(((Reference) value).getFactoryClassName());
+                    return factory.getObjectInstance(null,name,this,environment);
+                } else if(value instanceof Referenceable) {
+                    ObjectFactory factory = getObjectFactory(((Referenceable) value).getReference().getFactoryClassName());
+                    return factory.getObjectInstance(null,name,this,environment);
+                } else
+                    return value;
+            } catch(Exception ex) {
+                throw new NamingException("could not create object: "+ex.getMessage());
+            }
+
+        } else
+            throw new NameNotFoundException("name "+name+" could not be found");
+    }
+
+    /**
+     * Retrieves the named object.
+     * See {@link #lookup(javax.naming.Name)} for details.
+     *
+     * @param name the name of the object to look up
+     * @return the object bound to <tt>name</tt>
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public Object lookup(String name) throws NamingException {
+        return lookup(new CompoundName(name,parseProperties));
+    }
+
+    /**
+     * Binds a name to an object.
+     * All intermediate contexts and the target context (that named by all
+     * but terminal atomic component of the name) must already exist.
+     *
+     * @param name the name to bind; may not be empty
+     * @param obj  the object to bind; possibly null
+     * @throws javax.naming.NameAlreadyBoundException if name is already bound
+     * @throws javax.naming.directory.InvalidAttributesException if object did not supply all mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #bind(String, Object)
+     * @see #rebind(javax.naming.Name, Object)
+     * @see javax.naming.directory.DirContext#bind(javax.naming.Name, Object,
+     *      javax.naming.directory.Attributes)
+     */
+    @Override
+    public void bind(Name name, Object obj) throws NamingException {
+        if(name.size() == 0)
+            throw new InvalidNameException("the name passed to bind() is not valid");
+        else if(name.size() > 1) {
+            // we try getting the subcontext with the given name if it exists or create a new one if it does not
+            // exist, and then pass over to the subcontext's bind() operation
+            // look in subcontexts
+            if(bindings.containsKey(name.getPrefix(1))) {
+                Object subcontext = bindings.get(name.getPrefix(1));
+                if(subcontext instanceof Context) {
+                    ((Context) subcontext).bind(name.getSuffix(1),obj);
+                } else
+                    throw new NotContextException("the name "+name.getPrefix(1)+" does not identify a context");
+            } else {
+                Context subcontext = createSubcontext(name.getPrefix(1));
+                subcontext.bind(name.getSuffix(1),obj);
+            }
+        } else if(bindings.containsKey(name))
+            throw new NameAlreadyBoundException("name "+name+" is already bound in this context");
+        else {
+            bindings.put(name,obj);
+        }
+    }
+
+    /**
+     * Binds a name to an object.
+     * See {@link #bind(javax.naming.Name, Object)} for details.
+     *
+     * @param name the name to bind; may not be empty
+     * @param obj  the object to bind; possibly null
+     * @throws javax.naming.NameAlreadyBoundException if name is already bound
+     * @throws javax.naming.directory.InvalidAttributesException if object did not supply all mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void bind(String name, Object obj) throws NamingException {
+        bind(new CompoundName(name,parseProperties),obj);
+    }
+
+    /**
+     * Binds a name to an object, overwriting any existing binding.
+     * All intermediate contexts and the target context (that named by all
+     * but terminal atomic component of the name) must already exist.
+     * <p/>
+     * <p> If the object is a <tt>DirContext</tt>, any existing attributes
+     * associated with the name are replaced with those of the object.
+     * Otherwise, any existing attributes associated with the name remain
+     * unchanged.
+     *
+     * @param name the name to bind; may not be empty
+     * @param obj  the object to bind; possibly null
+     * @throws javax.naming.directory.InvalidAttributesException if object did not supply all mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #rebind(String, Object)
+     * @see #bind(javax.naming.Name, Object)
+     * @see javax.naming.directory.DirContext#rebind(javax.naming.Name, Object,
+     *      javax.naming.directory.Attributes)
+     * @see javax.naming.directory.DirContext
+     */
+    @Override
+    public void rebind(Name name, Object obj) throws NamingException {
+        if(name.size() == 0)
+            throw new InvalidNameException("the name passed to bind() is not valid");
+        else if(name.size() > 1) {
+            // we try getting the subcontext with the given name if it exists or create a new one if it does not
+            // exist, and then pass over to the subcontext's bind() operation
+            // look in subcontexts
+            if(bindings.containsKey(name.getPrefix(1))) {
+                Object subcontext = bindings.get(name.getPrefix(1));
+                if(subcontext instanceof Context) {
+                    ((Context) subcontext).bind(name.getSuffix(1),obj);
+                } else
+                    throw new NotContextException("the name "+name.getPrefix(1)+" does not identify a context");
+            } else {
+                Context subcontext = createSubcontext(name.getPrefix(1));
+                subcontext.bind(name.getSuffix(1),obj);
+            }
+        } else {
+            bindings.put(name,obj);
+        }
+    }
+
+    /**
+     * Binds a name to an object, overwriting any existing binding.
+     * See {@link #rebind(javax.naming.Name, Object)} for details.
+     *
+     * @param name the name to bind; may not be empty
+     * @param obj  the object to bind; possibly null
+     * @throws javax.naming.directory.InvalidAttributesException if object did not supply all mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void rebind(String name, Object obj) throws NamingException {
+        rebind(new CompoundName(name,parseProperties),obj);
+    }
+
+    /**
+     * Unbinds the named object.
+     * Removes the terminal atomic name in <code>name</code>
+     * from the target context--that named by all but the terminal
+     * atomic part of <code>name</code>.
+     * <p/>
+     * <p> This method is idempotent.
+     * It succeeds even if the terminal atomic name
+     * is not bound in the target context, but throws
+     * <tt>NameNotFoundException</tt>
+     * if any of the intermediate contexts do not exist.
+     * <p/>
+     * <p> Any attributes associated with the name are removed.
+     * Intermediate contexts are not changed.
+     *
+     * @param name the name to unbind; may not be empty
+     * @throws javax.naming.NameNotFoundException if an intermediate context does not exist
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #unbind(String)
+     */
+    @Override
+    public void unbind(Name name) throws NamingException {
+        if(name.size() == 0)
+            throw new InvalidNameException("an empty name cannot be unbound");
+        else if(name.size() > 1) {
+            // look in subcontexts
+            if(bindings.containsKey(name.getPrefix(1))) {
+                Object subcontext = bindings.get(name.getPrefix(1));
+                if(subcontext instanceof Context) {
+                    ((Context) subcontext).unbind(name.getSuffix(1));
+                } else
+                    throw new NotContextException("the name "+name.getPrefix(1)+" does not identify a context");
+            } else
+                throw new NameNotFoundException("the name "+name.getPrefix(1)+" is not bound");
+        } else {
+            bindings.remove(name);
+        }
+    }
+
+    /**
+     * Unbinds the named object.
+     * See {@link #unbind(javax.naming.Name)} for details.
+     *
+     * @param name the name to unbind; may not be empty
+     * @throws javax.naming.NameNotFoundException if an intermediate context does not exist
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void unbind(String name) throws NamingException {
+        unbind(new CompoundName(name,parseProperties));
+    }
+
+    /**
+     * Binds a new name to the object bound to an old name, and unbinds
+     * the old name.  Both names are relative to this context.
+     * Any attributes associated with the old name become associated
+     * with the new name.
+     * Intermediate contexts of the old name are not changed.
+     *
+     * @param oldName the name of the existing binding; may not be empty
+     * @param newName the name of the new binding; may not be empty
+     * @throws javax.naming.NameAlreadyBoundException if <tt>newName</tt> is already bound
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #rename(String, String)
+     * @see #bind(javax.naming.Name, Object)
+     * @see #rebind(javax.naming.Name, Object)
+     */
+    @Override
+    public void rename(Name oldName, Name newName) throws NamingException {
+        /* Confirm that this works.  We might have to catch the exception */
+        Object old = lookup(oldName);
+        if(newName.isEmpty()) throw new InvalidNameException("Cannot bind to empty name");
+
+        if(old == null) throw new NamingException("Name '" + oldName + "' not found.");
+
+        /* If the new name is bound throw a NameAlreadyBoundException */
+        if(lookup(newName) != null) throw new NameAlreadyBoundException("Name '" + newName + "' already bound");
+
+        unbind(oldName);
+        unbind(newName);
+        bind(newName, old);
+    }
+
+    /**
+     * Binds a new name to the object bound to an old name, and unbinds
+     * the old name.
+     * See {@link #rename(javax.naming.Name, javax.naming.Name)} for details.
+     *
+     * @param oldName the name of the existing binding; may not be empty
+     * @param newName the name of the new binding; may not be empty
+     * @throws javax.naming.NameAlreadyBoundException if <tt>newName</tt> is already bound
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void rename(String oldName, String newName) throws NamingException {
+        rename(new CompoundName(oldName,parseProperties),new CompoundName(newName,parseProperties));
+    }
+
+    /**
+     * Enumerates the names bound in the named context, along with the
+     * class names of objects bound to them.
+     * The contents of any subcontexts are not included.
+     * <p/>
+     * <p> If a binding is added to or removed from this context,
+     * its effect on an enumeration previously returned is undefined.
+     *
+     * @param name the name of the context to list
+     * @return an enumeration of the names and class names of the
+     * bindings in this context.  Each element of the
+     * enumeration is of type <tt>NameClassPair</tt>.
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #list(String)
+     * @see #listBindings(javax.naming.Name)
+     * @see javax.naming.NameClassPair
+     */
+    @Override
+    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
+        if(name == null || name.size() == 0)
+            return new NameClassEnumerationImpl(this.bindings);
+        else {
+            Object subcontext = bindings.get(name.getPrefix(1));
+            if(subcontext == null)
+                throw new NameNotFoundException("subcontext with name "+name.getPrefix(1)+" does not exist");
+            else if(subcontext instanceof Context) return ((Context) subcontext).list(name.getSuffix(1));
+            else
+                throw new NotContextException("object with name "+name.getPrefix(1)+" is not a context");
+        }
+    }
+
+    /**
+     * Enumerates the names bound in the named context, along with the
+     * class names of objects bound to them.
+     * See {@link #list(javax.naming.Name)} for details.
+     *
+     * @param name the name of the context to list
+     * @return an enumeration of the names and class names of the
+     * bindings in this context.  Each element of the
+     * enumeration is of type <tt>NameClassPair</tt>.
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
+        return list(new CompoundName(name,parseProperties));
+    }
+
+    /**
+     * Enumerates the names bound in the named context, along with the
+     * objects bound to them.
+     * The contents of any subcontexts are not included.
+     * <p/>
+     * <p> If a binding is added to or removed from this context,
+     * its effect on an enumeration previously returned is undefined.
+     *
+     * @param name the name of the context to list
+     * @return an enumeration of the bindings in this context.
+     * Each element of the enumeration is of type
+     * <tt>Binding</tt>.
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #listBindings(String)
+     * @see #list(javax.naming.Name)
+     * @see javax.naming.Binding
+     */
+    @Override
+    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
+        if(name == null || name.size() == 0)
+            return new BindingEnumerationImpl(this.bindings);
+        else {
+            Object subcontext = bindings.get(name.getPrefix(1));
+            if(subcontext == null)
+                throw new NameNotFoundException("subcontext with name "+name.getPrefix(1)+" does not exist");
+            else if(subcontext instanceof Context) return ((Context) subcontext).listBindings(name.getSuffix(1));
+            else
+                throw new NotContextException("object with name "+name.getPrefix(1)+" is not a context");
+        }
+    }
+
+    /**
+     * Enumerates the names bound in the named context, along with the
+     * objects bound to them.
+     * See {@link #listBindings(javax.naming.Name)} for details.
+     *
+     * @param name the name of the context to list
+     * @return an enumeration of the bindings in this context.
+     * Each element of the enumeration is of type
+     * <tt>Binding</tt>.
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
+        return listBindings(new CompoundName(name, parseProperties));
+    }
+
+    /**
+     * Destroys the named context and removes it from the namespace.
+     * Any attributes associated with the name are also removed.
+     * Intermediate contexts are not destroyed.
+     * <p/>
+     * <p> This method is idempotent.
+     * It succeeds even if the terminal atomic name
+     * is not bound in the target context, but throws
+     * <tt>NameNotFoundException</tt>
+     * if any of the intermediate contexts do not exist.
+     * <p/>
+     * <p> In a federated naming system, a context from one naming system
+     * may be bound to a name in another.  One can subsequently
+     * look up and perform operations on the foreign context using a
+     * composite name.  However, an attempt destroy the context using
+     * this composite name will fail with
+     * <tt>NotContextException</tt>, because the foreign context is not
+     * a "subcontext" of the context in which it is bound.
+     * Instead, use <tt>unbind()</tt> to remove the
+     * binding of the foreign context.  Destroying the foreign context
+     * requires that the <tt>destroySubcontext()</tt> be performed
+     * on a context from the foreign context's "native" naming system.
+     *
+     * @param name the name of the context to be destroyed; may not be empty
+     * @throws javax.naming.NameNotFoundException if an intermediate context does not exist
+     * @throws javax.naming.NotContextException if the name is bound but does not name a
+     * context, or does not name a context of the appropriate type
+     * @throws javax.naming.ContextNotEmptyException if the named context is not empty
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #destroySubcontext(String)
+     */
+    @Override
+    public void destroySubcontext(Name name) throws NamingException {
+        unbind(name);
+    }
+
+    /**
+     * Destroys the named context and removes it from the namespace.
+     * See {@link #destroySubcontext(javax.naming.Name)} for details.
+     *
+     * @param name the name of the context to be destroyed; may not be empty
+     * @throws javax.naming.NameNotFoundException if an intermediate context does not exist
+     * @throws javax.naming.NotContextException if the name is bound but does not name a
+     * context, or does not name a context of the appropriate type
+     * @throws javax.naming.ContextNotEmptyException if the named context is not empty
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void destroySubcontext(String name) throws NamingException {
+        unbind(name);
+    }
+
+    /**
+     * Creates and binds a new context.
+     * Creates a new context with the given name and binds it in
+     * the target context (that named by all but terminal atomic
+     * component of the name).  All intermediate contexts and the
+     * target context must already exist.
+     *
+     * @param name the name of the context to create; may not be empty
+     * @return the newly created context
+     * @throws javax.naming.NameAlreadyBoundException if name is already bound
+     * @throws javax.naming.directory.InvalidAttributesException if creation of the subcontext requires specification of
+     * mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #createSubcontext(String)
+     * @see javax.naming.directory.DirContext#createSubcontext
+     */
+    @Override
+    public Context createSubcontext(Name name) throws NamingException {
+        LMFContext subcontext = new LMFContext(new Hashtable<Object, Object>(this.environment));
+        bind(name,subcontext);
+        return subcontext;
+    }
+
+    /**
+     * Creates and binds a new context.
+     * See {@link #createSubcontext(javax.naming.Name)} for details.
+     *
+     * @param name the name of the context to create; may not be empty
+     * @return the newly created context
+     * @throws javax.naming.NameAlreadyBoundException if name is already bound
+     * @throws javax.naming.directory.InvalidAttributesException if creation of the subcontext requires specification of
+     * mandatory attributes
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public Context createSubcontext(String name) throws NamingException {
+        return createSubcontext(new CompoundName(name, parseProperties));
+    }
+
+    /**
+     * Retrieves the named object, following links except
+     * for the terminal atomic component of the name.
+     * If the object bound to <tt>name</tt> is not a link,
+     * returns the object itself.
+     *
+     * @param name the name of the object to look up
+     * @return the object bound to <tt>name</tt>, not following the
+     * terminal link (if any).
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #lookupLink(String)
+     */
+    @Override
+    public Object lookupLink(Name name) throws NamingException {
+        return lookup(name);
+    }
+
+    /**
+     * Retrieves the named object, following links except
+     * for the terminal atomic component of the name.
+     * See {@link #lookupLink(javax.naming.Name)} for details.
+     *
+     * @param name the name of the object to look up
+     * @return the object bound to <tt>name</tt>, not following the
+     * terminal link (if any)
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public Object lookupLink(String name) throws NamingException {
+        return lookup(name);
+    }
+
+    /**
+     * Retrieves the parser associated with the named context.
+     * In a federation of namespaces, different naming systems will
+     * parse names differently.  This method allows an application
+     * to get a parser for parsing names into their atomic components
+     * using the naming convention of a particular naming system.
+     * Within any single naming system, <tt>NameParser</tt> objects
+     * returned by this method must be equal (using the <tt>equals()</tt>
+     * test).
+     *
+     * @param name the name of the context from which to get the parser
+     * @return a name parser that can parse compound names into their atomic
+     * components
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #getNameParser(String)
+     * @see javax.naming.CompoundName
+     */
+    @Override
+    public NameParser getNameParser(Name name) throws NamingException {
+        return new LMFNameParser();
+    }
+
+    /**
+     * Retrieves the parser associated with the named context.
+     * See {@link #getNameParser(javax.naming.Name)} for details.
+     *
+     * @param name the name of the context from which to get the parser
+     * @return a name parser that can parse compound names into their atomic
+     * components
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public NameParser getNameParser(String name) throws NamingException {
+        return new LMFNameParser();
+    }
+
+    /**
+     * Composes the name of this context with a name relative to
+     * this context.
+     * Given a name (<code>name</code>) relative to this context, and
+     * the name (<code>prefix</code>) of this context relative to one
+     * of its ancestors, this method returns the composition of the
+     * two names using the syntax appropriate for the naming
+     * system(s) involved.  That is, if <code>name</code> names an
+     * object relative to this context, the result is the name of the
+     * same object, but relative to the ancestor context.  None of the
+     * names may be null.
+     * <p/>
+     * For example, if this context is named "wiz.com" relative
+     * to the initial context, then
+     * <pre>
+     * 	composeName("east", "wiz.com")	</pre>
+     * might return <code>"east.wiz.com"</code>.
+     * If instead this context is named "org/research", then
+     * <pre>
+     * 	composeName("user/jane", "org/research")	</pre>
+     * might return <code>"org/research/user/jane"</code> while
+     * <pre>
+     * 	composeName("user/jane", "research")	</pre>
+     * returns <code>"research/user/jane"</code>.
+     *
+     * @param name   a name relative to this context
+     * @param prefix the name of this context relative to one of its ancestors
+     * @return the composition of <code>prefix</code> and <code>name</code>
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #composeName(String, String)
+     */
+    @Override
+    public Name composeName(Name name, Name prefix) throws NamingException {
+        Name retName = (Name)prefix.clone();
+        retName.addAll(name);
+        return retName;
+    }
+
+    /**
+     * Composes the name of this context with a name relative to
+     * this context.
+     * See {@link #composeName(javax.naming.Name, javax.naming.Name)} for details.
+     *
+     * @param name   a name relative to this context
+     * @param prefix the name of this context relative to one of its ancestors
+     * @return the composition of <code>prefix</code> and <code>name</code>
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public String composeName(String name, String prefix) throws NamingException {
+        return composeName(new CompoundName(name,parseProperties), new CompoundName(prefix,parseProperties)).toString();
+    }
+
+    /**
+     * Adds a new environment property to the environment of this
+     * context.  If the property already exists, its value is overwritten.
+     * See class description for more details on environment properties.
+     *
+     * @param propName the name of the environment property to add; may not be null
+     * @param propVal  the value of the property to add; may not be null
+     * @return the previous value of the property, or null if the property was
+     * not in the environment before
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #getEnvironment()
+     * @see #removeFromEnvironment(String)
+     */
+    @Override
+    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+        return environment.put(propName,propVal);
+    }
+
+    /**
+     * Removes an environment property from the environment of this
+     * context.  See class description for more details on environment
+     * properties.
+     *
+     * @param propName the name of the environment property to remove; may not be null
+     * @return the previous value of the property, or null if the property was
+     * not in the environment
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #getEnvironment()
+     * @see #addToEnvironment(String, Object)
+     */
+    @Override
+    public Object removeFromEnvironment(String propName) throws NamingException {
+        return environment.remove(propName);
+    }
+
+    /**
+     * Retrieves the environment in effect for this context.
+     * See class description for more details on environment properties.
+     * <p/>
+     * <p> The caller should not make any changes to the object returned:
+     * their effect on the context is undefined.
+     * The environment of this context may be changed using
+     * <tt>addToEnvironment()</tt> and <tt>removeFromEnvironment()</tt>.
+     *
+     * @return the environment of this context; never null
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @see #addToEnvironment(String, Object)
+     * @see #removeFromEnvironment(String)
+     */
+    @Override
+    public Hashtable<?, ?> getEnvironment() throws NamingException {
+        return new Hashtable<Object, Object>(environment);
+    }
+
+    /**
+     * Closes this context.
+     * This method releases this context's resources immediately, instead of
+     * waiting for them to be released automatically by the garbage collector.
+     * <p/>
+     * <p> This method is idempotent:  invoking it on a context that has
+     * already been closed has no effect.  Invoking any other method
+     * on a closed context is not allowed, and results in undefined behaviour.
+     *
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     */
+    @Override
+    public void close() throws NamingException {
+    }
+
+    /**
+     * Retrieves the full name of this context within its own namespace.
+     * <p/>
+     * <p> Many naming services have a notion of a "full name" for objects
+     * in their respective namespaces.  For example, an LDAP entry has
+     * a distinguished name, and a DNS record has a fully qualified name.
+     * This method allows the client application to retrieve this name.
+     * The string returned by this method is not a JNDI composite name
+     * and should not be passed directly to context methods.
+     * In naming systems for which the notion of full name does not
+     * make sense, <tt>OperationNotSupportedException</tt> is thrown.
+     *
+     * @return this context's name in its own namespace; never null
+     * @throws javax.naming.OperationNotSupportedException if the naming system does
+     * not have the notion of a full name
+     * @throws javax.naming.NamingException if a naming exception is encountered
+     * @since 1.3
+     */
+    @Override
+    public String getNameInNamespace() throws NamingException {
+        throw new OperationNotSupportedException("no fullname support");
+    }
+
+
+    private static class NameClassEnumerationImpl implements NamingEnumeration<NameClassPair> {
+
+        Iterator<Map.Entry<Name,Object>> iterator;
+
+        private NameClassEnumerationImpl(Map<Name, Object> names) {
+            iterator = names.entrySet().iterator();
+        }
+
+        @Override
+        public NameClassPair next() throws NamingException {
+            Map.Entry<Name,Object> element = iterator.next();
+
+            return new NameClassPair(element.getKey().toString(),element.getValue().getClass().getName());
+        }
+
+        @Override
+        public boolean hasMore() throws NamingException {
+            return iterator.hasNext();
+        }
+
+        @Override
+        public void close() throws NamingException {
+        }
+
+        @Override
+        public boolean hasMoreElements() {
+            return iterator.hasNext();
+        }
+
+        @Override
+        public NameClassPair nextElement() {
+            try {
+                return next();
+            } catch (NamingException e) {
+                throw new NoSuchElementException("no such element");
+            }
+        }
+    }
+
+    private static class BindingEnumerationImpl implements NamingEnumeration<Binding> {
+        Iterator<Map.Entry<Name,Object>> iterator;
+
+        private BindingEnumerationImpl(Map<Name, Object> names) {
+            iterator = names.entrySet().iterator();
+        }
+
+        @Override
+        public Binding next() throws NamingException {
+            Map.Entry<Name,Object> element = iterator.next();
+
+            return new Binding(element.getKey().toString(),element.getValue());
+        }
+
+        @Override
+        public boolean hasMore() throws NamingException {
+            return iterator.hasNext();
+        }
+
+        @Override
+        public void close() throws NamingException {
+        }
+
+        @Override
+        public boolean hasMoreElements() {
+            return iterator.hasNext();
+        }
+
+        @Override
+        public Binding nextElement() {
+            try {
+                return next();
+            } catch (NamingException e) {
+                throw new NoSuchElementException("no such element");
+            }
+        }
+    }
+
+    private static class LMFNameParser implements NameParser {
+        @Override
+        public Name parse(String name) throws NamingException {
+            return new CompoundName(name,parseProperties);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/jndi/LMFContextFactory.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/jndi/LMFContextFactory.java b/lmf-core/src/main/java/kiwi/core/jndi/LMFContextFactory.java
new file mode 100644
index 0000000..92e9374
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/jndi/LMFContextFactory.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.jndi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+import java.util.Hashtable;
+
+/**
+ * A custom LMF JNDI implementation returning an LMFContext. This implementation should be considerably faster than
+ * the one provided by the application server, and in addition requires no configuration on the server side.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFContextFactory implements InitialContextFactory {
+
+    private static Logger log = LoggerFactory.getLogger(LMFContextFactory.class);
+
+    private static LMFContextFactory instance;
+
+    public LMFContextFactory() {
+        log.info("JNDI: initialising LMF Context Factory ...");
+
+    }
+
+    public static LMFContextFactory getInstance() {
+        if(instance == null) {
+            instance = new LMFContextFactory();
+        }
+        return instance;
+    }
+
+
+    @Override
+    public Context getInitialContext(Hashtable<?, ?> hashtable) throws NamingException {
+
+        Hashtable<Object,Object> env = new Hashtable<Object, Object>();
+        env.put("jndi.syntax.direction", "left_to_right");
+        env.put("jndi.syntax.separator","/");
+
+        env.putAll(hashtable);
+
+        return LMFInitialContext.getInstance(env);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContext.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContext.java b/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContext.java
new file mode 100644
index 0000000..0464c38
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContext.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.jndi;
+
+import kiwi.core.util.KiWiContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import java.util.Hashtable;
+
+/**
+ * This is our own simplified JNDI implementation providing the required functionality for looking up the bean
+ * manager and the SOLR home directory.
+ * <p/>
+ * The implementation is based on Simple-JNDI, which already offers the core functionality for memory-based JNDI
+ * implementations.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFInitialContext extends LMFContext {
+
+    private static Logger log = LoggerFactory.getLogger(LMFInitialContext.class);
+
+    private static LMFInitialContext instance;
+
+
+    /**
+     * @param env
+     */
+    public LMFInitialContext(Hashtable<Object, Object> env) {
+        super(env);
+
+        log.info("JNDI: creating LMF Initial Context ...");
+
+        try {
+            Context ctx_java = this.createSubcontext("java:comp");
+            Context ctx_env  = ctx_java.createSubcontext("env");
+
+            registerBeanManager(ctx_env);
+            registerSolrHome(ctx_env);
+
+        } catch (NamingException e) {
+            log.error("error while initialising LMF JNDI context",e);
+        }
+
+        KiWiContext.showJndiContext(this,"java:", "");
+
+    }
+
+    public static LMFInitialContext getInstance(Hashtable<Object, Object> env) {
+        if(instance == null) {
+            instance = new LMFInitialContext(env);
+        }
+        return instance;
+    }
+
+
+    private void registerSolrHome(Context ctx_java) throws NamingException {
+
+        Context ctx_solr = ctx_java.createSubcontext("solr");
+        ctx_solr.bind("home", new Reference("java.lang.String", "at.newmedialab.lmf.search.filters.SolrHomeFactory", null));
+
+    }
+
+    private void registerBeanManager(Context ctx_java) throws NamingException {
+        ctx_java.bind("BeanManager", new Reference("javax.enterprise.inject.spi.BeanManager", "org.jboss.weld.resources.ManagerObjectFactory", null));
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContextFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContextFactoryBuilder.java b/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContextFactoryBuilder.java
new file mode 100644
index 0000000..ae1f7a7
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/jndi/LMFInitialContextFactoryBuilder.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.jndi;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.spi.InitialContextFactoryBuilder;
+import java.util.Hashtable;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFInitialContextFactoryBuilder implements InitialContextFactoryBuilder {
+
+    public LMFInitialContextFactoryBuilder() {
+    }
+
+    @Override
+    public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> hashtable) throws NamingException {
+        // check if we are inside the LMF or outside; inside the LMF we return our own context factory,
+        // outside the system default
+        try {
+            return (InitialContextFactory) Thread.currentThread().getContextClassLoader().loadClass(LMFContextFactory.class.getName()).getMethod("getInstance").invoke(null);
+        } catch (Exception e) {
+            String factoryName = Context.INITIAL_CONTEXT_FACTORY;
+
+            try {
+                return (InitialContextFactory) Thread.currentThread().getContextClassLoader().loadClass(factoryName).newInstance();
+            } catch (Exception e1) {
+                throw new NamingException("default context factory "+factoryName+" could not be initialised");
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/jndi/LMFJndiListener.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/jndi/LMFJndiListener.java b/lmf-core/src/main/java/kiwi/core/jndi/LMFJndiListener.java
new file mode 100644
index 0000000..05844aa
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/jndi/LMFJndiListener.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.jndi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.NamingException;
+import javax.naming.spi.NamingManager;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFJndiListener implements ServletContextListener {
+
+    private static Logger log = LoggerFactory.getLogger(LMFJndiListener.class);
+
+    /**
+     * * Notification that the web application initialization
+     * * process is starting.
+     * * All ServletContextListeners are notified of context
+     * * initialization before any filter or servlet in the web
+     * * application is initialized.
+     */
+    @Override
+    public void contextInitialized(ServletContextEvent sce) {
+        log.info("JNDI: registering LMF JNDI implementation ...");
+        try {
+            NamingManager.setInitialContextFactoryBuilder(new LMFInitialContextFactoryBuilder());
+        } catch (NamingException e) {
+
+        } catch (IllegalStateException e) {
+            log.info("JNDI: a context factory of type is already installed");
+        }
+    }
+
+    /**
+     * * Notification that the servlet context is about to be shut down.
+     * * All servlets and filters have been destroy()ed before any
+     * * ServletContextListeners are notified of context
+     * * destruction.
+     */
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/content/Content.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/content/Content.java b/lmf-core/src/main/java/kiwi/core/model/content/Content.java
new file mode 100644
index 0000000..f226574
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/content/Content.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.content;
+
+/**
+ * A non-entity class used to represent in-memory media content in KiWi. The actual content is stored in
+ * KiWiMediaContentLiteral.
+ *
+ *
+ * <p/>
+ * User: sschaffe
+ */
+public class Content {
+
+    private byte[] data;
+
+    private String mimeType;
+
+    public Content(byte[] data, String mimeType) {
+        this.data = data;
+        this.mimeType = mimeType;
+    }
+
+    public byte[] getData() {
+        return data;
+    }
+
+    public void setData(byte[] data) {
+        this.data = data;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(String mimeType) {
+        this.mimeType = mimeType;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/content/MediaContent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/content/MediaContent.java b/lmf-core/src/main/java/kiwi/core/model/content/MediaContent.java
new file mode 100644
index 0000000..f4d0288
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/content/MediaContent.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.content;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * A non-entity class used to represent in-memory media content in KiWi. The actual content is stored in
+ * KiWiMediaContentLiteral.
+ *
+ *
+ * <p/>
+ * User: sschaffe
+ */
+public class MediaContent implements Serializable  {
+
+    private static final long serialVersionUID = 1L;
+
+    private byte[] data;
+
+    private String mimeType;
+
+    public MediaContent(byte[] data, String mimeType) {
+        this.data = data;
+        this.mimeType = mimeType;
+    }
+
+    public byte[] getData() {
+        return data;
+    }
+
+    public void setData(byte[] data) {
+        this.data = data;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(String mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        MediaContent that = (MediaContent) o;
+
+        if (!Arrays.equals(data, that.data)) return false;
+        return mimeType.equals(that.mimeType);
+
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Arrays.hashCode(data);
+        result = 31 * result + mimeType.hashCode();
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/content/MediaContentItem.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/content/MediaContentItem.java b/lmf-core/src/main/java/kiwi/core/model/content/MediaContentItem.java
new file mode 100644
index 0000000..ab3ec52
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/content/MediaContentItem.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.content;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import at.newmedialab.sesame.facading.annotations.RDF;
+import at.newmedialab.sesame.facading.model.Facade;
+
+/**
+ * User: Thomas Kurz
+ * Date: 25.01.11
+ * Time: 10:03
+ */
+public interface MediaContentItem  extends Facade {
+
+
+    /**
+     * Return the file system path of this content.
+     * @return
+     */
+    @RDF(Namespaces.NS_KIWI_CORE+"hasContentPath")
+    public String getContentPath();
+
+    /**
+     * Set the file system path of this content.
+     * @param path
+     */
+    public void setContentPath(String path);
+
+    /**
+     * Return the URI location of the content for this resource
+     * @return
+     */
+    @RDF(Namespaces.NS_KIWI_CORE+"hasContentLocation")
+    public String getContentLocation();
+
+    /**
+     * Set the URI location of the content for this resource
+     * @return
+     */
+    public void setContentLocation(String location);
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/filter/LMFLocalFilter.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/filter/LMFLocalFilter.java b/lmf-core/src/main/java/kiwi/core/model/filter/LMFLocalFilter.java
new file mode 100644
index 0000000..92c3536
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/filter/LMFLocalFilter.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.filter;
+
+import kiwi.core.api.config.ConfigurationService;
+import kiwi.core.util.KiWiContext;
+import org.apache.marmotta.sesame.filter.resource.ResourceFilter;
+import org.openrdf.model.BNode;
+import org.openrdf.model.Resource;
+import org.openrdf.model.URI;
+
+/**
+ * Accept only resources that are considered "local", i.e. either have the same URI prefix as the system,
+ * start with file:, start with urn:, or are blank nodes.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFLocalFilter implements ResourceFilter {
+
+    private ConfigurationService configurationService;
+
+    public LMFLocalFilter() {
+        configurationService = KiWiContext.getInstance(ConfigurationService.class);
+    }
+
+
+    private static LMFLocalFilter instance = null;
+
+    public static LMFLocalFilter getInstance() {
+        if(instance == null) {
+            instance = new LMFLocalFilter();
+        }
+        return instance;
+    }
+
+
+    /**
+     * Return false in case the filter does not accept the resource passed as argument, true otherwise.
+     *
+     *
+     * @param resource
+     * @return
+     */
+    @Override
+    public boolean accept(Resource resource) {
+        if(resource instanceof BNode) {
+            return true;
+        }
+
+        URI uri = (URI)resource;
+
+        if(uri.stringValue().startsWith("file:") || uri.stringValue().startsWith("urn:")) {
+            return true;
+        }
+
+        return uri.stringValue().startsWith(configurationService.getBaseUri());
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/module/ModuleConfiguration.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/module/ModuleConfiguration.java b/lmf-core/src/main/java/kiwi/core/model/module/ModuleConfiguration.java
new file mode 100644
index 0000000..16b3c8a
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/module/ModuleConfiguration.java
@@ -0,0 +1,139 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.module;
+
+import at.newmedialab.sesame.commons.util.DateUtils;
+import com.google.common.base.Preconditions;
+import org.apache.commons.configuration.Configuration;
+import org.apache.marmotta.commons.collections.CollectionUtils;
+
+import java.util.Date;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ModuleConfiguration {
+    
+    private Configuration config;
+
+    public ModuleConfiguration(Configuration config) {
+        Preconditions.checkNotNull(config, "configuration must not be null");
+
+        this.config = config;
+    }
+
+
+    public boolean hasBuildInfo() {
+        return config.containsKey("build.module");
+    }
+
+
+    /**
+     * Get the module name as configured in kiwi-module.properties
+     * @return the human-readable name of the module, or the string "Unknown Module"
+     */
+    public String getModuleName() {
+        return config.getString("name","Unknown Module");
+    }
+
+    /**
+     * Get the module identifier as used during build time.
+     * @return the module identifier, or "unknown" if no build info is present
+     */
+    public String getModuleId() {
+        return config.getString("build.module","unknown");
+    }
+
+    /**
+     * Get the build version of the module as configured at build time.
+     * @return the module version, or the string "RUNTIME" to indicate that the module is not part of a build
+     */
+    public String getModuleVersion() {
+        return config.getString("build.version","RUNTIME");
+    }
+
+    /**
+     * The user who assembled the module (was running the build), or the currently active system user
+     * @return   the user who assembled the module (was running the build), or the currently active system user
+     */
+    public String getBuildUser() {
+        return config.getString("build.user",System.getProperty("user.name"));
+    }
+
+    /**
+     * The host on which the module was assembled
+     * @return   the host on which the module was assembled
+     */
+    public String getBuildHost() {
+        return config.getString("build.host","unknown");
+    }
+
+    /**
+     * The host on which the module was assembled
+     * @return   the host on which the module was assembled
+     */
+    public String getBuildOS() {
+        return config.getString("build.os",System.getProperty("os.name") + " " + System.getProperty("os.version") + "/" + System.getProperty("os.arch"));
+    }
+
+    /**
+     * The version management revision of the module as determined at build time, or "0". Returns the
+     * integer version increment of the local repository used for building. For unique identifiers,
+     * consider using getBuildRevisionHash
+     *
+     * @return the version management revision of the module as determined at build time, or "0"
+     */
+    public String getBuildRevisionNumber() {
+        return config.getString("build.revision","0");
+    }
+
+
+    /**
+     * Return the unique Mercurial hash identifier for the revision used to build the system. Use this instead
+     * of getBuildRevisionNumber to ensure unique identifiers over several repositories.
+     * @return   he version management revision of the module as determined at build time, or ""
+     */
+    public String getBuildRevisionHash() {
+        return config.getString("build.revhash","");
+    }
+    
+    
+    /**
+     * Return the build time of the module in ISO time (GMT)
+     * @return the build time of the module in ISO time (GMT)
+     */
+    public String getBuildTimestamp() {
+        String timestamp = CollectionUtils.fold(config.getStringArray("build.timestamp"), ", ");
+        if("".equals(timestamp)) {
+            return DateUtils.GMTFORMAT.format(new Date());
+        } else {
+            return timestamp;
+        }
+
+    }
+
+
+    /**
+     * Return the Apache Commons Configuration object behind this module.
+     *
+     * @return
+     */
+    public Configuration getConfiguration() {
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/template/MenuItem.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/template/MenuItem.java b/lmf-core/src/main/java/kiwi/core/model/template/MenuItem.java
new file mode 100644
index 0000000..0ac7f91
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/template/MenuItem.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.template;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: tkurz
+ * Date: 18.01.13
+ * Time: 13:43
+ * To change this template use File | Settings | File Templates.
+ */
+public class MenuItem {
+
+    private Map<String,Object> properties;
+    private List<MenuItem> submenu;
+
+    public MenuItem() {
+        properties = new HashMap<String, Object>();
+        submenu = new ArrayList<MenuItem>();
+    }
+
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    public List<MenuItem> getSubmenu() {
+        return submenu;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/user/KiWiUser.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/user/KiWiUser.java b/lmf-core/src/main/java/kiwi/core/model/user/KiWiUser.java
new file mode 100644
index 0000000..60b56e5
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/user/KiWiUser.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.user;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import at.newmedialab.sesame.facading.annotations.RDF;
+import at.newmedialab.sesame.facading.annotations.RDFType;
+import at.newmedialab.sesame.facading.model.Facade;
+import org.openrdf.model.URI;
+
+import java.util.Set;
+
+
+/**
+ * User: Stephanie Stroka
+ * Date: 18.05.2011
+ * Time: 11:29:17
+ */
+@RDFType(Namespaces.NS_FOAF + "Person")
+public interface KiWiUser extends Facade {
+
+    @RDF(Namespaces.NS_FOAF + "nick")
+    public String getNick();
+    public void setNick(String nick);
+
+    /**
+     * The first name of the user; mapped to the foaf:firstName RDF property
+     */
+    @RDF(Namespaces.NS_FOAF + "firstName")
+    public String getFirstName();
+    public void setFirstName(String firstName);
+
+    /**
+     * The last name of the user; mapped to the foaf:lastName RDF property
+     */
+    @RDF(Namespaces.NS_FOAF + "lastName")
+    public String getLastName();
+    public void setLastName(String lastName);
+
+    @RDF(Namespaces.NS_FOAF + "mbox")
+    public String getMbox();
+    public void setMbox(String mbox);
+
+    @RDF(Namespaces.NS_FOAF + "depiction")
+    public URI getDepiciton();
+    public void setDepiction(URI depiction);
+
+    @RDF(Namespaces.NS_FOAF + "account")
+    public Set<OnlineAccount> getOnlineAccounts();
+    public void setOnlineAccounts(Set<OnlineAccount> onlineAccounts);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/model/user/OnlineAccount.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/model/user/OnlineAccount.java b/lmf-core/src/main/java/kiwi/core/model/user/OnlineAccount.java
new file mode 100644
index 0000000..44f2b6b
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/model/user/OnlineAccount.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.model.user;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import at.newmedialab.sesame.facading.annotations.RDF;
+import at.newmedialab.sesame.facading.annotations.RDFType;
+import at.newmedialab.sesame.facading.model.Facade;
+
+/**
+ * @author Stephanie Stroka
+ * User: Stephanie Stroka
+ * Date: 18.05.2011
+ * Time: 11:29:17
+ */
+@RDFType(Namespaces.NS_FOAF + "OnlineAccount")
+public interface OnlineAccount extends Facade {
+
+    @RDF(Namespaces.NS_FOAF + "accountServiceHomepage")
+    public String getAccountServiceHomepage();
+    public void setAccountServiceHomepage(String accountServiceHomepage);
+
+    @RDF(Namespaces.NS_FOAF + "accountName")
+    public String getAccountName();
+    public void setAccountName(String accountName);
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/cache/LMFCache.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/cache/LMFCache.java b/lmf-core/src/main/java/kiwi/core/qualifiers/cache/LMFCache.java
new file mode 100644
index 0000000..0cfeb41
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/cache/LMFCache.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.cache;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation to discriminate the injection of different caches using KiWi's CachingService
+ *
+ * Usage:
+ * @Inject @KiWiCache("cache-name")
+ * private Ehcache cache;
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+public @interface LMFCache {
+    @Nonbinding public String value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/ContentCreated.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/ContentCreated.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/ContentCreated.java
new file mode 100644
index 0000000..a9a980e
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/ContentCreated.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * User: Thomas Kurz
+ * Date: 06.09.11
+ * Time: 14:38
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface ContentCreated { }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/Created.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/Created.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Created.java
new file mode 100644
index 0000000..d09ce62
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Created.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface Created { }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/Removed.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/Removed.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Removed.java
new file mode 100644
index 0000000..eeb6ed9
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Removed.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface Removed { }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/Updated.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/Updated.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Updated.java
new file mode 100644
index 0000000..f104f70
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/Updated.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface Updated { }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterCommit.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterCommit.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterCommit.java
new file mode 100644
index 0000000..c4e9fab
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterCommit.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event.transaction;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An event qualifier used for events containing transaction data immediately after commit.
+ * <p/>
+ * Usage:
+ * public void afterCommit(@Observes @AfterCommit TransactionData data) ...
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface AfterCommit {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterRollback.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterRollback.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterRollback.java
new file mode 100644
index 0000000..559c0d6
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/AfterRollback.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event.transaction;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An event qualifier used for events containing transaction data immediately after rollback.
+ * <p/>
+ * Usage:
+ * public void beforeCommit(@Observes @AfterRollback TransactionData data) ...
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface AfterRollback {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeCommit.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeCommit.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeCommit.java
new file mode 100644
index 0000000..017f811
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeCommit.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event.transaction;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An event qualifier used for events containing transaction data immediately before commit.
+ * <p/>
+ * Usage:
+ * public void beforeCommit(@Observes @BeforeCommit TransactionData data) ...
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface BeforeCommit {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeRollback.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeRollback.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeRollback.java
new file mode 100644
index 0000000..ee2cd09
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/BeforeRollback.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event.transaction;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An event qualifier used for events containing transaction data immediately before rollback.
+ * <p/>
+ * Usage:
+ * public void beforeRollback(@Observes @BeforeRollback TransactionData data) ...
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface BeforeRollback {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/OnAbort.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/OnAbort.java b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/OnAbort.java
new file mode 100644
index 0000000..2c69c21
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/event/transaction/OnAbort.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.event.transaction;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An event qualifier used for events containing transaction data when a transaction is aborted
+ * <p/>
+ * Usage:
+ * public void beforeCommit(@Observes @BeforeCommit TransactionData data) ...
+ *
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({FIELD, PARAMETER})
+public @interface OnAbort {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/ActiveKnowledgeSpaces.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/ActiveKnowledgeSpaces.java b/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/ActiveKnowledgeSpaces.java
new file mode 100644
index 0000000..ec82483
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/ActiveKnowledgeSpaces.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.kspace;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Indicates the set of knowledge spaces that is currently active for reading. The set of active knowledge spaces
+ * is either selected explicitly in web service calls or it consists of all knowledge spaces.
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+public @interface ActiveKnowledgeSpaces {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/CurrentKnowledgeSpace.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/CurrentKnowledgeSpace.java b/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/CurrentKnowledgeSpace.java
new file mode 100644
index 0000000..0695ead
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/qualifiers/kspace/CurrentKnowledgeSpace.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kiwi.core.qualifiers.kspace;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Indicates the knowledge space that is currently selected for write access. The currently active knowledge space
+ * is either the default knowledge space or explicitly passed as argument ctx to web service calls.
+ * <p/>
+ * User: sschaffe
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+public @interface CurrentKnowledgeSpace {
+}