libs-gdl2/EOAccess/EOAdaptorContext.h
Matt Rice 22a14f5447 * EOAccess/EOAdaptorContext.h/m (-channels:): New method.
* EOAccess/EOSQLExpression.m
        (-_administrativeDatabaseStatementsForSelector:forEntityGroup:):
        Comment out login panel.
        * EOAccess/EOUtilities.m: Dont declare EOMoreThanOneException and
        NSObjectNotAvailableException as static.
        * EOControl/EOPrivate.h: Declare new class GDL2NonRetainingMutableArray
        and -registerAssociationForDeallocHack method.
        * EOControl/EOPrivate.m: New class GDL2NonRetainingMutableArray.
        * EOControl/EOEditingContext.m:
        (EOEditingContext -initWithParentObjectStore:): initialize _editors
        ivar with a non retaining array.
        (-dealloc): Remove the editing context as an observer for registered
        objects.
        (-[NSObject(DeallocHack) dealloc]): for associations, remove the
        association and object from the private hash table.
        (-[NSObject(DeallocHack) registerAssociationForDeallocHack]): New
        method.
        * EOControl/EOObserver.m (EOObserverCenter): Replace GSIArray usage
        with GDL2NonRetainingMutableArray.
        (+addObserver:forObject:, +removeObserver:forObject:): Ditto.
        (+initialize, +notifyObserversObjectWillChange:): Ditto.
        (+observersForObject:, +observerForObject:): Ditto.
        (+addOmniscientObserver:, +removeOmniscientObserver:): Ditto.
        (EOObserverProxy -initWithTarget:action:priority:): Don't retain
        target.
        (EOObserverProxy -dealloc:): Discard pending notifications.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21404 72102866-910b-0410-8b05-ffd578937521
2005-07-04 06:17:18 +00:00

145 lines
3.7 KiB
Objective-C

/* -*-objc-*-
EOAdaptorContext.h
Copyright (C) 2000 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
Date: February 2000
This file is part of the GNUstep Database Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __EOAdaptorContext_h__
#define __EOAdaptorContext_h__
#ifdef GNUSTEP
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif
#include <EOAccess/EODefines.h>
@class NSMutableArray;
@class NSString;
@class EOAdaptor;
@class EOAdaptorChannel;
typedef enum {
EODelegateRejects,
EODelegateApproves,
EODelegateOverrides
} EODelegateResponse;
/* The EOAdaptorContext class could be overriden for a concrete database
adaptor. You have to override only those methods marked in this header
with 'override'.
*/
@interface EOAdaptorContext : NSObject
{
EOAdaptor *_adaptor;
NSMutableArray *_channels; // values with channels
id _delegate; // not retained
unsigned short _transactionNestingLevel;
BOOL _debug;
/* Flags used to check if the delegate responds to several messages */
struct {
unsigned shouldConnect:1;
unsigned shouldBegin:1;
unsigned didBegin:1;
unsigned shouldCommit:1;
unsigned didCommit:1;
unsigned shouldRollback:1;
unsigned didRollback:1;
} _delegateRespondsTo;
}
+ (EOAdaptorContext *)adaptorContextWithAdaptor: (EOAdaptor *)adaptor;
- (id)initWithAdaptor: (EOAdaptor *)adaptor;
- (EOAdaptor *)adaptor;
- (EOAdaptorChannel *)createAdaptorChannel; // override
- (NSArray *)channels;
- (BOOL)hasOpenChannels;
- (BOOL)hasBusyChannels;
- (id)delegate;
- (void)setDelegate: (id)delegate;
- (void)handleDroppedConnection;
@end
@interface EOAdaptorContext (EOTransactions)
- (void)beginTransaction;
- (void)commitTransaction;
- (void)rollbackTransaction;
- (void)transactionDidBegin;
- (void)transactionDidCommit;
- (void)transactionDidRollback;
- (BOOL)hasOpenTransaction;
- (BOOL)canNestTransactions; // override
- (unsigned)transactionNestingLevel;
+ (void)setDebugEnabledDefault: (BOOL)yn;
+ (BOOL)debugEnabledDefault;
- (void)setDebugEnabled: (BOOL)debugEnabled;
- (BOOL)isDebugEnabled;
@end /* EOAdaptorContext (EOTransactions) */
@interface EOAdaptorContext(Private)
- (void)_channelDidInit: (id)channel;
- (void)_channelWillDealloc: (id)channel;
@end
@interface NSObject (EOAdaptorContextDelegation)
- (BOOL)adaptorContextShouldConnect: (id)context;
- (BOOL)adaptorContextShouldBegin: (id)context;
- (void)adaptorContextDidBegin: (id)context;
- (BOOL)adaptorContextShouldCommit: (id)context;
- (void)adaptorContextDidCommit: (id)context;
- (BOOL)adaptorContextShouldRollback: (id)context;
- (void)adaptorContextDidRollback: (id)context;
@end /* NSObject(EOAdaptorContextDelegate) */
GDL2ACCESS_EXPORT NSString *EOAdaptorContextBeginTransactionNotification;
GDL2ACCESS_EXPORT NSString *EOAdaptorContextCommitTransactionNotification;
GDL2ACCESS_EXPORT NSString *EOAdaptorContextRollbackTransactionNotification;
#endif /* __EOAdaptorContext_h__*/