/*!
@header FTTransactionImpl
@abstract Module of FT
@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
-------------------------------------------------------------------------
Modification history
17.04.05 ola initial version
18.04.06 ola added accessable transaction steps
23.08.06 ola license changed
-------------------------------------------------------------------------
*/
#if !defined(__FTTransactionImpl_H)
#define __FTTransactionImpl_H
#include
#include
#include
#include
#include
#include
@class FTTransactionManager;
/*!
* @class FTTransactionStepAndContext
* @abstract Internal representation used to combine a transaction with its
* related context
*/
@interface FTTransactionStepAndContext : FTObject {
id transactionStep;
FTTransactionContext *transactionContext;
}
/*!
* @method initWithTransactionStep
* @abstract Constructor
* @param transactionStep step to perform
* @param transactionContext context of the step
* @result self
*/
- initWithTransactionStep: (id ) aTransactionStep
withContext: (FTTransactionContext *) aTransactionContext;
- (void) dealloc;
/*!
* @method transactionStep
* @result returns the transaction step to perform
*/
- (id ) transactionStep;
/*!
* @method transactionContext
* @result return the context of the transaction step
*/
- (FTTransactionContext *) transactionContext;
@end
/*!
* @class FTTransactionImpl
* @abstract This is a very poor, simple, not usable transaction
* implementation
* @discussion The idea behind is to just integrate the underlying
* object infrastructure. Maybe in the future a real transaction model will
* be provided.
*/
@interface FTTransactionImpl : FTObject {
@private
id transactionManager;
NSMutableArray *transactionStepsAndContexts;
NSMutableDictionary *transactionKeyToArrayIndex;
}
/*!
* @method initForTransactionManager
* @param aManager underlying transaction manager
* @result self
*/
- initForTransactionManager: (id ) aManager;
- (void) dealloc;
/*!
* @method abort
* @abstract Aborts the whole transaction
*/
- (void) abort;
/*!
* @method addTransactionStep
* @param stepToAdd transaction step to add
* @return array index where the element has been stored related to
* self->transactionStepsAndContexts
*/
- (unsigned) addTransactionStep: (FTTransactionStepAndContext *) stepToAdd;
/*!
* @method addTransactionStep
* @abstract Adds a step to the transaction
* @param stepToAdd instance implementing the changes to be done by this step.
* @param context Additional (context) data for the step
* @result self
*/
- addTransactionStep: (id ) stepToAdd
withContext: (FTTransactionContext *) context;
/*!
* @method addTransactionStep
* @abstract Adds a step to the transaction. Additionally it associates this
* transaction step with a given key. Later on this step may be fetched
* using this key.
* @param stepToAdd instance implementing the changes to be done by this step.
* @param context Additional (context) data for the step
* @param identifiedByKey key used to identify the given transaction stept.
* @result self
*/
- addTransactionStep: (id ) stepToAdd
withContext: (FTTransactionContext *) context
identifiedByKey: (id ) aKey;
/*!
* @method commit
* @abstract commits all actions associated with this transaction
*/
- (void) commit;
/*!
* @method createContext
* @abstract Creates a context for a transaction step
* @result new context. This context is not attached to this transaction until
* {@link addTransactionStep} is being called.
*/
- (FTTransactionContext *) createContext;
/*!
* @method transactionStepForKey
* @param aKey key identifying a transaction step
* @result returns the transaction step associated with the given key
* or nil if not existent
*/
- (id ) transactionStepForKey: (id ) aKey;
/*!
* @method transactionSteps
* @discussion The caller may modify this array
* @result all transaction steps of this transaction
*/
- (NSMutableArray *) transactionSteps;
@end
#endif