org.apache.jdo.impl.fostore
Class FOStoreConnector

java.lang.Object
  extended byorg.apache.jdo.impl.fostore.FOStoreConnector
All Implemented Interfaces:
Connector

class FOStoreConnector
extends java.lang.Object
implements Connector

FOStoreConnector represents a connection to the FOStoreDatabase.

Author:
Dave Bristor

Field Summary
private  boolean busy
          True if flush is in progress.
(package private)  FOStoreClientConnection connection
          Connection for interacting with store.
(package private) static org.apache.commons.logging.Log logger
          Logger
private  Message message
          Message in which this Connector buffers requests for the store.
private static I18NHelper msg
          I18N support.
private  boolean okToReleaseConnection
          True if we can release this connection after flushing.
private  FOStorePMF pmf
          Datasource to which this Connector writes its Message.
private  boolean rollbackOnly
           
 
Constructor Summary
(package private) FOStoreConnector(FOStorePMF pmf)
           
 
Method Summary
private  void assertNotBusy(java.lang.String methodName)
           
private  void assertNotRollbackOnly()
           
 void beforeCompletion()
          Informs the Connector that the transaction has reached it's beforeCompletion phase.
 void begin(boolean optimistic)
          Informs the Connector that a transaction is beginning.
 void commit()
          Add a CommitRequest to the connector's message, and send it to the store.
 void flush()
          Get a connection, process the message by using that connection to interact with the database, read back the reply, release the connection.
(package private)  Message getMessage()
          Provides the Message which this this connector uses to send data to the store.
 boolean getRollbackOnly()
          Indicates whether or not the connector can do operations other than rollback.
 void rollback()
          If rollbackOnly is set, then the store has already done a rollback, so we don't do one now (but neither do we throw an exception, as do other methds).
 void setRollbackOnly()
          Requests that the Connector put itself in a state such that the only allowable operations is Connector.getRollbackOnly().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rollbackOnly

private boolean rollbackOnly
See Also:
Connector.setRollbackOnly()

msg

private static final I18NHelper msg
I18N support.


logger

static final org.apache.commons.logging.Log logger
Logger


message

private final Message message
Message in which this Connector buffers requests for the store.


pmf

private final FOStorePMF pmf
Datasource to which this Connector writes its Message.


connection

FOStoreClientConnection connection
Connection for interacting with store.


okToReleaseConnection

private boolean okToReleaseConnection
True if we can release this connection after flushing. By default we can; affected by transactions beginning and ending and their types.


busy

private boolean busy
True if flush is in progress.

Constructor Detail

FOStoreConnector

FOStoreConnector(FOStorePMF pmf)
Method Detail

begin

public void begin(boolean optimistic)
Description copied from interface: Connector
Informs the Connector that a transaction is beginning.

Specified by:
begin in interface Connector
Parameters:
optimistic - If true, then an optimistic transaction is beginning.
See Also:
Connector.begin(boolean)

beforeCompletion

public void beforeCompletion()
Description copied from interface: Connector
Informs the Connector that the transaction has reached it's beforeCompletion phase.

Specified by:
beforeCompletion in interface Connector
See Also:
Connector.beforeCompletion()

flush

public void flush()
Get a connection, process the message by using that connection to interact with the database, read back the reply, release the connection.

Specified by:
flush in interface Connector
See Also:
Connector.flush()

commit

public void commit()
Add a CommitRequest to the connector's message, and send it to the store. Then close the connection.

Specified by:
commit in interface Connector
See Also:
Connector.commit()

rollback

public void rollback()
If rollbackOnly is set, then the store has already done a rollback, so we don't do one now (but neither do we throw an exception, as do other methds).

Specified by:
rollback in interface Connector
See Also:
Connector.rollback(), ReplyHandler.processReplies(java.io.DataInput, org.apache.jdo.impl.fostore.Message)

setRollbackOnly

public void setRollbackOnly()
Description copied from interface: Connector
Requests that the Connector put itself in a state such that the only allowable operations is Connector.getRollbackOnly(). Once set, attempts to do any other operations will result in a JDODataStoreException.

Specified by:
setRollbackOnly in interface Connector
See Also:
Connector.setRollbackOnly()

getRollbackOnly

public boolean getRollbackOnly()
Description copied from interface: Connector
Indicates whether or not the connector can do operations other than rollback.

Specified by:
getRollbackOnly in interface Connector
Returns:
false if the connector can do operations other than rollback.
See Also:
Connector.getRollbackOnly()

getMessage

Message getMessage()
Provides the Message which this this connector uses to send data to the store.


assertNotRollbackOnly

private void assertNotRollbackOnly()

assertNotBusy

private void assertNotBusy(java.lang.String methodName)