com.bigdata.rawstore
Class AbstractRawStore

java.lang.Object
  extended by com.bigdata.rawstore.AbstractRawStore
All Implemented Interfaces:
IAddressManager, IRawStore, IStoreSerializer
Direct Known Subclasses:
AbstractRawWormStore, IndexSegmentStore

public abstract class AbstractRawStore
extends Object
implements IRawStore, IStoreSerializer

Abstract base class for IRawStore implementations. This class uses a delegation pattern for the IStoreSerializer interface and does not implement either the methods defined directly by the IRawStore interface nor the methods of the IAddressManager interface. As such it may be used as an abstract base class by any IRawStore implementation.

Version:
$Id: AbstractRawStore.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected  IStoreSerializer serializer
          The object that handles serialization.
 
Fields inherited from interface com.bigdata.rawstore.IAddressManager
NULL
 
Constructor Summary
AbstractRawStore()
          The designated constructor.
 
Method Summary
 Object deserialize(byte[] b)
          De-serialize an object using the Java serialization mechanisms.
 Object deserialize(byte[] b, int off, int len)
          De-serialize an object using the Java serialization mechanisms.
 Object deserialize(ByteBuffer buf)
          De-serialize an object using the Java serialization mechanisms.
abstract  IAddressManager getAddressManager()
          Return the delegate object that provides the IAddressManager implementation for this IRawStore.
 byte[] serialize(Object obj)
          Serialize an object using the Java serialization mechanisms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.rawstore.IRawStore
close, deleteResources, destroy, force, getCounters, getFile, getResourceMetadata, getUUID, isFullyBuffered, isOpen, isReadOnly, isStable, read, size, write
 
Methods inherited from interface com.bigdata.rawstore.IAddressManager
getByteCount, getOffset, packAddr, toAddr, toString, unpackAddr
 

Field Detail

serializer

protected final IStoreSerializer serializer
The object that handles serialization.

Constructor Detail

AbstractRawStore

public AbstractRawStore()
The designated constructor.

Method Detail

getAddressManager

public abstract IAddressManager getAddressManager()
Return the delegate object that provides the IAddressManager implementation for this IRawStore.

Note: LRUNexus depends on the delegation model to retain references to the IAddressManager without causing the IRawStore to be retained. It uses the IAddressManager to decode the address in order to track the bytesOnDisk for the buffered records.


deserialize

public final Object deserialize(byte[] b,
                                int off,
                                int len)
Description copied from interface: IStoreSerializer
De-serialize an object using the Java serialization mechanisms.

Specified by:
deserialize in interface IStoreSerializer
Parameters:
b - A byte[] containing a serialized object.
off - The offset of the first byte to de-serialize.
len - The #of bytes in the object record.
Returns:
The de-serialized object.

deserialize

public final Object deserialize(byte[] b)
Description copied from interface: IStoreSerializer
De-serialize an object using the Java serialization mechanisms.

Specified by:
deserialize in interface IStoreSerializer
Parameters:
b - A byte[] containing a serialized object.
Returns:
The de-serialized object.

deserialize

public final Object deserialize(ByteBuffer buf)
Description copied from interface: IStoreSerializer
De-serialize an object using the Java serialization mechanisms.

Specified by:
deserialize in interface IStoreSerializer
Parameters:
buf - A buffer containing a serialized object. The bytes from Buffer.position() to Buffer.limit() will be de-serialized and the position will be advanced to the limit.
Returns:
The de-serialized object.

serialize

public final byte[] serialize(Object obj)
Description copied from interface: IStoreSerializer
Serialize an object using the Java serialization mechanisms.

Specified by:
serialize in interface IStoreSerializer
Parameters:
obj - A Serializable object.
Returns:
The serialized object state.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.