org.apache.derby.impl.store.access.conglomerate
Class GenericConglomerateController

java.lang.Object
  extended byorg.apache.derby.impl.store.access.conglomerate.GenericController
      extended byorg.apache.derby.impl.store.access.conglomerate.GenericConglomerateController
All Implemented Interfaces:
ConglomerateController, ConglomPropertyQueryable
Direct Known Subclasses:
HeapController

public abstract class GenericConglomerateController
extends GenericController
implements ConglomerateController


Field Summary
 
Fields inherited from class org.apache.derby.impl.store.access.conglomerate.GenericController
open_conglom
 
Fields inherited from interface org.apache.derby.iapi.store.access.ConglomerateController
LOCK_INS, LOCK_INS_PREVKEY, LOCK_READ, LOCK_UPD, LOCK_UPDATE_LOCKS, ROWISDUPLICATE
 
Constructor Summary
GenericConglomerateController()
           
 
Method Summary
 void close()
          Close the conglomerate controller.
 boolean closeForEndTransaction(boolean closeHeldScan)
          Close conglomerate controller as part of terminating a transaction.
 boolean delete(RowLocation loc)
          Delete a row from the conglomerate.
 boolean fetch(RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns)
          Fetch the (partial) row at the given location.
 boolean fetch(RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns, boolean waitForLock)
          Fetch the (partial) row at the given location.
 int insert(DataValueDescriptor[] row)
          Public Methods implementing ConglomerateController - not implemented:
 void insertAndFetchLocation(DataValueDescriptor[] row, RowLocation templateRowLocation)
          insert row and fetch it's row location in one operation.
 boolean lockRow(long page_num, int record_id, int lock_operation, boolean wait, int lock_duration)
          Lock the given record id/page num pair.
 boolean lockRow(RowLocation loc, int lock_operation, boolean wait, int lock_duration)
          Lock the given row location.
 boolean replace(RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns)
          Replace the (partial) row at the given location.
 void unlockRowAfterRead(RowLocation loc, boolean forUpdate, boolean row_qualifies)
          UnLock the given row location.
 
Methods inherited from class org.apache.derby.impl.store.access.conglomerate.GenericController
checkConsistency, debugConglomerate, getEstimatedRowCount, getInternalTablePropertySet, getOpenConglom, getRowPositionFromRowLocation, getSpaceInfo, getTableProperties, init, isKeyed, isTableLocked, newRowLocationTemplate, queueDeletePostCommitWork, setEstimatedRowCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.store.access.ConglomerateController
checkConsistency, debugConglomerate, getSpaceInfo, isKeyed, newRowLocationTemplate
 
Methods inherited from interface org.apache.derby.iapi.store.access.ConglomPropertyQueryable
getInternalTablePropertySet, getTableProperties
 

Constructor Detail

GenericConglomerateController

public GenericConglomerateController()
Method Detail

close

public void close()
           throws StandardException
Description copied from interface: ConglomerateController
Close the conglomerate controller.

Close the conglomerate controller. Callers must not use the conglomerate controller after calling close. It is strongly recommended that callers clear out the reference after closing, e.g.,

 ConglomerateController cc;
 cc.close;
 cc = null;
 

Specified by:
close in interface ConglomerateController
Overrides:
close in class GenericController
Throws:
StandardException
See Also:
ConglomerateController.close()

closeForEndTransaction

public boolean closeForEndTransaction(boolean closeHeldScan)
                               throws StandardException
Close conglomerate controller as part of terminating a transaction.

Use this call to close the conglomerate controller resources as part of committing or aborting a transaction. The normal close() routine may do some cleanup that is either unnecessary, or not correct due to the unknown condition of the controller following a transaction ending error. Use this call when closing all controllers as part of an abort of a transaction. RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Specified by:
closeForEndTransaction in interface ConglomerateController
Returns:
boolean indicating that the close has resulted in a real close of the controller. A held scan will return false if called by closeForEndTransaction(false), otherwise it will return true. A non-held scan will always return true.
Throws:
StandardException - Standard exception policy.

delete

public boolean delete(RowLocation loc)
               throws StandardException
Description copied from interface: ConglomerateController
Delete a row from the conglomerate.

Specified by:
delete in interface ConglomerateController
Returns:
Returns true if delete was successful, false if the record pointed at no longer represents a valid record.
Throws:
StandardException - Standard exception policy.
See Also:
ConglomerateController.delete(org.apache.derby.iapi.types.RowLocation)

fetch

public boolean fetch(RowLocation loc,
                     DataValueDescriptor[] row,
                     FormatableBitSet validColumns)
              throws StandardException
Description copied from interface: ConglomerateController
Fetch the (partial) row at the given location.

Specified by:
fetch in interface ConglomerateController
Parameters:
loc - The "RowLocation" which describes the exact row to fetch from the table.
row - The row to read the data into.
validColumns - A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".
Returns:
Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.
Throws:
StandardException - Standard exception policy.
See Also:
ConglomerateController.fetch(org.apache.derby.iapi.types.RowLocation, org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.services.io.FormatableBitSet)

fetch

public boolean fetch(RowLocation loc,
                     DataValueDescriptor[] row,
                     FormatableBitSet validColumns,
                     boolean waitForLock)
              throws StandardException
Description copied from interface: ConglomerateController
Fetch the (partial) row at the given location.

Specified by:
fetch in interface ConglomerateController
Parameters:
loc - The "RowLocation" which describes the exact row to fetch from the table.
row - The row to read the data into.
validColumns - A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".
waitForLock - If false, then the call will throw a lock timeout exception immediately, if the lock can not be granted without waiting. If true call will act exactly as fetch() interface with no waitForLock parameter.
Returns:
Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.
Throws:
StandardException - Standard exception policy.
See Also:
ConglomerateController.fetch(org.apache.derby.iapi.types.RowLocation, org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.services.io.FormatableBitSet)

replace

public boolean replace(RowLocation loc,
                       DataValueDescriptor[] row,
                       FormatableBitSet validColumns)
                throws StandardException
Description copied from interface: ConglomerateController
Replace the (partial) row at the given location.

Specified by:
replace in interface ConglomerateController
Returns:
true if update was successful, returns false if the update fails because the record pointed at no longer represents a valid record.
Throws:
StandardException - Standard exception policy.
See Also:
ConglomerateController.replace(org.apache.derby.iapi.types.RowLocation, org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.services.io.FormatableBitSet)

insert

public int insert(DataValueDescriptor[] row)
           throws StandardException
Public Methods implementing ConglomerateController - not implemented:

Specified by:
insert in interface ConglomerateController
Parameters:
row - The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.
Returns:
Returns 0 if insert succeeded. Returns ConglomerateController.ROWISDUPLICATE if conglomerate supports uniqueness checks and has been created to disallow duplicates, and the row inserted had key columns which were duplicate of a row already in the table. Other insert failures will raise StandardException's.
Throws:
StandardException - Standard exception policy.
See Also:
RowUtil

insertAndFetchLocation

public void insertAndFetchLocation(DataValueDescriptor[] row,
                                   RowLocation templateRowLocation)
                            throws StandardException
Description copied from interface: ConglomerateController
insert row and fetch it's row location in one operation.

Insert a row into the conglomerate, and store its location in the provided destination row location. The row location must be of the correct type for this conglomerate (a new row location of the correct type can be obtained from newRowLocationTemplate()).

Specified by:
insertAndFetchLocation in interface ConglomerateController
Parameters:
row - The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.
templateRowLocation - The rowlocation to read the inserted row location into.
Throws:
StandardException - Standard exception policy.
See Also:
RowUtil

lockRow

public boolean lockRow(RowLocation loc,
                       int lock_operation,
                       boolean wait,
                       int lock_duration)
                throws StandardException
Description copied from interface: ConglomerateController
Lock the given row location.

Should only be called by access.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Specified by:
lockRow in interface ConglomerateController
Parameters:
loc - The "RowLocation" of the exact row to lock.
lock_operation - For what operation are we requesting the lock, this should be one of the following 4 options: LOCK_READ [read lock], (LOCK_INS | LOCK_UPD) [ lock for insert], (LOCK_INSERT_PREVKEY | LOCK_UPD) [lock for previous key to insert], (LOCK_UPD) [lock for delete or replace] (LOCK_UPD | LOCK_UPDATE_LOCKS) [lock scan for update, will upgrade lock later if actual update is take place]
wait - Should the lock call wait to be granted?
lock_duration - If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.
Returns:
true if lock was granted, only can be false if wait was false.
Throws:
StandardException - Standard exception policy.

lockRow

public boolean lockRow(long page_num,
                       int record_id,
                       int lock_operation,
                       boolean wait,
                       int lock_duration)
                throws StandardException
Description copied from interface: ConglomerateController
Lock the given record id/page num pair.

Should only be called by access, to lock "special" locks formed from the Recordhandle.* reserved constants for page specific locks.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Specified by:
lockRow in interface ConglomerateController
Parameters:
wait - Should the lock call wait to be granted?
lock_duration - If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.
Returns:
true if lock was granted, only can be false if wait was false.
Throws:
StandardException - Standard exception policy.

unlockRowAfterRead

public void unlockRowAfterRead(RowLocation loc,
                               boolean forUpdate,
                               boolean row_qualifies)
                        throws StandardException
Description copied from interface: ConglomerateController
UnLock the given row location.

Should only be called by access.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Specified by:
unlockRowAfterRead in interface ConglomerateController
Parameters:
loc - The "RowLocation" which describes the row to unlock.
forUpdate - Row was locked for read or update.
row_qualifies - Row was qualified and returned to the user.
Throws:
StandardException - Standard exception policy.


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.