/*!
  @header FTTransactionManager
  @abstract Used to globally manager transactions
 
  @availability OS X, GNUstep
  @copyright 2004, 2005, 2006 Free Software Foundation, Inc.
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  22.05.05 ola     initial version
  26.06.05 ola     protocol FTTransactionManager
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTTransactionManager_H)
#define __FTTransactionManager_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTTransaction.h>


@protocol FTSession;

/*!
 * @protocol FTTransactionManager
 * @abstract The transaction manager is a global object used to globally manage
 *   transactions
 */
@protocol FTTransactionManager <FTObject>

/*!
 * @method commitTransaction
 * @abstract Commits the given transaction
 * @discussion On successful commitment it removes the transaction
 *   from the stack of transaction of the corresponding session.
 * @param transactionToCommit
 * @result YES if transaction has successfully been commited
 */
- (BOOL) commitTransaction: (id <FTTransaction>) transactionToCommit;


/*!
 * @method createTransactionForSession
 * @abstract opens and returns a new transaction for the specified session.
 * @discussion If there is another transaction already being open then the
 *   the new one will be regarded as a nested one of the already opened 
 *   transaction
 * @result new transaction
 */
- (id <FTTransaction>) createTransactionForSession: (id <FTSession> ) session;


/*!
 * @method currentTransactionForSession
 * @abstract Returns the current transaction for the given session
 * @result the current transaction for the given session
 */
- (id <FTTransaction>) currentTransactionForSession: (id <FTSession>) session;
@end
#endif
