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 2014/01/10 16:17:31 UTC

[1/2] git commit: started with a parallel implementation of the next generation LDCache API (MARMOTTA-418): - API implemented - LDCache core implemented - Infinispan and File backends implemented

Updated Branches:
  refs/heads/develop 60ae655ac -> 3a68b4286


started with a parallel implementation of the next generation LDCache API (MARMOTTA-418):
- API implemented
- LDCache core implemented
- Infinispan and File backends implemented


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2253bcc1
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2253bcc1
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2253bcc1

Branch: refs/heads/develop
Commit: 2253bcc12bbd80c1ef1ea399c273dcb968c7d24d
Parents: 0226c44
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Fri Jan 10 16:14:34 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Fri Jan 10 16:14:34 2014 +0100

----------------------------------------------------------------------
 .../commons/sesame/model/ModelCommons.java      |  50 ++--
 .../ldcache/api/LDCachingBackendNG.java         |  74 ++++++
 .../ldcache/api/LDCachingServiceNG.java         |  92 ++++++++
 .../marmotta/ldcache/model/CacheEntryNG.java    |  49 ++++
 libraries/ldcache/ldcache-backend-file/pom.xml  |  27 +++
 .../backend/file/LDCachingFileBackendNG.java    | 226 ++++++++++++++++++
 .../backend/file/util/FileBackendUtils.java     |  40 ++--
 .../backend/file/test/LDCacheFileNGTest.java    |  74 ++++++
 .../ldcache/ldcache-backend-infinispan/pom.xml  |  10 +
 .../LDCachingInfinispanBackendNG.java           | 221 ++++++++++++++++++
 ...LDCachingInfinispanRepositoryConnection.java |   8 +-
 .../test/LDCacheInfinispanNGTest.java           |  43 ++++
 .../marmotta/ldcache/services/LDCache.java      |  72 ++++--
 .../marmotta/ldcache/services/LDCacheNG.java    | 230 +++++++++++++++++++
 .../services/test/ng/BaseLDCacheNGTest.java     | 166 +++++++++++++
 .../services/test/ng/dbpedia-berlin.sparql      |  24 ++
 .../ldcache/services/test/ng/foaf-wikier.sparql |  25 ++
 .../services/test/ng/geonames-embrun.sparql     |  24 ++
 .../services/test/ng/ohloh-marmotta.sparql      |  26 +++
 19 files changed, 1434 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/ModelCommons.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/ModelCommons.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/ModelCommons.java
index a51f7a3..6a1b338 100644
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/ModelCommons.java
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/ModelCommons.java
@@ -17,6 +17,7 @@
 
 package org.apache.marmotta.commons.sesame.model;
 
+import info.aduna.iteration.CloseableIteration;
 import javolution.util.function.Predicate;
 import org.openrdf.model.Model;
 import org.openrdf.model.Statement;
@@ -24,7 +25,6 @@ import org.openrdf.model.impl.TreeModel;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.RepositoryResult;
 import org.openrdf.repository.sail.SailRepository;
 import org.openrdf.rio.*;
 import org.openrdf.rio.helpers.RDFHandlerBase;
@@ -73,6 +73,7 @@ public class ModelCommons {
      * @param in      input stream to read the statements from
      * @param baseURI base URI to resolve relative URIs
      * @param format  RDF format of the data in the input stream
+     * @param filters an optional list of filters; if any of the filters rejects the statement it is not added
      * @throws IOException
      * @throws RDFParseException
      */
@@ -98,6 +99,7 @@ public class ModelCommons {
      * @param in      reader to read the statements from
      * @param baseURI base URI to resolve relative URIs
      * @param format  RDF format of the data in the reader
+     * @param filters an optional list of filters; if any of the filters rejects the statement it is not added
      * @throws IOException
      * @throws RDFParseException
      */
@@ -116,6 +118,35 @@ public class ModelCommons {
 
 
     /**
+     * Add statements from the given statement iteration to the given model.
+     *
+     * @param model   the model to add the statements to
+     * @param triples a closeable iteration of triples to add (e.g. a RepositoryResult<Statement>)
+     * @param filters an optional list of filters; if any of the filters rejects the statement it is not added
+     * @throws IOException
+     * @throws RDFParseException
+     */
+    public static <X extends Exception> void add(Model model, CloseableIteration<Statement,X> triples, Predicate<Statement>... filters) throws X {
+        try {
+            rloop: while(triples.hasNext()) {
+                Statement st = triples.next();
+
+                for(Predicate<Statement> f : filters) {
+                    if(!f.test(st)) {
+                        continue rloop;
+                    }
+                }
+
+                model.add(st);
+            }
+        } finally {
+            triples.close();
+        }
+    }
+
+
+
+    /**
      * Export all triples in the model passed as argument to the RDF handler passed as second argument. Similar to
      * RepositoryConnection.export.
      *
@@ -174,22 +205,7 @@ public class ModelCommons {
         try {
             con.begin();
 
-            RepositoryResult<Statement> r = con.getStatements(null,null,null,true);
-            try {
-                rloop: while(r.hasNext()) {
-                    Statement st = r.next();
-
-                    for(Predicate<Statement> f : filters) {
-                        if(!f.test(st)) {
-                            continue rloop;
-                        }
-                    }
-
-                    model.add(st);
-                }
-            } finally {
-                r.close();
-            }
+            add(model,con.getStatements(null,null,null,true), filters);
 
             con.commit();
         } catch(RepositoryException ex) {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingBackendNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingBackendNG.java b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingBackendNG.java
new file mode 100644
index 0000000..8966015
--- /dev/null
+++ b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingBackendNG.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.api;
+
+import org.apache.marmotta.ldcache.model.CacheEntryNG;
+import org.openrdf.model.URI;
+
+/**
+ * Next generation caching backend API. Needs to be implemented by backend providers to offer caching support.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface LDCachingBackendNG {
+
+
+    /**
+     * Return the cache entry for the given resource, or null if this entry does not exist.
+     *
+     * @param resource the resource to retrieve the cache entry for
+     * @return
+     */
+    public CacheEntryNG getEntry(URI resource);
+
+
+    /**
+     * Update the cache entry for the given resource with the given entry.
+     *
+     * @param resource the resource to update
+     * @param entry    the entry for the resource
+     */
+    public void putEntry(URI resource, CacheEntryNG entry);
+
+
+    /**
+     * Remove the cache entry for the given resource if it exists. Does nothing otherwise.
+     *
+     * @param resource the resource to remove the entry for
+     */
+    public void removeEntry(URI resource);
+
+
+    /**
+     * Clear all entries in the cache backend.
+     */
+    public void clear();
+
+
+
+    /**
+     * Carry out any initialization tasks that might be necessary
+     */
+    public void initialize();
+
+    /**
+     * Shutdown the backend and free all runtime resources.
+     */
+    public void shutdown();
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingServiceNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingServiceNG.java b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingServiceNG.java
new file mode 100644
index 0000000..1a9d549
--- /dev/null
+++ b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/api/LDCachingServiceNG.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.api;
+
+import org.openrdf.model.Model;
+import org.openrdf.model.URI;
+
+/**
+ * This is the next-generation API for LDCache that will become the default in Marmotta 3.3 or 4.0. For now,
+ * LDCache implements both the old and the new style.
+ * <p/>
+ * User: sschaffe
+ */
+public interface LDCachingServiceNG {
+
+
+    /**
+     * Refresh the resource passed as argument. If the resource is not yet cached or the cache entry is
+     * expired or refreshing is forced, the remote resource is retrieved using LDClient and the result stored
+     * in the cache. Otherwise the method does nothing.
+     * 
+     *
+     * @param resource  the resource to refresh
+     * @param options   options for refreshing
+     */
+    public void refresh(URI resource, RefreshOpts... options);
+
+
+    /**
+     * Refresh and return the resource passed as argument. If the resource is not yet cached or the cache entry is
+     * expired or refreshing is forced, the remote resource is retrieved using LDClient and the result stored
+     * in the cache. Otherwise the method does nothing.
+     *
+     * @param resource  the resource to retrieve
+     * @param options   options for refreshing
+     * @return a Sesame Model holding the triples representing the resource
+     */
+    public Model get(URI resource, RefreshOpts... options);
+
+
+    /**
+     * Manually expire the caching information for the given resource. The resource will be
+     * re-retrieved upon the next access.
+     *
+     * @param resource the resource to expire.
+     */
+    public void expire(URI resource);
+
+
+    /**
+     * Return true in case the cache contains an entry for the resource given as argument.
+     *
+     * @param resource the resource to check
+     * @return true in case the resource is contained in the cache
+     */
+    public boolean contains(URI resource);
+
+    /**
+     * Manually expire all cached resources.
+     */
+    public void clear();
+
+
+    /**
+     * Shutdown the caching service and free all occupied runtime resources.
+     */
+    public void shutdown();
+
+
+
+    public enum RefreshOpts {
+
+        /**
+         * Refresh the resource even if it is not yet expired
+         */
+        FORCE
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/model/CacheEntryNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/model/CacheEntryNG.java b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/model/CacheEntryNG.java
new file mode 100644
index 0000000..7232be2
--- /dev/null
+++ b/libraries/ldcache/ldcache-api/src/main/java/org/apache/marmotta/ldcache/model/CacheEntryNG.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.model;
+
+import org.apache.marmotta.commons.util.DateUtils;
+import org.openrdf.model.Model;
+
+/**
+ * Next generation cache entry representation. Adds the actual triples to the cache entry.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class CacheEntryNG extends CacheEntry {
+
+    protected Model triples;
+
+
+    public CacheEntryNG() {
+    }
+
+    public Model getTriples() {
+        return triples;
+    }
+
+    public void setTriples(Model triples) {
+        this.triples = triples;
+    }
+
+
+    @Override
+    public String toString() {
+        return String.format("CacheEntry(resource=%s,triples=%d,expiry=%s)", getResource().stringValue(), getTripleCount(), DateUtils.ISO8601FORMAT.format(getExpiryDate()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-file/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-file/pom.xml b/libraries/ldcache/ldcache-backend-file/pom.xml
index ceffa98..9ab2bd3 100644
--- a/libraries/ldcache/ldcache-backend-file/pom.xml
+++ b/libraries/ldcache/ldcache-backend-file/pom.xml
@@ -136,6 +136,33 @@
             <artifactId>guava</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldcache-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldcache-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldclient-provider-rdf</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldclient-provider-facebook</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openrdf.sesame</groupId>
+            <artifactId>sesame-rio-turtle</artifactId>
+            <scope>test</scope>
+        </dependency>
 
 
     </dependencies>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/LDCachingFileBackendNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/LDCachingFileBackendNG.java b/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/LDCachingFileBackendNG.java
new file mode 100644
index 0000000..2e77834
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/LDCachingFileBackendNG.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.backend.file;
+
+import org.apache.marmotta.commons.sesame.model.ModelCommons;
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.backend.file.util.FileBackendUtils;
+import org.apache.marmotta.ldcache.model.CacheEntryNG;
+import org.openrdf.model.Model;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.TreeModel;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.sail.nativerdf.NativeStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * File-based implementation of the next generation LDCaching Backend API
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCachingFileBackendNG implements LDCachingBackendNG {
+
+    private static Logger log = LoggerFactory.getLogger(LDCachingFileBackend.class);
+
+    private final File storageDir;
+
+    private Repository cacheRepository;
+
+    public LDCachingFileBackendNG(File storageDir) throws RepositoryException {
+        if (storageDir == null) throw new NullPointerException();
+        this.storageDir = storageDir;
+
+    }
+
+
+    /**
+     * Return the cache entry for the given resource, or null if this entry does not exist.
+     *
+     * @param resource the resource to retrieve the cache entry for
+     * @return
+     */
+    @Override
+    public CacheEntryNG getEntry(URI resource) {
+        try {
+            // load metadata from disk
+            final File dataFile = FileBackendUtils.getMetaFile(resource, storageDir);
+            if (!(dataFile.exists())) return null;
+            final CacheEntryNG ce = FileBackendUtils.readCacheEntryNG(dataFile, getValueFactory());
+            if (FileBackendUtils.isExpired(ce)) return null;
+
+            // read triples for this entry from cache repository
+            RepositoryConnection con = cacheRepository.getConnection();
+            try {
+                con.begin();
+
+                Model triples = new TreeModel();
+                ModelCommons.add(triples, con.getStatements(resource,null,null,true));
+                ce.setTriples(triples);
+
+                con.commit();
+            } catch(RepositoryException ex) {
+                con.rollback();
+            } finally {
+                con.close();
+            }
+
+            return ce;
+        } catch (IOException | RepositoryException e) {
+            log.error("error while loading cache entry from file system:",e);
+
+            return null;
+        }
+    }
+
+
+    /**
+     * Update the cache entry for the given resource with the given entry.
+     *
+     * @param resource the resource to update
+     * @param entry    the entry for the resource
+     */
+    @Override
+    public void putEntry(URI resource, CacheEntryNG entry) {
+        try {
+            FileBackendUtils.writeCacheEntry(entry, storageDir);
+
+            // update the repository with the triples from the entry
+            RepositoryConnection con = cacheRepository.getConnection();
+            try {
+                con.begin();
+
+                con.remove(resource,null,null);
+                con.add(entry.getTriples());
+
+                con.commit();
+            } catch(RepositoryException ex) {
+                con.rollback();
+            } finally {
+                con.close();
+            }
+        } catch (IOException | RepositoryException e) {
+            log.error("could not store cache entry for {}: {}", resource.stringValue(), e.getMessage());
+        }
+
+    }
+
+    /**
+     * Remove the cache entry for the given resource if it exists. Does nothing otherwise.
+     *
+     * @param resource the resource to remove the entry for
+     */
+    @Override
+    public void removeEntry(URI resource) {
+        try {
+            final File metaFile = FileBackendUtils.getMetaFile(resource, storageDir);
+            if (metaFile.exists()) metaFile.delete();
+
+            // update the repository with the triples from the entry
+            RepositoryConnection con = cacheRepository.getConnection();
+            try {
+                con.begin();
+
+                con.remove(resource, null, null);
+
+                con.commit();
+            } catch(RepositoryException ex) {
+                con.rollback();
+            } finally {
+                con.close();
+            }
+        } catch (RepositoryException e) {
+            log.error("could not remove cache entry for {}: {}", resource.stringValue(), e.getMessage());
+        }
+    }
+
+    /**
+     * Clear all entries in the cache backend.
+     */
+    @Override
+    public void clear() {
+        for(File metaFile : FileBackendUtils.listMetaFiles(storageDir)) {
+            metaFile.delete();
+        }
+
+        try {
+            RepositoryConnection con = cacheRepository.getConnection();
+            try {
+                con.begin();
+
+                con.clear();
+
+                con.commit();
+            } catch(RepositoryException ex) {
+                con.rollback();
+            } finally {
+                con.close();
+            }
+        } catch(RepositoryException ex) {
+            log.error("could not clear cache: {}", ex.getMessage());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.marmotta.ldcache.api.LDCachingBackend#initialize()
+     */
+    @Override
+    public void initialize() {
+        if (!storageDir.exists() && !storageDir.mkdirs()){
+            log.error("Could not create storage directory: " + storageDir.getPath());
+        } else if (!storageDir.isDirectory()) {
+            log.error(storageDir.getPath() + " is not a directory");
+        }
+
+        File tripleDir = new File(storageDir,"triples");
+
+        try {
+            cacheRepository = new SailRepository(new NativeStore(tripleDir, "spoc"));
+            cacheRepository.initialize();
+        } catch (RepositoryException ex) {
+            log.error("could not initialize cache directory",ex);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.marmotta.ldcache.api.LDCachingBackend#shutdown()
+     */
+    @Override
+    public void shutdown() {
+        try {
+            cacheRepository.shutDown();
+        } catch (RepositoryException e) {
+            log.error("error while shutting down cache repository", e);
+        }
+
+    }
+
+
+    private ValueFactory getValueFactory() {
+        return ValueFactoryImpl.getInstance();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/util/FileBackendUtils.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/util/FileBackendUtils.java b/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/util/FileBackendUtils.java
index a24902c..7c30120 100644
--- a/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/util/FileBackendUtils.java
+++ b/libraries/ldcache/ldcache-backend-file/src/main/java/org/apache/marmotta/ldcache/backend/file/util/FileBackendUtils.java
@@ -17,22 +17,17 @@
 
 package org.apache.marmotta.ldcache.backend.file.util;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
 import org.apache.marmotta.commons.util.HashUtils;
 import org.apache.marmotta.ldcache.model.CacheEntry;
+import org.apache.marmotta.ldcache.model.CacheEntryNG;
 import org.openrdf.model.URI;
 import org.openrdf.model.ValueFactory;
 
+import java.io.*;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
 public class FileBackendUtils {
 
 	private static final String DATA_EXT = ".ttl";
@@ -108,8 +103,27 @@ public class FileBackendUtils {
 				br.close();
 			}
 	}
-	
-	public static void writeCacheEntry(CacheEntry ce, File baseDir) throws IOException {
+
+    public static CacheEntryNG readCacheEntryNG(File metaFile, ValueFactory valueFactory) throws IOException {
+        BufferedReader br;
+        br = new BufferedReader(new FileReader(metaFile));
+        try {
+            final CacheEntryNG ce = new CacheEntryNG();
+
+            ce.setResource(valueFactory.createURI(br.readLine()));
+            ce.setLastRetrieved(new Date(Long.parseLong(br.readLine().replaceFirst("#.*$", "").trim())));
+            ce.setExpiryDate(new Date(Long.parseLong(br.readLine().replaceFirst("#.*$", "").trim())));
+            ce.setUpdateCount(Integer.parseInt(br.readLine().replaceFirst("#.*$", "").trim()));
+            ce.setTripleCount(Integer.parseInt(br.readLine().replaceFirst("#.*$", "").trim()));
+
+            return ce;
+        } finally {
+            br.close();
+        }
+    }
+
+
+    public static void writeCacheEntry(CacheEntry ce, File baseDir) throws IOException {
 		File metaFile = getMetaFile(ce.getResource(), baseDir);
 
         // ensure that the directory where we write the file exists

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-file/src/test/java/org/apache/marmotta/ldcache/backend/file/test/LDCacheFileNGTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-file/src/test/java/org/apache/marmotta/ldcache/backend/file/test/LDCacheFileNGTest.java b/libraries/ldcache/ldcache-backend-file/src/test/java/org/apache/marmotta/ldcache/backend/file/test/LDCacheFileNGTest.java
new file mode 100644
index 0000000..333057e
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-file/src/test/java/org/apache/marmotta/ldcache/backend/file/test/LDCacheFileNGTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.backend.file.test;
+
+import com.google.common.io.Files;
+import org.apache.commons.io.FileUtils;
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackendNG;
+import org.apache.marmotta.ldcache.services.test.ng.BaseLDCacheNGTest;
+import org.junit.internal.AssumptionViolatedException;
+import org.openrdf.repository.RepositoryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCacheFileNGTest extends BaseLDCacheNGTest {
+
+    private static Logger log = LoggerFactory.getLogger(LDCacheFileNGTest.class);
+
+    /**
+     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
+     *
+     * @return
+     */
+    @Override
+    protected LDCachingBackendNG createBackend() {
+        final File storageDir = Files.createTempDir();
+
+        LDCachingBackendNG backend = null;
+        try {
+            backend = new LDCachingFileBackendNG(storageDir) {
+                @Override
+                public void shutdown() {
+                    super.shutdown();
+
+                    try {
+                        FileUtils.deleteDirectory(storageDir);
+                    } catch (IOException e) {
+                    }
+                }
+            };
+            backend.initialize();
+
+            return backend;
+        } catch (RepositoryException e) {
+            throw new AssumptionViolatedException("could not initialise backend",e);
+        }
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-infinispan/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-infinispan/pom.xml b/libraries/ldcache/ldcache-backend-infinispan/pom.xml
index b1089bb..1069f73 100644
--- a/libraries/ldcache/ldcache-backend-infinispan/pom.xml
+++ b/libraries/ldcache/ldcache-backend-infinispan/pom.xml
@@ -133,6 +133,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldclient-provider-rdf</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ldclient-provider-facebook</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.openrdf.sesame</groupId>
             <artifactId>sesame-rio-turtle</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/LDCachingInfinispanBackendNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/LDCachingInfinispanBackendNG.java b/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/LDCachingInfinispanBackendNG.java
new file mode 100644
index 0000000..701912e
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/LDCachingInfinispanBackendNG.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.backend.infinispan;
+
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.model.CacheEntryNG;
+import org.infinispan.Cache;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.context.Flag;
+import org.infinispan.distribution.ch.SyncConsistentHashFactory;
+import org.infinispan.eviction.EvictionStrategy;
+import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.openrdf.model.URI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCachingInfinispanBackendNG implements LDCachingBackendNG {
+
+    private static Logger log = LoggerFactory.getLogger(LDCachingInfinispanBackendNG.class);
+
+    public static final String LDCACHE_ENTRY_CACHE = "ldcache-entry-cache";
+    public static final String LDCACHE_TRIPLE_CACHE = "ldcache-triple-cache";
+
+    private EmbeddedCacheManager cacheManager;
+
+    private GlobalConfiguration globalConfiguration;
+
+    private Configuration defaultConfiguration;
+
+    private boolean clustered;
+
+    private Cache<String,CacheEntryNG> entryCache;
+
+    /**
+     * Create a non-clustered instance of the infinispan cache.
+     */
+    public LDCachingInfinispanBackendNG() {
+        globalConfiguration = new GlobalConfigurationBuilder()
+                .classLoader(LDCachingInfinispanBackendNG.class.getClassLoader())
+                .globalJmxStatistics()
+                    .jmxDomain("org.apache.marmotta.ldcache")
+                    .allowDuplicateDomains(true)
+                .build();
+
+        defaultConfiguration = new ConfigurationBuilder()
+                .clustering()
+                    .cacheMode(CacheMode.LOCAL)
+                .eviction()
+                    .strategy(EvictionStrategy.LIRS)
+                    .maxEntries(100000)
+                .expiration()
+                    .lifespan(7, TimeUnit.DAYS)
+                    .maxIdle(1, TimeUnit.DAYS)
+                .build();
+
+        clustered = false;
+
+    }
+
+    /**
+     * Create a clustered instane of the infinispan cache backend using the provided cluster and machine name
+     * @param clusterName
+     * @param machineName
+     */
+    public LDCachingInfinispanBackendNG(String clusterName, String machineName) {
+        globalConfiguration = new GlobalConfigurationBuilder()
+                .classLoader(LDCachingInfinispanBackendNG.class.getClassLoader())
+                .transport()
+                    .defaultTransport()
+                    .clusterName(clusterName)
+                    .machineId(machineName)
+                    .addProperty("configurationFile", "jgroups-kiwi.xml")
+                .globalJmxStatistics()
+                    .jmxDomain("org.apache.marmotta.ldcache")
+                    .allowDuplicateDomains(true)
+                .build();
+
+
+
+        defaultConfiguration = new ConfigurationBuilder()
+                .clustering()
+                    .cacheMode(CacheMode.DIST_ASYNC)
+                        .async()
+                        .asyncMarshalling()
+                    .l1()
+                        .lifespan(5, TimeUnit.MINUTES)
+                    .hash()
+                        .numOwners(2)
+                        .numSegments(40)
+                        .consistentHashFactory(new SyncConsistentHashFactory())
+                .stateTransfer()
+                    .fetchInMemoryState(false)
+                .eviction()
+                    .strategy(EvictionStrategy.LIRS)
+                    .maxEntries(100000)
+                .expiration()
+                    .lifespan(7, TimeUnit.DAYS)
+                    .maxIdle(1, TimeUnit.DAYS)
+                .build();
+
+
+        clustered = true;
+
+
+    }
+
+
+    public synchronized Cache<String,CacheEntryNG> getEntryCache() {
+        return entryCache;
+
+    }
+
+
+    /**
+     * Return the cache entry for the given resource, or null if this entry does not exist.
+     *
+     * @param resource the resource to retrieve the cache entry for
+     * @return
+     */
+    @Override
+    public CacheEntryNG getEntry(URI resource) {
+        CacheEntryNG entry = getEntryCache().get(resource.stringValue());
+
+        log.debug("retrieved entry for resource {}: {}", resource.stringValue(), entry);
+
+        return entry;
+    }
+
+    /**
+     * Update the cache entry for the given resource with the given entry.
+     *
+     * @param resource the resource to update
+     * @param entry    the entry for the resource
+     */
+    @Override
+    public void putEntry(URI resource, CacheEntryNG entry) {
+        log.debug("updating entry for resource {} to {}", resource.stringValue(), entry);
+
+        getEntryCache().put(resource.stringValue(), entry);
+    }
+
+    /**
+     * Remove the cache entry for the given resource if it exists. Does nothing otherwise.
+     *
+     * @param resource the resource to remove the entry for
+     */
+    @Override
+    public void removeEntry(URI resource) {
+        log.debug("removing entry for resource {}", resource.stringValue());
+
+        getEntryCache().remove(resource.stringValue());
+    }
+
+    /**
+     * Clear all entries in the cache backend.
+     */
+    @Override
+    public void clear() {
+        getEntryCache().clear();
+    }
+
+    /**
+     * Carry out any initialization tasks that might be necessary
+     */
+    @Override
+    public void initialize() {
+        cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true);
+
+        if(entryCache == null) {
+            cacheManager.defineConfiguration(LDCACHE_ENTRY_CACHE, defaultConfiguration);
+
+            entryCache = cacheManager.<String,CacheEntryNG>getCache(LDCACHE_ENTRY_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP);
+        }
+
+
+        log.info("initialised cache manager ({})", globalConfiguration.isClustered() ? "cluster name: "+globalConfiguration.transport().clusterName() : "single host");
+
+    }
+
+    /**
+     * Shutdown the backend and free all runtime resources.
+     */
+    @Override
+    public void shutdown() {
+        log.warn("shutting down cache manager ...");
+        if(cacheManager.getTransport() != null) {
+            log.info("... shutting down transport ...");
+            cacheManager.getTransport().stop();
+        }
+        log.info("... shutting down main component ...");
+        cacheManager.stop();
+        log.info("... done!");
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/repository/LDCachingInfinispanRepositoryConnection.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/repository/LDCachingInfinispanRepositoryConnection.java b/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/repository/LDCachingInfinispanRepositoryConnection.java
index 57f8289..863c78d 100644
--- a/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/repository/LDCachingInfinispanRepositoryConnection.java
+++ b/libraries/ldcache/ldcache-backend-infinispan/src/main/java/org/apache/marmotta/ldcache/backend/infinispan/repository/LDCachingInfinispanRepositoryConnection.java
@@ -96,7 +96,7 @@ public class LDCachingInfinispanRepositoryConnection extends RepositoryConnectio
      */
     @Override
     public void addCacheEntry(URI resource, CacheEntry entry) throws RepositoryException {
-        backend.getEntryCache().putAsync(resource.stringValue(),entry,entry.getExpiryDate().getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
+        backend.getEntryCache().put(resource.stringValue(),entry,entry.getExpiryDate().getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
 
         Model model = new TreeModel();
 
@@ -109,7 +109,7 @@ public class LDCachingInfinispanRepositoryConnection extends RepositoryConnectio
             triples.close();
         }
 
-        backend.getTripleCache().putAsync(resource.stringValue(),model,entry.getExpiryDate().getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
+        backend.getTripleCache().put(resource.stringValue(),model,entry.getExpiryDate().getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -119,8 +119,8 @@ public class LDCachingInfinispanRepositoryConnection extends RepositoryConnectio
      */
     @Override
     public void removeCacheEntry(URI resource) throws RepositoryException {
-        backend.getEntryCache().removeAsync(resource.stringValue());
-        backend.getTripleCache().removeAsync(resource.stringValue());
+        backend.getEntryCache().remove(resource.stringValue());
+        backend.getTripleCache().remove(resource.stringValue());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanNGTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanNGTest.java b/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanNGTest.java
new file mode 100644
index 0000000..5710042
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanNGTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.infinispan.test;
+
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.backend.infinispan.LDCachingInfinispanBackendNG;
+import org.apache.marmotta.ldcache.services.test.ng.BaseLDCacheNGTest;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCacheInfinispanNGTest extends BaseLDCacheNGTest {
+
+    /**
+     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
+     *
+     * @return
+     */
+    @Override
+    protected LDCachingBackendNG createBackend() {
+        LDCachingBackendNG backend = new LDCachingInfinispanBackendNG();
+        backend.initialize();
+
+        return backend;
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
index 1b66511..0605fc9 100644
--- a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
+++ b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
@@ -19,9 +19,11 @@ package org.apache.marmotta.ldcache.services;
 
 import info.aduna.iteration.CloseableIteration;
 import org.apache.marmotta.commons.locking.ObjectLocks;
+import org.apache.marmotta.commons.sesame.model.ModelCommons;
 import org.apache.marmotta.ldcache.api.LDCachingBackend;
 import org.apache.marmotta.ldcache.api.LDCachingConnection;
 import org.apache.marmotta.ldcache.api.LDCachingService;
+import org.apache.marmotta.ldcache.api.LDCachingServiceNG;
 import org.apache.marmotta.ldcache.model.CacheConfiguration;
 import org.apache.marmotta.ldcache.model.CacheEntry;
 import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
@@ -29,12 +31,10 @@ import org.apache.marmotta.ldclient.exception.DataRetrievalException;
 import org.apache.marmotta.ldclient.model.ClientResponse;
 import org.apache.marmotta.ldclient.services.ldclient.LDClient;
 import org.openrdf.model.Model;
-import org.openrdf.model.Statement;
 import org.openrdf.model.URI;
 import org.openrdf.model.impl.TreeModel;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.RepositoryResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +48,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
  * <p/>
  * Author: Sebastian Schaffert (sschaffert@apache.org)
  */
-public class LDCache implements LDCachingService {
+public class LDCache implements LDCachingService, LDCachingServiceNG {
 
     private static Logger log = LoggerFactory.getLogger(LDCache.class);
 
@@ -152,6 +152,22 @@ public class LDCache implements LDCachingService {
         }
     }
 
+
+    /**
+     * Return true in case the cache contains an entry for the resource given as argument.
+     *
+     * @param resource the resource to check
+     * @return true in case the resource is contained in the cache
+     */
+    @Override
+    public boolean contains(URI resource) {
+        try {
+            return isCached(resource.stringValue());
+        } catch (RepositoryException e) {
+            return false;
+        }
+    }
+
     /**
      * Manually expire the caching information for the given resource. The resource will be
      * re-retrieved upon the next access.
@@ -196,29 +212,59 @@ public class LDCache implements LDCachingService {
      * @return
      * @throws RepositoryException
      */
-    public Model get(URI resource) throws RepositoryException {
+    public Model get(URI resource, RefreshOpts... options)  {
         refreshResource(resource,false);
 
         Model m = new TreeModel();
 
-        LDCachingConnection c = getCacheConnection(resource.stringValue());
         try {
-            c.begin();
-            RepositoryResult<Statement> triples = c.getStatements(resource,null,null,false);
+            LDCachingConnection c = getCacheConnection(resource.stringValue());
             try {
-                while(triples.hasNext()) {
-                    m.add(triples.next());
-                }
+                c.begin();
+
+                ModelCommons.add(m, c.getStatements(resource,null,null,false));
+
+                c.commit();
             } finally {
-                triples.close();
+                c.close();
             }
-        } finally {
-            c.close();
+        } catch (RepositoryException e) {
+            log.error("error adding cached triples to model:",e);
         }
         return m;
 
     }
 
+
+    /**
+     * Refresh the resource passed as argument. If the resource is not yet cached or the cache entry is
+     * expired or refreshing is forced, the remote resource is retrieved using LDClient and the result stored
+     * in the cache. Otherwise the method does nothing.
+     *
+     * @param resource the resource to refresh
+     * @param options  options for refreshing
+     */
+    @Override
+    public void refresh(URI resource, RefreshOpts... options) {
+        boolean force = false;
+        for(RefreshOpts opt : options) {
+            if(opt == RefreshOpts.FORCE) {
+                force = true;
+            }
+        }
+
+        refreshResource(resource, force);
+    }
+
+
+    /**
+     * Manually expire all cached resources.
+     */
+    @Override
+    public void clear() {
+        expireAll();
+    }
+
     /**
      * Refresh the cached resource passed as argument. The method will do nothing for local
      * resources.

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCacheNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCacheNG.java b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCacheNG.java
new file mode 100644
index 0000000..24c299a
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCacheNG.java
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.services;
+
+import org.apache.marmotta.commons.locking.ObjectLocks;
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.api.LDCachingServiceNG;
+import org.apache.marmotta.ldcache.model.CacheConfiguration;
+import org.apache.marmotta.ldcache.model.CacheEntryNG;
+import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
+import org.apache.marmotta.ldclient.exception.DataRetrievalException;
+import org.apache.marmotta.ldclient.model.ClientResponse;
+import org.apache.marmotta.ldclient.services.ldclient.LDClient;
+import org.openrdf.model.Model;
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.TreeModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Next generation LDCache API. Will eventually replace the old LDCache API.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCacheNG implements LDCachingServiceNG {
+
+    private static Logger log = LoggerFactory.getLogger(LDCacheNG.class);
+
+    // lock a resource while refreshing it so that not several threads trigger a refresh at the same time
+    private ObjectLocks resourceLocks;
+
+    private CacheConfiguration config;
+
+    private LDClientService ldclient;
+
+    private LDCachingBackendNG backend;
+
+    private ReentrantReadWriteLock lock;
+
+    /**
+     * Create a new instance of LDCache using the provided LDCache configuration and backend. The backend needs to
+     * be initialized already. The cache configuration will be used to create an instance of LDClient.
+     *
+     * @param config
+     * @param backend
+     */
+    public LDCacheNG(CacheConfiguration config, LDCachingBackendNG backend) {
+        this.resourceLocks = new ObjectLocks();
+        this.backend  = backend;
+        this.ldclient = new LDClient(config.getClientConfiguration());
+        this.config   = config;
+        this.lock = new ReentrantReadWriteLock();
+    }
+
+
+    /**
+     * Reload configuration and initialise LDClient.
+     */
+    public void reload() {
+        lock.writeLock().lock();
+        try {
+            if(this.ldclient != null) {
+                log.info("Reloading LDClient configuration ...");
+                this.ldclient.shutdown();
+                this.ldclient = new LDClient(config.getClientConfiguration());
+            }
+        } finally {
+            lock.writeLock().unlock();
+        }
+    }
+
+    /**
+     * Refresh the resource passed as argument. If the resource is not yet cached or the cache entry is
+     * expired or refreshing is forced, the remote resource is retrieved using LDClient and the result stored
+     * in the cache. Otherwise the method does nothing.
+     *
+     * @param resource the resource to refresh
+     * @param options  options for refreshing
+     */
+    @Override
+    public void refresh(URI resource, RefreshOpts... options) {
+        Set<RefreshOpts> optionSet = new HashSet<>(Arrays.asList(options));
+
+        resourceLocks.lock(resource.stringValue());
+        try {
+            // check if the resource is already cached; if yes, and refresh is not forced, return immediately
+            CacheEntryNG entry = backend.getEntry(resource);
+            if(!optionSet.contains(RefreshOpts.FORCE) && entry != null && entry.getExpiryDate().after(new Date())) {
+                log.debug("not refreshing resource {}, as the cached entry is not yet expired",resource);
+                return;
+            }
+
+            // refresh the resource by calling LDClient
+            log.debug("refreshing resource {}",resource);
+            this.lock.readLock().lock();
+            try {
+                ClientResponse response = ldclient.retrieveResource(resource.stringValue());
+
+                if(response != null) {
+                    log.info("refreshed resource {}",resource);
+
+                    CacheEntryNG newEntry = new CacheEntryNG();
+                    newEntry.setResource(resource);
+                    newEntry.setExpiryDate(response.getExpires());
+                    newEntry.setLastRetrieved(new Date());
+                    if(entry != null) {
+                        newEntry.setUpdateCount(entry.getUpdateCount()+1);
+                    } else {
+                        newEntry.setUpdateCount(1);
+                    }
+                    newEntry.setTripleCount(response.getData().size());
+                    newEntry.setTriples(response.getData());
+
+                    backend.putEntry(resource, newEntry);
+
+                }
+
+            } catch (DataRetrievalException e) {
+
+                // on exception, save an expiry information and retry in one day
+                CacheEntryNG newEntry = new CacheEntryNG();
+                newEntry.setResource(resource);
+                newEntry.setExpiryDate(new Date(System.currentTimeMillis() + config.getDefaultExpiry()*1000));
+                newEntry.setLastRetrieved(new Date());
+                if(entry != null) {
+                    newEntry.setUpdateCount(entry.getUpdateCount()+1);
+                } else {
+                    newEntry.setUpdateCount(1);
+                }
+                newEntry.setTripleCount(0);
+                newEntry.setTriples(new TreeModel());
+
+                backend.putEntry(resource, newEntry);
+
+            } finally {
+                this.lock.readLock().unlock();
+            }
+        } finally {
+            resourceLocks.unlock(resource.stringValue());
+        }
+
+    }
+
+    /**
+     * Refresh and return the resource passed as argument. If the resource is not yet cached or the cache entry is
+     * expired or refreshing is forced, the remote resource is retrieved using LDClient and the result stored
+     * in the cache. Otherwise the method returns the cached entry. In case a cached entry does not exist, the method
+     * returns an empty Model.
+     *
+     * @param resource the resource to retrieve
+     * @param options  options for refreshing
+     * @return a Sesame Model holding the triples representing the resource
+     */
+    @Override
+    public Model get(URI resource, RefreshOpts... options) {
+        refresh(resource, options);
+
+        CacheEntryNG entry =  backend.getEntry(resource);
+
+        if(entry != null) {
+            return entry.getTriples();
+        } else {
+            return new TreeModel();
+        }
+    }
+
+    /**
+     * Manually expire the caching information for the given resource. The resource will be
+     * re-retrieved upon the next access.
+     *
+     * @param resource the resource to expire.
+     */
+    @Override
+    public void expire(URI resource) {
+        backend.removeEntry(resource);
+    }
+
+    /**
+     * Return true in case the cache contains an entry for the resource given as argument.
+     *
+     * @param resource the resource to check
+     * @return true in case the resource is contained in the cache
+     */
+    @Override
+    public boolean contains(URI resource) {
+        return backend.getEntry(resource) != null;
+    }
+
+    /**
+     * Manually expire all cached resources.
+     */
+    @Override
+    public void clear() {
+        backend.clear();
+    }
+
+    /**
+     * Shutdown the caching service and free all occupied runtime resources.
+     */
+    @Override
+    public void shutdown() {
+        backend.shutdown();
+    }
+
+
+    public LDClientService getClient() {
+        return ldclient;
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheNGTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheNGTest.java b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheNGTest.java
new file mode 100644
index 0000000..f2f6203
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheNGTest.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.ldcache.services.test.ng;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.marmotta.commons.sesame.model.ModelCommons;
+import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.model.CacheConfiguration;
+import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.junit.*;
+import org.openrdf.model.Model;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.query.BooleanQuery;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.Rio;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public abstract class BaseLDCacheNGTest {
+
+    private static final String DBPEDIA = "http://dbpedia.org/resource/Berlin";
+    private static final String GEONAMES = "http://sws.geonames.org/3020251/";
+    private static final String MARMOTTA = "http://rdfohloh.wikier.org/project/marmotta";
+    private static final String WIKIER = "http://www.wikier.org/foaf#wikier";
+
+    private static Logger log = LoggerFactory.getLogger(BaseLDCacheNGTest.class);
+
+    protected LDCacheNG ldcache;
+
+
+    protected ValueFactory valueFactory = ValueFactoryImpl.getInstance();
+
+    /**
+     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
+     *
+     * @return
+     */
+    protected abstract LDCachingBackendNG createBackend();
+
+
+
+    @Before
+    public void setup() {
+        ldcache = new LDCacheNG(new CacheConfiguration(), createBackend());
+    }
+
+
+    @Test
+    public void testDBPedia() throws Exception {
+        Assume.assumeTrue(existsClass("org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider"));
+
+        testResource(DBPEDIA, "dbpedia-berlin.sparql");
+    }
+
+    @Test
+    public void testGeonames() throws Exception {
+        Assume.assumeTrue(existsClass("org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider"));
+
+        testResource(GEONAMES, "geonames-embrun.sparql");
+    }
+
+    @Test
+    public void testFOAF() throws Exception {
+        Assume.assumeTrue(existsClass("org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider"));
+
+        testResource(WIKIER, "foaf-wikier.sparql");
+    }
+
+    @Test
+    @Ignore("test failing for the moment because the data returned by the service is wrong")
+    public void testOHLOH() throws Exception {
+        Assume.assumeTrue(existsClass("org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider"));
+
+        testResource(MARMOTTA, "ohloh-marmotta.sparql");
+    }
+
+    /**
+     * Test retrieving and caching some resources (provided by DummyProvider).
+     */
+    @Test
+    public void testLocal() throws Exception {
+        String uri1 = "http://localhost/resource1";
+        String uri2 = "http://localhost/resource2";
+        String uri3 = "http://localhost/resource3";
+
+        ldcache.refresh(valueFactory.createURI(uri1));
+
+        Assert.assertTrue(ldcache.contains(valueFactory.createURI(uri1)));
+        Assert.assertEquals(3, ldcache.get(valueFactory.createURI(uri1)).size());
+
+        ldcache.refresh(valueFactory.createURI(uri2));
+
+        Assert.assertTrue(ldcache.contains(valueFactory.createURI(uri2)));
+        Assert.assertEquals(2, ldcache.get(valueFactory.createURI(uri2)).size());
+
+        ldcache.refresh(valueFactory.createURI(uri3));
+
+        Assert.assertTrue(ldcache.contains(valueFactory.createURI(uri3)));
+        Assert.assertEquals(2, ldcache.get(valueFactory.createURI(uri3)).size());
+    }
+
+
+    protected void testResource(String uri, String sparqlFile) throws Exception {
+
+        Assume.assumeTrue(ldcache.getClient().ping(uri));
+
+
+        Model model = ldcache.get(valueFactory.createURI(uri));
+
+        Assert.assertTrue(model.size() > 0);
+
+        RepositoryConnection connection = ModelCommons.asRepository(model).getConnection();
+        connection.begin();
+
+        // run a SPARQL test to see if the returned data is correct
+        InputStream sparql = BaseLDCacheNGTest.class.getResourceAsStream(sparqlFile);
+        BooleanQuery testLabel = connection.prepareBooleanQuery(QueryLanguage.SPARQL, IOUtils.toString(sparql));
+        Assert.assertTrue("SPARQL test query failed", testLabel.evaluate());
+
+        if(log.isDebugEnabled()) {
+            StringWriter out = new StringWriter();
+            connection.export(Rio.createWriter(RDFFormat.TURTLE, out));
+            log.debug("DATA:");
+            log.debug(out.toString());
+        }
+
+        connection.commit();
+        connection.close();
+    }
+
+
+    protected boolean existsClass(String className) {
+        try {
+            Class.forName(className);
+            return true;
+        } catch (ClassNotFoundException e) {
+            return false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/dbpedia-berlin.sparql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/dbpedia-berlin.sparql b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/dbpedia-berlin.sparql
new file mode 100644
index 0000000..cfea0fe
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/dbpedia-berlin.sparql
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX dbp: <http://dbpedia.org/ontology/>
+ASK {
+    <http://dbpedia.org/resource/Berlin> rdfs:label "Berlin"@en .
+    <http://dbpedia.org/resource/Berlin> rdf:type dbp:City
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/foaf-wikier.sparql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/foaf-wikier.sparql b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/foaf-wikier.sparql
new file mode 100644
index 0000000..7060e94
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/foaf-wikier.sparql
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+ASK {
+    <http://www.wikier.org/foaf#wikier> rdf:type foaf:Person ; 
+        foaf:name "Sergio Fernández"@es ;
+        foaf:homepage <http://www.wikier.org>  .
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/geonames-embrun.sparql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/geonames-embrun.sparql b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/geonames-embrun.sparql
new file mode 100644
index 0000000..fd29033
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/geonames-embrun.sparql
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX gn: <http://www.geonames.org/ontology#>
+ASK {
+    <http://sws.geonames.org/3020251/> gn:name "Embrun" .
+    <http://sws.geonames.org/3020251/> rdf:type gn:Feature
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2253bcc1/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/ohloh-marmotta.sparql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/ohloh-marmotta.sparql b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/ohloh-marmotta.sparql
new file mode 100644
index 0000000..0fbaf78
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/resources/org/apache/marmotta/ldcache/services/test/ng/ohloh-marmotta.sparql
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX doap: <http://usefulinc.com/ns/doap#>
+ASK {
+    <http://rdfohloh.wikier.org/project/marmotta> rdf:type doap:Project ; 
+        doap:name "Apache Marmotta" ;
+        doap:homepage <http://marmotta.apache.org>  .
+}


[2/2] git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop

Posted by ss...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/3a68b428
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/3a68b428
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/3a68b428

Branch: refs/heads/develop
Commit: 3a68b428656b2e2092e8f274d9bd426b5038c838
Parents: 2253bcc 60ae655
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Fri Jan 10 16:17:15 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Fri Jan 10 16:17:15 2014 +0100

----------------------------------------------------------------------
 LICENSE.txt                                     |   71 -
 .../maven/plugins/refpack/RefPackMojo.java      |   13 +-
 launchers/marmotta-installer/pom.xml            |   18 +
 .../src/main/resources/installer/LICENSE.txt    |   72 -
 .../src/main/resources/installer/standalone.xml |    1 +
 launchers/marmotta-splash/pom.xml               |   32 +-
 .../src/ext/java/net/miginfocom/layout/AC.java  |  564 -----
 .../java/net/miginfocom/layout/BoundSize.java   |  273 --
 .../src/ext/java/net/miginfocom/layout/CC.java  | 1833 --------------
 .../net/miginfocom/layout/ComponentWrapper.java |  297 ---
 .../net/miginfocom/layout/ConstraintParser.java | 1464 -----------
 .../net/miginfocom/layout/ContainerWrapper.java |   69 -
 .../net/miginfocom/layout/DimConstraint.java    |  471 ----
 .../ext/java/net/miginfocom/layout/Grid.java    | 2350 ------------------
 .../ext/java/net/miginfocom/layout/IDEUtil.java |  789 ------
 .../miginfocom/layout/InCellGapProvider.java    |   65 -
 .../src/ext/java/net/miginfocom/layout/LC.java  | 1032 --------
 .../net/miginfocom/layout/LayoutCallback.java   |   77 -
 .../java/net/miginfocom/layout/LayoutUtil.java  |  566 -----
 .../java/net/miginfocom/layout/LinkHandler.java |  200 --
 .../net/miginfocom/layout/PlatformDefaults.java |  772 ------
 .../net/miginfocom/layout/ResizeConstraint.java |   92 -
 .../net/miginfocom/layout/UnitConverter.java    |   59 -
 .../java/net/miginfocom/layout/UnitValue.java   |  637 -----
 .../java/net/miginfocom/swing/MigLayout.java    |  701 ------
 .../miginfocom/swing/SwingComponentWrapper.java |  459 ----
 .../miginfocom/swing/SwingContainerWrapper.java |  109 -
 .../swingbits/action/ActionBuilderHelper.java   |  241 --
 .../action/ActionContainerBuilderFactory.java   |   89 -
 .../swingbits/action/ActionDropDownMenu.java    |   91 -
 .../org/oxbow/swingbits/action/ActionGroup.java |  131 -
 .../org/oxbow/swingbits/action/Actions.java     |   83 -
 .../org/oxbow/swingbits/action/CheckAction.java |   39 -
 .../action/IActionContainerBuilder.java         |   43 -
 .../org/oxbow/swingbits/action/RadioAction.java |   39 -
 .../org/oxbow/swingbits/action/dropdown.png     |  Bin 1227 -> 0 bytes
 .../swingbits/dialog/task/CommandLink.java      |  104 -
 .../dialog/task/ContentDesignFactory.java       |   55 -
 .../dialog/task/ICommandLinkPainter.java        |   43 -
 .../swingbits/dialog/task/IContentDesign.java   |  127 -
 .../oxbow/swingbits/dialog/task/TaskDialog.java |  968 --------
 .../dialog/task/TaskDialogException.java        |   53 -
 .../swingbits/dialog/task/TaskDialogs.java      |  666 -----
 .../dialog/task/design/CommandLinkButton.java   |  147 --
 .../task/design/CommandLinkButtonGroup.java     |   53 -
 .../task/design/DefaultCommandLinkPainter.java  |  162 --
 .../task/design/DefaultContentDesign.java       |  192 --
 .../dialog/task/design/DetailsToggleButton.java |   49 -
 .../dialog/task/design/LinuxContentDesign.java  |   75 -
 .../task/design/MacOsCommandLinkPainter.java    |   48 -
 .../dialog/task/design/MacOsContentDesign.java  |  137 -
 .../dialog/task/design/TaskDialogContent.java   |  385 ---
 .../task/design/WindowsCommandLinkPainter.java  |   65 -
 .../task/design/WindowsContentDesign.java       |   66 -
 .../swingbits/list/ActionCheckListModel.java    |  188 --
 .../org/oxbow/swingbits/list/CheckList.java     |  173 --
 .../oxbow/swingbits/list/CheckListEditor.java   |   84 -
 .../swingbits/list/CheckListFilterType.java     |   31 -
 .../oxbow/swingbits/list/CheckListRenderer.java |  228 --
 .../swingbits/list/DefaultCheckListModel.java   |  175 --
 .../oxbow/swingbits/list/ICheckListAction.java  |   33 -
 .../oxbow/swingbits/list/ICheckListModel.java   |   77 -
 .../oxbow/swingbits/misc/JSearchTextField.java  |   72 -
 .../java/org/oxbow/swingbits/misc/search.png    |  Bin 851 -> 0 bytes
 .../org/oxbow/swingbits/popup/PopupWindow.java  |  331 ---
 .../swingbits/table/TableHeaderRenderer.java    |   77 -
 .../table/filter/AbstractTableFilter.java       |  191 --
 .../table/filter/DistinctColumnItem.java        |  115 -
 .../table/filter/FilterTableHeaderRenderer.java |  103 -
 .../table/filter/IFilterChangeListener.java     |   37 -
 .../swingbits/table/filter/ITableFilter.java    |   99 -
 .../swingbits/table/filter/JTableFilter.java    |  116 -
 .../filter/TableAwareCheckListRenderer.java     |   86 -
 .../table/filter/TableFilterColumnPopup.java    |  317 ---
 .../table/filter/TableFilterState.java          |  129 -
 .../table/filter/TableRowFilterSupport.java     |  166 --
 .../org/oxbow/swingbits/table/filter/funnel.png |  Bin 797 -> 0 bytes
 .../swingbits/table/filter/funnel_delete.png    |  Bin 906 -> 0 bytes
 .../oxbow/swingbits/util/CollectionUtils.java   |   64 -
 .../java/org/oxbow/swingbits/util/DeepCopy.java |   94 -
 .../oxbow/swingbits/util/DeepCopyException.java |   57 -
 .../util/DefaultObjectToStringTranslator.java   |   42 -
 .../util/IObjectToStringTranslator.java         |   38 -
 .../org/oxbow/swingbits/util/IValueWrapper.java |    7 -
 .../java/org/oxbow/swingbits/util/Markup.java   |  123 -
 .../oxbow/swingbits/util/OperatingSystem.java   |   97 -
 .../org/oxbow/swingbits/util/Preconditions.java |   58 -
 .../org/oxbow/swingbits/util/Screenshot.java    |  143 --
 .../java/org/oxbow/swingbits/util/Strings.java  |  102 -
 .../util/copy/FastByteArrayInputStream.java     |   92 -
 .../util/copy/FastByteArrayOutputStream.java    |  117 -
 .../swingbits/util/swing/AncestorAdapter.java   |   51 -
 .../swingbits/util/swing/BeanProperty.java      |   93 -
 .../swingbits/util/swing/CompoundIcon.java      |  302 ---
 .../oxbow/swingbits/util/swing/EmptyIcon.java   |  104 -
 .../org/oxbow/swingbits/util/swing/Icons.java   |   98 -
 .../oxbow/swingbits/util/swing/SwingBean.java   |   76 -
 .../src/ext/resources/META-INF/LICENSE          |  208 --
 .../src/ext/resources/META-INF/NOTICE           |   11 -
 .../swingbits/dialog/task/arrowGreenRight.png   |  Bin 3526 -> 0 bytes
 .../swingbits/dialog/task/fewerDetails.png      |  Bin 933 -> 0 bytes
 .../swingbits/dialog/task/fewerDetailsMac.png   |  Bin 458 -> 0 bytes
 .../oxbow/swingbits/dialog/task/linux_error.png |  Bin 1998 -> 0 bytes
 .../oxbow/swingbits/dialog/task/linux_info.png  |  Bin 2328 -> 0 bytes
 .../swingbits/dialog/task/linux_question.png    |  Bin 2671 -> 0 bytes
 .../swingbits/dialog/task/linux_warning.png     |  Bin 2169 -> 0 bytes
 .../oxbow/swingbits/dialog/task/moreDetails.png |  Bin 912 -> 0 bytes
 .../swingbits/dialog/task/moreDetailsMac.png    |  Bin 468 -> 0 bytes
 .../marmotta/splash/ProgressListener.java       |    2 +-
 .../marmotta/splash/SplashContextListener.java  |    2 +-
 .../marmotta/splash/SplashScreenListener.java   |    2 +-
 .../splash/SplashScreenUpdaterBase.java         |    2 +-
 .../marmotta/splash/common/MarmottaContext.java |    2 +-
 .../splash/common/MarmottaStartupHelper.java    |    2 +-
 .../splash/common/ui/MessageDialog.java         |  142 ++
 .../splash/common/ui/SelectionDialog.java       |  215 ++
 .../splash/startup/StartupListener.java         |   27 +-
 .../splash/systray/SystrayListener.java         |   20 +-
 .../src/main/resources/META-INF/LICENSE         |  284 ---
 .../src/main/resources/META-INF/NOTICE          |   11 -
 .../src/main/resources/task-dialog.properties   |   34 -
 .../main/resources/task-dialog_de_DE.properties |   16 -
 .../main/resources/task-dialog_es_ES.properties |   16 -
 .../main/resources/task-dialog_fr_FR.properties |   16 -
 .../main/resources/task-dialog_it_IT.properties |   16 -
 .../main/resources/task-dialog_pl_PL.properties |   16 -
 .../main/resources/task-dialog_pt_BR.properties |   16 -
 .../main/resources/task-dialog_pt_PT.properties |   16 -
 .../main/resources/task-dialog_zh_CN.properties |   16 -
 .../splash/startup/StartupListenerTest.java     |   26 +
 .../src/main/webapp/META-INF/LICENSE            |   72 -
 .../src/main/webapp/META-INF/LICENSE            |   72 -
 132 files changed, 451 insertions(+), 22634 deletions(-)
----------------------------------------------------------------------