com.sleepycat.je.dbi
Class TriggerUtils

java.lang.Object
  extended by com.sleepycat.je.dbi.TriggerUtils

public class TriggerUtils
extends Object

Utility functions used by the trigger implementation.


Constructor Summary
TriggerUtils()
           
 
Method Summary
(package private) static void dumpTriggers(StringBuilder sb, byte[][] triggerBytes, List<Trigger> triggers)
          Dumps an XML representation of the triggers into the StringBuilder.
(package private) static int logSize(byte[][] triggerBytes)
          Determines the size in bytes used to represent the trigger in the log, that is, the size of the output generated by writeTriggers(ByteBuffer, byte[][])
(package private) static byte[][] readTriggers(ByteBuffer logBuffer, int entryVersion)
          Reads the triggers from a log buffer and returns then in their serialized byte array form.
(package private) static LinkedList<Trigger> unmarshallTriggers(String dbName, byte[][] triggerBytes, ClassLoader loader)
          Deserializes the trigger representation to yield the trigger object instance.
(package private) static void writeTriggers(ByteBuffer logBuffer, byte[][] triggerBytes)
          Writes the triggers out to the log buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriggerUtils

public TriggerUtils()
Method Detail

logSize

static int logSize(byte[][] triggerBytes)
Determines the size in bytes used to represent the trigger in the log, that is, the size of the output generated by writeTriggers(ByteBuffer, byte[][])

Parameters:
triggerBytes - the triggers whose size is to be estimated.
Returns:
the size in bytes

writeTriggers

static void writeTriggers(ByteBuffer logBuffer,
                          byte[][] triggerBytes)
Writes the triggers out to the log buffer.

Parameters:
logBuffer - the buffer in which the bytes are assembled.
triggerBytes - the trigger bytes to be written.

readTriggers

static byte[][] readTriggers(ByteBuffer logBuffer,
                             int entryVersion)
Reads the triggers from a log buffer and returns then in their serialized byte array form.

Parameters:
logBuffer - the buffer from which to read the triggers.
entryVersion - the version associated with the current log
Returns:
the trigger bytes

unmarshallTriggers

static LinkedList<Trigger> unmarshallTriggers(String dbName,
                                              byte[][] triggerBytes,
                                              ClassLoader loader)
Deserializes the trigger representation to yield the trigger object instance.

Parameters:
dbName - the name to be associated with the de-serialized triggers
triggerBytes - the serialized representation of the trigger
Returns:
the list of trigger instances

dumpTriggers

static void dumpTriggers(StringBuilder sb,
                         byte[][] triggerBytes,
                         List<Trigger> triggers)
Dumps an XML representation of the triggers into the StringBuilder. It gives preference to the instance representation if it's readily available.

Parameters:
sb - the string buffer that will contain the XML representation
triggerBytes - the bytes representing the trigger
triggers - the trigger instances corresponding to triggerBytes


Copyright (c) 2004-2012 Oracle. All rights reserved.