Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.log

public Class ChecksumOperation

extends Object
implements Loggable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.Loggable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.Formatable, .FormatIdUtil, .StoredFormatIds, .CompressedNumber, .LimitObjectInput, org.apache.derby.catalog.UUID, org.apache.derby.iapi.store.raw.Transaction, .Loggable, org.apache.derby.iapi.store.raw.log.LogInstant, .LogFactory, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.util.ByteArray, java.io.Externalizable, .OutputStream, .InputStream, .ObjectInput, .ObjectOutput, .IOException, java.util.zip.Checksum, .CRC32

A Log Operation that represents a checksum for a group of log records that are written to the tranaction log file.
See Also
Loggable

Field Summary

Modifier and TypeField and Description
private Checksum
private byte
private long
public static final byte
private int
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
doMe(Transaction
the Transaction
xact
,
LogInstant
the log instant of this operation
instant
,
LimitObjectInput
optional data
in
)

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Nothing to do for the checksum log record because it does need to be applied during redo.

protected int
getDataLength()

Access attributes of the checksum log record

public ByteArray
getPreparedLog()

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

the default for prepared log is always null for all the operations that don't have optionalData.

public int
public int
public int
group()

Implements org.apache.derby.iapi.store.raw.Loggable.group.

Checksum is a raw store operation

public void
init()

private void
protected boolean
isChecksumValid(byte[] data, int off, int length)

public boolean
needsRedo(Transaction
The transaction trying to redo this operation
xact
)

Implements org.apache.derby.iapi.store.raw.Loggable.needsRedo.

Checksum does not need to be redone, it is used to just verify that log records are written completely.

public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

public void
releaseResource(Transaction xact)

Implements org.apache.derby.iapi.store.raw.Loggable.releaseResource.

Checksum has no resources to release

protected void
public String
toString()

Overrides java.lang.Object.toString.

DEBUG: Print self.

protected void
update(byte[] buf, int off, int len)

public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

checksumback to summary
private Checksum checksum
checksumAlgoback to summary
private byte checksumAlgo
checksumValueback to summary
private long checksumValue
CRC32_ALGORITHMback to summary
public static final byte CRC32_ALGORITHM
dataLengthback to summary
private int dataLength
formatLengthback to summary
private static final int formatLength

Constructor Detail

ChecksumOperationback to summary
public ChecksumOperation()

Method Detail

doMeback to summary
public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Nothing to do for the checksum log record because it does need to be applied during redo.

Parameters
xact:Transaction

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

the Transaction

instant:LogInstant

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

the log instant of this operation

in:LimitObjectInput

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

optional data

Exceptions
StandardException:

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

Standard Derby policy.

getDataLengthback to summary
protected int getDataLength()

Access attributes of the checksum log record

getPreparedLogback to summary
public ByteArray getPreparedLog()

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

the default for prepared log is always null for all the operations that don't have optionalData. If an operation has optional data, the operation need to prepare the optional data for this method. Checksum has no optional data to write out

getStoredSizeback to summary
public int getStoredSize()
getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Return my format identifier.

Returns:int

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

The identifier. (A UUID stuffed in an array of 16 bytes).

groupback to summary
public int group()

Implements org.apache.derby.iapi.store.raw.Loggable.group.

Checksum is a raw store operation

initback to summary
public void init()
initializeChecksumAlgoback to summary
private void initializeChecksumAlgo()
isChecksumValidback to summary
protected boolean isChecksumValid(byte[] data, int off, int length)
needsRedoback to summary
public boolean needsRedo(Transaction xact)

Implements org.apache.derby.iapi.store.raw.Loggable.needsRedo.

Checksum does not need to be redone, it is used to just verify that log records are written completely.

Parameters
xact:Transaction

Doc from org.apache.derby.iapi.store.raw.Loggable.needsRedo.

The transaction trying to redo this operation

Returns:boolean

Doc from org.apache.derby.iapi.store.raw.Loggable.needsRedo.

true if operation needs redoing, false if not.

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

the stream to read data from in order to restore the object

Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
If the class for an object being restored cannot be found.
releaseResourceback to summary
public void releaseResource(Transaction xact)

Implements org.apache.derby.iapi.store.raw.Loggable.releaseResource.

Checksum has no resources to release

resetback to summary
protected void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

DEBUG: Print self.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

updateback to summary
protected void update(byte[] buf, int off, int len)
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Exceptions
IOException:
Includes any I/O exceptions that may occur