1 21 22 package org.apache.derby.impl.store.raw.data; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 import org.apache.derby.iapi.services.io.FormatIdUtil; 26 import org.apache.derby.iapi.services.io.StoredFormatIds; 27 28 import org.apache.derby.iapi.store.raw.Compensation; 29 import org.apache.derby.iapi.store.raw.ContainerHandle; 30 import org.apache.derby.iapi.store.raw.Loggable; 31 import org.apache.derby.iapi.store.raw.Transaction; 32 import org.apache.derby.iapi.store.raw.Undoable; 33 34 import org.apache.derby.iapi.store.raw.data.RawContainerHandle; 35 import org.apache.derby.iapi.store.raw.log.LogInstant; 36 37 import org.apache.derby.iapi.error.StandardException; 38 39 import java.io.InputStream ; 40 import java.io.ObjectOutput ; 41 import java.io.ObjectInput ; 42 import java.io.IOException ; 43 import org.apache.derby.iapi.services.io.LimitObjectInput; 44 45 46 public class ContainerUndoOperation extends ContainerBasicOperation 47 implements Compensation 48 { 49 transient private ContainerOperation undoOp; 51 52 53 54 58 public ContainerUndoOperation(RawContainerHandle hdl, ContainerOperation op) 59 throws StandardException 60 { 61 super(hdl); 62 undoOp = op; 63 } 64 65 68 69 public ContainerUndoOperation() { super(); } 71 72 public void writeExternal(ObjectOutput out) throws IOException 73 { 74 super.writeExternal(out); 75 } 76 77 81 public void readExternal(ObjectInput in) 82 throws IOException , ClassNotFoundException 83 { 84 super.readExternal(in); 85 } 86 87 90 public int getTypeFormatId() { 91 return StoredFormatIds.LOGOP_CONTAINER_UNDO; 92 } 93 94 97 98 99 public void setUndoOp(Undoable op) 100 { 101 if (SanityManager.DEBUG) { 102 SanityManager.ASSERT(op instanceof ContainerOperation); 103 } 104 105 undoOp = (ContainerOperation)op; 106 } 107 108 111 112 124 public final void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) 125 throws StandardException, IOException 126 { 127 if (SanityManager.DEBUG) { 128 SanityManager.ASSERT(containerHdl != null, "clr has null containerHdl"); 129 } 130 131 138 undoOp.undoMe(xact, containerHdl, instant, in); 139 releaseResource(xact); 140 } 141 142 143 public void releaseResource(Transaction xact) 144 { 145 if (undoOp != null) 146 undoOp.releaseResource(xact); 147 super.releaseResource(xact); 148 } 149 150 151 public int group() 152 { 153 return super.group() | Loggable.COMPENSATION | Loggable.RAWSTORE; 154 } 155 156 } 157 | Popular Tags |