GNUstep Core Data 0.1
NSPersistentStoreCoordinator.h
1/* Interface of the NSPersistentStoreCoordinator class for the GNUstep
2 Core Data framework.
3 Copyright (C) 2005 Free Software Foundation, Inc.
4
5 Written by: Saso Kiselkov <diablos@manga.sk>
6 Date: August 2005
7
8 This file is part of the GNUstep Core Data framework.
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free
22 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
23 */
24
25#ifndef _NSPersistentStoreCoordinator_h_
26#define _NSPersistentStoreCoordinator_h_
27
28#import <Foundation/NSObject.h>
29#import <Foundation/NSLock.h>
30
31@class NSString,
32 NSDictionary,
33 NSMutableDictionary,
34 NSURL,
35 NSError;
36@class NSManagedObjectModel,
38
39// Persistent store types.
40extern NSString * const NSSQLiteStoreType;
41extern NSString * const NSXMLStoreType;
42extern NSString * const NSBinaryStoreType;
43extern NSString * const NSInMemoryStoreType;
44
45// Persistent store option keys.
46extern NSString * const NSReadOnlyPersistentStoreOption;
47extern NSString * const NSValidateXMLStoreOption;
48
49// Persistent store type keys.
50extern NSString * const NSStoreTypeKey;
51extern NSString * const NSStoreUUIDKey;
52
53@interface NSPersistentStoreCoordinator : NSObject <NSLocking>
54{
55 NSManagedObjectModel * _model;
56
57 // a dictionary where stores are keyed to their URLs
58 NSMutableDictionary * _persistentStores;
59 NSRecursiveLock * _lock;
60
71 BOOL _configurationSet;
72 // YES if the first added store passed a non-nil configuration,
73 // NO otherwise.
74 BOOL _multipleConfigurationsAllowed;
75
82 BOOL _acquiredModel;
83}
84
85// Initialization.
86- (id) initWithManagedObjectModel: (NSManagedObjectModel *) aModel;
87- (NSManagedObjectModel *) managedObjectModel;
88
89// Managing the persistent stores.
90- (id) addPersistentStoreWithType: (NSString *) aStoreType
91 configuration: (NSString *) aConfiguration
92 URL: (NSURL *) aStoreURL
93 options: (NSDictionary *) someOptions
94 error: (NSError **) anErrorPointer;
95
96- (BOOL) removePersistentStore: (id) aPersistentStore
97 error: (NSError **) errorPointer;
98
99- (id) migratePersistentStore: (id) aPersistentStore
100 toURL: (NSURL *) aURL
101 options: (NSDictionary *) options
102 withType: (NSString *) newStoreType
103 error: (NSError **) errorPointer;
104
105- (NSArray *) persistentStores;
106- (id) persistentStoreForURL: (NSURL *) aURL;
107- (NSURL *) URLForPersistentStore: (id) aPersistentStore;
108
109// Locking.
110- (void) lock;
111- (void) unlock;
112- (BOOL) tryLock;
113
114// Store meta-data handling.
115+ (NSDictionary *) metadataForPersistentStoreWithURL: (NSURL *) aUrl
116 error: (NSError **) errorPtr;
117- (NSDictionary *) metadataForPersistentStore: (id) store;
118- (void) setMetadata: (NSDictionary *) metadata
119 forPersistentStore: (id) store;
120
121// Getting managed object IDs.
122- (NSManagedObjectID *) managedObjectIDForURIRepresentation: (NSURL *) uri;
123
124@end
125
126#endif // _NSPersistentStoreCoordinator_h_
For implementation notes see "Documentation/NSManagedObjectID.txt" in the source distribution of the ...