You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/02/22 16:21:36 UTC
[13/37] MARMOTTA-105: renamed packages in marmotta-core
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/http/HttpClientService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/http/HttpClientService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/http/HttpClientService.java
new file mode 100644
index 0000000..ec1ce10
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/http/HttpClientService.java
@@ -0,0 +1,166 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.http;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.methods.HttpUriRequest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+public interface HttpClientService {
+
+ /**
+ * Execute the {@link HttpRequestBase} passing the response to the provided
+ * {@link ResponseHandler}. Connection management is done by the {@link HttpClientService}
+ *
+ * @param request the HttpRequest to execute
+ * @param handler the {@link ResponseHandler} for the response
+ * @return whatever the {@link ResponseHandler} builds.
+ *
+ * @see HttpClient#execute(HttpUriRequest, ResponseHandler)
+ */
+ public <T> T execute(HttpRequestBase request, ResponseHandler<? extends T> handler) throws ClientProtocolException, IOException;
+
+ /**
+ * Execute the {@link HttpRequestBase}.
+ *
+ * <b>ATTENTION</b> To prevent memory leaks, make sure to close the {@link InputStream} in the
+ * {@link HttpEntity}, or
+ * use {@link #cleanupResponse(HttpResponse)}!
+ *
+ * @param request the HttpRequest to execute.
+ * @return the {@link HttpResponse} of the request. <b>ATTENTION</b> To prevent memory leaks,
+ * make sure to close the {@link InputStream} in the {@link HttpEntity}, or
+ * use {@link #cleanupResponse(HttpResponse)}!
+ * @see #cleanupResponse(HttpResponse)
+ */
+ public HttpResponse execute(HttpRequestBase request) throws ClientProtocolException, IOException;
+
+ /**
+ * Close and release all resources of the provided {@link HttpResponse}.
+ *
+ * @param response the {@link HttpResponse} to clean up.
+ * @see org.apache.http.util.EntityUtils#consume(HttpEntity)
+ */
+ public void cleanupResponse(HttpResponse response);
+
+ /**
+ * Convenience method to execute a <code>GET</code>-request.
+ *
+ * @param requestUrl the request URL
+ * @param responseHandler the {@link ResponseHandler} for the request
+ * @return whatever the {@link ResponseHandler} builds.
+ */
+ public <T> T doGet(String requestUrl, ResponseHandler<? extends T> responseHandler) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>GET</code>-request, returning the response-entity as
+ * {@link String}.
+ *
+ * @param requestUrl the request URL
+ * @return the response-entity.
+ */
+ public String doGet(String requestUrl) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>POST</code>-request.
+ *
+ * @param requestUrl the request URL
+ * @param body the (body) content of the <code>POST</code>-request
+ * @param responseHandler the {@link ResponseHandler} for the request
+ * @return whatever the {@link ResponseHandler} builds.
+ */
+ public <T> T doPost(String requestUrl, HttpEntity body, ResponseHandler<? extends T> responseHandler) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>POST</code>-request, returning the response-entity as
+ * {@link String}.
+ *
+ * @param url the request URL
+ * @param body the (body) content of the <code>POST</code>-request
+ * @return the response-entity.
+ */
+ public String doPost(String url, String body) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>PUT</code>-request.
+ *
+ * @param requestUrl the request URL
+ * @param body the (body) content of the <code>PUT</code>-request
+ * @param responseHandler the {@link ResponseHandler} for the request
+ * @return whatever the {@link ResponseHandler} builds.
+ */
+ public <T> T doPut(String url, HttpEntity body, ResponseHandler<? extends T> responseHandler) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>PUT</code>-request, returning the response-entity as
+ * {@link String}.
+ *
+ * @param url the request URL
+ * @param body the (body) content of the <code>PUT</code>-request
+ * @return the response-entity.
+ */
+ public String doPut(String url, String body) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>DELETE</code>-request.
+ *
+ * @param requestUrl the request URL
+ * @param responseHandler the {@link ResponseHandler} for the request
+ * @return whatever the {@link ResponseHandler} builds.
+ */
+ public <T> T doDelete(String url, ResponseHandler<? extends T> responseHandler) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>DELETE</code>-request, returning the response code.
+ *
+ * @param url the request URL
+ * @return the http response code (e.g. <code>200</code> for success)
+ * @see org.apache.http.HttpStatus
+ */
+ public int doDelete(String url) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>HEAD</code>-request.
+ *
+ * @param requestUrl the request URL
+ * @param responseHandler the {@link ResponseHandler} for the request
+ * @return whatever the {@link ResponseHandler} builds.
+ */
+ public <T> T doHead(String url, ResponseHandler<? extends T> responseHandler) throws IOException;
+
+ /**
+ * Convenience method to execute a <code>HEAD</code>-request, returning the last-modified date.
+ *
+ * @param url the request URL
+ * @return the value Last-Modified Header, or <code>null</code> if the header was missing or
+ * could not be parsed.
+ */
+ public Date doHead(String url) throws IOException;
+
+ /**
+ * Get a ready-to-use {@link HttpClient}.
+ */
+ public HttpClient getHttpClient();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/ImportService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/ImportService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/ImportService.java
new file mode 100644
index 0000000..3cf7e3b
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/ImportService.java
@@ -0,0 +1,109 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.importer;
+
+import org.apache.marmotta.platform.core.exception.io.LMFImportException;
+import org.openrdf.model.Resource;
+import org.openrdf.model.URI;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Set;
+
+/**
+ * A service for importing and exporting different kinds of data into the KiWi system.
+ *
+ * Should at least support:
+ * - a native KiWi format
+ * - RDF in XML format
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public interface ImportService {
+
+ /**
+ * Get a collection of all mime types accepted by this importer. Used for automatically
+ * selecting the appropriate importer in ImportService.
+ *
+ * @return a set of strings representing the mime types accepted by this importer
+ */
+ public Set<String> getAcceptTypes();
+
+ /**
+ * Import data from the input stream provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param url the url from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ * @param context the context of the import data; if null, default context is used
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import fails
+ */
+ public int importData(URL url, String format, Resource user, URI context) throws LMFImportException;
+
+
+ /**
+ * Import data from the input stream provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param is the input stream from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ * @param context the context of the import data; if null, default context is used
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import cannot execute
+ */
+ public int importData(InputStream is, String format, Resource user, URI context) throws LMFImportException;
+
+ /**
+ * Import data from the reader provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param reader the reader from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ * @param context the context of the import data; if null, default context is used
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import fails
+ */
+ public int importData(Reader reader, String format, Resource user, URI context) throws LMFImportException;
+
+
+ /**
+ * Schedule an import for regular execution. When the ImportService is running, it
+ * checks at regular intervals whether the task is due and runs it if necessary.
+ *
+ * @param description a human-readable description of the task
+ * @param interval a Date representing the interval in which to run the task
+ * @param url the URL to retrieve
+ * @param format the format of the content to retrieve
+ * @param types the types to associate with each imported content item
+ * @param tags the tags to associate with each imported content item
+ * @param user the user to set as author for each imported content item
+ */
+ //public void scheduleImport(String description, Date interval, URL url, String format, Set<KiWiUriResource> types, Set<KiWiResource> tags, KiWiUser user);
+ //TODO implement scheduled importer
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/Importer.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/Importer.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/Importer.java
new file mode 100644
index 0000000..a7df82e
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/importer/Importer.java
@@ -0,0 +1,109 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.importer;
+
+import org.apache.marmotta.platform.core.exception.io.LMFImportException;
+import org.openrdf.model.Resource;
+import org.openrdf.model.URI;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Set;
+
+
+/**
+ * Interface specification for importer components that may be used for importing content
+ * in various formats into the KiWi system.
+ * <p>
+ * Importers are typically implemented as stateless components that register themselves on
+ * startup with the ImportService by calling registerImporter(); they usually make
+ * use of the kiwiEntityManager for persisting entities and the tripleStore component for
+ * adding/updating triples.
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public interface Importer {
+
+
+ /**
+ * Get the name of this importer. Used for presentation to the user and for internal
+ * identification.
+ *
+ * @return a string uniquely identifying this importer
+ */
+ public String getName();
+
+ /**
+ * Get a description of this importer for presentation to the user.
+ *
+ * @return a string describing this importer for the user
+ */
+ public String getDescription();
+
+
+ /**
+ * Get a collection of all mime types accepted by this importer. Used for automatically
+ * selecting the appropriate importer in ImportService.
+ *
+ * @return a set of strings representing the mime types accepted by this importer
+ */
+ public Set<String> getAcceptTypes();
+
+ /**
+ * Import data from the input stream provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param url the url from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import fails
+ */
+ public int importData(URL url, String format, Resource user, URI context) throws LMFImportException;
+
+ /**
+ * Import data from the input stream provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param is the input stream from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import cannot execute
+ */
+ public int importData(InputStream is, String format, Resource user, URI context) throws LMFImportException;
+
+ /**
+ * Import data from the reader provided as argument into the KiWi database.
+ *
+ *
+ *
+ * @param reader the reader from which to read the data
+ * @param format the mime type of the import format
+ * @param user the user to use as author of all imported data
+ *
+ * @return the number of Content Items imported
+ * @throws org.apache.marmotta.platform.core.exception.io.LMFImportException in case the import fails
+ */
+ public int importData(Reader reader, String format, Resource user, URI context) throws LMFImportException;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/LMFIOService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/LMFIOService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/LMFIOService.java
new file mode 100644
index 0000000..b6f1205
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/LMFIOService.java
@@ -0,0 +1,56 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.io;
+
+import org.openrdf.rio.RDFFormat;
+
+import java.util.List;
+
+/**
+ * Manages RDF parsers and serializers
+ *
+ * User: Thomas Kurz
+ * Date: 18.02.11
+ * Time: 10:37
+ */
+public interface LMFIOService {
+
+ /**
+ * returns a list of all mimetypes which can be parsed by implemented parsers
+ * @return
+ */
+ public List<String> getAcceptTypes();
+
+ /**
+ * returns a list of all mimetypes which can be produced by implemented serializers
+ * @return
+ */
+ public List<String> getProducedTypes();
+
+ /**
+ * returns a serializer for a given mimetype; null if no serializer defined
+ * @param mimetype
+ * @return
+ */
+ public RDFFormat getSerializer(String mimetype);
+ /**
+ * returns a parser for a given mimetype; null if no parser defined
+ * @param mimetype
+ * @return
+ */
+ public RDFFormat getParser(String mimetype);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFHtmlWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFHtmlWriter.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFHtmlWriter.java
new file mode 100644
index 0000000..62fd967
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFHtmlWriter.java
@@ -0,0 +1,29 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.io;
+
+import org.openrdf.rio.RDFWriter;
+
+/**
+ * User: Thomas Kurz
+ * Date: 08.08.12
+ * Time: 11:02
+ */
+public interface RDFHtmlWriter extends RDFWriter {
+
+ public RDFWriterPriority getPriority();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFWriterPriority.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFWriterPriority.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFWriterPriority.java
new file mode 100644
index 0000000..2d24cae
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/io/RDFWriterPriority.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 org.apache.marmotta.platform.core.api.io;
+
+/**
+ * User: Thomas Kurz
+ * Date: 08.08.12
+ * Time: 11:07
+ */
+public enum RDFWriterPriority {
+
+ VERY_LOW,LOW,MEDIUM,HIGH,VERY_HIGH;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/logging/LoggingService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/logging/LoggingService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/logging/LoggingService.java
new file mode 100644
index 0000000..7b66fb0
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/logging/LoggingService.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 org.apache.marmotta.platform.core.api.logging;
+
+import org.slf4j.Logger;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * LoggingService - a service for providing a SLF4J logger to other components in the
+ * KiWi system.
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public interface LoggingService {
+
+ /**
+ * Provide a logger to the injection point given as argument.
+ *
+ * @param injectionPoint
+ * @return
+ */
+ public Logger createLogger(InjectionPoint injectionPoint);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFHttpFilter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFHttpFilter.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFHttpFilter.java
new file mode 100644
index 0000000..6871c5e
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFHttpFilter.java
@@ -0,0 +1,57 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.modules;
+
+import javax.servlet.Filter;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+public interface LMFHttpFilter extends Filter {
+
+ // authentication and access control have to come before everything else
+ public static int PRIO_AUTH = Integer.MIN_VALUE;
+
+ public static int PRIO_ACL = Integer.MIN_VALUE + 10;
+
+ // first in filter chain
+ public static int PRIO_FIRST = 1;
+
+ // somewhere inbetween
+ public static int PRIO_MIDDLE = Integer.MAX_VALUE / 2;
+
+ // last in filter chain
+ public static int PRIO_LAST = Integer.MAX_VALUE;
+
+ /**
+ * Return the pattern (regular expression) that a request URI (relative to the LMF base URI) has to match
+ * before triggering this filter.
+ *
+ * @return
+ */
+ public String getPattern();
+
+
+ /**
+ * 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
+ */
+ public int getPriority();
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFResourceService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFResourceService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFResourceService.java
new file mode 100644
index 0000000..983c131
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/LMFResourceService.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 org.apache.marmotta.platform.core.api.modules;
+
+import java.net.URL;
+
+/**
+ * A service for resolving and accessing resources contained in the LMF modules. The resource service takes care
+ * of retrieving, caching and refreshing resources from the appropriate locations.
+ * <p/>
+ * Note that the resource service is not to be confused with the RDF resources maintained by the server. It is
+ * purely meant to retrieve static non-Java resources contained in the modules and web application.
+ *
+ * User: sschaffe
+ */
+public interface LMFResourceService {
+
+
+ /**
+ * Return the resource identified by the relative URL passed as argument. The passed argument is relative
+ * to the web application root of this web application.
+ *
+ * @param relativeURL a URL relative to the web application root of this web application
+ * @return the resource identified by the relative URL, or null if it does not exist
+ */
+ public ResourceEntry getResource(String relativeURL);
+
+
+ /**
+ * Return the file system URL of the resource identified by the relative HTTP URL passed as argument.
+ * he passed argument is relative to the web application root of this web application.
+ *
+ * @param relativeURL a URL relative to the web application root of this web application
+ * @return the file system URL of the resource, regardless whether it actually exists or not
+ */
+ public URL resolveResource(String relativeURL);
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ModuleService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ModuleService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ModuleService.java
new file mode 100644
index 0000000..9d0e005
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ModuleService.java
@@ -0,0 +1,130 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.modules;
+
+import org.apache.marmotta.platform.core.model.module.ModuleConfiguration;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * A service for managing the LMF modules that are active in the installation.
+ * <p/>
+ * User: sschaffe
+ */
+public interface ModuleService {
+
+ /**
+ * List the names of all currently active modules
+ * @return
+ */
+ public Collection<String> listModules();
+
+ /**
+ * Return the configuration for the module identified by the name given as argument. Returns an
+ * immutable Apache Commons Configuration object, or null if the module is not found.
+ *
+ * @param moduleName
+ * @return
+ */
+ public ModuleConfiguration getModuleConfiguration(String moduleName);
+
+
+ /**
+ * Provide the current module configuration for the service injecting it, i.e. the configuration
+ * of the module containing the service.
+ *
+ */
+ public ModuleConfiguration getModuleConfiguration(InjectionPoint injectionPoint);
+
+ /**
+ * Provide the current module configuration for the given class, i.e. the configuration of the
+ * module containing the class.
+ *
+ */
+ public ModuleConfiguration getModuleConfiguration(Class<?> cls);
+
+ /**
+ * Get the URL of the JAR file of the module whose name is given as argument.
+ *
+ * @param moduleName
+ * @return
+ */
+ public URL getModuleJar(String moduleName);
+
+ /**
+ * Get the path relative to the LMF base URL where the web contents of this URL can be found
+ *
+ * @param moduleName
+ * @return
+ */
+ public String getModuleWeb(String moduleName);
+
+
+ /**
+ * Return a list of entities used by this module. Each entry is a fully-qualified classname of
+ * an entity class that this module registers.
+ *
+ * @param moduleName
+ * @return
+ */
+ public Collection<String> getEntities(String moduleName);
+
+ /**
+ * Return a list of webservices used by this module. Each entry is a fully-qualified classname
+ * of a webservice class that this module registers.
+ *
+ * @param moduleName
+ * @return
+ */
+ public Collection<String> getWebservices(String moduleName);
+
+
+ /**
+ * Return a list of filters used by this module. Each entry is a fully-qualified classname
+ * of a filter class implementing LMFHttpFilter that this module registers.
+ *
+ * @param moduleName
+ * @return
+ */
+ public Collection<String> getFilters(String moduleName);
+
+ /**
+ * Return a list of admin pages (paths)
+ * @param moduleName
+ * @return
+ */
+ public List<String> getAdminPages(String moduleName);
+
+ /**
+ * Weight is used to sort modules in UI.
+ * typical weights & recommendations:
+ * <table>
+ * <tr><th>weight</th><th>modules</th></tr>
+ * <tr><td>5</td><td>scenario-specific module</td></tr>
+ * <tr><td>10</td><td>lmf-core</td></tr>
+ * <tr><td>20</td><td>lmf-demo-*</td></tr>
+ * <tr><td>50</td><td>default</td></tr>
+ * </table>
+ *
+ * @param moduleName
+ * @return the weight (default == 50)
+ */
+ public int getWeight(String moduleName);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ResourceEntry.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ResourceEntry.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ResourceEntry.java
new file mode 100644
index 0000000..9f9acfb
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/modules/ResourceEntry.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 org.apache.marmotta.platform.core.api.modules;
+
+import java.net.URL;
+
+/**
+ * Internal representation of a resource contained in one of the modules.
+ * <p/>
+ * User: sschaffe
+ */
+public class ResourceEntry {
+
+ /**
+ * The path relative to the web application root under which this resource is accessed.
+ */
+ private String relativePath;
+
+
+ /**
+ * The file system location of the resource entry (in case it needs to be refreshed)
+ */
+ private URL location;
+
+ /**
+ * The byte data of the resource, this is the actual content
+ */
+ private byte[] data;
+
+ /**
+ * The content length of the resource (number of bytes)
+ */
+ private int length;
+
+ /**
+ * The content type (MIME) of the resource
+ */
+ private String contentType;
+
+ public ResourceEntry(URL location, byte[] data, int length, String contentType) {
+ super();
+ this.location = location;
+ this.data = data;
+ this.length = length;
+ this.contentType = contentType;
+ }
+
+ /**
+ * @return the data
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+
+ /**
+ * @return the length
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * @param length the length to set
+ */
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * @return the contentType
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * @param contentType the contentType to set
+ */
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setLocation(URL location) {
+ this.location = location;
+ }
+
+ public String getRelativePath() {
+ return relativePath;
+ }
+
+ public void setRelativePath(String relativePath) {
+ this.relativePath = relativePath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
new file mode 100644
index 0000000..47d37a9
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
@@ -0,0 +1,42 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.prefix;
+
+/**
+ * Prefix Provider definition
+ *
+ * @author Sergio Fernández
+ *
+ */
+public interface PrefixProvider {
+
+ /**
+ * Get namespace identified by this prefix
+ *
+ * @param prefix prefix
+ * @return namespace
+ */
+ String getNamespace(String prefix);
+
+ /**
+ * Get prefix which identifies this namespace
+ *
+ * @param namespace namespace
+ * @return prefix
+ */
+ String getPrefix(String namespace);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
new file mode 100644
index 0000000..5861484
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixService.java
@@ -0,0 +1,110 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.prefix;
+
+import java.net.URISyntaxException;
+import java.util.Map;
+
+/**
+ * Prefix Manager definition
+ *
+ * @author Sergio Fernández
+ *
+ */
+public interface PrefixService {
+
+ /**
+ * Check prefix mapping
+ *
+ * @param prefix prefix
+ * @return mapping exists
+ */
+ boolean containsPrefix(String prefix);
+
+ /**
+ * Check if there is registered any prefix for such namespace
+ *
+ * @param namespace uri
+ * @return mapping exists
+ */
+ boolean containsNamespace(String namespace);
+
+ /**
+ * Get namespace for such prefix
+ *
+ * @param prefix prefix
+ * @return namespace
+ */
+ String getNamespace(String prefix);
+
+ /**
+ * Get prefix which identifies this namespace
+ *
+ * @param namespace uri
+ * @return prefix
+ */
+ String getPrefix(String namespace);
+
+ /**
+ * Add a new prefix mapping
+ *
+ * @param prefix prefix
+ * @param namespace uri
+ * @throws IllegalArgumentException when one of both is already mapped
+ * @throws URISyntaxException
+ */
+ void add(String prefix, String namespace) throws IllegalArgumentException, URISyntaxException;
+
+ /**
+ * Force addition of a new prefix mapping, even if it already exists
+ *
+ * @param prefix prefix
+ * @param namespace uri
+ */
+ void forceAdd(String prefix, String namespace);
+
+ /**
+ * Get all current mappings
+ *
+ * @return mappings
+ */
+ Map<String, String> getMappings();
+
+ /**
+ * Get the CURIE for this URI if possible
+ *
+ * @param uri uri
+ * @return curie
+ */
+ String getCurie(String uri);
+
+ /**
+ * Serializes the current mapping to the the syntax requited by vocab in HTML
+ * (i.e., a white space separated list of prefix-name IRI pairs of the form)
+ *
+ * @see http://www.w3.org/TR/rdfa-core/#A-prefix
+ * @return prefixes mapping
+ */
+ String serializePrefixMapping();
+
+ /**
+ * Serializes all prefixes according the SPARQL syntax
+ *
+ * @return prefixes declaration
+ */
+ String serializePrefixesSparqlDeclaration();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsModule.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsModule.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsModule.java
new file mode 100644
index 0000000..1cf321c
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsModule.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 org.apache.marmotta.platform.core.api.statistics;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * StatisticsModule - collects statistical information for a specific part of the system.
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public interface StatisticsModule {
+
+ /**
+ * Enable this module. Depending on the type of information, this may involve additional runtime overhead.
+ */
+ public void enable();
+
+ /**
+ * Disable this module.
+ */
+ public void disable();
+
+ /**
+ * Return true if the module is enabled.
+ * @return
+ */
+ public boolean isEnabled();
+
+
+ /**
+ * Return all names of properties supported by this module.
+ * @return
+ */
+ public List<String> getPropertyNames();
+
+ /**
+ * Return the statistics as a map from key to value
+ * @return
+ */
+ public Map<String,String> getStatistics();
+
+
+ /**
+ * Return the display name of the statistics module.
+ * @return
+ */
+ public String getName();
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsService.java
new file mode 100644
index 0000000..32d2bbd
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/statistics/StatisticsService.java
@@ -0,0 +1,99 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.statistics;
+
+import java.util.List;
+
+/**
+ * StatisticsService - gathers statistics about the system runtime behaviour, e.g.
+ * database/hibernate, caching, etc.
+ *
+ *
+ *
+ * @author Sebastian Schaffert
+ *
+ */
+public interface StatisticsService {
+
+ /**
+ * Turn on collection of statistical information for all modules. May introduce additional
+ * overhead.
+ */
+ public void enableAll();
+
+ /**
+ * Turn off collection of statistical information for all modules.
+ */
+ public void disableAll();
+
+ /**
+ * Return true if statistics gathering is enabled.
+ *
+ * @return
+ */
+ public boolean isEnabled();
+
+ /**
+ * Enable collection of statistical information for the specified module;
+ *
+ * @param modName
+ */
+ public void enableModule(String modName);
+
+ /**
+ * Disable collection of statistical information for the specified module;
+ *
+ * @param modName
+ */
+ public void disableModule(String modName);
+
+ /**
+ * Register the statistics module given as argument with the statistics service
+ *
+ * @param mod
+ */
+ public void registerModule(String modName, StatisticsModule mod);
+
+ /**
+ * Unregister the statistics module given as argument.
+ *
+ * @param mod
+ */
+ public void unregisterModule(StatisticsModule mod);
+
+ /**
+ * Unregister the statistics module with the moduleName given as argument.
+ *
+ * @param modName
+ */
+ public void unregisterModule(String modName);
+
+ /**
+ * Return the statistics module identified by the name passed as parameter.
+ *
+ * @param modName
+ * @return
+ */
+ public StatisticsModule getModule(String modName);
+
+ /**
+ * Return all statistics modules associated with the statistics service.
+ *
+ * @return
+ */
+ public List<String> listModules();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/Task.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/Task.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/Task.java
new file mode 100644
index 0000000..2667674
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/Task.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 org.apache.marmotta.platform.core.api.task;
+
+public abstract class Task extends TaskInfo {
+
+ protected Task(String uuid) {
+ super(uuid);
+ }
+
+ public abstract long endTask();
+
+ public void updateMessage(String message) {
+ this.message = message;
+ updateLastModified();
+ }
+
+ public void updateProgress(long steps) {
+ this.progress = steps;
+ updateLastModified();
+ }
+
+ public void updateTotalSteps(long totalSteps) {
+ this.totalSteps = totalSteps;
+ updateLastModified();
+ }
+
+ public void updateDetailMessage(String detail, String message) {
+ if (message != null) {
+ detailMessages.put(detail, message);
+ updateLastModified();
+ } else {
+ removeDetailMessage(detail);
+ }
+ }
+
+ public void removeDetailMessage(String detail) {
+ detailMessages.remove(detail);
+ updateLastModified();
+ }
+
+ protected void updateLastModified() {
+ this.lastUpdate = System.currentTimeMillis();
+ }
+
+ public void updateName(String name) {
+ this.name = name;
+ updateLastModified();
+ }
+
+ public void updateGroup(String group) {
+ this.group = group;
+ updateLastModified();
+ }
+
+ public void resetProgress() {
+ this.totalSteps = this.progress = 0;
+ updateLastModified();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskInfo.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskInfo.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskInfo.java
new file mode 100644
index 0000000..3511b60
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskInfo.java
@@ -0,0 +1,92 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.task;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public abstract class TaskInfo {
+
+ protected final long started;
+ protected final String uuid;
+ protected long lastUpdate;
+ protected String name;
+ protected String group;
+ protected String message;
+ protected long progress = 0;
+ protected long totalSteps = 0;
+ protected final Map<String, String> detailMessages;
+
+ public Date getStarted() {
+ return new Date(started);
+ }
+
+ public Date getLastUpdate() {
+ return new Date(lastUpdate);
+ }
+
+ public Date getETA() {
+ if (progress > 0 && totalSteps > 0) {
+ long now = System.currentTimeMillis();
+ long end = now + totalSteps * (now - started) / progress;
+ return new Date(end);
+ }
+ return null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public long getProgress() {
+ return progress;
+ }
+
+ public long getTotalSteps() {
+ return totalSteps;
+ }
+
+ public Map<String, String> getDetailMessages() {
+ return Collections.unmodifiableMap(detailMessages);
+ }
+
+ protected TaskInfo(String uuid) {
+ this.uuid = uuid;
+ this.detailMessages = new LinkedHashMap<String, String>();
+ this.lastUpdate = this.started = System.currentTimeMillis();
+ }
+
+ @Deprecated
+ @JsonIgnore
+ public String printStatus() {
+ if (totalSteps > 0) return String.format("%s: %s [%d/%d] (%tF %<tT)", name, message, progress, totalSteps, lastUpdate);
+ if (progress > 0) return String.format("%s: %s [%d] (%tF %<tT)", name, message, progress, lastUpdate);
+ return String.format("%s: %s (%tF %<tT)", name, message, lastUpdate);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskManagerService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskManagerService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskManagerService.java
new file mode 100644
index 0000000..3a926d4
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/task/TaskManagerService.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 org.apache.marmotta.platform.core.api.task;
+
+import java.lang.ref.WeakReference;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+public interface TaskManagerService {
+
+ public Task createTask(String name);
+
+ public Task createTask(String name, String group);
+
+ public Task createSubTask(String name);
+
+ public Task createSubTask(String name, String group);
+
+ public Task getTask();
+
+ public void endTask(TaskInfo task);
+
+ public List<TaskInfo> getTasks();
+
+ public Map<String, List<TaskInfo>> getTasksByGroup();
+
+ public Map<WeakReference<Thread>, Stack<TaskInfo>> getTasksByThread();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/templating/TemplatingService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/templating/TemplatingService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/templating/TemplatingService.java
new file mode 100644
index 0000000..f0b1233
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/templating/TemplatingService.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 org.apache.marmotta.platform.core.api.templating;
+
+import org.apache.marmotta.platform.core.exception.TemplatingException;
+
+import javax.servlet.ServletContext;
+
+/**
+ * User: Thomas Kurz
+ * Date: 22.07.11
+ * Time: 13:06
+ */
+public interface TemplatingService {
+
+ public final static String PATH = "/templates/";
+
+ /**
+ * inits a freebase template service with a servlet context
+ * @param context
+ */
+ public void init(ServletContext context) throws TemplatingException;
+
+ /**
+ * this method wraps a file with a default template
+ * @param bytes
+ * @return
+ */
+ public byte[] process(byte[] bytes, String path) throws TemplatingException;
+
+ /**
+ * Check whether the templating service considers the resource passed in the path as a menu entry it is
+ * responsible for.
+ *
+ * @param path
+ * @return
+ */
+ boolean isMenuEntry(String path);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/ContextService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/ContextService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/ContextService.java
new file mode 100644
index 0000000..e75960c
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/ContextService.java
@@ -0,0 +1,188 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.triplestore;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Set;
+
+import org.openrdf.model.URI;
+
+/**
+ * The context (named graphs in LMF, formerly "knowledge space" in KiWi) service offers convenience
+ * functions for working with LMF Contexts. Low level manipulation of contexts is offered by
+ * TripleStore.
+ * <p/>
+ * A context or (other name) named graph represent a own graph for a separation of the whole
+ * data in the context. In other words: the relationship between triples and a context is
+ * a 1 to N relationship. Every triple is though the context connect to exactly one context.
+ * <p/>
+ * Every context has own access rights, triples, reasoning rules and other metadata.
+ * <p/>
+ * You can create contexts for user, for imported ontologies, own created content, inferred
+ * triples and system data
+ * <p/>
+ * every new triple without information of a context is connect with the context to the
+ * default context
+ * <p/>
+ *
+ * @author Stefan
+ * @author Sergio Fernández
+ */
+public interface ContextService {
+
+ static final String DEFAULT_PREFIX = "context";
+
+ //****************************************
+ // get/create default, inferred
+ //****************************************
+
+ /**
+ * Get the base context URI
+ *
+ * @return base context
+ */
+ String getBaseContext();
+
+ /**
+ * Return the knowledge space that is currently selected for write access. The currently active context
+ * is either the default context or explicitly passed as argument ctx to web service calls.
+ *
+ * @return a KiWiUriResource representing the current knowledge space
+ */
+ URI getCurrentContext();
+
+ /**
+ * Return the set of contexts that is currently active for reading. The set of active contexts
+ * is either selected explicitly in web service calls or it consists of all contexts.
+ *
+ * @return a set of URIs indicating the active contexts
+ */
+ Set<URI> getActiveContext();
+
+ /**
+ * Return the context used for storing system information.
+ *
+ * @return a URI representing the system context
+ */
+ URI getSystemContext();
+
+ /**
+ * Get the uri of the inferred context
+ *
+ * @return uri of this inferred context
+ */
+ URI getInferredContext();
+
+ /**
+ * Get the uri of the default context
+ *
+ * @return
+ */
+ URI getDefaultContext();
+
+ /**
+ * Get the uri of the context used for caching linked data
+ * @return
+ */
+ URI getCacheContext();
+
+ /**
+ * List all contexts currently available
+ *
+ * @return
+ */
+ List<URI> listContexts();
+
+ /**
+ * List all accepted formats to ingest content
+ *
+ * @return
+ */
+ Set<String> getAcceptFormats();
+
+ /**
+ * List all contexts currently available
+ *
+ * @param filter filter only the contexts using the normative base uri
+ * @return
+ */
+ List<URI> listContexts(boolean filter);
+
+ /**
+ * Create a new context with the given URI or return the already existing context. Essentially
+ * just calls resourceService.createUriResource, but sets some resource parameters correctly.
+ *
+ *
+ * @param uri the uri of the context to create
+ * @return a URI representing the created context
+ */
+ URI createContext(String uri);
+
+ /**
+ * Create a new context with the given URI or return the already existing context. Essentially
+ * just calls resourceService.createUriResource, but sets some resource parameters correctly.
+ *
+ * @param uri
+ * @param label
+ * @return
+ */
+ URI createContext(String uri, String label);
+
+ /**
+ * Return the context with the given URI if it exists.
+ *
+ * @param context_uri
+ * @return
+ */
+ URI getContext(String context_uri);
+
+ /**
+ * Return a human-readable label for the context, either the rdfs:label or the last part of the URI.
+ *
+ * @param context
+ * @return
+ */
+ String getContextLabel(URI context);
+
+ /**
+ * Import content into the context
+ *
+ * @param context
+ * @param is
+ * @param format
+ * @return
+ */
+ boolean importContent(String context, InputStream is, String format);
+
+ /**
+ * Remove (clean whole content) the context represented by this URI
+ *
+ * @param context uri
+ * @return operation result, false if context does not exist
+ */
+ boolean removeContext(String context);
+
+ /**
+ * Remove (clean whole content) the context represented by this resource
+ *
+ *
+ * @param context resource
+ * @return operation result, false if context does not exist
+ */
+ boolean removeContext(URI context);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/LdpService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/LdpService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/LdpService.java
new file mode 100644
index 0000000..1b6ce3c
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/LdpService.java
@@ -0,0 +1,84 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.triplestore;
+
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.openrdf.model.URI;
+import org.openrdf.repository.RepositoryException;
+
+/**
+ * Interface for supporting LDP (WIP)
+ *
+ * @see http://www.w3.org/TR/ldp/
+ * @author Sergio Fernández
+ *
+ */
+public interface LdpService {
+
+ static final String DEFAULT_PREFIX = "container";
+
+ /**
+ * Get the base context URI
+ *
+ * @return base context
+ */
+ String getBaseContainer();
+
+ /**
+ * Lists the current container
+ *
+ * @return list of containers
+ */
+ List<URI> list();
+
+ /**
+ * Return the URI for this LDPR
+ *
+ * @param container plain text URI
+ * @return container's URI, null if does not exit
+ */
+ URI get(String resource);
+
+ /**
+ * Creates a new LDPR
+ *
+ * @param container plain text URI
+ * @return URI of the new container if success
+ * @throws URISyntaxException
+ */
+ boolean create(String resource) throws URISyntaxException;
+
+ /**
+ * Creates a new LDPR defining a title for it
+ *
+ * @param container plain text URI
+ * @return URI of the new container if success
+ * @throws URISyntaxException
+ */
+ boolean create(String resource, String title) throws URISyntaxException;
+
+ /**
+ * Delete this LDPR
+ *
+ * @param resource uri
+ * @return
+ * @throws RepositoryException
+ */
+ boolean delete(String resource) throws RepositoryException;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/NotifyingSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/NotifyingSailProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/NotifyingSailProvider.java
new file mode 100644
index 0000000..76ad89a
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/NotifyingSailProvider.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 org.apache.marmotta.platform.core.api.triplestore;
+
+import org.openrdf.sail.NotifyingSail;
+import org.openrdf.sail.helpers.NotifyingSailWrapper;
+
+/**
+ * An interface implemented by all modules that provide notifying sail wrappers for the sesame sail stack.
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface NotifyingSailProvider 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 NotifyingSailWrapper createSail(NotifyingSail parent);
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SailProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SailProvider.java
new file mode 100644
index 0000000..8ae8af9
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SailProvider.java
@@ -0,0 +1,38 @@
+/**
+ * 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 org.apache.marmotta.platform.core.api.triplestore;
+
+/**
+ * Common interface for all sail providers
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface SailProvider {
+
+
+ /**
+ * Return the name of the provider. Used e.g. for displaying status information or logging.
+ * @return
+ */
+ public String getName();
+
+
+ /**
+ * Return true if this sail provider is enabled in the configuration.
+ * @return
+ */
+ public boolean isEnabled();
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SesameService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SesameService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/SesameService.java
new file mode 100644
index 0000000..ef1efeb
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.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/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/StandardSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/StandardSailProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/StandardSailProvider.java
new file mode 100644
index 0000000..4745123
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.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/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/TransactionalSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/TransactionalSailProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/triplestore/TransactionalSailProvider.java
new file mode 100644
index 0000000..5748fa2
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.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/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/ui/LMFSystrayLink.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/ui/LMFSystrayLink.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/ui/LMFSystrayLink.java
new file mode 100644
index 0000000..56a4c40
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.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/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserService.java
new file mode 100644
index 0000000..5e5a351
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.core.api.user;
+
+import org.apache.marmotta.platform.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/4d3eebdd/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserToken.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserToken.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/user/UserToken.java
new file mode 100644
index 0000000..c8395ab
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/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 org.apache.marmotta.platform.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();
+ }
+}