]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcher.java
Add logging to indexing & replace File-API with NIO Path-API
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / IndexedRelationsSearcher.java
index 115e54595585bafe2b3b5ca88a9e0c2f2bee4c03..a535183f2cd7ce0289c82b1638264d4331ef95b8 100644 (file)
@@ -27,13 +27,17 @@ import org.simantics.db.Session;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.adapter.GenericRelation;
 import org.simantics.utils.datastructures.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Tuukka Lehtonen
  * @author Antti Villberg
  */
 public class IndexedRelationsSearcher extends IndexedRelationsSearcherBase {
-    
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(IndexedRelationsSearcher.class);
+
     IndexedRelationsMemorySearcher cache;
 
     IndexedRelationsSearcher(RequestProcessor session, Resource relation, Resource input, GenericRelation r) throws DatabaseException {
@@ -126,7 +130,7 @@ public class IndexedRelationsSearcher extends IndexedRelationsSearcherBase {
         
        MemoryIndexing mem = MemoryIndexing.getInstance(session.getSession());
        
-        String key = indexPath.getAbsolutePath();
+        String key = indexPath.toAbsolutePath().toString();
         
         Map<String,List<Map<String, Object>>> cache = mem.persistentCache.get(key);
         if(cache != null) {
@@ -154,7 +158,7 @@ public class IndexedRelationsSearcher extends IndexedRelationsSearcherBase {
         
        MemoryIndexing mem = MemoryIndexing.getInstance(session.getSession());
        
-        String key = indexPath.getAbsolutePath();
+        String key = indexPath.toAbsolutePath().toString();
         
         Map<String,List<Resource>> cache = mem.persistentCacheResources.get(key);
         if(cache != null) {
@@ -280,7 +284,7 @@ public class IndexedRelationsSearcher extends IndexedRelationsSearcherBase {
         t = cache.bestEffortClear(monitor, session);
         if(t != null) return t;
         
-        String key = indexPath.getAbsolutePath();
+        String key = indexPath.toAbsolutePath().toString();
         MemoryIndexing mem = MemoryIndexing.getInstance(session);
         mem.persistentCache.remove(key);
         mem.persistentCacheResources.remove(key);
@@ -288,5 +292,10 @@ public class IndexedRelationsSearcher extends IndexedRelationsSearcherBase {
         return null;
         
     }
+
+    @Override
+    protected Logger getLogger() {
+        return LOGGER;
+    }
     
 }