clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1458440 - in /clerezza/trunk/rdf.jena.tdb.storage/src: main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java
Date Tue, 19 Mar 2013 18:13:16 GMT
Author: reto
Date: Tue Mar 19 18:13:15 2013
New Revision: 1458440

URL: http://svn.apache.org/r1458440
Log:
CLEREZZA-749: 
- reverted change breaking java 6 compatibility
- changes storage mode so files can be deleted on windows

Modified:
    clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
    clerezza/trunk/rdf.jena.tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java

Modified: clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java?rev=1458440&r1=1458439&r2=1458440&view=diff
==============================================================================
--- clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
(original)
+++ clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProvider.java
Tue Mar 19 18:13:15 2013
@@ -22,17 +22,17 @@ import com.hp.hpl.jena.query.Dataset;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.tdb.TDB;
 import com.hp.hpl.jena.tdb.TDBFactory;
+import com.hp.hpl.jena.tdb.base.block.FileMode;
+import com.hp.hpl.jena.tdb.sys.SystemTDB;
 import java.io.File;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
-import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -71,6 +71,12 @@ import org.apache.felix.scr.annotations.
 @Property(name="weight", intValue=105)
 public class TdbTcProvider implements WeightedTcProvider {
 
+    static {
+        //not sure what the perfomance implication of this is
+        //it is only needed so that on windows the files of a dataset can be deleteds
+        SystemTDB.setFileMode(FileMode.direct);
+    }
+    
     @Property(intValue=6, description="Specifies the number of seconds to wait "
     + "between synchronizations of the TDB datasets to the filesystem")
     public static final String SYNC_INTERVAL = "sync-interval";
@@ -228,6 +234,7 @@ public class TdbTcProvider implements We
     public void deleteTripleCollection(UriRef name)
             throws UnsupportedOperationException, NoSuchEntityException,
             EntityUndeletableException {
+        syncWithFileSystem();
         if (deleteTcDir(getGraphDir(name))) {
             graphMap.remove(name);
             return;
@@ -278,7 +285,11 @@ public class TdbTcProvider implements We
         if (file.isDirectory()) {
             cleanDirectory(file);
         }
-        Files.delete(file.toPath());
+        //better but only in java 7
+        //Files.delete(file.toPath());
+        if (!file.delete()) {
+            throw new IOException("couldn't delete "+file.getAbsolutePath());
+        }
     }
 
     @Override

Modified: clerezza/trunk/rdf.jena.tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.jena.tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java?rev=1458440&r1=1458439&r2=1458440&view=diff
==============================================================================
--- clerezza/trunk/rdf.jena.tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java
(original)
+++ clerezza/trunk/rdf.jena.tdb.storage/src/test/java/org/apache/clerezza/rdf/jena/tdb/storage/TdbTcProviderTest.java
Tue Mar 19 18:13:15 2013
@@ -22,8 +22,6 @@ import java.io.File;
 import java.io.IOException;
 
 
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import org.junit.After;
 import org.junit.Before;
 import org.apache.clerezza.rdf.core.access.TcProvider;
@@ -47,7 +45,8 @@ public class TdbTcProviderTest extends T
 
     @After
     public void cleanUp() throws IOException {
-        TdbTcProvider.delete(tempFile);
+        //as TDB tends to keep files open this causes troubles on windows
+        //TdbTcProvider.delete(tempFile);
     }
 
 



Mime
View raw message