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
[15/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/api/triplestore/SesameService.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/triplestore/SesameService.java b/lmf-core/src/main/java/kiwi/core/api/triplestore/SesameService.java
new file mode 100644
index 0000000..704d49a
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/triplestore/SesameService.java
@@ -0,0 +1,85 @@
+/**
+ * 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.api.triplestore;
+
+import org.openrdf.model.ValueFactory;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.sail.SailRepository;
+
+/**
+ * Offers access to the Sesame repository underlying this LMF instance. The activation/deactivation methods
+ * of this service make sure the repository is properly initialised and shut down.
+ * <p/>
+ * Usage: to access the triple store properly through Sesame, you should follow the following
+ * pattern:
+ * <pre>
+ * RespositoryConnection con = sesameService.getConnection();
+ *
+ * URI subject = con.getValueFactory().createURI(...);
+ * ...
+ * RepositoryResult<Statement> result = con.getStatemenrs(subject,predicate,object,inferred,context);
+ * while(result.hasNext()) {
+ * Statement triple = result.next();
+ * ...
+ * }
+ *
+ * con.close();
+ * </pre>
+ *
+ * <p/>
+ * Will replace the existing TripleStore at some point.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public interface SesameService {
+
+ /**
+ * Initialise the Sesame repository. Should be called on service activation.
+ */
+ void initialise();
+
+
+ /**
+ * Shutdown the Sesame repository. Should be called on service deactivation.
+ */
+ void shutdown();
+
+
+ /**
+ * Return the Sesame Repository underlying this service. Callers should be careful with modifying
+ * this object directly.
+ *
+ * @return the Sesame Repository instance used by this service
+ */
+ SailRepository getRepository();
+
+ /**
+ * Return a Sesame RepositoryConnection to the underlying repository.
+ *
+ * @return a RepositoryConnection to the underlying Sesame repository.
+ */
+ RepositoryConnection getConnection() throws RepositoryException;
+
+ /**
+ * Return a Sesame ValueFactory for creating new RDF objects.
+ *
+ * @return the Sesame ValueFactory belonging to the repository that is used by the service
+ */
+ @Deprecated
+ ValueFactory getValueFactory();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/api/triplestore/StandardSailProvider.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/triplestore/StandardSailProvider.java b/lmf-core/src/main/java/kiwi/core/api/triplestore/StandardSailProvider.java
new file mode 100644
index 0000000..0cbd75d
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/triplestore/StandardSailProvider.java
@@ -0,0 +1,36 @@
+/**
+ * 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.api.triplestore;
+
+import org.openrdf.sail.Sail;
+import org.openrdf.sail.helpers.SailWrapper;
+
+/**
+ * An interface implemented by all modules that provide sail wrappers for the sesame sail stack.
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface StandardSailProvider extends SailProvider {
+
+ /**
+ * Create the sail wrapper provided by this SailProvider
+ *
+ * @param parent the parent sail to wrap by the provider
+ * @return the wrapped sail
+ */
+ public SailWrapper createSail(Sail parent);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/api/triplestore/TransactionalSailProvider.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/triplestore/TransactionalSailProvider.java b/lmf-core/src/main/java/kiwi/core/api/triplestore/TransactionalSailProvider.java
new file mode 100644
index 0000000..802c15f
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/triplestore/TransactionalSailProvider.java
@@ -0,0 +1,36 @@
+/**
+ * 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.api.triplestore;
+
+import org.apache.marmotta.kiwi.transactions.api.TransactionalSail;
+import org.apache.marmotta.kiwi.transactions.wrapper.TransactionalSailWrapper;
+
+/**
+ * An interface implemented by all modules that provide transactional sail wrappers for the sesame sail stack.
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface TransactionalSailProvider extends SailProvider {
+
+ /**
+ * Create the sail wrapper provided by this SailProvider
+ *
+ * @param parent the parent sail to wrap by the provider
+ * @return the wrapped sail
+ */
+ public TransactionalSailWrapper createSail(TransactionalSail parent);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/api/ui/LMFSystrayLink.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/ui/LMFSystrayLink.java b/lmf-core/src/main/java/kiwi/core/api/ui/LMFSystrayLink.java
new file mode 100644
index 0000000..bb22c02
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/ui/LMFSystrayLink.java
@@ -0,0 +1,49 @@
+/**
+ * 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.api.ui;
+
+/**
+ * Implementing classes provide a menu entry for the Systray menu and possibly other user interfaces.
+ * The SystrayService in lmf-systray will inject all such service classes; with the interface in lmf-core
+ * it is however not necessary to always have a dependency on lmf-systray.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public interface LMFSystrayLink {
+
+ public enum Section {
+ ADMIN, DEMO
+ }
+
+ /**
+ * Get the label of the systray entry for displaying in the menu.
+ * @return
+ */
+ public String getLabel();
+
+
+ /**
+ * Get the link to point the browser to when the user selects the menu entry.
+ * @return
+ */
+ public String getLink();
+
+ /**
+ * Get the section where to add the systray link in the menu (currently either ADMIN or DEMO).
+ * @return
+ */
+ public Section getSection();
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/api/user/UserService.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/user/UserService.java b/lmf-core/src/main/java/kiwi/core/api/user/UserService.java
new file mode 100644
index 0000000..286d7ff
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/user/UserService.java
@@ -0,0 +1,140 @@
+/**
+ * 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.api.user;
+
+import kiwi.core.exception.UserExistsException;
+import org.openrdf.model.URI;
+
+/**
+ * Manages the user-resources (BASE_URL/users/*)
+ *
+ * @author sschaffe
+ * @author Jakob Frank <ja...@salzburgresearch.at>
+ */
+public interface UserService {
+
+ /* Current User Management */
+
+ /**
+ * Return the currently active user. The method tries to determine the current user using the
+ * following means:
+ * <ol>
+ * <li>the user stored in the session, if existant
+ * <li>the user authenticated using HTTP authentication, if existant
+ * <li>the anonymous user
+ * </ol>
+ *
+ * Child-Threads will inherit the current user from it's parent thread unless the current user
+ * was explicitly set.
+ *
+ * @see #setCurrentUser(org.openrdf.model.URI)
+ *
+ * @return the resource for the current user.
+ */
+ public URI getCurrentUser();
+
+ /**
+ * Check whether the given resource is the anonyous user resource
+ *
+ *
+ * @param user the resource to check
+ * @return <code>true</code> if the given resource equals the anonymous user resource.
+ * @see #getAnonymousUser()
+ */
+ public boolean isAnonymous(URI user);
+
+ /**
+ * Set the current user to the user passed as argument. The current user should be associated
+ * with the current session in a thread local variable that is cleared again when the request
+ * finishes (KiWiUserTokenFilter)
+ *
+ * @param user
+ */
+ public void setCurrentUser(URI user);
+
+ /**
+ * Clear a current user setting for the current thread. Clears the thread local variable set for
+ * the currently running thread.
+ *
+ * This will revert the the current user to the state as it had never been set, i.e. inheriting
+ * from the parent thread.
+ */
+ public void clearCurrentUser();
+
+ /* User Token Management */
+
+ /**
+ * Create a new user with the provided login. The method first checks of a user with this login
+ * already exists; if yes, an exception is thrown.
+ *
+ *
+ * @param login login of the user to create
+ * @return the newly created user.
+ */
+ public URI createUser(String login) throws UserExistsException;
+
+ /**
+ * Create a new user with the provided login, first name and last name. The method first
+ * checks of a user with this login already exists; if yes, an exception is thrown.
+ *
+ *
+ * @param login login of the user to create
+ * @param firstName first name of the user to create
+ * @param lastName last name of the user to create
+ * @return the newly created user.
+ */
+ public URI createUser(final String login, final String firstName, final String lastName) throws UserExistsException;
+
+ /**
+ * Return the anonymous user. If it does not exist yet, it is created in the database and
+ * stored.
+ *
+ * @return the {@link org.apache.marmotta.kiwi.model.rdf.KiWiUriResource} representing the anonymous user.
+ */
+ public URI getAnonymousUser();
+
+ /**
+ * Return the (default) admin user. If it does not exist yet, it is created in the database and
+ * stored.
+ *
+ * @return the {@link org.apache.marmotta.kiwi.model.rdf.KiWiUriResource} representing the user "admin".
+ */
+ public URI getAdminUser();
+
+ /**
+ * Return a user by login. The user is looked up in the database and returned. In case
+ * no user with this login is found, this method returns null.
+ *
+ *
+ * @param login the login to look for
+ * @return the user with the given login, or null if no such user exists
+ */
+ public URI getUser(String login);
+
+ /**
+ * Check whether the user with the given login name already exists.
+ *
+ * @param login the username to check
+ * @return true if it exists.
+ */
+ public boolean userExists(String login);
+
+ /**
+ * Create the default users (namely "admin" and "anonymous").
+ */
+ public void createDefaultUsers();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/api/user/UserToken.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/api/user/UserToken.java b/lmf-core/src/main/java/kiwi/core/api/user/UserToken.java
new file mode 100644
index 0000000..e3f3a52
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/api/user/UserToken.java
@@ -0,0 +1,82 @@
+/**
+ * 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.api.user;
+
+
+import org.apache.marmotta.kiwi.model.rdf.KiWiUriResource;
+
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+public class UserToken {
+
+ private Date created, modified;
+
+ private UUID uuid;
+
+ private KiWiUriResource user;
+
+
+ public UserToken(KiWiUriResource user) {
+ this.user = user;
+ this.uuid = UUID.randomUUID();
+ this.created = new Date();
+ this.modified = new Date();
+ }
+
+ public Date getCreated() {
+ return new Date(created.getTime());
+ }
+
+ public void setCreated(Date created) {
+ this.created = new Date(created.getTime());
+ }
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ public KiWiUriResource getUser() {
+ return user;
+ }
+
+ public void setUser(KiWiUriResource user) {
+ this.user = user;
+ }
+
+ public Date getModified() {
+ return new Date(modified.getTime());
+ }
+
+ public void setModified(Date modified) {
+ this.modified = new Date(modified.getTime());
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s; %tFT%<tTZ", user, modified);
+ // return uuid.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/ConfigurationChangedEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/ConfigurationChangedEvent.java b/lmf-core/src/main/java/kiwi/core/events/ConfigurationChangedEvent.java
new file mode 100644
index 0000000..5728a56
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/ConfigurationChangedEvent.java
@@ -0,0 +1,53 @@
+/**
+ * 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.events;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * An event indicating that the configuration has been updated. Takes the configuration key as argument
+ *
+ * <p/>
+ * KiWiUser: sschaffe
+ */
+public class ConfigurationChangedEvent {
+
+ private final Set<String> keys;
+
+ public ConfigurationChangedEvent(String key) {
+ this.keys = Collections.singleton(key);
+ }
+
+ public ConfigurationChangedEvent(Set<String> keys) {
+ this.keys = Collections.unmodifiableSet(keys);
+ }
+
+ public Set<String> getKeys() {
+ return keys;
+ }
+
+ public boolean containsChangedKey(String key) {
+ return keys.contains(key);
+ }
+
+ public boolean containsChangedKeyWithPrefix(String prefix) {
+ for (String key : keys) {
+ if (key.startsWith(prefix)) return true;
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/ConfigurationServiceInitEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/ConfigurationServiceInitEvent.java b/lmf-core/src/main/java/kiwi/core/events/ConfigurationServiceInitEvent.java
new file mode 100644
index 0000000..aff794b
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/ConfigurationServiceInitEvent.java
@@ -0,0 +1,27 @@
+/**
+ * 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.events;
+
+/**
+ * Raised when the configuration service finishes its initialisation (but before the system has finished startup).
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ConfigurationServiceInitEvent {
+
+ public ConfigurationServiceInitEvent() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/ContentCreatedEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/ContentCreatedEvent.java b/lmf-core/src/main/java/kiwi/core/events/ContentCreatedEvent.java
new file mode 100644
index 0000000..c62936f
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/ContentCreatedEvent.java
@@ -0,0 +1,40 @@
+/**
+ * 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.events;
+
+import org.openrdf.model.Resource;
+
+/**
+ * User: Thomas Kurz
+ * Date: 06.09.11
+ * Time: 18:15
+ */
+public class ContentCreatedEvent {
+
+ private Resource resource;
+
+ public ContentCreatedEvent(Resource resource) {
+ this.resource = resource;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/SesameStartupEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/SesameStartupEvent.java b/lmf-core/src/main/java/kiwi/core/events/SesameStartupEvent.java
new file mode 100644
index 0000000..8de7036
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/SesameStartupEvent.java
@@ -0,0 +1,24 @@
+/**
+ * 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.events;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class SesameStartupEvent {
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/SystemRestartedEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/SystemRestartedEvent.java b/lmf-core/src/main/java/kiwi/core/events/SystemRestartedEvent.java
new file mode 100644
index 0000000..d84c31c
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/SystemRestartedEvent.java
@@ -0,0 +1,24 @@
+/**
+ * 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.events;
+
+/**
+ * Thrown when system restart has completed and the database is ready again
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class SystemRestartedEvent {
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/SystemRestartingEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/SystemRestartingEvent.java b/lmf-core/src/main/java/kiwi/core/events/SystemRestartingEvent.java
new file mode 100644
index 0000000..498d5f8
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/SystemRestartingEvent.java
@@ -0,0 +1,24 @@
+/**
+ * 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.events;
+
+/**
+ * This event is raised when the system is restarted (e.g. database reinitialised)
+ * <p/>
+ * User: sschaffe
+ */
+public class SystemRestartingEvent {
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/events/SystemStartupEvent.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/events/SystemStartupEvent.java b/lmf-core/src/main/java/kiwi/core/events/SystemStartupEvent.java
new file mode 100644
index 0000000..ec98146
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/events/SystemStartupEvent.java
@@ -0,0 +1,27 @@
+/**
+ * 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.events;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+public class SystemStartupEvent {
+
+ public SystemStartupEvent() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/InvalidArgumentException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/InvalidArgumentException.java b/lmf-core/src/main/java/kiwi/core/exception/InvalidArgumentException.java
new file mode 100644
index 0000000..e96df51
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/InvalidArgumentException.java
@@ -0,0 +1,58 @@
+/**
+ * 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.exception;
+
+/**
+ * @author Sebastian Schaffert
+ *
+ */
+public class InvalidArgumentException extends RuntimeException {
+
+ private static final long serialVersionUID = -4997842359857913880L;
+
+ /**
+ *
+ */
+ public InvalidArgumentException() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidArgumentException(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidArgumentException(Throwable arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public InvalidArgumentException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ // TODO Auto-generated constructor stub
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/LMFConfigurationException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/LMFConfigurationException.java b/lmf-core/src/main/java/kiwi/core/exception/LMFConfigurationException.java
new file mode 100644
index 0000000..abe5c28
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/LMFConfigurationException.java
@@ -0,0 +1,40 @@
+/**
+ * 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.exception;
+
+/**
+ *
+ * @author Sebastian Schaffert
+ */
+public class LMFConfigurationException extends LMFException {
+
+ private static final long serialVersionUID = 5573137610964184957L;
+
+ /**
+ * Creates a new instance of <code>KiWiConfigurationException</code> without detail message.
+ */
+ public LMFConfigurationException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>KiWiConfigurationException</code> with the specified detail message.
+ * @param msg the detail message.
+ */
+ public LMFConfigurationException(String msg) {
+ super(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/LMFException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/LMFException.java b/lmf-core/src/main/java/kiwi/core/exception/LMFException.java
new file mode 100644
index 0000000..413645b
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/LMFException.java
@@ -0,0 +1,49 @@
+/**
+ * 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.exception;
+
+/**
+ *
+ * @author Sebastian Schaffert
+ */
+public class LMFException extends Exception {
+
+ private static final long serialVersionUID = 6193753017649674995L;
+
+
+ /**
+ * Creates a new instance of <code>KiWiException</code> without detail message.
+ */
+ public LMFException() {
+ }
+
+
+ /**
+ * Constructs an instance of <code>KiWiException</code> with the specified detail message.
+ * @param msg the detail message.
+ */
+ public LMFException(String msg) {
+ super(msg);
+ }
+
+ public LMFException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public LMFException(Throwable c) {
+ super(c);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/ResolvingException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/ResolvingException.java b/lmf-core/src/main/java/kiwi/core/exception/ResolvingException.java
new file mode 100644
index 0000000..8ea4f1b
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/ResolvingException.java
@@ -0,0 +1,33 @@
+/**
+ * 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.exception;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+public class ResolvingException extends Exception {
+
+ private static final long serialVersionUID = 1172696647248144843L;
+
+ public ResolvingException() {
+ }
+
+ public ResolvingException(String s) {
+ super(s);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/TemplatingException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/TemplatingException.java b/lmf-core/src/main/java/kiwi/core/exception/TemplatingException.java
new file mode 100644
index 0000000..f1d3823
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/TemplatingException.java
@@ -0,0 +1,33 @@
+/**
+ * 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.exception;
+
+/**
+ * User: Thomas Kurz
+ * Date: 22.07.11
+ * Time: 13:45
+ */
+public class TemplatingException extends Exception {
+
+ private static final long serialVersionUID = 4400229749389036384L;
+
+ public TemplatingException() {
+ super();
+ }
+ public TemplatingException(String msg) {
+ super(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/UserExistsException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/UserExistsException.java b/lmf-core/src/main/java/kiwi/core/exception/UserExistsException.java
new file mode 100644
index 0000000..7c51d68
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/UserExistsException.java
@@ -0,0 +1,59 @@
+/**
+ * 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.exception;
+
+/**
+ * Thrown to indicate that a user already exists when trying to create a new one.
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public class UserExistsException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8670379009777836957L;
+
+ /**
+ *
+ */
+ public UserExistsException() {
+ }
+
+ /**
+ * @param message
+ */
+ public UserExistsException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public UserExistsException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public UserExistsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/WritingNotSupportedException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/WritingNotSupportedException.java b/lmf-core/src/main/java/kiwi/core/exception/WritingNotSupportedException.java
new file mode 100644
index 0000000..76f9be5
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/WritingNotSupportedException.java
@@ -0,0 +1,48 @@
+/**
+ * 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.exception;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class WritingNotSupportedException extends LMFException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7591775138145634253L;
+
+ /**
+ * Creates a new instance of <code>KiWiException</code> without detail message.
+ */
+ public WritingNotSupportedException() {
+ }
+
+ /**
+ * Constructs an instance of <code>KiWiException</code> with the specified detail message.
+ *
+ * @param msg the detail message.
+ */
+ public WritingNotSupportedException(String msg) {
+ super(msg);
+ }
+
+ public WritingNotSupportedException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/authentication/LoginFailedException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/authentication/LoginFailedException.java b/lmf-core/src/main/java/kiwi/core/exception/authentication/LoginFailedException.java
new file mode 100644
index 0000000..0950712
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/authentication/LoginFailedException.java
@@ -0,0 +1,32 @@
+/**
+ * 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.exception.authentication;
+
+/**
+ * @author sstroka
+ * User: sstroka
+ * Date: 29.09.2011
+ * Time: 17:16:08
+ */
+public class LoginFailedException extends Exception {
+
+ private static final long serialVersionUID = 672088108405801956L;
+
+ public LoginFailedException(String s) {
+ super(s);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/io/LMFExportException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/io/LMFExportException.java b/lmf-core/src/main/java/kiwi/core/exception/io/LMFExportException.java
new file mode 100644
index 0000000..35bf1f2
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/io/LMFExportException.java
@@ -0,0 +1,85 @@
+/**
+ * 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.exception.io;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFExportException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2679720143121353080L;
+
+ /**
+ * Constructs a new exception with <code>null</code> as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public LMFExportException() {
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public LMFExportException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. <p>Note that the detail message associated with
+ * <code>cause</code> is <i>not</i> automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public LMFExportException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+ * typically contains the class and detail message of <tt>cause</tt>).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public LMFExportException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/io/LMFImportException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/io/LMFImportException.java b/lmf-core/src/main/java/kiwi/core/exception/io/LMFImportException.java
new file mode 100644
index 0000000..08285b7
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/io/LMFImportException.java
@@ -0,0 +1,48 @@
+/**
+ * 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.exception.io;
+
+/**
+ * Exception that is thrown if KiWi recognizes problems with the import service.
+ *
+ * @author Stephanie Stroka
+ * (stephanie.stroka@salzburgresearch.at)
+ *
+ */
+public class LMFImportException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8157237047910758443L;
+
+ public LMFImportException() {
+ super();
+ }
+
+ public LMFImportException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public LMFImportException(String message) {
+ super(message);
+ }
+
+ public LMFImportException(Throwable cause) {
+ super(cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/io/UnsupportedExporterException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/io/UnsupportedExporterException.java b/lmf-core/src/main/java/kiwi/core/exception/io/UnsupportedExporterException.java
new file mode 100644
index 0000000..6940212
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/io/UnsupportedExporterException.java
@@ -0,0 +1,49 @@
+/**
+ * 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.exception.io;
+
+
+/**
+ * Thrown if the export format is not supported by the export service.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class UnsupportedExporterException extends LMFExportException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -557585376003250965L;
+
+ /**
+ * Creates a new instance of <code>KiWiException</code> without detail message.
+ */
+ public UnsupportedExporterException() {
+ }
+
+ /**
+ * Constructs an instance of <code>KiWiException</code> with the specified detail message.
+ *
+ * @param msg the detail message.
+ */
+ public UnsupportedExporterException(String msg) {
+ super(msg);
+ }
+
+ public UnsupportedExporterException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/security/AccessDeniedException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/security/AccessDeniedException.java b/lmf-core/src/main/java/kiwi/core/exception/security/AccessDeniedException.java
new file mode 100644
index 0000000..ffcd49b
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/security/AccessDeniedException.java
@@ -0,0 +1,82 @@
+/**
+ * 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.exception.security;
+
+/**
+ * Thrown by the filter chain in case the access to the resource is denied. Caught by LMFAuthenticationFilter to
+ * send an authorization request.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class AccessDeniedException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs a new runtime exception with <code>null</code> as its
+ * detail message. The cause is not initialized, and may subsequently be
+ * initialized by a call to {@link #initCause}.
+ */
+ public AccessDeniedException() {
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public AccessDeniedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail message and
+ * cause. <p>Note that the detail message associated with
+ * <code>cause</code> is <i>not</i> automatically incorporated in
+ * this runtime exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public AccessDeniedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified cause and a
+ * detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * (which typically contains the class and detail message of
+ * <tt>cause</tt>). This constructor is useful for runtime exceptions
+ * that are little more than wrappers for other throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public AccessDeniedException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/webservice/NotFoundException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/webservice/NotFoundException.java b/lmf-core/src/main/java/kiwi/core/exception/webservice/NotFoundException.java
new file mode 100644
index 0000000..c8390a7
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/webservice/NotFoundException.java
@@ -0,0 +1,43 @@
+/**
+ * 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.exception.webservice;
+
+import kiwi.core.exception.LMFException;
+
+/**
+ * User: Thomas Kurz
+ * Date: 21.02.11
+ * Time: 13:09
+ */
+public class NotFoundException extends LMFException {
+ private static final long serialVersionUID = 4705776110923618486L;
+
+ public NotFoundException() {
+ super();
+ }
+ public NotFoundException(String s) {
+ super(s);
+ }
+
+ public NotFoundException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public NotFoundException(Throwable c) {
+ super(c);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/exception/webservice/ServerException.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/exception/webservice/ServerException.java b/lmf-core/src/main/java/kiwi/core/exception/webservice/ServerException.java
new file mode 100644
index 0000000..80c3734
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/exception/webservice/ServerException.java
@@ -0,0 +1,44 @@
+/**
+ * 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.exception.webservice;
+
+import kiwi.core.exception.LMFException;
+
+/**
+ * User: Thomas Kurz
+ * Date: 21.02.11
+ * Time: 13:15
+ */
+public class ServerException extends LMFException {
+
+ private static final long serialVersionUID = 8374959314074759653L;
+
+ public ServerException() {
+ super();
+ }
+ public ServerException(String s) {
+ super(s);
+ }
+
+ public ServerException(String s, Throwable c) {
+ super(s, c);
+ }
+
+ public ServerException(Throwable c) {
+ super(c);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/java/kiwi/core/filters/LMFServerNameFilter.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/filters/LMFServerNameFilter.java b/lmf-core/src/main/java/kiwi/core/filters/LMFServerNameFilter.java
new file mode 100644
index 0000000..91c703e
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/filters/LMFServerNameFilter.java
@@ -0,0 +1,119 @@
+/**
+ * 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.filters;
+
+import kiwi.core.api.config.ConfigurationService;
+import kiwi.core.api.modules.LMFHttpFilter;
+import kiwi.core.model.module.ModuleConfiguration;
+
+import javax.inject.Inject;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * Adds the LMF Server Version header to each response
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LMFServerNameFilter implements LMFHttpFilter {
+
+ @Inject
+ private ConfigurationService configurationService;
+
+ @Inject
+ private ModuleConfiguration moduleConfiguration;
+
+ /**
+ * Return the pattern (regular expression) that a request URI (relative to the LMF base URI) has to match
+ * before triggering this filter.
+ *
+ * @return
+ */
+ @Override
+ public String getPattern() {
+ return "/.*";
+ }
+
+ /**
+ * Return the priority of the filter. Filters that need to be executed before anything else should return
+ * PRIO_FIRST, filters that need to be executed last in the chain should return PRIO_LAST, all other filters
+ * something inbetween (e.g. PRIO_MIDDLE).
+ *
+ * @return
+ */
+ @Override
+ public int getPriority() {
+ return PRIO_MIDDLE;
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being placed into
+ * service. The servlet container calls the init method exactly once after instantiating the
+ * filter. The init method must complete successfully before the filter is asked to do any
+ * filtering work. <br><br>
+ * <p/>
+ * The web container cannot place the filter into service if the init method either<br>
+ * 1.Throws a ServletException <br>
+ * 2.Does not return within a time period defined by the web container
+ */
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+ /**
+ * The <code>doFilter</code> method of the Filter is called by the container
+ * each time a request/response pair is passed through the chain due
+ * to a client request for a resource at the end of the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the next entity in the
+ * chain.<p>
+ * A typical implementation of this method would follow the following pattern:- <br>
+ * 1. Examine the request<br>
+ * 2. Optionally wrap the request object with a custom implementation to
+ * filter content or headers for input filtering <br>
+ * 3. Optionally wrap the response object with a custom implementation to
+ * filter content or headers for output filtering <br>
+ * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
+ * * 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
+ * * 5. Directly set headers on the response after invocation of the next entity in the filter chain.
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ HttpServletResponse resp = (HttpServletResponse)response;
+ resp.setHeader("Server","Linked Media Framework/"+moduleConfiguration.getModuleVersion() + " (build "+moduleConfiguration.getBuildRevisionNumber()+")");
+
+ chain.doFilter(request,response);
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being taken out of service. This
+ * method is only called once all threads within the filter's doFilter method have exited or after
+ * a timeout period has passed. After the web container calls this method, it will not call the
+ * doFilter method again on this instance of the filter. <br><br>
+ * <p/>
+ * This method gives the filter an opportunity to clean up any resources that are being held (for
+ * example, memory, file handles, threads) and make sure that any persistent state is synchronized
+ * with the filter's current state in memory.
+ */
+ @Override
+ public void destroy() {
+ //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/filters/ModuleResourceFilter.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/filters/ModuleResourceFilter.java b/lmf-core/src/main/java/kiwi/core/filters/ModuleResourceFilter.java
new file mode 100644
index 0000000..33e4b44
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/filters/ModuleResourceFilter.java
@@ -0,0 +1,178 @@
+/**
+ * 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.filters;
+
+import kiwi.core.api.config.ConfigurationService;
+import kiwi.core.api.modules.LMFHttpFilter;
+import kiwi.core.api.modules.LMFResourceService;
+import kiwi.core.api.modules.ResourceEntry;
+import org.slf4j.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * Resolve the resources of LMF modules and deliver them. Proceeds with the chain if not found.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+@ApplicationScoped
+public class ModuleResourceFilter implements LMFHttpFilter {
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private LMFResourceService resourceService;
+
+ @Inject
+ private ConfigurationService configurationService;
+
+
+ /**
+ * Return the pattern (regular expression) that a request URI (relative to the LMF base URI) has to match
+ * before triggering this filter.
+ *
+ * @return
+ */
+ @Override
+ public String getPattern() {
+ return "^/.*";
+ }
+
+ /**
+ * Return the priority of the filter. Filters that need to be executed before anything else should return
+ * PRIO_FIRST, filters that need to be executed last in the chain should return PRIO_LAST, all other filters
+ * something inbetween (e.g. PRIO_MIDDLE).
+ *
+ * @return
+ */
+ @Override
+ public int getPriority() {
+ return PRIO_LAST;
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being placed into
+ * service. The servlet container calls the init method exactly once after instantiating the
+ * filter. The init method must complete successfully before the filter is asked to do any
+ * filtering work. <br><br>
+ * <p/>
+ * The web container cannot place the filter into service if the init method either<br>
+ * 1.Throws a ServletException <br>
+ * 2.Does not return within a time period defined by the web container
+ */
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ /**
+ * The <code>doFilter</code> method of the Filter is called by the container
+ * each time a request/response pair is passed through the chain due
+ * to a client request for a resource at the end of the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the next entity in the
+ * chain.<p>
+ * A typical implementation of this method would follow the following pattern:- <br>
+ * 1. Examine the request<br>
+ * 2. Optionally wrap the request object with a custom implementation to
+ * filter content or headers for input filtering <br>
+ * 3. Optionally wrap the response object with a custom implementation to
+ * filter content or headers for output filtering <br>
+ * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
+ * * 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
+ * * 5. Directly set headers on the response after invocation of the next entity in the filter chain.
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ URL url = null;
+ String prefix = null, path = null;
+ if (request instanceof HttpServletRequest) {
+ url = new URL(((HttpServletRequest)request).getRequestURL().toString());
+ prefix = ((HttpServletRequest)request).getContextPath();
+ if(url.getPath().startsWith(prefix)) {
+ path = url.getPath().substring(prefix.length());
+ }
+ }
+
+
+ if(path != null) {
+ long starttime = System.currentTimeMillis();
+
+ ResourceEntry data = resourceService.getResource(path);
+
+
+ // if no: proceed with the chain by calling chain.doFilter()
+ if(data != null && data.getLength() > 0) {
+
+
+ HttpServletResponse hresponse = (HttpServletResponse) response;
+
+ if(configurationService.getBooleanConfiguration("resources.browsercache.enabled",true)) {
+ hresponse.setDateHeader("Expires", System.currentTimeMillis()+configurationService.getIntConfiguration("resources.browsercache.seconds",300)*1000);
+ } else {
+ hresponse.setHeader("Cache-Control", "no-store");
+ hresponse.setHeader("Pragma", "no-cache");
+ hresponse.setDateHeader("Expires", 0);
+ }
+
+ if(data.getContentType() != null && !data.getContentType().contains("unknown")) {
+ hresponse.setContentType(data.getContentType());
+ }
+ hresponse.setContentLength(data.getLength());
+
+ hresponse.getOutputStream().write(data.getData());
+ hresponse.getOutputStream().flush();
+ hresponse.getOutputStream().close();
+
+ if (log.isDebugEnabled()) {
+ log.debug("request for {} took {}ms", url, System.currentTimeMillis() - starttime);
+ }
+
+ return;
+ }
+
+
+
+ }
+
+ chain.doFilter(request,response);
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being taken out of service. This
+ * method is only called once all threads within the filter's doFilter method have exited or after
+ * a timeout period has passed. After the web container calls this method, it will not call the
+ * doFilter method again on this instance of the filter. <br><br>
+ * <p/>
+ * This method gives the filter an opportunity to clean up any resources that are being held (for
+ * example, memory, file handles, threads) and make sure that any persistent state is synchronized
+ * with the filter's current state in memory.
+ */
+ @Override
+ public void destroy() {
+ //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/filters/TemplatingFilter.java
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/java/kiwi/core/filters/TemplatingFilter.java b/lmf-core/src/main/java/kiwi/core/filters/TemplatingFilter.java
new file mode 100644
index 0000000..9f9e55a
--- /dev/null
+++ b/lmf-core/src/main/java/kiwi/core/filters/TemplatingFilter.java
@@ -0,0 +1,190 @@
+/**
+ * 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.filters;
+
+import kiwi.core.api.config.ConfigurationService;
+import kiwi.core.api.modules.LMFHttpFilter;
+import kiwi.core.api.modules.LMFResourceService;
+import kiwi.core.api.modules.ResourceEntry;
+import kiwi.core.api.templating.TemplatingService;
+import kiwi.core.exception.TemplatingException;
+import org.slf4j.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+@ApplicationScoped
+public class TemplatingFilter implements LMFHttpFilter {
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private LMFResourceService resourceService;
+
+ @Inject
+ private ConfigurationService configurationService;
+
+ @Inject
+ private TemplatingService templatingService;
+
+ /**
+ * Return the pattern (regular expression) that a request URI (relative to the LMF base URI) has to match
+ * before triggering this filter.
+ *
+ * @return
+ */
+ @Override
+ public String getPattern() {
+ return "^/.*";
+ }
+
+ /**
+ * Return the priority of the filter. Filters that need to be executed before anything else should return
+ * PRIO_FIRST, filters that need to be executed last in the chain should return PRIO_LAST, all other filters
+ * something inbetween (e.g. PRIO_MIDDLE).
+ *
+ * @return
+ */
+ @Override
+ public int getPriority() {
+ return PRIO_MIDDLE;
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being placed into
+ * service. The servlet container calls the init method exactly once after instantiating the
+ * filter. The init method must complete successfully before the filter is asked to do any
+ * filtering work. <br><br>
+ * <p/>
+ * The web container cannot place the filter into service if the init method either<br>
+ * 1.Throws a ServletException <br>
+ * 2.Does not return within a time period defined by the web container
+ */
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ //init templating service
+ try {
+ templatingService.init(filterConfig.getServletContext());
+ } catch (TemplatingException e) {
+ log.error("templating service could not be initialized: " + e.getMessage());
+ }
+ }
+
+ /**
+ * The <code>doFilter</code> method of the Filter is called by the container
+ * each time a request/response pair is passed through the chain due
+ * to a client request for a resource at the end of the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the next entity in the
+ * chain.<p>
+ * A typical implementation of this method would follow the following pattern:- <br>
+ * 1. Examine the request<br>
+ * 2. Optionally wrap the request object with a custom implementation to
+ * filter content or headers for input filtering <br>
+ * 3. Optionally wrap the response object with a custom implementation to
+ * filter content or headers for output filtering <br>
+ * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
+ * * 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
+ * * 5. Directly set headers on the response after invocation of the next entity in the filter chain.
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ URL url = null;
+ String prefix = null, path = null;
+ if (request instanceof HttpServletRequest) {
+ url = new URL(((HttpServletRequest)request).getRequestURL().toString());
+ prefix = ((HttpServletRequest)request).getContextPath();
+ if(url.getPath().startsWith(prefix)) {
+ path = url.getPath().substring(prefix.length());
+ }
+ }
+ long starttime = System.currentTimeMillis();
+
+
+ if(path != null && templatingService.isMenuEntry(path)) {
+
+ ResourceEntry data = resourceService.getResource(path);
+
+ // if no: proceed with the chain by calling chain.doFilter()
+ if(data != null && data.getLength() > 0) {
+
+ try {
+ byte [] templatedData = templatingService.process(data.getData(),path);
+ data = new ResourceEntry(data.getLocation(),templatedData,templatedData.length,data.getContentType());
+
+ HttpServletResponse hresponse = (HttpServletResponse) response;
+
+ if(configurationService.getBooleanConfiguration("resources.browsercache.enabled",true)) {
+ hresponse.setDateHeader("Expires", System.currentTimeMillis()+configurationService.getIntConfiguration("resources.browsercache.seconds",300)*1000);
+ } else {
+ hresponse.setHeader("Cache-Control", "no-store");
+ hresponse.setHeader("Pragma", "no-cache");
+ hresponse.setDateHeader("Expires", 0);
+ }
+
+ if(data.getContentType() != null && !data.getContentType().contains("unknown")) {
+ hresponse.setContentType(data.getContentType());
+ }
+ hresponse.setContentLength(data.getLength());
+
+ hresponse.getOutputStream().write(data.getData());
+ hresponse.getOutputStream().flush();
+ hresponse.getOutputStream().close();
+
+ if (log.isDebugEnabled()) {
+ log.debug("request for {} took {}ms", url, System.currentTimeMillis() - starttime);
+ }
+
+ return;
+ } catch(TemplatingException e) {
+ log.error("templating did not work");
+ }
+
+ }
+ }
+
+ chain.doFilter(request,response);
+ }
+
+ /**
+ * Called by the web container to indicate to a filter that it is being taken out of service. This
+ * method is only called once all threads within the filter's doFilter method have exited or after
+ * a timeout period has passed. After the web container calls this method, it will not call the
+ * doFilter method again on this instance of the filter. <br><br>
+ * <p/>
+ * This method gives the filter an opportunity to clean up any resources that are being held (for
+ * example, memory, file handles, threads) and make sure that any persistent state is synchronized
+ * with the filter's current state in memory.
+ */
+ @Override
+ public void destroy() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}