Top Description Methods
org.eclipse.persistence.internal.databaseaccess

public Interface Accessor

extends Cloneable
Known Direct Implementers
org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor
Imports
java.util.Vector, org.eclipse.persistence.exceptions.DatabaseException, org.eclipse.persistence.internal.sequencing.SequencingCallback, .SequencingCallbackFactory, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.queries.Call, org.eclipse.persistence.sessions.Login, org.eclipse.persistence.sessions.server.ConnectionPool

INTERNAL: Accessor defines the interface used primarily by the assorted TopLink Sessions to interact with a data store. In "normal" TopLink this data store is a relational database. But this interface also allows developers using the TopLink SDK to develop Accessors to other, non-relational, data stores.

Accessors must implement the following behavior:

Author
Big Country
Since
TOPLink/Java 3.0
See Also
org.eclipse.persistence.internal.sessions.AbstractSession, Call

Method Summary

Modifier and TypeMethod and Description
public void
beginTransaction(AbstractSession session)

Begin a transaction on the data store.

public Object
clone()

Return a clone of the accessor.

public void
closeConnection()

Close the accessor's connection.

public void
closeJTSConnection()

Called from beforeCompletion external transaction synchronization listener callback to close the external connection corresponding to the completing external transaction.

public void
commitTransaction(AbstractSession session)

Commit a transaction on the data store.

public void
connect(Login login, AbstractSession session)

Connect to the data store using the configuration information in the login.

public void
createCustomizer(AbstractSession session)

Attempts to create ConnectionCustomizer.

public void
decrementCallCount()

Decrement the number of calls in progress.

public void
disconnect(AbstractSession session)

Disconnect from the data store.

public Object

Returns:

a row, a collection of rows, a row count, or a cursor
executeCall
(Call call, AbstractRecord translationRow, AbstractSession session)

Execute the call.

public void
flushSelectCalls(AbstractSession session)

Execute any deferred select calls.

public int
getCallCount()

Return the number of calls currently in progress.

public Vector<AbstractRecord>
getColumnInfo(String catalog, String schema, String tableName, String columnName, AbstractSession session)

Return the column metadata for the specified selection criteria.

public Vector<AbstractRecord>
getColumnInfo(String tableName, String columnName, AbstractSession session)

Return the column metadata for the specified selection criteria limited to the context of the current Accessor.

public Connection
getConnection()

Return the JDBC connection for relational accessors.

public Object
getDatasourceConnection()

Return the driver level connection, this will need to be cast to the implementation class for the data access type being used.

public ConnectionPool
getPool()

Return the associated connection pool this connection was obtained from.

public SequencingCallback
getSequencingCallback(SequencingCallbackFactory sequencingCallbackFactory)

Return sequencing callback.

public Vector<AbstractRecord>
getTableInfo(String catalog, String schema, String tableName, String[] types, AbstractSession session)

Return the table metadata for the specified selection criteria.

public Vector<AbstractRecord>
getTableInfo(String tableName, String[] types, AbstractSession session)

Return the table metadata for the specified selection criteria limited to the context of the current Accessor.

public void
incrementCallCount(AbstractSession session)

Increment the number of calls in progress.

public boolean
isConnected()

Return whether the accessor is connected to the data store.

public boolean
isInTransaction()

Return whether the accessor is in transaction.

public boolean
isValid()

Returns true if this Accessor can continue to be used.

public void
reestablishConnection(AbstractSession session)

Reconnect to the database.

public void
releaseCustomizer()

Clear customizer if it's active and set it to null.

public void
releaseCustomizer(AbstractSession session)

Clear and remove customizer if its session is the same as the passed one; in case prevCustomizer exists set it as a new customizer.

public void
reset()

Reset the accessor before being released.

public void
rollbackTransaction(AbstractSession session)

Roll back a transaction on the data store.

public void
setIsValid(boolean isValid)

This should be set to false if a communication failure occurred durring a call execution.

public void
setPool(ConnectionPool pool)

Set the associated connection pool this connection was obtained from.

public boolean
usesExternalConnectionPooling()

Return whether the accessor uses external connection pooling.

public boolean
usesExternalTransactionController()

Return whether the accessor uses an external transaction controller (e.g. JTS).

public void
writesCompleted(AbstractSession session)

This method will be called after a series of writes have been issued to mark where a particular set of writes has completed.

Method Detail

beginTransactionback to summary
public void beginTransaction(AbstractSession session) throws DatabaseException

Begin a transaction on the data store.

cloneback to summary
public Object clone()

Return a clone of the accessor.

closeConnectionback to summary
public void closeConnection()

Close the accessor's connection. This is used only for external connection pooling when it is intended for the connection to be reconnected in the future.

closeJTSConnectionback to summary
public void closeJTSConnection()

Called from beforeCompletion external transaction synchronization listener callback to close the external connection corresponding to the completing external transaction. Final sql calls could be sent through the connection by this method before it closes the connection.

commitTransactionback to summary
public void commitTransaction(AbstractSession session) throws DatabaseException

Commit a transaction on the data store.

connectback to summary
public void connect(Login login, AbstractSession session) throws DatabaseException

Connect to the data store using the configuration information in the login.

createCustomizerback to summary
public void createCustomizer(AbstractSession session)

Attempts to create ConnectionCustomizer. If created the customizer is cached by the accessor. Called by the owner of accessor (DatabaseSession, ServerSession through ConnectionPool) just once, typically right after the accessor is created. Also called by ClientSession when it acquires write accessor. If accessor already has a customizer set by ConnectionPool then ClientSession's customizer compared with the existing one and if they are not equal (don't produce identical customization) then the new customizer set onto accessor, caching the old customizer so that it could be restored later.

decrementCallCountback to summary
public void decrementCallCount()

Decrement the number of calls in progress. Used for external pooling.

disconnectback to summary
public void disconnect(AbstractSession session) throws DatabaseException

Disconnect from the data store.

executeCallback to summary
public Object executeCall(Call call, AbstractRecord translationRow, AbstractSession session) throws DatabaseException

Execute the call. The actual behavior of the execution depends on the type of call. The call may be parameterized where the arguments are in the translation row. The row will be empty if there are no parameters.

Returns:Object

a row, a collection of rows, a row count, or a cursor

flushSelectCallsback to summary
public void flushSelectCalls(AbstractSession session)

Execute any deferred select calls. This method will generally be called after one or more select calls have been collected in a LOBValueWriter (to be executed after all insert calls are executed). Bug 2804663.

See Also
org.eclipse.persistence.internal.helper.LOBValueWriter#buildAndExecuteSelectCalls(AbstractSession)
getCallCountback to summary
public int getCallCount()

Return the number of calls currently in progress. Used for load balancing and external pooling.

getColumnInfoback to summary
public Vector<AbstractRecord> getColumnInfo(String catalog, String schema, String tableName, String columnName, AbstractSession session) throws DatabaseException

Return the column metadata for the specified selection criteria.

getColumnInfoback to summary
public Vector<AbstractRecord> getColumnInfo(String tableName, String columnName, AbstractSession session) throws DatabaseException

Return the column metadata for the specified selection criteria limited to the context of the current Accessor.

getConnectionback to summary
public Connection getConnection()

Return the JDBC connection for relational accessors. This will fail for non-relational accessors.

getDatasourceConnectionback to summary
public Object getDatasourceConnection()

Return the driver level connection, this will need to be cast to the implementation class for the data access type being used.

getPoolback to summary
public ConnectionPool getPool()

Return the associated connection pool this connection was obtained from.

getSequencingCallbackback to summary
public SequencingCallback getSequencingCallback(SequencingCallbackFactory sequencingCallbackFactory)

Return sequencing callback.

getTableInfoback to summary
public Vector<AbstractRecord> getTableInfo(String catalog, String schema, String tableName, String[] types, AbstractSession session) throws DatabaseException

Return the table metadata for the specified selection criteria.

getTableInfoback to summary
public Vector<AbstractRecord> getTableInfo(String tableName, String[] types, AbstractSession session) throws DatabaseException

Return the table metadata for the specified selection criteria limited to the context of the current Accessor.

incrementCallCountback to summary
public void incrementCallCount(AbstractSession session)

Increment the number of calls in progress. Used for external pooling.

isConnectedback to summary
public boolean isConnected()

Return whether the accessor is connected to the data store.

isInTransactionback to summary
public boolean isInTransaction()

Return whether the accessor is in transaction.

isValidback to summary
public boolean isValid()

Returns true if this Accessor can continue to be used. This will be false if a communication failure occurred during a call execution. In the case of an invalid accessor the Accessor will not be returned to the pool.

reestablishConnectionback to summary
public void reestablishConnection(AbstractSession session) throws DatabaseException

Reconnect to the database. This can be used if the connection was temporarily disconnected or if it timed out.

releaseCustomizerback to summary
public void releaseCustomizer()

Clear customizer if it's active and set it to null. Called by the same object that has created customizer (DatabaseSession, ConnectionPool) when the latter is no longer required, typically before releasing the accessor. Ignored if there's no customizer.

releaseCustomizerback to summary
public void releaseCustomizer(AbstractSession session)

Clear and remove customizer if its session is the same as the passed one; in case prevCustomizer exists set it as a new customizer. Called when ClientSession releases write accessor: if the customizer was created by the ClientSession it's removed, and the previous customizer (that ConnectionPool had set) is brought back; otherwise the customizer (created by ConnectionPool) is kept. Ignored if there's no customizer.

resetback to summary
public void reset()

Reset the accessor before being released.

rollbackTransactionback to summary
public void rollbackTransaction(AbstractSession session) throws DatabaseException

Roll back a transaction on the data store.

setIsValidback to summary
public void setIsValid(boolean isValid)

This should be set to false if a communication failure occurred durring a call execution. In the case of an invalid accessor the Accessor will not be returned to the pool.

setPoolback to summary
public void setPool(ConnectionPool pool)

Set the associated connection pool this connection was obtained from.

usesExternalConnectionPoolingback to summary
public boolean usesExternalConnectionPooling()

Return whether the accessor uses external connection pooling.

usesExternalTransactionControllerback to summary
public boolean usesExternalTransactionController()

Return whether the accessor uses an external transaction controller (e.g. JTS).

writesCompletedback to summary
public void writesCompleted(AbstractSession session)

This method will be called after a series of writes have been issued to mark where a particular set of writes has completed. It will be called from commitTransaction and may be called from writeChanges. Its main purpose is to ensure that the batched statements have been executed