com.sleepycat.je.dbi
Class DatabaseId

java.lang.Object
  extended by com.sleepycat.je.dbi.DatabaseId
All Implemented Interfaces:
LogReadable, LogWritable, Comparable

public class DatabaseId
extends Object
implements Comparable, LogWritable, LogReadable

DatabaseImpl Ids are wrapped in a class so they can be logged.


Constructor Summary
DatabaseId()
          Uninitialized database id, for logging.
DatabaseId(int id)
           
 
Method Summary
 int compareTo(Object o)
          see Comparable#compareTo
 void dumpLog(StringBuffer sb, boolean verbose)
          Write the object into the string buffer for log dumping.
 boolean equals(Object obj)
          Compare two DatabaseImpl Id's.
 byte[] getBytes()
           
 int getId()
           
 int getLogSize()
           
 long getTransactionId()
           
 int hashCode()
           
 boolean logEntryIsTransactional()
           
 void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
 String toString()
           
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatabaseId

public DatabaseId(int id)

DatabaseId

public DatabaseId()
Uninitialized database id, for logging.

Method Detail

getId

public int getId()
Returns:
id value

getBytes

public byte[] getBytes()
                throws DatabaseException
Returns:
id as bytes, for use as a key
Throws:
DatabaseException

equals

public boolean equals(Object obj)
Compare two DatabaseImpl Id's.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
see Comparable#compareTo

Specified by:
compareTo in interface Comparable

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface LogWritable
Returns:
number of bytes used to store this object.
See Also:
LogWritable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer logBuffer)
Description copied from interface: LogWritable
Serialize this object into the buffer.

Specified by:
writeToLog in interface LogWritable
Parameters:
logBuffer - is the destination buffer
See Also:
LogWritable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        byte entryTypeVersion)
Description copied from interface: LogReadable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface LogReadable
See Also:
LogReadable.readFromLog(java.nio.ByteBuffer, byte)

dumpLog

public void dumpLog(StringBuffer sb,
                    boolean verbose)
Description copied from interface: LogReadable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface LogReadable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
LogReadable.dumpLog(java.lang.StringBuffer, boolean)

logEntryIsTransactional

public boolean logEntryIsTransactional()
Specified by:
logEntryIsTransactional in interface LogReadable
Returns:
true if the LogEntry is a transactional log entry type.
See Also:
LogReadable.logEntryIsTransactional()

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface LogReadable
Returns:
return the transaction id if this log entry is transactional, 0 otherwise.
See Also:
LogReadable.getTransactionId()


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.