NSPersistentStore.m
1 #import <CoreData/NSPersistentStore.h> 2 #import <CoreData/NSPersistentStoreCoordinator.h> 3 #import <CoreFoundation/CFUUID.h> 4 #import <Foundation/NSDictionary.h> 5 #import <Foundation/NSRaise.h> 6 7 @implementation NSPersistentStore 8 9 + (NSDictionary *) metadataForPersistentStoreWithURL: (NSURL *) url 10 error: (NSError **) error 11 { 12 NSInvalidAbstractInvocation(); 13 return nil; 14 } 15 16 + (BOOL) setMetadata: (NSDictionary *) metadata 17 forPersistentStoreWithURL: (NSURL *) url 18 error: (NSError **) error 19 { 20 NSInvalidAbstractInvocation(); 21 return 0; 22 } 23 24 + (Class) migrationManagerClass { 25 NSUnimplementedMethod(); 26 return 0; 27 } 28 29 - initWithPersistentStoreCoordinator: (NSPersistentStoreCoordinator *) root 30 configurationName: (NSString *) name 31 URL: (NSURL *) url 32 options: (NSDictionary *) options 33 { 34 _coordinator = root; 35 _configurationName = [name copy]; 36 _url = [url copy]; 37 _options = [options copy]; 38 _isReadOnly = NO; 39 CFUUIDRef uuid = CFUUIDCreate(NULL); 40 _identifier = (NSString *) CFUUIDCreateString(NULL, uuid); 41 CFRelease(uuid); 42 43 return self; 44 } 45 46 - (void) dealloc { 47 [_identifier release]; 48 [super dealloc]; 49 } 50 51 - (NSString *) type { 52 NSInvalidAbstractInvocation(); 53 return 0; 54 } 55 56 - (NSPersistentStoreCoordinator *) persistentStoreCoordinator { 57 return _coordinator; 58 } 59 60 - (NSString *) configurationName { 61 return _configurationName; 62 } 63 64 - (NSURL *) URL { 65 return _url; 66 } 67 68 - (NSDictionary *) options { 69 return _options; 70 } 71 72 - (BOOL) isReadOnly { 73 return _isReadOnly; 74 } 75 76 - (NSString *) identifier { 77 return _identifier; 78 } 79 80 - (NSDictionary *) metadata { 81 return [NSDictionary 82 dictionaryWithObjectsAndKeys: [self identifier], NSStoreUUIDKey, 83 [self type], NSStoreTypeKey, nil]; 84 } 85 86 - (void) setURL: (NSURL *) value { 87 value = [value copy]; 88 [_url release]; 89 _url = value; 90 } 91 92 - (void) setReadOnly: (BOOL) value { 93 NSUnimplementedMethod(); 94 } 95 96 - (void) setIdentifier: (NSString *) value { 97 value = [value copy]; 98 [_identifier release]; 99 _identifier = value; 100 } 101 102 - (void) setMetadata: (NSDictionary *) value { 103 NSUnimplementedMethod(); 104 } 105 106 - (BOOL) loadMetadata: (NSError **) error { 107 NSUnimplementedMethod(); 108 } 109 110 - (void) willRemoveFromPersistentStoreCoordinator: 111 (NSPersistentStoreCoordinator *) coordinator 112 { 113 // Default implementation does nothing 114 } 115 116 - (void) didAddToPersistentStoreCoordinator: 117 (NSPersistentStoreCoordinator *) coordinator 118 { 119 // Default implementation does nothing 120 } 121 122 - (NSString *) description { 123 return [NSString stringWithFormat: @"<%@ %p URL=%@>", [self class], self, 124 [self URL]]; 125 } 126 127 @end