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

public Class EncryptContainerOperation

extends Object
implements Undoable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.Undoable, 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.iapi.services.io.StoredFormatIds, .LimitObjectInput, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.store.raw.Compensation, .Transaction, .Undoable, .Loggable, .ContainerKey, org.apache.derby.iapi.store.raw.data.RawContainerHandle, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.util.ByteArray, java.io.ObjectOutput, .ObjectInput, .IOException

Log operation to encrypt a container with a new encryption key or to encrypt an unencrypted container while configuring the database for encryption. Container is synced to the disk when encryption is is successful, there is nothing to do on a redo. If there is crash/error while configuring a database for encryption; original version of the container is put back during undo.
See Also
Undoable

Field Summary

Modifier and TypeField and Description
private ContainerKey

Constructor Summary

AccessConstructor and Description
protected
public

Method Summary

Modifier and TypeMethod and Description
public final void
doMe(Transaction
transaction doing the operation.
tran
,
LogInstant
log instant for this operation.
instant
,
LimitObjectInput
unused by this log operation.
in
)

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

Containers are not encryped on a redo.

public Compensation
generateUndo(Transaction
the transaction doing the compensating
tran
,
LimitObjectInput
optional input; not used by this operation.
in
)

Implements org.apache.derby.iapi.store.raw.Undoable.generateUndo.

Generate a Compensation (EncryptContainerUndoOperation) that will rollback the changes made to the container during container encryption.

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
group()

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

A space operation is a RAWSTORE log record

public boolean

Returns:

true, if this operation needs to be redone during recovery.
needsRedo
(Transaction
the transaction that is doing the rollback
xact
)

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

Check if this operation needs to be redone during recovery redo.

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 tran)

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

Release any resource that was acquired for doMe for rollback or recovery redo.

public String
public void
undoMe(Transaction
the transaction that is undoing this operation
tran
)

Undo of encrytpion of the container.

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

containerIdback to summary
private ContainerKey containerId

Constructor Detail

EncryptContainerOperationback to summary
protected EncryptContainerOperation(RawContainerHandle hdl) throws StandardException
EncryptContainerOperationback to summary
public EncryptContainerOperation()

Method Detail

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

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

Containers are not encryped on a redo. Nothing to do in this method.

Parameters
tran:Transaction

transaction doing the operation.

instant:LogInstant

log instant for this operation.

in:LimitObjectInput

unused by this log operation.

Exceptions
StandardException:
Standard Derby error policy
generateUndoback to summary
public Compensation generateUndo(Transaction tran, LimitObjectInput in) throws StandardException

Implements org.apache.derby.iapi.store.raw.Undoable.generateUndo.

Generate a Compensation (EncryptContainerUndoOperation) that will rollback the changes made to the container during container encryption.

Parameters
tran:Transaction

the transaction doing the compensating

in:LimitObjectInput

optional input; not used by this operation.

Returns:Compensation

Doc from org.apache.derby.iapi.store.raw.Undoable.generateUndo.

the compensation operation that will rollback this change, or null if nothing to undo.

Exceptions
StandardException:
Standard Derby error policy
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. Encrypt Operation has no optional data to write out

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.

A space operation is a RAWSTORE log record

needsRedoback to summary
public boolean needsRedo(Transaction xact) throws StandardException

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

Check if this operation needs to be redone during recovery redo. Returns true if this op should be redone during recovery redo,

Parameters
xact:Transaction

the transaction that is doing the rollback

Returns:boolean

true, if this operation needs to be redone during recovery.

Exceptions
StandardException:
Standard Derby error policy
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 tran)

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

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

Release any resource that was acquired for doMe for rollback or recovery redo. This resource is acquired in either generateUndo (if this is a compensation operation during run time rollback or recovery rollback) or in needsRedo (if this is during recovery redo). The run time transaction context should have all the resource already acquird for run time roll forward, so there is no need to releaseResource during run time roll forward. This method must be safe to be called multiple times.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

debug

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

undoMeback to summary
public void undoMe(Transaction tran) throws StandardException

Undo of encrytpion of the container. Original version of the container that existed before the start of the database encryption is put back.

Parameters
tran:Transaction

the transaction that is undoing this operation

Exceptions
StandardException:
Standard Derby error policy
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