com.sapportals.wcm.repository.txn

Interface IFrameworkTransaction


public interface IFrameworkTransaction

Interface for framework wide transactions.

Copyright (c) SAP AG 2004


Method Summary
 void addEndListener(ITransactionEndsListener listener)
          Adds an ITransactionEndsListener which is called either when the transaction is committed or rollbacked.
 void addTransactionObject(Object key, Object o)
          Stores all kind of objects in this framework transaction.
 boolean commit()
          Has be called when a a transaction shall be committed.
 Connection getConnection()
          Returns a valid connection object.
 ITransactionEndsListener getEndListener(String key)
          Returns a specific listener if it is already registered with this transaction
 Object getTransactionObject(Object key)
          Returns a previous added object.
 boolean isActive()
           
 boolean isEndListenerRegistered(ITransactionEndsListener listener)
          Tells if a specific listener is already registered with this transaction
 void rollback()
          Has be called when a a transaction shall be rollbacked.
 void setVeto()
          If called a later commit will always return with false and a rollback will be performed.
 void setVeto(Exception cause)
          If called a later commit will always return with false and a rollback will be performed.
 boolean willBeRollbacked()
          Check whether it is necessary to perform further actions with this open transaction.
 

Method Detail

getConnection

public Connection getConnection()
                         throws TxException
Returns a valid connection object.
You must not call Connection.commit() or Connection.rollback() on this connection. Instead just close it and call commit() or rollback() on this transaction object afterwards.

Returns:
the connection to be used for all persistence calls
Throws:
TxException

addTransactionObject

public void addTransactionObject(Object key,
                                 Object o)
Stores all kind of objects in this framework transaction. Can be retrieved via getTransactionObject(java.lang.Object)


getTransactionObject

public Object getTransactionObject(Object key)
Returns a previous added object.

Parameters:
key - the lookup key
Returns:
null or the previously added object
See Also:
addTransactionObject(Object, Object)

addEndListener

public void addEndListener(ITransactionEndsListener listener)
                    throws TxException
Adds an ITransactionEndsListener which is called either when the transaction is committed or rollbacked.

Parameters:
listener -
Throws:
TxException

isEndListenerRegistered

public boolean isEndListenerRegistered(ITransactionEndsListener listener)
                                throws TxException
Tells if a specific listener is already registered with this transaction

Parameters:
listener -
Throws:
TxException

getEndListener

public ITransactionEndsListener getEndListener(String key)
                                        throws TxException
Returns a specific listener if it is already registered with this transaction

Parameters:
key -
Throws:
TxException

commit

public boolean commit()
               throws TxException
Has be called when a a transaction shall be committed. All notifiers will be called and the connection closed. If transaction can not be committed an implicit rollback() will be called and false returned.

Returns:
true if commit was performed, false otherwise
Throws:
TxException - if the commit failed, a veto was given or this transaction is not active.

rollback

public void rollback()
              throws TxException
Has be called when a a transaction shall be rollbacked. All notifiers will be called and the connection closed.

Throws:
TxException - if this transaction is not active.
See Also:
willBeRollbacked()

setVeto

public void setVeto()
             throws TxException
If called a later commit will always return with false and a rollback will be performed.

Throws:
TxException
See Also:
willBeRollbacked()

setVeto

public void setVeto(Exception cause)
             throws TxException
If called a later commit will always return with false and a rollback will be performed.

Parameters:
cause - A root exception as reason why the transaction is to be rolled back.
Throws:
TxException
See Also:
willBeRollbacked()

willBeRollbacked

public boolean willBeRollbacked()
                         throws TxException
Check whether it is necessary to perform further actions with this open transaction.

Returns:
true if a setVeto() was called.
Throws:
TxException

isActive

public boolean isActive()
                 throws TxException
Returns:
true, if this transaction was committed or rolled back. false, otherwise.
Throws:
TxException


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.