ojb.server
Class ObjectTransactionWrapper

java.lang.Object
  |
  +--ojb.server.ObjectTransactionWrapper
All Implemented Interfaces:
ObjectModification

public class ObjectTransactionWrapper
extends java.lang.Object
implements ObjectModification

Class declaration

Version:
%I%, %G%
Author:
 

Constructor Summary
ObjectTransactionWrapper(java.lang.Object obj)
          Create a wrapper by providing an Object.
 
Method Summary
 void abort()
          abort method comment.
 void afterAbort()
          Method declaration
 void afterCommit()
          Method declaration
 void beforeAbort()
          Method declaration
 void beforeCommit()
          We need to implement the Two-Phase Commit protocol. beginCommit is where we say if we can or cannot commit the transaction.
 void commit()
          commit method comment.
 ModificationState getModificationState()
          returns the Modification-state.
 java.lang.Object getObject()
          Simple maintenance methods.
 boolean hasChanged()
          checks whether object and internal clone differ and returns true if so, returns false else.
 void manage(java.lang.Object obj)
          Manage an object.
 boolean needsInsert()
          returns true if the underlying Object needs an INSERT statement.
 boolean needsUpdate()
          returns true if the underlying Object needs an UPDATE statement.
 void setModificationState(ModificationState newModificationState)
          set the Modification state to a new value.
 java.lang.String toString()
          returns a String representation.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectTransactionWrapper

public ObjectTransactionWrapper(java.lang.Object obj)
Create a wrapper by providing an Object.
Method Detail

manage

public void manage(java.lang.Object obj)
Manage an object.

getObject

public java.lang.Object getObject()
Simple maintenance methods.

beforeCommit

public void beforeCommit()
We need to implement the Two-Phase Commit protocol. beginCommit is where we say if we can or cannot commit the transaction. At the begining however, we need to attain the after image so we can isolate everything. We should issue the call against the database at this point. If we get a SQL Exception, we should throw the org.odmg.TransactionAbortedException. We should also check to see if the object is TransactionAware. If so, we should give it a chance to kill the transaction before we toss it to the database.

afterCommit

public void afterCommit()
Method declaration
See Also:

beforeAbort

public void beforeAbort()
Method declaration
See Also:

afterAbort

public void afterAbort()
Method declaration
See Also:

abort

public void abort()
abort method comment.

commit

public void commit()
commit method comment.

getModificationState

public ModificationState getModificationState()
returns the Modification-state.
Returns:
ojb.server.states.ModificationState

needsInsert

public boolean needsInsert()
returns true if the underlying Object needs an INSERT statement. Returns false else.
Specified by:
needsInsert in interface ObjectModification

needsUpdate

public boolean needsUpdate()
returns true if the underlying Object needs an UPDATE statement. Else Returns false.
Specified by:
needsUpdate in interface ObjectModification

setModificationState

public void setModificationState(ModificationState newModificationState)
set the Modification state to a new value. Used during state transitions.
Parameters:
newModificationState - ojb.server.states.ModificationState

toString

public java.lang.String toString()
returns a String representation.
Overrides:
toString in class java.lang.Object
Returns:
java.lang.String

hasChanged

public boolean hasChanged()
checks whether object and internal clone differ and returns true if so, returns false else.
Returns:
boolean


Authors: Thomas Mahler, David Dixon-Peugh. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.1.120, 2001-05-12