org.apache.jackrabbit.core.persistence.bundle.util
Class ItemStateBinding

java.lang.Object
  extended by org.apache.jackrabbit.core.persistence.bundle.util.ItemStateBinding
Direct Known Subclasses:
BundleBinding

public class ItemStateBinding
extends Object

This Class implements relatively efficient serialization methods for item states.


Field Summary
protected  BLOBStore blobStore
          the blob store
protected  DataStore dataStore
          Data store for binary properties.
protected  ErrorHandling errorHandling
          the error handling
protected  long minBlobSize
          minimum size of binaries to store in blob store
protected  StringIndex nameIndex
          the name index
protected  StringIndex nsIndex
          the namespace index
static int VERSION_1
          serialization version 1
static int VERSION_2
          serialization version 2
static int VERSION_CURRENT
          current version
 
Constructor Summary
ItemStateBinding(ErrorHandling errorHandling, BLOBStore blobStore, StringIndex nsIndex, StringIndex nameIndex, DataStore dataStore)
          Creates a new item state binding
 
Method Summary
 BLOBStore getBlobStore()
          Returns the blob store that is assosiated with this binding.
 long getMinBlobSize()
          Returns the minimum blob size
 NodeId readID(DataInputStream in)
          Deserializes a NodeID
 Name readIndexedQName(DataInputStream in)
          Deserializes an indexed Name
 short readModCount(DataInputStream in)
          Deserializes a mod-count
 PropertyId readPropertyId(DataInputStream in)
          Deserializes a PropertyId
 Name readQName(DataInputStream in)
          Deserializes a Name
 NodeState readState(DataInputStream in, NodeId id, PersistenceManager pMgr)
          Deserializes a NodeState from the data input stream.
 NodeReferences readState(DataInputStream in, NodeReferencesId id, PersistenceManager pMgr)
          Deserializes a NodeReferences from the data input stream.
 UUID readUUID(DataInputStream in)
          Deserializes a UUID
 void setMinBlobSize(long minBlobSize)
          Sets the minimum blob size.
 void writeID(DataOutputStream out, NodeId id)
          Serializes a node id
 void writeIndexedQName(DataOutputStream out, Name name)
          Serializes a indexed Name
 void writeModCount(DataOutputStream out, short modCount)
          Sersializes a mod-count
 void writePropertyId(DataOutputStream out, PropertyId id)
          Serializes a PropertyId
 void writeQName(DataOutputStream out, Name name)
          Serializes a Name
 void writeState(DataOutputStream out, NodeReferences state)
          Serializes a NodeReferences to the data output stream.
 void writeState(DataOutputStream out, NodeState state)
          Serializes a NodeState to the data output stream
 void writeUUID(DataOutputStream out, String uuid)
          Serializes a UUID
 void writeUUID(DataOutputStream out, UUID uuid)
          Serializes a UUID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_1

public static final int VERSION_1
serialization version 1

See Also:
Constant Field Values

VERSION_2

public static final int VERSION_2
serialization version 2

See Also:
Constant Field Values

VERSION_CURRENT

public static final int VERSION_CURRENT
current version

See Also:
Constant Field Values

nsIndex

protected final StringIndex nsIndex
the namespace index


nameIndex

protected final StringIndex nameIndex
the name index


blobStore

protected final BLOBStore blobStore
the blob store


minBlobSize

protected long minBlobSize
minimum size of binaries to store in blob store


errorHandling

protected final ErrorHandling errorHandling
the error handling


dataStore

protected final DataStore dataStore
Data store for binary properties.

Constructor Detail

ItemStateBinding

public ItemStateBinding(ErrorHandling errorHandling,
                        BLOBStore blobStore,
                        StringIndex nsIndex,
                        StringIndex nameIndex,
                        DataStore dataStore)
Creates a new item state binding

Parameters:
errorHandling - the error handing configuration
blobStore - the blobstore
nsIndex - the namespace index
nameIndex - the name index
dataStore - the data store
Method Detail

getMinBlobSize

public long getMinBlobSize()
Returns the minimum blob size

Returns:
the minimum blob size
See Also:
for details.

setMinBlobSize

public void setMinBlobSize(long minBlobSize)
Sets the minimum blob size. Binary values that are shorted than this given size will be inlined in the serialization stream, binary value that are longer, will be stored in the blob store. default is 4k.

Parameters:
minBlobSize - the minimum blob size.

getBlobStore

public BLOBStore getBlobStore()
Returns the blob store that is assosiated with this binding.

Returns:
the blob store

readState

public NodeReferences readState(DataInputStream in,
                                NodeReferencesId id,
                                PersistenceManager pMgr)
                         throws IOException
Deserializes a NodeReferences from the data input stream.

Parameters:
in - the input stream
id - the id of the nodereference to deserialize
pMgr - the persistence manager
Returns:
the node references
Throws:
IOException - in an I/O error occurs.

writeState

public void writeState(DataOutputStream out,
                       NodeReferences state)
                throws IOException
Serializes a NodeReferences to the data output stream.

Parameters:
out - the output stream
state - the state to write.
Throws:
IOException - in an I/O error occurs.

readState

public NodeState readState(DataInputStream in,
                           NodeId id,
                           PersistenceManager pMgr)
                    throws IOException
Deserializes a NodeState from the data input stream.

Parameters:
in - the input streaam
id - the id of the nodestate to read
pMgr - the persistence manager
Returns:
the node state
Throws:
IOException - in an I/O error occurs.

writeState

public void writeState(DataOutputStream out,
                       NodeState state)
                throws IOException
Serializes a NodeState to the data output stream

Parameters:
out - the output stream
state - the state to write
Throws:
IOException - in an I/O error occurs.

readUUID

public UUID readUUID(DataInputStream in)
              throws IOException
Deserializes a UUID

Parameters:
in - the input stream
Returns:
the uuid
Throws:
IOException - in an I/O error occurs.

writeUUID

public void writeUUID(DataOutputStream out,
                      String uuid)
               throws IOException
Serializes a UUID

Parameters:
out - the output stream
uuid - the uuid
Throws:
IOException - in an I/O error occurs.

readID

public NodeId readID(DataInputStream in)
              throws IOException
Deserializes a NodeID

Parameters:
in - the input stream
Returns:
the uuid
Throws:
IOException - in an I/O error occurs.

writeID

public void writeID(DataOutputStream out,
                    NodeId id)
             throws IOException
Serializes a node id

Parameters:
out - the output stream
id - the id
Throws:
IOException - in an I/O error occurs.

writeUUID

public void writeUUID(DataOutputStream out,
                      UUID uuid)
               throws IOException
Serializes a UUID

Parameters:
out - the output stream
uuid - the uuid
Throws:
IOException - in an I/O error occurs.

readQName

public Name readQName(DataInputStream in)
               throws IOException
Deserializes a Name

Parameters:
in - the input stream
Returns:
the qname
Throws:
IOException - in an I/O error occurs.

readModCount

public short readModCount(DataInputStream in)
                   throws IOException
Deserializes a mod-count

Parameters:
in - the input stream
Returns:
the mod count
Throws:
IOException - in an I/O error occurs.

writeModCount

public void writeModCount(DataOutputStream out,
                          short modCount)
                   throws IOException
Sersializes a mod-count

Parameters:
out - the output stream
modCount - the mod count
Throws:
IOException - in an I/O error occurs.

writeQName

public void writeQName(DataOutputStream out,
                       Name name)
                throws IOException
Serializes a Name

Parameters:
out - the output stream
name - the name
Throws:
IOException - in an I/O error occurs.

readIndexedQName

public Name readIndexedQName(DataInputStream in)
                      throws IOException
Deserializes an indexed Name

Parameters:
in - the input stream
Returns:
the qname
Throws:
IOException - in an I/O error occurs.

writeIndexedQName

public void writeIndexedQName(DataOutputStream out,
                              Name name)
                       throws IOException
Serializes a indexed Name

Parameters:
out - the output stream
name - the name
Throws:
IOException - in an I/O error occurs.

writePropertyId

public void writePropertyId(DataOutputStream out,
                            PropertyId id)
                     throws IOException
Serializes a PropertyId

Parameters:
out - the output stream
id - the id
Throws:
IOException - in an I/O error occurs.

readPropertyId

public PropertyId readPropertyId(DataInputStream in)
                          throws IOException
Deserializes a PropertyId

Parameters:
in - the input stream
Returns:
the property id
Throws:
IOException - in an I/O error occurs.


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.