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 2011/05/21 22:35:38 UTC
svn commit: r1125805 - in /incubator/jena/Experimental/TxTDB/trunk:
src-dev/tx/ src-dev/tx/base/ src-dev/tx/blockstream/
src/main/java/com/hp/hpl/jena/tdb/base/block/
src/main/java/com/hp/hpl/jena/tdb/base/file/
src/main/java/com/hp/hpl/jena/tdb/base/o...
Author: andy
Date: Sat May 21 20:35:37 2011
New Revision: 1125805
URL: http://svn.apache.org/viewvc?rev=1125805&view=rev
Log: (empty)
Added:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java (contents, props changed)
- copied, changed from r1125428, incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java (contents, props changed)
- copied, changed from r1125793, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/Channel.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java (contents, props changed)
- copied, changed from r1125747, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelFile.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java (contents, props changed)
- copied, changed from r1125747, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelMem.java
Removed:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileHandle.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/Channel.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelFile.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelMem.java
Modified:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntry.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryInputStream.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryOutputStream.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryStreamMem.java
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/TestJournalEntryStreams.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelFile.java
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelMem.java
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java Sat May 21 20:35:37 2011
@@ -7,7 +7,7 @@ public class DevTx
// Test with overlapping iterators.
- // Storage+Adler32
+ // Channel+Adler32
// Ref counting get/release.
Copied: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java (from r1125428, incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java?p2=incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java&p1=incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java&r1=1125428&r2=1125805&rev=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java Sat May 21 20:35:37 2011
@@ -6,35 +6,54 @@
package tx.base;
-public class FileRef
+final
+public class BlockRef
{
- private final String filename ;
+ private final FileRef file ;
private final int blockId ;
+
+ static public BlockRef create(FileRef file, int blockId) { return new BlockRef(file, blockId) ; }
+ static public BlockRef create(String file, int blockId) { return new BlockRef(file, blockId) ; }
- public FileRef(String filename, int blockId)
+ private BlockRef(String file, int blockId)
+ {
+ this(FileRef.create(file), blockId) ;
+ }
+
+ private BlockRef(FileRef file, int blockId)
{
- this.filename = filename ;
+ this.file = file ;
this.blockId = blockId ;
}
- public String getFilename() { return filename ; }
+ public FileRef getFile() { return file ; }
public int getBlockId() { return blockId ; }
@Override
public int hashCode()
{
- return filename.hashCode() ^ blockId ;
+ final int prime = 31 ;
+ int result = 1 ;
+ result = prime * result + blockId ;
+ result = prime * result + ((file == null) ? 0 : file.hashCode()) ;
+ return result ;
}
-
+
@Override
- public boolean equals(Object other)
+ public boolean equals(Object obj)
{
- if ( ! ( other instanceof FileRef ) )
- return false ;
- FileRef fRef = (FileRef)other ;
-
- return (blockId == fRef.blockId) && filename.equals(fRef.filename) ;
+ if (this == obj) return true ;
+ if (obj == null) return false ;
+ if (getClass() != obj.getClass()) return false ;
+ BlockRef other = (BlockRef)obj ;
+ if (blockId != other.blockId) return false ;
+ if (file == null)
+ {
+ if (other.file != null) return false ;
+ } else
+ if (!file.equals(other.file)) return false ;
+ return true ;
}
}
Propchange: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/BlockRef.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/base/FileRef.java Sat May 21 20:35:37 2011
@@ -6,36 +6,53 @@
package tx.base;
+final
public class FileRef
{
+ // Symbol<T> ?
private final String filename ;
- private final int blockId ;
- public FileRef(String filename, int blockId)
+ static public FileRef create(String symbolStr) { return new FileRef(symbolStr) ; }
+ static public FileRef create(FileRef other) { return new FileRef(other) ; }
+
+ private FileRef(String filename)
{
- this.filename = filename ;
- this.blockId = blockId ;
+ // Canonicalise filename.
+ if ( filename == null )
+ throw new IllegalArgumentException("Null for a FileRef filename") ;
+ this.filename = filename.intern() ;
}
- public String getFilename() { return filename ; }
-
- public int getBlockId() { return blockId ; }
-
+ private FileRef(FileRef other) { this.filename = other.filename ; }
+
+ public String getFilename() { return filename ; }
+
@Override
public int hashCode()
{
- return filename.hashCode() ^ blockId ;
+ final int prime = 37 ;
+ int result = 1 ;
+ result = prime * result + ((filename == null) ? 0 : filename.hashCode()) ;
+ return result ;
}
@Override
- public boolean equals(Object other)
+ public boolean equals(Object obj)
{
- if ( ! ( other instanceof FileRef ) )
- return false ;
- FileRef fRef = (FileRef)other ;
-
- return (blockId == fRef.blockId) && filename.equals(fRef.filename) ;
+ if (this == obj) return true ;
+ if (obj == null) return false ;
+ if (getClass() != obj.getClass()) return false ;
+ FileRef other = (FileRef)obj ;
+ if (filename == null)
+ {
+ if (other.filename != null) return false ;
+ } else
+ if (!filename.equals(other.filename)) return false ;
+ return true ;
}
+
+ @Override
+ public String toString() { return "file:"+filename ; }
}
/*
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntry.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntry.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntry.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntry.java Sat May 21 20:35:37 2011
@@ -8,24 +8,25 @@ package tx.blockstream;
import java.nio.ByteBuffer ;
-import tx.base.FileRef ;
+import tx.base.BlockRef ;
public class JournalEntry
{
-
+ public enum Type { Block, Object, Commit, Checkpoint }
+
private final int type ;
- private final FileRef fileReference ;
+ private final BlockRef fileReference ;
private final ByteBuffer byteBuffer ;
- public JournalEntry(int type, FileRef fileRef, ByteBuffer bytes)
+ public JournalEntry(int type, BlockRef blockRef, ByteBuffer bytes)
{
this.type = type ;
- this.fileReference = fileRef ;
+ this.fileReference = blockRef ;
this.byteBuffer = bytes ;
}
public int getType() { return type ; }
- public FileRef getFileRef() { return fileReference ; }
+ public BlockRef getFileRef() { return fileReference ; }
public ByteBuffer getByteBuffer() { return byteBuffer ; }
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryInputStream.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryInputStream.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryInputStream.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryInputStream.java Sat May 21 20:35:37 2011
@@ -10,7 +10,7 @@ import java.io.InputStream ;
import java.nio.ByteBuffer ;
import org.openjena.atlas.io.IO ;
-import tx.base.FileRef ;
+import tx.base.BlockRef ;
public class JournalEntryInputStream implements JournalEntryInput
{
@@ -28,7 +28,7 @@ public class JournalEntryInputStream imp
if ( type == -1 )
return null ;
- FileRef fRef = readFileRef() ;
+ BlockRef fRef = readFileRef() ;
if ( fRef == null )
return null ;
@@ -45,7 +45,7 @@ public class JournalEntryInputStream imp
IO.close(in) ;
}
- private FileRef readFileRef()
+ private BlockRef readFileRef()
{
String fn = IOBytes.readStr(in) ;
if ( fn == null )
@@ -53,7 +53,7 @@ public class JournalEntryInputStream imp
int blockId = IOBytes.readInt(in) ;
if ( blockId == -1 )
return null ;
- return new FileRef(fn, blockId) ;
+ return BlockRef.create(fn, blockId) ;
}
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryOutputStream.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryOutputStream.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryOutputStream.java Sat May 21 20:35:37 2011
@@ -11,7 +11,7 @@ import java.io.IOException ;
import java.io.OutputStream ;
import org.openjena.atlas.io.IO ;
-import tx.base.FileRef ;
+import tx.base.BlockRef ;
public class JournalEntryOutputStream implements JournalEntryOutput
{
@@ -30,10 +30,10 @@ public class JournalEntryOutputStream im
IOBytes.writeBytes(out, entry.getByteBuffer().array()) ;
}
- private void writeFileRef(FileRef fileRef)
+ private void writeFileRef(BlockRef blockRef)
{
- IOBytes.writeStr(out, fileRef.getFilename()) ;
- IOBytes.writeInt(out, fileRef.getBlockId()) ;
+ IOBytes.writeStr(out, blockRef.getFile().getFilename()) ;
+ IOBytes.writeInt(out, blockRef.getBlockId()) ;
}
@Override
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryStreamMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryStreamMem.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryStreamMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/JournalEntryStreamMem.java Sat May 21 20:35:37 2011
@@ -11,7 +11,6 @@ import java.util.ArrayList ;
import java.util.List ;
import org.openjena.atlas.lib.ByteBufferLib ;
-import tx.base.FileRef ;
import com.hp.hpl.jena.tdb.TDBException ;
@@ -30,15 +29,10 @@ public class JournalEntryStreamMem
private static JournalEntry deepCopy(JournalEntry entry)
{
ByteBuffer bb = ByteBufferLib.duplicate(entry.getByteBuffer()) ;
- FileRef rf = copy(entry.getFileRef()) ;
- return new JournalEntry(entry.getType(), rf, bb) ;
+ // Filerefs are value-types.
+ return new JournalEntry(entry.getType(), entry.getFileRef(), bb) ;
}
- private static FileRef copy(FileRef fileRef)
- {
- return new FileRef(fileRef.getFilename(), fileRef.getBlockId()) ;
- }
-
public static class Input implements JournalEntryInput
{
private final List<JournalEntry> entries ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/TestJournalEntryStreams.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/TestJournalEntryStreams.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/TestJournalEntryStreams.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/blockstream/TestJournalEntryStreams.java Sat May 21 20:35:37 2011
@@ -15,7 +15,7 @@ import org.junit.Test ;
import org.openjena.atlas.junit.BaseTest ;
import org.openjena.atlas.lib.Bytes ;
import org.openjena.atlas.lib.Lib ;
-import tx.base.FileRef ;
+import tx.base.BlockRef ;
public class TestJournalEntryStreams extends BaseTest
{
@@ -24,11 +24,11 @@ public class TestJournalEntryStreams ext
static ByteBuffer bb2 = ByteBuffer.allocate(4) ;
static ByteBuffer bb3 = ByteBuffer.allocate(4) ;
- static FileRef fileref1 = new FileRef("xyz", 10) ;
- static FileRef fileref2 = new FileRef("xyz", 10) ;
+ static BlockRef fileref1 = BlockRef.create("xyz", 10) ;
+ static BlockRef fileref2 = BlockRef.create("xyz", 10) ;
- static FileRef fileref3 = new FileRef("xyz", 20) ;
- static FileRef fileref4 = new FileRef("abc", 10) ;
+ static BlockRef fileref3 = BlockRef.create("xyz", 20) ;
+ static BlockRef fileref4 = BlockRef.create("abc", 10) ;
static JournalEntry je1 = new JournalEntry(10, fileref1, bb1) ;
static JournalEntry je2 = new JournalEntry(10, fileref2, bb2) ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java Sat May 21 20:35:37 2011
@@ -8,7 +8,7 @@ package com.hp.hpl.jena.tdb.base.block;
import java.nio.ByteBuffer ;
-import tx.base.FileRef ;
+import tx.base.BlockRef ;
import com.hp.hpl.jena.tdb.base.page.Page ;
@@ -16,7 +16,7 @@ public final class Block
{
private final Integer id ; // Keep as object. It's the cache key.
private final boolean readOnly ;
- private final FileRef fileRef ;
+ private final BlockRef blockRef ;
private boolean modified = false ;
private final ByteBuffer byteBuffer ;
@@ -28,7 +28,7 @@ public final class Block
this.id = id ;
this.byteBuffer = byteBuffer ;
//this.type = BlockType.UNDEF ;
- this.fileRef = null ;
+ this.blockRef = null ;
this.readOnly = false ;
// Initially a block is not modified.
this.modified = false ;
@@ -70,9 +70,9 @@ public final class Block
this.modified = modified ;
}
- public FileRef getFileRef()
+ public BlockRef getFileRef()
{
- return fileRef ;
+ return blockRef ;
}
// public void setType(BlockType blockType)
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java Sat May 21 20:35:37 2011
@@ -13,6 +13,8 @@ import com.hp.hpl.jena.tdb.base.block.Bl
/** Interface to concrete storage.
* This is wrapped in a BlockMgrAccess to provide a higher level abstraction.
+ * BufferChannels are a separate lower-level, interface to storage.
+ * @see BufferChannel
*/
public interface BlockAccess extends Sync, Closeable
{
Copied: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java (from r1125793, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/Channel.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/Channel.java&r1=1125793&r2=1125805&rev=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/Channel.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java Sat May 21 20:35:37 2011
@@ -13,10 +13,10 @@ import org.openjena.atlas.lib.Sync ;
/** Interface to storage : a simplified version of FileChannel.
- * This also enables use to implement memory-bcked versions.
+ * This also enables use to implement memory-backed versions.
* @see BlockAccess
*/
-public interface Channel extends Sync, Closeable
+public interface BufferChannel extends Sync, Closeable
{
// This is a simple, low level "file = array of bytes" interface"
// This interface does not support slicing - so it's not suitable for memory mapped I/O
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java (from r1125747, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelFile.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelFile.java&r1=1125747&r2=1125805&rev=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelFile.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java Sat May 21 20:35:37 2011
@@ -12,11 +12,11 @@ import java.nio.ByteBuffer ;
import org.openjena.atlas.io.IO ;
-public class ChannelFile implements Channel
+public class BufferChannelFile implements BufferChannel
{
private FileBase file ;
- public ChannelFile(String filename)
+ public BufferChannelFile(String filename)
{
file = new FileBase(filename) ;
}
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java (from r1125747, incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelMem.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java?p2=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java&p1=incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelMem.java&r1=1125747&r2=1125805&rev=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/ChannelMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java Sat May 21 20:35:37 2011
@@ -10,7 +10,7 @@ import java.nio.ByteBuffer ;
import com.hp.hpl.jena.tdb.base.StorageException ;
-public class ChannelMem implements Channel
+public class BufferChannelMem implements BufferChannel
{
private ByteBuffer bytes ; // Position is our file position.
private long length ; // Bytes in use: 0 to length-1
@@ -18,7 +18,7 @@ public class ChannelMem implements Chann
private static int INIT_SIZE = 1024 ;
private static int INC_SIZE = 1024 ;
- public ChannelMem(String name)
+ public BufferChannelMem(String name)
{
bytes = ByteBuffer.allocate(1024) ;
length = 0 ;
Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannelMem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java Sat May 21 20:35:37 2011
@@ -22,7 +22,7 @@ public class FileFactory
public static ObjectFile createObjectFileDisk(String filename)
{
- Channel file = new ChannelFile(filename) ;
+ BufferChannel file = new BufferChannelFile(filename) ;
return new ObjectFileStorage(file) ;
}
@@ -34,7 +34,7 @@ public class FileFactory
else
{
// Newer way.
- Channel file = new ChannelMem("mem") ;
+ BufferChannel file = new BufferChannelMem("mem") ;
return new ObjectFileStorage(file) ;
}
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java Sat May 21 20:35:37 2011
@@ -15,7 +15,7 @@ import java.util.Iterator ;
import org.openjena.atlas.lib.Bytes ;
import org.openjena.atlas.lib.Pair ;
-import com.hp.hpl.jena.tdb.base.file.Channel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
import com.hp.hpl.jena.tdb.base.file.FileException ;
/** Variable length ByteBuffer file on disk.
@@ -44,7 +44,7 @@ public class ObjectFileStorage implement
private final ByteBuffer writeBuffer ;
private int bufferSize ;
- private final Channel file ; // Access to storage
+ private final BufferChannel file ; // Access to storage
private long filesize ; // Size of on-disk.
// Two-step write - alloc, write
@@ -52,12 +52,12 @@ public class ObjectFileStorage implement
private ByteBuffer allocByteBuffer = null ;
private long allocLocation = -1 ;
- public ObjectFileStorage(Channel file)
+ public ObjectFileStorage(BufferChannel file)
{
this(file, ObjectFileWriteCacheSize) ;
}
- public ObjectFileStorage(Channel file, int bufferSize)
+ public ObjectFileStorage(BufferChannel file, int bufferSize)
{
this.file = file ;
this.bufferSize = bufferSize ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/AbstractTestChannel.java Sat May 21 20:35:37 2011
@@ -8,19 +8,19 @@ package com.hp.hpl.jena.tdb.base.file;
import java.nio.ByteBuffer ;
-import com.hp.hpl.jena.tdb.base.file.Channel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
import org.junit.Test ;
import org.openjena.atlas.junit.BaseTest ;
public abstract class AbstractTestChannel extends BaseTest
{
- protected abstract Channel make() ;
+ protected abstract BufferChannel make() ;
static final int blkSize = 100 ;
@Test public void storage_01()
{
- Channel store = make() ;
+ BufferChannel store = make() ;
assertEquals(0, store.length()) ;
}
@@ -46,7 +46,7 @@ public abstract class AbstractTestChanne
@Test public void storage_02()
{
- Channel store = make() ;
+ BufferChannel store = make() ;
ByteBuffer b = data(blkSize) ;
store.write(b) ;
long x = store.length() ;
@@ -55,7 +55,7 @@ public abstract class AbstractTestChanne
@Test public void storage_03()
{
- Channel store = make() ;
+ BufferChannel store = make() ;
ByteBuffer b1 = data(blkSize) ;
long posn = store.position() ;
store.write(b1) ;
@@ -67,7 +67,7 @@ public abstract class AbstractTestChanne
@Test public void storage_04()
{
- Channel store = make() ;
+ BufferChannel store = make() ;
ByteBuffer b1 = data(blkSize) ;
ByteBuffer b2 = data(blkSize/2) ;
@@ -82,7 +82,7 @@ public abstract class AbstractTestChanne
@Test public void storage_05()
{
- Channel store = make() ;
+ BufferChannel store = make() ;
ByteBuffer b1 = data(blkSize) ;
ByteBuffer b1a = ByteBuffer.allocate(blkSize) ;
ByteBuffer b2 = data(blkSize/2) ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelFile.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelFile.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelFile.java Sat May 21 20:35:37 2011
@@ -10,8 +10,8 @@ import org.junit.AfterClass ;
import org.openjena.atlas.lib.FileOps ;
import com.hp.hpl.jena.tdb.ConfigTest ;
-import com.hp.hpl.jena.tdb.base.file.Channel ;
-import com.hp.hpl.jena.tdb.base.file.ChannelFile ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;
public class TestChannelFile extends AbstractTestChannel
{
@@ -20,10 +20,10 @@ public class TestChannelFile extends Abs
@AfterClass public static void cleanup() { FileOps.deleteSilent(filename) ; }
@Override
- protected Channel make()
+ protected BufferChannel make()
{
FileOps.deleteSilent(filename) ;
- return new ChannelFile(filename) ;
+ return new BufferChannelFile(filename) ;
}
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelMem.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelMem.java?rev=1125805&r1=1125804&r2=1125805&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelMem.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/file/TestChannelMem.java Sat May 21 20:35:37 2011
@@ -6,8 +6,8 @@
package com.hp.hpl.jena.tdb.base.file;
-import com.hp.hpl.jena.tdb.base.file.Channel ;
-import com.hp.hpl.jena.tdb.base.file.ChannelMem ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannelMem ;
public class TestChannelMem extends AbstractTestChannel
@@ -15,9 +15,9 @@ public class TestChannelMem extends Abst
static int counter = 0 ;
@Override
- protected Channel make()
+ protected BufferChannel make()
{
- return new ChannelMem("Test-"+(counter++)) ;
+ return new BufferChannelMem("Test-"+(counter++)) ;
}
}