You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/10/16 15:16:54 UTC

svn commit: r1532756 - in /jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb: StoreConnection.java base/file/Location.java

Author: andy
Date: Wed Oct 16 13:16:54 2013
New Revision: 1532756

URL: http://svn.apache.org/r1532756
Log:
Fix handling of memory locations

Modified:
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/Location.java

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java?rev=1532756&r1=1532755&r2=1532756&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java Wed Oct 16 13:16:54 2013
@@ -31,13 +31,12 @@ import com.hp.hpl.jena.tdb.setup.Dataset
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.transaction.* ;
 
-/** Interface to the TDB transaction mechanism. */
+/** A StoreConnection is the reference to the underlying storage.
+ *  There is JVM-wide cache of backing datasets.
+ *  The work of transaction coordination is done in TransactionManager.
+ */
 public class StoreConnection
 {
-    // A StoreConnection is the reference to the underlying storage.
-    // There is cache of backing datasets, managed by statics.
-    // The work of transaction coordination is done in TransactionManager.
-
     private final TransactionManager transactionManager ;
     private final DatasetGraphTDB    baseDSG ;
     private boolean                  isValid = true ;

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/Location.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/Location.java?rev=1532756&r1=1532755&r2=1532756&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/Location.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/Location.java Wed Oct 16 13:16:54 2013
@@ -125,12 +125,18 @@ public class Location {
 
     public Location getSubLocation(String dirname) {
         String newName = pathname + dirname ;
+        if ( isMem() ) {
+            if ( isMemUnique )
+                return mem() ;
+            else
+                return mem(newName) ;
+        }   
+
         File file = new File(newName) ;
         if ( file.exists() && !file.isDirectory() )
             throw new FileException("Existing file: " + file.getAbsolutePath()) ;
         if ( !file.exists() )
             file.mkdir() ;
-
         return new Location(newName) ;
     }
 
@@ -160,6 +166,8 @@ public class Location {
 
     /** Does the location exist (and it a directory, and is accessible) */
     public boolean exists() {
+        if ( isMem() )
+            return true ;
         File f = new File(getDirectoryPath()) ;
         return f.exists() && f.isDirectory() && f.canRead() ;
     }
@@ -169,6 +177,8 @@ public class Location {
     }
 
     public boolean exists(String filename, String ext) {
+        if ( isMem() )
+            return true ;
         String fn = getPath(filename, ext) ;
         File f = new File(fn) ;
         return f.exists() ;