Author: torehalset
Date: Mon Sep  4 12:53:52 2006
New Revision: 440161

URL: http://svn.apache.org/viewvc?view=rev&rev=440161
Log:
 * started to implement arc handling and CAYManagedArray
 * some memory-cleanups

Added:
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.h
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.h
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.h
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.m
Modified:
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYCocoaCayenne.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.h
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectId.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToManyFault.m
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToOneFault.m
    
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj

Added: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.h
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.h?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.h 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.h 
Mon Sep  4 12:53:52 2006
@@ -0,0 +1,37 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import "CAYNodeDiff.h"
+
[EMAIL PROTECTED] CAYArcCreateOperation : CAYNodeDiff <NSCoding> {
+
+    NSObject *targetNodeId;
+    NSObject *arcId;
+    
+}
+
+-(id)initWithNodeId:(NSObject *)nid targetNodeId:(NSObject *)tnid 
arcId:(NSObject *)aid;
+
+-(void)setTargetNodeId:(NSObject *)o;
+-(NSObject *)targetNodeId;
+-(void)setArcId:(NSObject *)o;
+-(NSObject *)arcId;
+
[EMAIL PROTECTED]

Added: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.m?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.m 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcCreateOperation.m 
Mon Sep  4 12:53:52 2006
@@ -0,0 +1,83 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import "CAYArcCreateOperation.h"
+
+
[EMAIL PROTECTED] CAYArcCreateOperation
+
+-(id)initWithNodeId:(NSObject *)nid targetNodeId:(NSObject *)tnid 
arcId:(NSObject *)aid
+{
+    self = [super initWithNodeId:nid];
+    if(self)
+    {
+        [self setTargetNodeId:tnid];
+        [self setArcId:aid];
+    }
+    return self;
+}
+
+-(id)initWithCoder:(NSCoder*)coder
+{
+       [super initWithCoder:coder];
+    [self setTargetNodeId:[coder decodeObjectForKey:@"targetNodeId"]];
+    [self setArcId:[coder decodeObjectForKey:@"arcId"]];
+       return self;
+}
+
+-(void)encodeWithCoder:(NSCoder*)coder
+{
+    [super encodeWithCoder:coder];
+       [coder encodeObject:targetNodeId forKey:@"targetNodeId"];
+       [coder encodeObject:arcId forKey:@"arcId"];
+}
+
+-(void)setTargetNodeId:(NSObject *)o
+{
+    [o retain];
+    [targetNodeId release];
+    targetNodeId = o;
+}
+
+-(NSObject *)targetNodeId
+{
+    return targetNodeId;
+}
+
+-(void)setArcId:(NSObject *)o
+{
+    [o retain];
+    [arcId release];
+    arcId = o;
+}
+
+-(NSObject *)arcId
+{
+    return arcId;
+}
+
+-(void)dealloc
+{
+       [self setTargetNodeId:nil];
+       [self setArcId:nil];
+       [super dealloc];
+}
+
+
[EMAIL PROTECTED]

Added: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.h
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.h?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.h 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.h 
Mon Sep  4 12:53:52 2006
@@ -0,0 +1,37 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import "CAYNodeDiff.h"
+
[EMAIL PROTECTED] CAYArcDeleteOperation : CAYNodeDiff <NSCoding> {
+
+    NSObject *targetNodeId;
+    NSObject *arcId;
+    
+}
+
+-(id)initWithNodeId:(NSObject *)nid targetNodeId:(NSObject *)tnid 
arcId:(NSObject *)aid;
+
+-(void)setTargetNodeId:(NSObject *)o;
+-(NSObject *)targetNodeId;
+-(void)setArcId:(NSObject *)o;
+-(NSObject *)arcId;
+
[EMAIL PROTECTED]

Added: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.m?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.m 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArcDeleteOperation.m 
Mon Sep  4 12:53:52 2006
@@ -0,0 +1,82 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import "CAYArcDeleteOperation.h"
+
+
[EMAIL PROTECTED] CAYArcDeleteOperation
+
+-(id)initWithNodeId:(NSObject *)nid targetNodeId:(NSObject *)tnid 
arcId:(NSObject *)aid
+{
+    self = [super initWithNodeId:nid];
+    if(self)
+    {
+        [self setTargetNodeId:tnid];
+        [self setArcId:aid];
+    }
+    return self;
+}
+
+-(id)initWithCoder:(NSCoder*)coder
+{
+       [super initWithCoder:coder];
+    [self setTargetNodeId:[coder decodeObjectForKey:@"targetNodeId"]];
+    [self setArcId:[coder decodeObjectForKey:@"arcId"]];
+       return self;
+}
+
+-(void)encodeWithCoder:(NSCoder*)coder
+{
+    [super encodeWithCoder:coder];
+       [coder encodeObject:targetNodeId forKey:@"targetNodeId"];
+       [coder encodeObject:arcId forKey:@"arcId"];
+}
+
+-(void)setTargetNodeId:(NSObject *)o
+{
+    [o retain];
+    [targetNodeId release];
+    targetNodeId = o;
+}
+
+-(NSObject *)targetNodeId
+{
+    return targetNodeId;
+}
+
+-(void)setArcId:(NSObject *)o
+{
+    [o retain];
+    [arcId release];
+    arcId = o;
+}
+
+-(NSObject *)arcId
+{
+    return arcId;
+}
+
+-(void)dealloc
+{
+       [self setTargetNodeId:nil];
+       [self setArcId:nil];
+       [super dealloc];
+}
+
[EMAIL PROTECTED]

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYCocoaCayenne.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYCocoaCayenne.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYCocoaCayenne.m 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYCocoaCayenne.m Mon 
Sep  4 12:53:52 2006
@@ -47,6 +47,8 @@
     [classMapping setObject:@"CAYNodePropertyChangeOperation" 
forKey:@"org.objectstyle.cayenne.graph.NodePropertyChangeOperation"];
     [classMapping setObject:@"CAYNodeDeleteOperation" 
forKey:@"org.objectstyle.cayenne.graph.NodeDeleteOperation"];
     [classMapping setObject:@"CAYNodeIdChangeOperation" 
forKey:@"org.objectstyle.cayenne.graph.NodeIdChangeOperation"];
+    [classMapping setObject:@"CAYArcCreateOperation" 
forKey:@"org.objectstyle.cayenne.graph.ArcCreateOperation"];
+    [classMapping setObject:@"CAYArcDeleteOperation" 
forKey:@"org.objectstyle.cayenne.graph.ArcDeleteOperation"];
     
     return classMapping;
 }

Added: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.h
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.h?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.h 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.h Mon 
Sep  4 12:53:52 2006
@@ -0,0 +1,31 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import "CAYObjectContext.h"
+
[EMAIL PROTECTED] CAYManagedArray : NSMutableArray {
+    NSMutableArray *content;
+    CAYObjectContext *objectContext;
+}
+
+-(void)setObjectContext:(CAYObjectContext *)ctxt;
+-(CAYObjectContext *)objectContext;
+
[EMAIL PROTECTED]

Added: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.m?view=auto&rev=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.m 
(added)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYManagedArray.m Mon 
Sep  4 12:53:52 2006
@@ -0,0 +1,100 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+#import "CAYManagedArray.h"
+#import "CAYPersistentObject.h"
+
[EMAIL PROTECTED] CAYManagedArray
+
+-(id)init
+{
+    self = [super init];
+    if(self)
+    {
+       content = [[NSMutableArray alloc] init];
+    }
+    return self;
+}
+
+- (unsigned)count
+{
+    return [content count];
+}
+
+- (id)objectAtIndex:(unsigned)index
+{
+    return [content objectAtIndex:index];
+}
+
+- (void)addObject:(id)anObject
+{
+    if([anObject isKindOfClass:[CAYPersistentObject class]])
+    {
+        if(![anObject objectContext])
+        {
+            [[self objectContext] registerNewObject:anObject];
+        }
+    }
+    [content addObject:anObject];
+}
+
+- (void)insertObject:(id)anObject atIndex:(unsigned)index
+{
+    [content insertObject:anObject atIndex:index];
+}
+
+- (void)removeLastObject
+{
+    [content removeLastObject];
+}
+
+- (void)removeObjectAtIndex:(unsigned)index
+{
+    [content removeObjectAtIndex:index];
+}
+
+- (void)replaceObjectAtIndex:(unsigned)index withObject:(id)anObject
+{
+    [content replaceObjectAtIndex:index withObject:anObject];
+}
+
+-(void)setObjectContext:(CAYObjectContext *)ctxt
+{
+    // do not need to retain/release as ctxt is our master
+       //[ctxt retain];
+       //[objectContext release];
+       objectContext = ctxt;
+}
+
+-(CAYObjectContext *)objectContext
+{
+       return objectContext;
+}
+
+
+-(void)dealloc
+{
+    [content release];
+    content = nil;
+    [self setObjectContext:nil];
+       [super dealloc];
+}
+
+
[EMAIL PROTECTED]

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.h
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.h?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.h 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.h Mon 
Sep  4 12:53:52 2006
@@ -28,9 +28,10 @@
        CAYClientConnection *connection;
     NSMutableArray *diffs;
     CAYEntityResolver *entityResolver;
+    NSMutableDictionary *objectByObjectId;
 }
 
--(NSArray *)performQyery:(CAYQuery *)q;
+-(NSArray *)performQuery:(CAYQuery *)q;
 
 -(void)setConnection:(CAYClientConnection *)c;
 -(CAYClientConnection *)connection;

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m Mon 
Sep  4 12:53:52 2006
@@ -43,11 +43,12 @@
     if(self != nil)
     {
         diffs = [[NSMutableArray array] retain];
+        objectByObjectId = [[NSMutableDictionary alloc] init];
     }
     return self;
 }
 
--(NSArray *)performQyery:(CAYQuery *)query
+-(NSArray *)performQuery:(CAYQuery *)query
 {
        CAYQueryMessage *queryMessage = [[CAYQueryMessage alloc] init];
        [queryMessage setQuery:query];
@@ -65,6 +66,20 @@
         id row = [rows objectAtIndex:i];
         if([row isKindOfClass:[CAYPersistentObject class]])
         {
+        
+            // try to look for old with same context
+            CAYPersistentObject *old = (CAYPersistentObject 
*)[objectByObjectId objectForKey:[row objectId]];
+            if(old)
+            {
+                NSLog(@"old exist for oid %@", [row objectId]);
+                // TODO: copy new into old
+            }
+            else
+            {
+                NSLog(@"old does not exist for oid %@", [row objectId]);
+                [objectByObjectId setObject:row forKey:[row objectId]];
+            }
+        
             [row setObjectContext:self];
             // TODO: set initial persistant state
             // TODO: check for existing objects in context with same ObjectId
@@ -96,6 +111,8 @@
             {
                 NSLog(@"ERROR: Could not find ObjEntity for class %@", [row 
class]);
             }
+            
+            
         }
     }
     
@@ -136,8 +153,6 @@
     [bootstrapMsg release];
     
     // update class mapping based on EntityResolver
-    //[[self entityResolver] updateClassMapping];
-    //[[self connection] updateClassMapping];
     [self updateClassMapping];
 }
 
@@ -209,7 +224,22 @@
     [diffs addObject:diff];
     [diff release];
     
+    [objectByObjectId setObject:o forKey:oid];
+    
     // TODO: init values with NSNull objects?
+    
+    NSEnumerator *enumerator = [[objEntity attributes] objectEnumerator];
+    NSString *attribute;
+    while(attribute = [enumerator nextObject])
+    {
+        NSLog(@"check if object has value for %@", attribute);
+        if(![[o valuesRaw] objectForKey:attribute])
+        {
+            NSLog(@"setting %@ to NSNull", attribute);
+            [[o valuesRaw] setObject:[NSNull null] forKey:attribute];
+        }
+    }
+    
     [randomdata release];
     [oid release];
     [o release];
@@ -248,8 +278,11 @@
 -(void)dealloc
 {
        [self setConnection:nil];
-    [diffs release];
     [self setEntityResolver:nil];
+    [diffs release];
+    diffs = nil;
+    [objectByObjectId release];
+    objectByObjectId = nil;
        [super dealloc];
 }
 

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectId.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectId.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectId.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectId.m Mon Sep  
4 12:53:52 2006
@@ -195,5 +195,15 @@
     return result;
 }
 
+-(void)dealloc
+{
+    [self setEntityName:nil];
+    [self setObjectIdKeys:nil];
+    [self setSingleKey:nil];
+    [self setSingleValue:nil];
+    [self setTempKey:nil];
+    [self setReplacementIdMap:nil];
+       [super dealloc];
+}
 
 @end

Modified: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m 
Mon Sep  4 12:53:52 2006
@@ -71,8 +71,9 @@
 
 -(void)setObjectContext:(CAYObjectContext *)ctxt
 {
-       [ctxt retain];
-       [objectContext release];
+    // do not need to retain/release as ctxt is our master
+       //[ctxt retain];
+       //[objectContext release];
        objectContext = ctxt;
 }
 
@@ -135,9 +136,10 @@
 
 -(void)dealloc
 {
-       [objectId release];
-       [objectContext release];
+    [self setObjectId:nil];
+    [self setObjectContext:nil];
     [values release];
+    values = nil;
        [super dealloc];
 }
 

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToManyFault.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToManyFault.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToManyFault.m 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToManyFault.m Mon 
Sep  4 12:53:52 2006
@@ -21,6 +21,7 @@
 #import "CAYFault.h"
 #import "CAYRelationshipQuery.h"
 #import "CAYObjectContext.h"
+#import "CAYManagedArray.h"
 
 @implementation CAYToManyFault
 
@@ -33,18 +34,16 @@
     [q setRelationshipName:[self relationshipName]];
     
     CAYObjectContext *ctxt = [[self sourceObject] objectContext];
-    NSArray *rows = (NSArray *)[ctxt performQyery:q];
+    NSArray *rows = (NSArray *)[ctxt performQuery:q];
     [q release];
-    return rows;
+    //return rows;
     
     // TODO: create a collection that will autoadd new objects to the context? 
check with Core Data
-    /*
     CAYManagedArray *managedRows = [[CAYManagedArray alloc] init];
     [managedRows setArray:rows];
     [managedRows setObjectContext:ctxt];
     
     return [managedRows autorelease];
-    */
 }
 
 @end

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToOneFault.m
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToOneFault.m?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToOneFault.m 
(original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYToOneFault.m Mon Sep 
 4 12:53:52 2006
@@ -33,7 +33,7 @@
     [q setRelationshipName:[self relationshipName]];
     
     CAYObjectContext *ctxt = [[self sourceObject] objectContext];
-    NSArray *rows = (NSArray *)[ctxt performQyery:q];
+    NSArray *rows = (NSArray *)[ctxt performQuery:q];
     CAYPersistentObject *row = nil;
     if([rows count] == 1)
     {

Modified: 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj?view=diff&rev=440161&r1=440160&r2=440161
==============================================================================
--- 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj
 (original)
+++ 
incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj
 Mon Sep  4 12:53:52 2006
@@ -63,6 +63,12 @@
                4448AA440AA4C55F002C2FA7 /* CAYNodeDeleteOperation.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = 4448AA420AA4C55F002C2FA7 /* 
CAYNodeDeleteOperation.m */; };
                444DA8050AA61E54006E1768 /* CAYCocoaCayenne.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 444DA8030AA61E54006E1768 /* CAYCocoaCayenne.h 
*/; settings = {ATTRIBUTES = (Public, ); }; };
                444DA8060AA61E54006E1768 /* CAYCocoaCayenne.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 444DA8040AA61E54006E1768 /* CAYCocoaCayenne.m 
*/; };
+               444DA9FD0AA640B8006E1768 /* CAYManagedArray.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 444DA9FB0AA640B8006E1768 /* CAYManagedArray.h 
*/; settings = {ATTRIBUTES = (Public, ); }; };
+               444DA9FE0AA640B8006E1768 /* CAYManagedArray.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 444DA9FC0AA640B8006E1768 /* CAYManagedArray.m 
*/; };
+               444DAB190AACB74C006E1768 /* CAYArcCreateOperation.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = 444DAB170AACB74C006E1768 /* 
CAYArcCreateOperation.h */; };
+               444DAB1A0AACB74C006E1768 /* CAYArcCreateOperation.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = 444DAB180AACB74C006E1768 /* 
CAYArcCreateOperation.m */; };
+               444DAB270AACB7B1006E1768 /* CAYArcDeleteOperation.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = 444DAB250AACB7B1006E1768 /* 
CAYArcDeleteOperation.h */; };
+               444DAB280AACB7B1006E1768 /* CAYArcDeleteOperation.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = 444DAB260AACB7B1006E1768 /* 
CAYArcDeleteOperation.m */; };
                44FE798F0AA3790C0040BB78 /* HessianObjC.framework in Frameworks 
*/ = {isa = PBXBuildFile; fileRef = 44FE798E0AA3790C0040BB78 /* 
HessianObjC.framework */; };
                8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = 
{isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings 
*/; };
                8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; 
};
@@ -130,6 +136,12 @@
                4448AA420AA4C55F002C2FA7 /* CAYNodeDeleteOperation.m */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; 
path = CAYNodeDeleteOperation.m; sourceTree = "<group>"; };
                444DA8030AA61E54006E1768 /* CAYCocoaCayenne.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
CAYCocoaCayenne.h; sourceTree = "<group>"; };
                444DA8040AA61E54006E1768 /* CAYCocoaCayenne.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= CAYCocoaCayenne.m; sourceTree = "<group>"; };
+               444DA9FB0AA640B8006E1768 /* CAYManagedArray.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
CAYManagedArray.h; sourceTree = "<group>"; };
+               444DA9FC0AA640B8006E1768 /* CAYManagedArray.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= CAYManagedArray.m; sourceTree = "<group>"; };
+               444DAB170AACB74C006E1768 /* CAYArcCreateOperation.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
CAYArcCreateOperation.h; sourceTree = "<group>"; };
+               444DAB180AACB74C006E1768 /* CAYArcCreateOperation.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= CAYArcCreateOperation.m; sourceTree = "<group>"; };
+               444DAB250AACB7B1006E1768 /* CAYArcDeleteOperation.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
CAYArcDeleteOperation.h; sourceTree = "<group>"; };
+               444DAB260AACB7B1006E1768 /* CAYArcDeleteOperation.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= CAYArcDeleteOperation.m; sourceTree = "<group>"; };
                44FE798E0AA3790C0040BB78 /* HessianObjC.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
HessianObjC.framework; path = /Library/Frameworks/HessianObjC.framework; 
sourceTree = "<absolute>"; };
                8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = 
Info.plist; sourceTree = "<group>"; };
                8DC2EF5B0486A6940098B216 /* CocoaCayenne.framework */ = {isa = 
PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; 
path = CocoaCayenne.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -191,6 +203,7 @@
                08FB77AEFE84172EC02AAC07 /* Classes */ = {
                        isa = PBXGroup;
                        children = (
+                               444DA9FA0AA6409E006E1768 /* collection */,
                                444DA8AC0AA62727006E1768 /* connection */,
                                44463DCB0AA3757F006BAA58 /* fault */,
                                44463DCC0AA37586006BAA58 /* message */,
@@ -289,6 +302,10 @@
                                4448AA420AA4C55F002C2FA7 /* 
CAYNodeDeleteOperation.m */,
                                4421E61C0AA4EE2D00FBE975 /* 
CAYNodeIdChangeOperation.h */,
                                4421E61D0AA4EE2D00FBE975 /* 
CAYNodeIdChangeOperation.m */,
+                               444DAB170AACB74C006E1768 /* 
CAYArcCreateOperation.h */,
+                               444DAB180AACB74C006E1768 /* 
CAYArcCreateOperation.m */,
+                               444DAB250AACB7B1006E1768 /* 
CAYArcDeleteOperation.h */,
+                               444DAB260AACB7B1006E1768 /* 
CAYArcDeleteOperation.m */,
                        );
                        name = graph;
                        sourceTree = "<group>";
@@ -317,6 +334,15 @@
                        name = connection;
                        sourceTree = "<group>";
                };
+               444DA9FA0AA6409E006E1768 /* collection */ = {
+                       isa = PBXGroup;
+                       children = (
+                               444DA9FB0AA640B8006E1768 /* CAYManagedArray.h 
*/,
+                               444DA9FC0AA640B8006E1768 /* CAYManagedArray.m 
*/,
+                       );
+                       name = collection;
+                       sourceTree = "<group>";
+               };
 /* End PBXGroup section */
 
 /* Begin PBXHeadersBuildPhase section */
@@ -352,6 +378,9 @@
                                4448AA430AA4C55F002C2FA7 /* 
CAYNodeDeleteOperation.h in Headers */,
                                4421E61E0AA4EE2D00FBE975 /* 
CAYNodeIdChangeOperation.h in Headers */,
                                444DA8050AA61E54006E1768 /* CAYCocoaCayenne.h 
in Headers */,
+                               444DA9FD0AA640B8006E1768 /* CAYManagedArray.h 
in Headers */,
+                               444DAB190AACB74C006E1768 /* 
CAYArcCreateOperation.h in Headers */,
+                               444DAB270AACB7B1006E1768 /* 
CAYArcDeleteOperation.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -437,6 +466,9 @@
                                4448AA440AA4C55F002C2FA7 /* 
CAYNodeDeleteOperation.m in Sources */,
                                4421E61F0AA4EE2D00FBE975 /* 
CAYNodeIdChangeOperation.m in Sources */,
                                444DA8060AA61E54006E1768 /* CAYCocoaCayenne.m 
in Sources */,
+                               444DA9FE0AA640B8006E1768 /* CAYManagedArray.m 
in Sources */,
+                               444DAB1A0AACB74C006E1768 /* 
CAYArcCreateOperation.m in Sources */,
+                               444DAB280AACB7B1006E1768 /* 
CAYArcDeleteOperation.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };


Reply via email to