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 18:09:20 UTC

[2/4] MARMOTTA-418: removed old LDCache API

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/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 0605fc9..ca2bae2 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
@@ -1,13 +1,12 @@
-/**
- * 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
+/*
+ * 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
+ *      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,
@@ -15,15 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 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;
@@ -33,46 +29,43 @@ 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.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
 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;
 
 /**
- * Main class for accessing the Linked Data Cache. A new LDCache can be instantiated with
- * <code>new LDCache(CacheConfiguration, LDCachingBackend)</code> and passing an appropriate
- * configuration and caching backend.
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
+ * Next generation LDCache API. Will eventually replace the old LDCache API.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
  */
-public class LDCache implements LDCachingService, LDCachingServiceNG {
+public class LDCache implements LDCachingService {
 
     private static Logger log = LoggerFactory.getLogger(LDCache.class);
 
-
     // lock a resource while refreshing it so that not several threads trigger a refresh at the same time
     private ObjectLocks resourceLocks;
 
-    private LDClientService  ldclient;
+    private CacheConfiguration config;
+
+    private LDClientService ldclient;
 
     private LDCachingBackend backend;
 
-    private CacheConfiguration config;
-
     private ReentrantReadWriteLock lock;
 
     /**
-     * Instantiate a new LDCache service by passing a configuration and a backend for storing cache data.
+     * 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 LDCache(CacheConfiguration config, LDCachingBackend backend) {
-        log.info("Linked Data Caching Service initialising ...");
-
         this.resourceLocks = new ObjectLocks();
         this.backend  = backend;
         this.ldclient = new LDClient(config.getClientConfiguration());
@@ -80,6 +73,7 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
         this.lock = new ReentrantReadWriteLock();
     }
 
+
     /**
      * Reload configuration and initialise LDClient.
      */
@@ -97,146 +91,6 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
     }
 
     /**
-     * Return a repository connection that can be used for accessing cached resources.
-     *
-     * @param  resource the resource that will be cached
-     * @return a repository connection that can be used for storing retrieved triples for caching
-     */
-    @Override
-    public LDCachingConnection getCacheConnection(String resource) throws RepositoryException {
-        return backend.getCacheConnection(resource);
-    }
-
-    /**
-     * Return an iterator over all cache entries (can e.g. be used for refreshing or expiring).
-     *
-     * @return
-     */
-    @Override
-    public CloseableIteration<CacheEntry, RepositoryException> listCacheEntries() throws RepositoryException {
-        return backend.listCacheEntries();
-    }
-
-    /**
-     * Return an iterator over all expired cache entries (can e.g. be used for refreshing).
-     *
-     * @return
-     */
-    @Override
-    public CloseableIteration<CacheEntry, RepositoryException> listExpiredEntries() throws RepositoryException {
-        return backend.listExpiredEntries();
-    }
-
-
-    /**
-     * Return true if the resource is a cached resource.
-     *
-     * @param resourceUri
-     * @return
-     * @throws RepositoryException
-     */
-    public boolean isCached(String resourceUri) throws RepositoryException {
-        // if there is no cache entry, then return false in any case
-        if(!backend.isCached(resourceUri)) {
-            return false;
-        } else {
-            // else list all cached triples - if there are none, the resource is not cached (e.g. blacklist or no LD resource)
-            RepositoryConnection con = backend.getCacheConnection(resourceUri);
-            try {
-                con.begin();
-                return con.hasStatement(con.getValueFactory().createURI(resourceUri), null, null, false);
-            } finally {
-                con.commit();
-                con.close();
-            }
-        }
-    }
-
-
-    /**
-     * 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.
-     *
-     * @param resource the Resource to expire.
-     */
-    @Override
-    public void expire(URI resource) {
-        Date now = new Date();
-
-        try {
-            LDCachingConnection con = backend.getCacheConnection(resource.stringValue());
-            try {
-                con.begin();
-
-                CacheEntry entry = con.getCacheEntry(resource);
-                if(entry.getExpiryDate().getTime() > now.getTime()) {
-                    entry.setExpiryDate(now);
-
-                    con.removeCacheEntry(entry.getResource());
-                    con.addCacheEntry(entry.getResource(),entry);
-                }
-
-                con.commit();
-            } catch(RepositoryException ex) {
-                con.rollback();
-            } finally {
-                con.close();
-            }
-        } catch(RepositoryException ex) {
-            ex.printStackTrace(); // TODO: handle error
-        }
-
-    }
-
-
-    /**
-     * Return the triples for the linked data resource given as argument. Will transparently retrieve triples from
-     * remote servers if needed or retrieve them from the cache.
-     *
-     * @param resource
-     * @return
-     * @throws RepositoryException
-     */
-    public Model get(URI resource, RefreshOpts... options)  {
-        refreshResource(resource,false);
-
-        Model m = new TreeModel();
-
-        try {
-            LDCachingConnection c = getCacheConnection(resource.stringValue());
-            try {
-                c.begin();
-
-                ModelCommons.add(m, c.getStatements(resource,null,null,false));
-
-                c.commit();
-            } 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.
@@ -246,70 +100,18 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
      */
     @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();
-    }
+        Set<RefreshOpts> optionSet = new HashSet<>(Arrays.asList(options));
 
-    /**
-     * Refresh the cached resource passed as argument. The method will do nothing for local
-     * resources.
-     * Calling the method will carry out the following tasks:
-     * 1. check whether the resource is a remote resource; if no, returns immediately
-     * 2. check whether the resource has a cache entry; if no, goto 4
-     * 3. check whether the expiry time of the cache entry has passed; if no, returns immediately
-     * 4. retrieve the triples for the resource from the Linked Data Cloud using the methods offered
-     * by the
-     * LinkedDataClientService (registered endpoints etc); returns immediately if the result is null
-     * or
-     * an exception is thrown
-     * 5. remove all old triples for the resource and add all new triples for the resource
-     * 6. create new expiry information of the cache entry and persist it in the transaction
-     *
-     * @param resource
-     * @param forceRefresh if <code>true</code> the resource will be refreshed despite the
-     */
-    @Override
-    public void refreshResource(URI resource, boolean forceRefresh) {
         resourceLocks.lock(resource.stringValue());
         try {
-            LDCachingConnection cacheConnection = backend.getCacheConnection(resource.stringValue());
-            CacheEntry entry = null;
-            try {
-                cacheConnection.begin();
-
-                // 2. check whether the resource has a cache entry; if no, goto 4
-                entry = cacheConnection.getCacheEntry(resource);
-
-                // commit/close the connection, the retrieveResource method takes too long to hold the DB connection open
-                cacheConnection.commit();
-
-                // 3. check whether the expiry time of the cache entry has passed; if no, returns immediately
-                if(!forceRefresh && entry != null && entry.getExpiryDate().after(new Date())) {
-                    log.debug("not refreshing resource {}, as the cached entry is not yet expired",resource);
-                    return;
-                }
-            } catch(RepositoryException ex) {
-                cacheConnection.rollback();
-            } finally {
-                cacheConnection.close();
+            // check if the resource is already cached; if yes, and refresh is not forced, return immediately
+            CacheEntry 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;
             }
 
-            // 4.
+            // refresh the resource by calling LDClient
             log.debug("refreshing resource {}",resource);
             this.lock.readLock().lock();
             try {
@@ -318,40 +120,27 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
                 if(response != null) {
                     log.info("refreshed resource {}",resource);
 
-                    // obtain a new cache connection, since we closed the original connection above
-                    LDCachingConnection cacheConnection1 = backend.getCacheConnection(resource.stringValue());
-                    cacheConnection1.begin();
-                    try {
-                        URI subject = cacheConnection1.getValueFactory().createURI(resource.stringValue());
-
-                        cacheConnection1.add(response.getData());
-
-                        CacheEntry newEntry = new CacheEntry();
-                        newEntry.setResource(subject);
-                        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());
-
-                        cacheConnection1.removeCacheEntry(resource);
-                        cacheConnection1.addCacheEntry(resource, newEntry);
-                        cacheConnection1.commit();
-                    } catch (RepositoryException e) {
-                        log.error("repository error while refreshing the remote resource {} from the Linked Data Cloud", resource, e);
-                        cacheConnection1.rollback();
-                    } finally {
-                        cacheConnection1.close();
+                    CacheEntry newEntry = new CacheEntry();
+                    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
                 CacheEntry newEntry = new CacheEntry();
-                newEntry.setResource(cacheConnection.getValueFactory().createURI(resource.stringValue()));
+                newEntry.setResource(resource);
                 newEntry.setExpiryDate(new Date(System.currentTimeMillis() + config.getDefaultExpiry()*1000));
                 newEntry.setLastRetrieved(new Date());
                 if(entry != null) {
@@ -360,106 +149,70 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
                     newEntry.setUpdateCount(1);
                 }
                 newEntry.setTripleCount(0);
+                newEntry.setTriples(new TreeModel());
+
+                backend.putEntry(resource, newEntry);
 
-                LDCachingConnection cacheConnection2 = backend.getCacheConnection(resource.stringValue());
-                cacheConnection2.begin();
-                try {
-                    cacheConnection2.removeCacheEntry(resource);
-                    cacheConnection2.addCacheEntry(resource, newEntry);
-
-                    cacheConnection2.commit();
-                    log.error("refreshing the remote resource {} from the Linked Data Cloud failed ({})",resource,e.getMessage());
-                    //log.info("exception was:",e);
-                    return;
-                } catch (RepositoryException ex) {
-                    log.error("repository error while refreshing the remote resource {} from the Linked Data Cloud", resource, ex);
-                    cacheConnection2.rollback();
-                } finally {
-                    cacheConnection2.close();
-                }
             } finally {
                 this.lock.readLock().unlock();
             }
-        } catch (RepositoryException e) {
-            log.error("repository exception while obtaining cache connection",e);
         } finally {
             resourceLocks.unlock(resource.stringValue());
         }
 
     }
 
-
     /**
-     * Refresh all expired resources by listing the cache entries that have expired and calling refreshResource on
-     * them. This method can e.g. be called by a scheduled task to regularly update cache entries to always have
-     * the latest version available in the Search Index and elsewhere.
+     * 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 void refreshExpired() {
-        Date now = new Date();
+    public Model get(URI resource, RefreshOpts... options) {
+        refresh(resource, options);
 
-        try {
-            CloseableIteration<CacheEntry,RepositoryException> it = backend.listExpiredEntries();
-            try {
-                while(it.hasNext()) {
-                    CacheEntry next =  it.next();
+        CacheEntry entry =  backend.getEntry(resource);
 
-                    if(next.getExpiryDate().getTime() < now.getTime()) {
-                        refreshResource(next.getResource(),false);
-                    }
-                }
-            } finally {
-                it.close();
-            }
-        } catch(RepositoryException ex) {
-            log.error("exception while refreshing cache entries", ex);
+        if(entry != null) {
+            return entry.getTriples();
+        } else {
+            return new TreeModel();
         }
-
     }
 
     /**
-     * Manually expire all cached resources.
+     * Manually expire the caching information for the given resource. The resource will be
+     * re-retrieved upon the next access.
      *
-     * @see #expire(org.openrdf.model.URI)
+     * @param resource the resource to expire.
      */
     @Override
-    public void expireAll() {
-        Date now = new Date();
+    public void expire(URI resource) {
+        backend.removeEntry(resource);
+    }
 
-        try {
-            CloseableIteration<CacheEntry,RepositoryException> it = backend.listCacheEntries();
-            try {
-                while(it.hasNext()) {
-                    CacheEntry next =  it.next();
-
-                    if(next.getExpiryDate().getTime() > now.getTime()) {
-                        next.setExpiryDate(now);
-
-                        try {
-                            LDCachingConnection con = backend.getCacheConnection(next.getResource().stringValue());
-                            try {
-                                con.begin();
-
-                                con.removeCacheEntry(next.getResource());
-                                con.addCacheEntry(next.getResource(), next);
-
-                                con.commit();
-                            } catch(RepositoryException ex) {
-                                con.rollback();
-                            } finally {
-                                con.close();
-                            }
-                        } catch(RepositoryException ex) {
-                        }
-                    }
-                }
-            } finally {
-                it.close();
-            }
-        } catch(RepositoryException ex) {
-            log.error("exception while expiring cache entries",ex);
-        }
+    /**
+     * 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();
     }
 
     /**
@@ -467,17 +220,11 @@ public class LDCache implements LDCachingService, LDCachingServiceNG {
      */
     @Override
     public void shutdown() {
-        lock.writeLock().lock();
-        try {
-            backend.shutdown();
-            ldclient.shutdown();
-        } finally {
-            lock.writeLock().unlock();
-        }
+        backend.shutdown();
     }
 
 
-    public LDClientService getLDClient() {
+    public LDClientService getClient() {
         return ldclient;
     }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/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
deleted file mode 100644
index d41e558..0000000
--- a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCacheNG.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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.CacheEntry;
-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
-            CacheEntry 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);
-
-                    CacheEntry newEntry = new CacheEntry();
-                    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
-                CacheEntry newEntry = new CacheEntry();
-                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);
-
-        CacheEntry 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/8941574c/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
deleted file mode 100644
index be97d70..0000000
--- a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheNGTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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
-    @Ignore("test failing for the moment because the data returned by the service is wrong")
-    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();
-        connection.getRepository().shutDown();
-    }
-
-
-    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/8941574c/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheTest.java b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheTest.java
new file mode 100644
index 0000000..f2d243d
--- /dev/null
+++ b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/ng/BaseLDCacheTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.LDCachingBackend;
+import org.apache.marmotta.ldcache.model.CacheConfiguration;
+import org.apache.marmotta.ldcache.services.LDCache;
+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 BaseLDCacheTest {
+
+    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(BaseLDCacheTest.class);
+
+    protected LDCache 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 LDCachingBackend createBackend();
+
+
+
+    @Before
+    public void setup() {
+        ldcache = new LDCache(new CacheConfiguration(), createBackend());
+    }
+
+
+    @Test
+    @Ignore("test failing for the moment because the data returned by the service is wrong")
+    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 = BaseLDCacheTest.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();
+        connection.getRepository().shutDown();
+    }
+
+
+    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/8941574c/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSail.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSail.java b/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSail.java
index c4936bc..f41879c 100644
--- a/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSail.java
+++ b/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSail.java
@@ -19,9 +19,9 @@ package org.apache.marmotta.ldcache.sail;
 
 import org.apache.marmotta.commons.sesame.filter.AlwaysTrueFilter;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
-import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
+import org.apache.marmotta.ldcache.api.LDCachingBackend;
 import org.apache.marmotta.ldcache.model.CacheConfiguration;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.apache.marmotta.ldclient.model.ClientConfiguration;
 import org.openrdf.model.Resource;
 import org.openrdf.sail.NotifyingSail;
@@ -37,32 +37,32 @@ import org.openrdf.sail.helpers.NotifyingSailWrapper;
  */
 public class GenericLinkedDataSail extends NotifyingSailWrapper {
 
-	private final LDCachingBackendNG cachingBackend;
+	private final LDCachingBackend cachingBackend;
 	private CacheConfiguration config;
-	private LDCacheNG ldcache;
+	private LDCache ldcache;
 	private SesameFilter<Resource> acceptForCaching;
 
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend) {
 		this(base, cachingBackend, new AlwaysTrueFilter<Resource>(), createCacheConfiguration(null));
 	}
 
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend, ClientConfiguration clientConfig) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend, ClientConfiguration clientConfig) {
 		this(base, cachingBackend, new AlwaysTrueFilter<Resource>(), clientConfig);
 	}
 
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend, CacheConfiguration cacheConfig) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend, CacheConfiguration cacheConfig) {
 		this(base, cachingBackend, new AlwaysTrueFilter<Resource>(), cacheConfig);
 	}
 	
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend, SesameFilter<Resource> acceptForCaching) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend, SesameFilter<Resource> acceptForCaching) {
 		this(base, cachingBackend, acceptForCaching, createCacheConfiguration(null));
 	}
 
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend, SesameFilter<Resource> acceptForCaching, ClientConfiguration clientConfig) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend, SesameFilter<Resource> acceptForCaching, ClientConfiguration clientConfig) {
 		this(base, cachingBackend, acceptForCaching, createCacheConfiguration(clientConfig));
 	}
 
-	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackendNG cachingBackend, SesameFilter<Resource> acceptForCaching, CacheConfiguration cacheConfig) {
+	public GenericLinkedDataSail(NotifyingSail base, LDCachingBackend cachingBackend, SesameFilter<Resource> acceptForCaching, CacheConfiguration cacheConfig) {
 		super(base);
 		this.cachingBackend = cachingBackend;
 		this.acceptForCaching = acceptForCaching;
@@ -88,7 +88,7 @@ public class GenericLinkedDataSail extends NotifyingSailWrapper {
 		
 		cachingBackend.initialize();
 		
-		ldcache = new LDCacheNG(this.config,cachingBackend);
+		ldcache = new LDCache(this.config,cachingBackend);
 	}
 	
 	@Override
@@ -102,14 +102,14 @@ public class GenericLinkedDataSail extends NotifyingSailWrapper {
 	
 	public void reinit() {
 		ldcache.shutdown();
-		ldcache = new LDCacheNG(this.config,cachingBackend);
+		ldcache = new LDCache(this.config,cachingBackend);
 	}
 	
 	public CacheConfiguration getCacheConfiguration() {
 		return config;
 	}
 
-    public LDCacheNG getLDCache() {
+    public LDCache getLDCache() {
         return ldcache;
     }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSailConnection.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSailConnection.java b/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSailConnection.java
index 3eb996a..3c56985 100644
--- a/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSailConnection.java
+++ b/libraries/ldcache/ldcache-sail-generic/src/main/java/org/apache/marmotta/ldcache/sail/GenericLinkedDataSailConnection.java
@@ -23,7 +23,7 @@ import info.aduna.iteration.UnionIteration;
 import org.apache.marmotta.commons.sesame.filter.AlwaysTrueFilter;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
 import org.apache.marmotta.commons.sesame.repository.ResourceUtils;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.openrdf.model.*;
 import org.openrdf.sail.NotifyingSailConnection;
 import org.openrdf.sail.SailException;
@@ -43,15 +43,15 @@ public class GenericLinkedDataSailConnection extends NotifyingSailConnectionWrap
 
     private static Logger log = LoggerFactory.getLogger(GenericLinkedDataSailConnection.class);
 
-    private final LDCacheNG ldcache;
+    private final LDCache ldcache;
     private final SesameFilter<Resource> acceptForCaching;
 
-    public GenericLinkedDataSailConnection(NotifyingSailConnection connection, LDCacheNG ldcache) {
+    public GenericLinkedDataSailConnection(NotifyingSailConnection connection, LDCache ldcache) {
         this(connection, ldcache, new AlwaysTrueFilter<Resource>());
     }
 
 
-    public GenericLinkedDataSailConnection(NotifyingSailConnection connection, LDCacheNG ldcache, SesameFilter<Resource> acceptForCaching) {
+    public GenericLinkedDataSailConnection(NotifyingSailConnection connection, LDCache ldcache, SesameFilter<Resource> acceptForCaching) {
         super(connection);
         this.ldcache = ldcache;
         this.acceptForCaching = acceptForCaching;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/GenericLinkedDataSailOfflineTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/GenericLinkedDataSailOfflineTest.java b/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/GenericLinkedDataSailOfflineTest.java
index 4bff0ac..0d4ef57 100644
--- a/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/GenericLinkedDataSailOfflineTest.java
+++ b/libraries/ldcache/ldcache-sail-generic/src/test/java/org/apache/marmotta/ldcache/sail/test/GenericLinkedDataSailOfflineTest.java
@@ -21,7 +21,7 @@ import info.aduna.iteration.Iterations;
 import org.apache.commons.io.FileUtils;
 import org.apache.marmotta.commons.sesame.filter.resource.ResourceFilter;
 import org.apache.marmotta.commons.sesame.filter.resource.UriPrefixFilter;
-import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackendNG;
+import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackend;
 import org.apache.marmotta.ldcache.sail.GenericLinkedDataSail;
 import org.apache.marmotta.ldcache.services.test.dummy.DummyEndpoint;
 import org.apache.marmotta.ldclient.model.ClientConfiguration;
@@ -60,7 +60,7 @@ public class GenericLinkedDataSailOfflineTest {
 
     private Repository repository;
 
-    private LDCachingFileBackendNG backend;
+    private LDCachingFileBackend backend;
 
     private GenericLinkedDataSail lsail;
 
@@ -76,7 +76,7 @@ public class GenericLinkedDataSailOfflineTest {
 
         tmpDirectory = Files.createTempDir();
 
-        backend = new LDCachingFileBackendNG(tmpDirectory);
+        backend = new LDCachingFileBackend(tmpDirectory);
         lsail = new GenericLinkedDataSail(new MemoryStore(),backend, cacheFilter, config);
         repository = new SailRepository(lsail);
         repository.initialize();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSail.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSail.java b/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSail.java
index a571234..70a0625 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSail.java
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSail.java
@@ -19,9 +19,9 @@ package org.apache.marmotta.ldcache.sail;
 
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.apache.marmotta.ldcache.backend.kiwi.LDCachingKiWiBackendNG;
+import org.apache.marmotta.ldcache.backend.kiwi.LDCachingKiWiBackend;
 import org.apache.marmotta.ldcache.model.CacheConfiguration;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.apache.marmotta.ldclient.model.ClientConfiguration;
 import org.openrdf.model.Resource;
 import org.openrdf.sail.NotifyingSail;
@@ -39,9 +39,9 @@ public class KiWiLinkedDataSail extends NotifyingSailWrapper {
 
     private KiWiStore store;
 
-    private LDCachingKiWiBackendNG backend;
+    private LDCachingKiWiBackend backend;
 
-    private LDCacheNG ldcache;
+    private LDCache ldcache;
 
     private SesameFilter<Resource> acceptor;
 
@@ -88,10 +88,10 @@ public class KiWiLinkedDataSail extends NotifyingSailWrapper {
     public void initialize() throws SailException {
         super.initialize();
 
-        backend = new LDCachingKiWiBackendNG(store, cache_context);
+        backend = new LDCachingKiWiBackend(store, cache_context);
         backend.initialize();
 
-        ldcache = new LDCacheNG(config,backend);
+        ldcache = new LDCache(config,backend);
 
     }
 
@@ -126,11 +126,11 @@ public class KiWiLinkedDataSail extends NotifyingSailWrapper {
         }
     }
 
-    public LDCachingKiWiBackendNG getBackend() {
+    public LDCachingKiWiBackend getBackend() {
         return backend;
     }
 
-    public LDCacheNG getLDCache() {
+    public LDCache getLDCache() {
         return ldcache;
     }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSailConnection.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSailConnection.java b/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSailConnection.java
index 36dae58..b483ad8 100644
--- a/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSailConnection.java
+++ b/libraries/ldcache/ldcache-sail-kiwi/src/main/java/org/apache/marmotta/ldcache/sail/KiWiLinkedDataSailConnection.java
@@ -19,7 +19,7 @@ package org.apache.marmotta.ldcache.sail;
 
 import info.aduna.iteration.CloseableIteration;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.openrdf.model.*;
 import org.openrdf.sail.NotifyingSailConnection;
 import org.openrdf.sail.SailException;
@@ -32,11 +32,11 @@ import org.openrdf.sail.helpers.NotifyingSailConnectionWrapper;
  */
 public class KiWiLinkedDataSailConnection extends NotifyingSailConnectionWrapper {
 
-    private LDCacheNG ldcache;
+    private LDCache ldcache;
 
     private SesameFilter<Resource> acceptor;
 
-    public KiWiLinkedDataSailConnection(NotifyingSailConnection wrappedCon, LDCacheNG ldcache, SesameFilter<Resource> acceptor) {
+    public KiWiLinkedDataSailConnection(NotifyingSailConnection wrappedCon, LDCache ldcache, SesameFilter<Resource> acceptor) {
         super(wrappedCon);
 
         this.ldcache = ldcache;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldpath/ldpath-backend-linkeddata/src/main/java/org/apache/marmotta/ldpath/backend/linkeddata/LDPersistentBackend.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-backend-linkeddata/src/main/java/org/apache/marmotta/ldpath/backend/linkeddata/LDPersistentBackend.java b/libraries/ldpath/ldpath-backend-linkeddata/src/main/java/org/apache/marmotta/ldpath/backend/linkeddata/LDPersistentBackend.java
index a7d2067..1e56703 100644
--- a/libraries/ldpath/ldpath-backend-linkeddata/src/main/java/org/apache/marmotta/ldpath/backend/linkeddata/LDPersistentBackend.java
+++ b/libraries/ldpath/ldpath-backend-linkeddata/src/main/java/org/apache/marmotta/ldpath/backend/linkeddata/LDPersistentBackend.java
@@ -19,7 +19,7 @@ package org.apache.marmotta.ldpath.backend.linkeddata;
 
 import org.apache.marmotta.commons.sesame.filter.AlwaysTrueFilter;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
-import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackendNG;
+import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackend;
 import org.apache.marmotta.ldcache.sail.GenericLinkedDataSail;
 import org.apache.marmotta.ldclient.model.ClientConfiguration;
 import org.apache.marmotta.ldpath.backend.sesame.SesameRepositoryBackend;
@@ -43,7 +43,7 @@ import java.io.IOException;
 public class LDPersistentBackend extends SesameRepositoryBackend {
     private static final Logger log = LoggerFactory.getLogger(LDPersistentBackend.class);
 
-    private LDCachingFileBackendNG backend;
+    private LDCachingFileBackend backend;
 
     private GenericLinkedDataSail sail;
 
@@ -72,7 +72,7 @@ public class LDPersistentBackend extends SesameRepositoryBackend {
         try {
             ClientConfiguration config = new ClientConfiguration();
 
-            backend = new LDCachingFileBackendNG(dataDirectory);
+            backend = new LDCachingFileBackend(dataDirectory);
             sail = new GenericLinkedDataSail(new MemoryStore(),backend, cacheFilter, config);
             Repository repository = new SailRepository(sail);
             repository.initialize();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/api/ldcache/LDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/api/ldcache/LDCacheSailProvider.java b/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/api/ldcache/LDCacheSailProvider.java
index f99a23e..9fac83d 100644
--- a/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/api/ldcache/LDCacheSailProvider.java
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/api/ldcache/LDCacheSailProvider.java
@@ -17,7 +17,7 @@
 
 package org.apache.marmotta.platform.ldcache.api.ldcache;
 
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
 import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
 import org.apache.marmotta.ldclient.model.ClientConfiguration;
@@ -155,7 +155,7 @@ public abstract class LDCacheSailProvider implements NotifyingSailProvider {
      * Return the caching backend used by the caching system (e.g. for debugging)
      * @return
      */
-    public abstract LDCacheNG getLDCache();
+    public abstract LDCache getLDCache();
 
     /**
      * Add a volatile (in-memory) endpoint to the LDClient configuration. Can be used by other services for auto-registering

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java b/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
index b71ac41..96daf10 100644
--- a/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
+++ b/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
@@ -20,9 +20,9 @@ import com.google.common.collect.Lists;
 import org.apache.marmotta.commons.sesame.filter.NotFilter;
 import org.apache.marmotta.commons.sesame.filter.OneOfFilter;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
-import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackendNG;
+import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackend;
 import org.apache.marmotta.ldcache.sail.GenericLinkedDataSail;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
 import org.apache.marmotta.platform.core.model.filter.MarmottaLocalFilter;
 import org.apache.marmotta.platform.ldcache.api.ldcache.LDCacheSailProvider;
@@ -51,7 +51,7 @@ public class FileLDCacheSailProvider extends LDCacheSailProvider {
 
     private static Logger log = LoggerFactory.getLogger(FileLDCacheSailProvider.class);
 
-    private LDCachingFileBackendNG backend;
+    private LDCachingFileBackend backend;
 
     private GenericLinkedDataSail sail;
 
@@ -87,7 +87,7 @@ public class FileLDCacheSailProvider extends LDCacheSailProvider {
         directory = new File(configurationService.getHome() + File.separator + "ldcache");
 
         try {
-            backend = new LDCachingFileBackendNG(directory);
+            backend = new LDCachingFileBackend(directory);
             sail = new GenericLinkedDataSail(parent, backend, new NotFilter<Resource>(cacheFilters), ldclientConfig);
             return sail;
         } catch (RepositoryException e) {
@@ -113,7 +113,7 @@ public class FileLDCacheSailProvider extends LDCacheSailProvider {
      * Return the caching backend used by the caching system (e.g. for debugging)
      * @return
      */
-    public LDCacheNG getLDCache() {
+    public LDCache getLDCache() {
         if(sail != null) {
             return sail.getLDCache();
         } else {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java b/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
index cb8f328..a285c66 100644
--- a/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
+++ b/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
@@ -22,7 +22,7 @@ import org.apache.marmotta.commons.sesame.filter.NotFilter;
 import org.apache.marmotta.commons.sesame.filter.OneOfFilter;
 import org.apache.marmotta.commons.sesame.filter.SesameFilter;
 import org.apache.marmotta.ldcache.sail.KiWiLinkedDataSail;
-import org.apache.marmotta.ldcache.services.LDCacheNG;
+import org.apache.marmotta.ldcache.services.LDCache;
 import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
 import org.apache.marmotta.platform.core.model.filter.MarmottaLocalFilter;
 import org.apache.marmotta.platform.ldcache.api.ldcache.LDCacheSailProvider;
@@ -95,7 +95,7 @@ public class KiWiLDCacheSailProvider extends LDCacheSailProvider {
      * Return the caching backend used by the caching system (e.g. for debugging)
      * @return
      */
-    public LDCacheNG getLDCache() {
+    public LDCache getLDCache() {
         if(sail != null) {
             return sail.getLDCache();
         } else {