Initial implementation of 'others shared'.
authorMiltiadis Vasilakis <mvasilak@gmail.com>
Wed, 28 Sep 2011 14:04:59 +0000 (17:04 +0300)
committerMiltiadis Vasilakis <mvasilak@gmail.com>
Wed, 28 Sep 2011 14:04:59 +0000 (17:04 +0300)
21 files changed:
pithos-apple-common
pithos-macos.xcodeproj/project.pbxproj
pithos-macos/AllowedToBoolTransformer.h [new file with mode: 0644]
pithos-macos/AllowedToBoolTransformer.m [new file with mode: 0644]
pithos-macos/PithosAccountNode.m
pithos-macos/PithosBrowserController.h
pithos-macos/PithosBrowserController.m
pithos-macos/PithosContainerNode.m
pithos-macos/PithosContainerNodeInfoController.xib
pithos-macos/PithosFileUtilities.h
pithos-macos/PithosFileUtilities.m
pithos-macos/PithosNode.h
pithos-macos/PithosNode.m
pithos-macos/PithosObjectNode.m
pithos-macos/PithosObjectNodeInfoController.xib
pithos-macos/PithosSharingAccountsNode.h [new file with mode: 0644]
pithos-macos/PithosSharingAccountsNode.m [new file with mode: 0644]
pithos-macos/PithosSubdirNode.m
pithos-macos/SharingAccountBoolTransformer.h [new file with mode: 0644]
pithos-macos/SharingAccountBoolTransformer.m [new file with mode: 0644]
pithos-macos/pithos_macosAppDelegate.m

index 13bc2a4..83e121f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 13bc2a4ea0abb34059558ef6307feff936b083eb
+Subproject commit 83e121faad77eff1bba9a13b42992429d381359d
index de84be8..fb4709b 100644 (file)
@@ -44,6 +44,9 @@
                6139837113EFEECC004CE444 /* FileSystemBrowserCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6139837013EFEECC004CE444 /* FileSystemBrowserCell.m */; };
                61433BC9141BA1CE00CD978D /* HashMapHash.m in Sources */ = {isa = PBXBuildFile; fileRef = 61433BC8141BA1CE00CD978D /* HashMapHash.m */; };
                614592BC1417CE70002E7A8C /* ASIPithosAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 614592BB1417CE70002E7A8C /* ASIPithosAccount.m */; };
+               6152D08C143200CC00803874 /* PithosSharingAccountsNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6152D08B143200CC00803874 /* PithosSharingAccountsNode.m */; };
+               6152D092143334CC00803874 /* AllowedToBoolTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6152D091143334CC00803874 /* AllowedToBoolTransformer.m */; };
+               6152D095143334E000803874 /* SharingAccountBoolTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6152D094143334E000803874 /* SharingAccountBoolTransformer.m */; };
                615615DD140CECDB00017BD4 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 615615DC140CECDB00017BD4 /* libz.dylib */; };
                615A444E140F8A5700308614 /* MetadataKeyTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 615A444D140F8A5700308614 /* MetadataKeyTransformer.m */; };
                615A4451140F8A7F00308614 /* MetadataKeyFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 615A4450140F8A7F00308614 /* MetadataKeyFormatter.m */; };
                61433BC8141BA1CE00CD978D /* HashMapHash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HashMapHash.m; path = "pithos-macos/HashMapHash.m"; sourceTree = "<group>"; };
                614592BA1417CE70002E7A8C /* ASIPithosAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIPithosAccount.h; sourceTree = "<group>"; };
                614592BB1417CE70002E7A8C /* ASIPithosAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIPithosAccount.m; sourceTree = "<group>"; };
+               6152D08A143200CB00803874 /* PithosSharingAccountsNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PithosSharingAccountsNode.h; sourceTree = "<group>"; };
+               6152D08B143200CC00803874 /* PithosSharingAccountsNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PithosSharingAccountsNode.m; sourceTree = "<group>"; };
+               6152D090143334CC00803874 /* AllowedToBoolTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AllowedToBoolTransformer.h; path = "pithos-macos/AllowedToBoolTransformer.h"; sourceTree = "<group>"; };
+               6152D091143334CC00803874 /* AllowedToBoolTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AllowedToBoolTransformer.m; path = "pithos-macos/AllowedToBoolTransformer.m"; sourceTree = "<group>"; };
+               6152D093143334E000803874 /* SharingAccountBoolTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharingAccountBoolTransformer.h; path = "pithos-macos/SharingAccountBoolTransformer.h"; sourceTree = "<group>"; };
+               6152D094143334E000803874 /* SharingAccountBoolTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SharingAccountBoolTransformer.m; path = "pithos-macos/SharingAccountBoolTransformer.m"; sourceTree = "<group>"; };
                615615DC140CECDB00017BD4 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
                615A444C140F8A5700308614 /* MetadataKeyTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MetadataKeyTransformer.h; path = "pithos-macos/MetadataKeyTransformer.h"; sourceTree = "<group>"; };
                615A444D140F8A5700308614 /* MetadataKeyTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MetadataKeyTransformer.m; path = "pithos-macos/MetadataKeyTransformer.m"; sourceTree = "<group>"; };
                                610DD36313E6E2E400ED982F /* PithosAccountNode.m */,
                                610DD36513E6E69D00ED982F /* PithosContainerNode.h */,
                                610DD36613E6E69D00ED982F /* PithosContainerNode.m */,
-                               610DD37013E7059800ED982F /* PithosObjectNode.h */,
-                               610DD37113E7059900ED982F /* PithosObjectNode.m */,
                                610DD37313E7064E00ED982F /* PithosSubdirNode.h */,
                                610DD37413E7064F00ED982F /* PithosSubdirNode.m */,
+                               610DD37013E7059800ED982F /* PithosObjectNode.h */,
+                               610DD37113E7059900ED982F /* PithosObjectNode.m */,
+                               6152D08A143200CB00803874 /* PithosSharingAccountsNode.h */,
+                               6152D08B143200CC00803874 /* PithosSharingAccountsNode.m */,
                                611FFCAD13EBF0B800E43E18 /* PithosEmptyNode.h */,
                                611FFCAE13EBF0B900E43E18 /* PithosEmptyNode.m */,
                                61C24BEA14161EC0007004DC /* PithosFileUtilities.h */,
                610DD33013E6BD8B00ED982F /* Pithos */ = {
                        isa = PBXGroup;
                        children = (
+                               610DD33B13E6BD8B00ED982F /* ASIPithosRequest.h */,
+                               610DD33C13E6BD8B00ED982F /* ASIPithosRequest.m */,
                                610DD33113E6BD8B00ED982F /* ASIPithosAccountRequest.h */,
                                610DD33213E6BD8B00ED982F /* ASIPithosAccountRequest.m */,
-                               610DD33313E6BD8B00ED982F /* ASIPithosContainer.h */,
-                               610DD33413E6BD8B00ED982F /* ASIPithosContainer.m */,
                                610DD33513E6BD8B00ED982F /* ASIPithosContainerRequest.h */,
                                610DD33613E6BD8B00ED982F /* ASIPithosContainerRequest.m */,
-                               610DD33713E6BD8B00ED982F /* ASIPithosObject.h */,
-                               610DD33813E6BD8B00ED982F /* ASIPithosObject.m */,
                                610DD33913E6BD8B00ED982F /* ASIPithosObjectRequest.h */,
                                610DD33A13E6BD8B00ED982F /* ASIPithosObjectRequest.m */,
-                               610DD33B13E6BD8B00ED982F /* ASIPithosRequest.h */,
-                               610DD33C13E6BD8B00ED982F /* ASIPithosRequest.m */,
                                614592BA1417CE70002E7A8C /* ASIPithosAccount.h */,
                                614592BB1417CE70002E7A8C /* ASIPithosAccount.m */,
+                               610DD33313E6BD8B00ED982F /* ASIPithosContainer.h */,
+                               610DD33413E6BD8B00ED982F /* ASIPithosContainer.m */,
+                               610DD33713E6BD8B00ED982F /* ASIPithosObject.h */,
+                               610DD33813E6BD8B00ED982F /* ASIPithosObject.m */,
                        );
                        name = Pithos;
                        path = "pithos-apple-common/asi-http-request-with-pithos/Classes/Pithos";
                                61C65ADE1428C578002597C2 /* CountTransformer.m */,
                                61C65AE11428D41C002597C2 /* PolicyVersioningTransformer.h */,
                                61C65AE21428D41C002597C2 /* PolicyVersioningTransformer.m */,
+                               6152D093143334E000803874 /* SharingAccountBoolTransformer.h */,
+                               6152D094143334E000803874 /* SharingAccountBoolTransformer.m */,
+                               6152D090143334CC00803874 /* AllowedToBoolTransformer.h */,
+                               6152D091143334CC00803874 /* AllowedToBoolTransformer.m */,
                        );
                        name = "Value Transformers";
                        sourceTree = "<group>";
                                61C65ADF1428C578002597C2 /* CountTransformer.m in Sources */,
                                61C65AE31428D41C002597C2 /* PolicyVersioningTransformer.m in Sources */,
                                61C65AE6142918DD002597C2 /* PithosObjectNodeInfoController.m in Sources */,
+                               6152D08C143200CC00803874 /* PithosSharingAccountsNode.m in Sources */,
+                               6152D092143334CC00803874 /* AllowedToBoolTransformer.m in Sources */,
+                               6152D095143334E000803874 /* SharingAccountBoolTransformer.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/pithos-macos/AllowedToBoolTransformer.h b/pithos-macos/AllowedToBoolTransformer.h
new file mode 100644 (file)
index 0000000..8cdcb79
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  AllowedToBoolTransformer.h
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+@interface AllowedToBoolTransformer : NSValueTransformer
+@end
diff --git a/pithos-macos/AllowedToBoolTransformer.m b/pithos-macos/AllowedToBoolTransformer.m
new file mode 100644 (file)
index 0000000..7cd0c8d
--- /dev/null
@@ -0,0 +1,60 @@
+//
+//  AllowedToBoolTransformer.m
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "AllowedToBoolTransformer.h"
+
+@implementation AllowedToBoolTransformer
+
++ (Class)transformedValueClass {
+       return [NSNumber class];
+}
+
++ (BOOL)allowsReverseTransformation {
+       return NO;
+}
+
+- (id)transformedValue:(id)value {
+    if (value == nil)
+        return [NSNumber numberWithBool:YES];
+    return [NSNumber numberWithBool:[(NSString *)value isEqualTo:@"write"]];
+}
+
++ (void)initialize {
+    [[NSValueTransformer class] setValueTransformer:[self new] forName:@"AllowedToBoolTransformer"];
+}
+
+@end
index 9d5afc9..1087fcf 100644 (file)
 #import "ASIDownloadCache.h"
 #import "PithosFileUtilities.h"
 
+static NSImage *sharedIcon = nil;
+
 @implementation PithosAccountNode
 
++ (void)initialize {
+       if (self == [PithosAccountNode class])
+        sharedIcon = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)] retain];
+}
+
 #pragma mark -
 #pragma mark Object Lifecycle
 
 #pragma mark Properties
 
 - (NSString *)url {
-    if (url == nil) 
-        url = [[ASIPithosRequest storageURL] copy];
+    if (url == nil)
+        url = [[NSString alloc] initWithFormat:@"%@%@", 
+               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
+               (shared ? @"?shared" : @"")];
     return url;
 }
 
@@ -74,6 +83,8 @@
                                                                                    marker:nil 
                                                                                    shared:shared 
                                                                                     until:nil] retain];
+                if (sharingAccount)
+                    [accountRequest setRequestUserFromDefaultTo:sharingAccount];
                 accountRequest.delegate = self;
                 accountRequest.didFinishSelector = @selector(accountRequestFinished:);
                 accountRequest.didFailSelector = @selector(accountRequestFailed:);
 }
 
 - (NSString *)displayName {
-    if (displayName == nil) {
-        displayName = [[NSString alloc] initWithString:@"account"];
-    }
-    return displayName;
+    if (displayName == nil)
+        return [NSString stringWithString:(sharingAccount ? sharingAccount : @"account")];
+    return [[displayName copy] autorelease];
+}
+
+- (NSImage *)icon {
+    if (icon == nil)
+        icon = [sharedIcon retain];
+    return icon;
 }
 
 #pragma mark -
             NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
             for (ASIPithosContainer *container in containers) {
                 PithosContainerNode *node = [[[PithosContainerNode alloc] initWithPithosContainer:container] autorelease];
+                node.parent = self;
+                node.shared = shared;
+                node.sharingAccount = sharingAccount;
                 if (children) {
                     NSUInteger oldIndex = [children indexOfObject:node];
                     if (oldIndex != NSNotFound) {
                         [keptNodes addIndex:oldIndex];
                     }
                 }
-                node.parent = self;
-                node.shared = shared;
                 [newChildren addObject:node];
             }
             [[children objectsAtIndexes:
                                                                            marker:[[someContainers lastObject] name] 
                                                                            shared:shared 
                                                                             until:nil] retain];
+        if (sharingAccount)
+            [accountRequest setRequestUserFromDefaultTo:sharingAccount];
         accountRequest.delegate = self;
         accountRequest.downloadCache = [ASIDownloadCache sharedCache];
         [accountRequest startAsynchronous];
index facd1b3..d94f433 100644 (file)
@@ -38,6 +38,7 @@
 #import <Cocoa/Cocoa.h>
 @class PithosNode;
 @class PithosAccountNode;
+@class PithosSharingAccountsNode;
 @class PithosEmptyNode;
 
 @interface PithosBrowserController : NSWindowController <NSBrowserDelegate, NSSplitViewDelegate, NSOutlineViewDelegate, NSMenuDelegate> {    
@@ -47,7 +48,7 @@
     NSMutableArray *containersNodeChildren;
     PithosEmptyNode *sharedNode;
     PithosAccountNode *mySharedNode;
-    PithosEmptyNode *othersSharedNode;
+    PithosSharingAccountsNode *othersSharedNode;
     
     NSViewController *sharedPreviewController;
     
index 832014e..aaa4e2a 100644 (file)
@@ -41,6 +41,7 @@
 #import "PithosContainerNode.h"
 #import "PithosSubdirNode.h"
 #import "PithosObjectNode.h"
+#import "PithosSharingAccountsNode.h"
 #import "PithosEmptyNode.h"
 #import "ImageAndTextCell.h"
 #import "FileSystemBrowserCell.h"
 - (void)resetContainers:(NSNotification *)notification {
     rootNode = nil;
     [browser loadColumnZero];
+    [containersNodeChildren removeAllObjects];
     [outlineView reloadData];
     
        // Expand the folder outline view
     mySharedNode.displayName = @"my shared";
     mySharedNode.shared = YES;
     mySharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
-    othersSharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"others shared" 
-                                                               icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)]];
+    othersSharedNode = [[PithosSharingAccountsNode alloc] init];
+    othersSharedNode.displayName = @"others shared";
+    othersSharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)];
     
     [[[outlineView tableColumns] objectAtIndex:0] setDataCell:[[[PithosOutlineViewCell alloc] init] autorelease]];
     
     // Register for updates
+    // PithosContainerNode updates browser nodes
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosNodeChildrenUpdated:) 
                                                  name:@"PithosContainerNodeChildrenUpdated" 
                                                object:nil];
+    // PithosSubdirNode updates browser nodes
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosNodeChildrenUpdated:) 
                                                  name:@"PithosSubdirNodeChildrenUpdated" 
                                                object:nil];
+    // PithosAccountNode accountNode updates outlineView container nodes 
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosAccountNodeChildrenUpdated:) 
                                                  name:@"PithosAccountNodeChildrenUpdated" 
                                                object:accountNode];
+    // PithosAccountNode other than accountNode updates nodes 
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosNodeChildrenUpdated:) 
                                                  name:@"PithosAccountNodeChildrenUpdated" 
-                                               object:mySharedNode];
+                                               object:nil];
+    // PithosSharingAccountsNode othersSharedNode updates browser nodes 
+    [[NSNotificationCenter defaultCenter] addObserver:self 
+                                             selector:@selector(pithosNodeChildrenUpdated:) 
+                                                 name:@"PithosSharingAccountsNodeChildrenUpdated" 
+                                               object:othersSharedNode];
+    // Updated authentication credentials reset containers in the outline view 
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(resetContainers:) 
                                                  name:@"PithosAuthenticationCredentialsUpdated" 
                                                object:nil];
+    // Request for browser refresh 
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosBrowserRefreshNeeded:) 
                                                  name:@"PithosBrowserRefreshNeeeded" 
 
 - (void)pithosNodeChildrenUpdated:(NSNotification *)notification {
     PithosNode *node = (PithosNode *)[notification object];
+    if (node == accountNode)
+        return;
     NSLog(@"pithosNodeChildrenUpdated:%@", node.url);
     NSInteger lastColumn = [browser lastColumn];
     for (NSInteger column = lastColumn; column >= 0; column--) {
 
 - (BOOL)browser:(NSBrowser *)browser shouldEditItem:(id)item {
     PithosNode *node = (PithosNode *)item;
-    if (node.shared || ([node class] == [PithosContainerNode class]))
+    if (node.shared || node.sharingAccount || 
+        ([node class] == [PithosContainerNode class]) || ([node class] == [PithosAccountNode class]))
         return NO;
     return YES;
 }
@@ -496,7 +513,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                     NSArray *objectRequests = [PithosFileUtilities objectDataRequestsForSubdirWithContainerName:node.pithosContainer.name 
                                                                                                      objectName:node.pithosObject.name 
                                                                                                     toDirectory:[dropDestination path] 
-                                                                                                  checkIfExists:YES];
+                                                                                                  checkIfExists:YES 
+                                                                                                 sharingAccount:node.sharingAccount];
                     if (objectRequests) {
                         for (ASIPithosObjectRequest *objectRequest in objectRequests) {
                             [names addObject:[objectRequest.userInfo valueForKey:@"fileName"]];
@@ -512,7 +530,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             ASIPithosObjectRequest *objectRequest = [PithosFileUtilities objectDataRequestWithContainerName:node.pithosContainer.name 
                                                                                                  objectName:node.pithosObject.name 
                                                                                                 toDirectory:[dropDestination path] 
-                                                                                              checkIfExists:YES];
+                                                                                              checkIfExists:YES 
+                                                                                             sharingAccount:node.sharingAccount];
             if (objectRequest) {
                 [names addObject:[objectRequest.userInfo valueForKey:@"fileName"]];
                 objectRequest.delegate = self;
@@ -539,13 +558,20 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             *row = -1;
         // Only allow dropping in folders
         if (*column != -1) {
+            PithosNode *dropNode;
             if (*row != -1) {
                 // Check if the node is not a folder and if so redirect to the parent item
-                if ([[browser itemAtRow:*row inColumn:*column] class] != [PithosSubdirNode class])
+                dropNode = [browser itemAtRow:*row inColumn:*column];
+                if ([dropNode class] != [PithosSubdirNode class])
                     *row = -1;
             }
-            *dropOperation = NSBrowserDropOn;
-            result = NSDragOperationCopy;
+            if (*row == -1)
+                dropNode = [browser parentForItemsInColumn:*column];
+            
+            if (!dropNode.shared && !dropNode.sharingAccount) {
+                *dropOperation = NSBrowserDropOn;
+                result = NSDragOperationCopy;
+            }
         }
     } else if ([[[info draggingPasteboard] types] containsObject:NSFilesPromisePboardType]) {
         // For a drop above, the drop is redirected to the parent item
@@ -563,7 +589,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             if (*row == -1)
                 dropNode = [browser parentForItemsInColumn:*column];
             
-            if (!dropNode.shared) {
+            if (!dropNode.shared && !dropNode.sharingAccount) {
                 if ([info draggingSourceOperationMask] & NSDragOperationMove) {
                     // NSDragOperationCopy | NSDragOperationMove -> NSDragOperationMove
                     if ((([dropNode class] == [PithosContainerNode class]) || 
@@ -811,7 +837,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                                                                                                                  objectName:node.pithosObject.name 
                                                                                                    destinationContainerName:containerName 
                                                                                                       destinationObjectName:destinationObjectName 
-                                                                                                              checkIfExists:YES];
+                                                                                                              checkIfExists:YES 
+                                                                                                             sharingAccount:nil];
                             if (objectRequest) {
                                 objectRequest.delegate = self;
                                 objectRequest.didFinishSelector = @selector(copyFinished:);
@@ -838,7 +865,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                                                                                                              objectName:node.pithosObject.name 
                                                                                                destinationContainerName:containerName 
                                                                                                   destinationObjectName:destinationObjectName 
-                                                                                                          checkIfExists:YES];
+                                                                                                          checkIfExists:YES 
+                                                                                                         sharingAccount:nil];
                             if (objectRequests) {
                                 for (ASIPithosObjectRequest *objectRequest in objectRequests) {
                                     objectRequest.delegate = self;
@@ -1146,11 +1174,12 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         } else {
             menuNode = [browser itemAtIndexPath:[menuNodesIndexPaths objectAtIndex:0]];
         }
-        if ([menuNode class] == [PithosAccountNode class])
+        if (([menuNode class] == [PithosAccountNode class]) || ([menuNode class] == [PithosSharingAccountsNode class]))
             return;
         BOOL shared = menuNode.shared;
+        BOOL sharingAccount = (menuNode.sharingAccount != nil);
         
-        if (!shared) {
+        if (!shared && !sharingAccount) {
             // New Folder
             menuItem = [[[NSMenuItem alloc] initWithTitle:@"New Folder" action:@selector(menuNewFolder:) keyEquivalent:@""] autorelease];
             [menuItem setRepresentedObject:menuNode];
@@ -1163,7 +1192,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         [menuItem setRepresentedObject:[NSArray arrayWithObject:menuNode]];
         [menu addItem:menuItem];
         
-        if (!shared) {
+        if (!shared && !sharingAccount) {
             // Paste
             if (clipboardNodes) {
                 NSUInteger clipboardNodesCount = [clipboardNodes count];
@@ -1194,10 +1223,11 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             [menuNodes addObject:[browser itemAtIndexPath:clickedNodeIndexPath]];
         }
         NSUInteger menuNodesCount = [menuNodes count];
-        BOOL shared = ((PithosNode *)[menuNodes objectAtIndex:0]).shared;
-        
+        PithosNode *firstMenuNode = (PithosNode *)[menuNodes objectAtIndex:0];
+        BOOL shared = firstMenuNode.shared;
+        BOOL sharingAccount = (firstMenuNode.sharingAccount != nil);
         
-        if (!shared) {
+        if (!shared && !sharingAccount) {
             // Move to Trash (pithos container only)
             // Delete
             if ([rootNode class] == [PithosContainerNode class]) {
@@ -1213,15 +1243,17 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             }
         }
         
-        // Get Info
-        menuItem = [[[NSMenuItem alloc] initWithTitle:@"Get Info" action:@selector(menuGetInfo:) keyEquivalent:@""] autorelease];
-        [menuItem setRepresentedObject:menuNodes];
-        [menu addItem:menuItem];
-        
-        if (!shared || ([[menuNodes objectAtIndex:0] class] != [PithosContainerNode class]))
-            [menu addItem:[NSMenuItem separatorItem]];
+        if (!sharingAccount || ([firstMenuNode class] != [PithosAccountNode class])) {
+            // Get Info
+            menuItem = [[[NSMenuItem alloc] initWithTitle:@"Get Info" action:@selector(menuGetInfo:) keyEquivalent:@""] autorelease];
+            [menuItem setRepresentedObject:menuNodes];
+            [menu addItem:menuItem];
+            
+            if ((!shared && !sharingAccount) || ([firstMenuNode class] != [PithosContainerNode class]))
+                [menu addItem:[NSMenuItem separatorItem]];
+        }
         
-        if (!shared) {
+        if (!shared && !sharingAccount) {
             // Cut
             
             if (menuNodesCount == 1)
@@ -1233,7 +1265,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             [menu addItem:menuItem];
         }
         
-        if (!shared || ([[menuNodes objectAtIndex:0] class] != [PithosContainerNode class])) {
+        if ((!shared && !sharingAccount) || 
+            (([firstMenuNode class] != [PithosContainerNode class]) && ([firstMenuNode class] != [PithosAccountNode class]))) {
             // Copy
             if (menuNodesCount == 1)
                 menuItemTitle = [NSString stringWithFormat:@"Copy \"%@\"", ((PithosNode *)[menuNodes objectAtIndex:0]).displayName];
@@ -1244,7 +1277,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             [menu addItem:menuItem];
         }
         
-        if (!shared) {
+        if (!shared && !sharingAccount) {
             // Paste
             if (menuNodesCount == 1) {
                 PithosNode *menuNode = [menuNodes objectAtIndex:0];
@@ -1513,7 +1546,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                                                                                                          objectName:node.pithosObject.name 
                                                                                            destinationContainerName:containerName 
                                                                                               destinationObjectName:destinationObjectName 
-                                                                                                      checkIfExists:YES];
+                                                                                                      checkIfExists:YES 
+                                                                                                     sharingAccount:node.sharingAccount];
                     if (objectRequest) {
                         objectRequest.delegate = self;
                         objectRequest.didFinishSelector = @selector(copyFinished:);
@@ -1540,7 +1574,8 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                                                                                                      objectName:node.pithosObject.name 
                                                                                        destinationContainerName:containerName 
                                                                                           destinationObjectName:destinationObjectName 
-                                                                                                  checkIfExists:YES];
+                                                                                                  checkIfExists:YES 
+                                                                                                 sharingAccount:node.sharingAccount];
                     if (objectRequests) {
                         for (ASIPithosObjectRequest *objectRequest in objectRequests) {
                             objectRequest.delegate = self;
index 522aee1..84663a6 100644 (file)
@@ -63,7 +63,6 @@ static NSImage *sharedIcon = nil;
     if ((self = [super init])) {
         self.pithosContainer = aPithosContainer;
         prefix = nil;
-        shared = NO;
         self.icon = anIcon;
         childrenUpdatedNotificationName = @"PithosContainerNodeChildrenUpdated";
     }
@@ -104,8 +103,11 @@ static NSImage *sharedIcon = nil;
 #pragma mark Properties
 
 - (NSString *)url {
-    if (url == nil) 
-        url = [[NSString alloc] initWithFormat:@"%@/%@", [ASIPithosRequest storageURL], pithosContainer.name];
+    if (url == nil)
+        url = [[NSString alloc] initWithFormat:@"%@/%@%@", 
+               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
+               pithosContainer.name, 
+               (shared ? @"?shared" : @"")];
     return url;
 }
 
@@ -125,6 +127,8 @@ static NSImage *sharedIcon = nil;
                                                                                               meta:nil 
                                                                                             shared:shared 
                                                                                              until:nil] retain];
+                if (sharingAccount)
+                    [containerRequest setRequestUserFromDefaultTo:sharingAccount];
                 containerRequest.delegate = self;
                 containerRequest.didFinishSelector = @selector(containerRequestFinished:);
                 containerRequest.didFailSelector = @selector(containerRequestFailed:);
@@ -215,6 +219,9 @@ static NSImage *sharedIcon = nil;
                         if ((sameNameObjectIndex == NSNotFound) ||
                             ![[[objects objectAtIndex:sameNameObjectIndex] contentType] isEqualToString:@"application/directory"]) {
                             PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
+                            node.parent = self;
+                            node.shared = shared;
+                            node.sharingAccount = sharingAccount;
                             if (children) {
                                 NSUInteger oldIndex = [children indexOfObject:node];
                                 if (oldIndex != NSNotFound) {
@@ -225,12 +232,15 @@ static NSImage *sharedIcon = nil;
                                     [keptNodes addIndex:oldIndex];
                                 }
                             }
-                            node.parent = self;
-                            node.shared = shared;
+                            if (sharingAccount)
+                                node.pithosObject.allowedTo = [NSString stringWithString:@"read"];
                             [newChildren addObject:node];
                         }
                     } else if ([object.contentType isEqualToString:@"application/directory"]) {
                         PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
+                        node.parent = self;
+                        node.shared = shared;
+                        node.sharingAccount = sharingAccount;
                         if (children) {
                             NSUInteger oldIndex = [children indexOfObject:node];
                             if (oldIndex != NSNotFound) {
@@ -241,11 +251,12 @@ static NSImage *sharedIcon = nil;
                                 [keptNodes addIndex:oldIndex];
                             }
                         }
-                        node.parent = self;
-                        node.shared = shared;
                         [newChildren addObject:node];
                     } else {
                         PithosObjectNode *node = [[[PithosObjectNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
+                        node.parent = self;
+                        node.shared = shared;
+                        node.sharingAccount = sharingAccount;
                         if (children) {
                             NSUInteger oldIndex = [children indexOfObject:node];
                             if (oldIndex != NSNotFound) {
@@ -256,8 +267,6 @@ static NSImage *sharedIcon = nil;
                                 [keptNodes addIndex:oldIndex];
                             }
                         }
-                        node.parent = self;
-                        node.shared = shared;
                         [newChildren addObject:node];                                
                     }
                 }
@@ -291,6 +300,8 @@ static NSImage *sharedIcon = nil;
                                                                                       meta:nil 
                                                                                     shared:shared 
                                                                                      until:nil] retain];
+        if (sharingAccount)
+            [containerRequest setRequestUserFromDefaultTo:sharingAccount];
         containerRequest.delegate = self;
         containerRequest.downloadCache = [ASIDownloadCache sharedCache];
         [containerRequest startAsynchronous];
index 9affab4..57ccd4d 100755 (executable)
@@ -90,7 +90,6 @@
                                                        </object>
                                                        <string key="NSFrame">{{10, 370}, {32, 32}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="56844250"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSImageCell" key="NSCell" id="689737374">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{47, 387}, {148, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="335436590"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="974224135">
                                                        <int key="NSvFlags">265</int>
                                                        <string key="NSFrame">{{190, 387}, {68, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="773635799"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="8803370">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 356}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="67996369"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 341}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1042818350"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="532119727">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 319}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1059051766"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="394856129">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 304}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="838884408"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="303440755">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 289}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="600006232"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="999705685">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 274}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="390812603"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="693260766">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 259}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="402838882"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1061069897">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 319}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="860907333"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="997558256">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 304}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="626534516"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="28801404">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 289}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="886319680"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="13882105">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 274}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="130231867"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="854644441">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 259}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="754158675"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="603172790">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 246}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="212288772"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 231}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="290149761"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="804456721">
                                                                                        <int key="NSvFlags">4352</int>
                                                                                        <string key="NSFrameSize">{243, 78}</string>
                                                                                        <reference key="NSSuperview" ref="588679996"/>
-                                                                                       <reference key="NSWindow"/>
-                                                                                       <reference key="NSNextKeyView" ref="185303975"/>
+                                                                                       <reference key="NSNextKeyView" ref="529165266"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSTableHeaderView" key="NSHeaderView" id="1071020862">
                                                                                                <reference key="NSNextResponder" ref="185303975"/>
                                                                                                <int key="NSvFlags">256</int>
                                                                                                <string key="NSFrameSize">{243, 17}</string>
                                                                                                <reference key="NSSuperview" ref="185303975"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="103059877"/>
                                                                                                <reference key="NSTableView" ref="334049559"/>
                                                                                        </object>
                                                                                                <int key="NSvFlags">-2147483392</int>
                                                                                                <string key="NSFrame">{{224, 0}, {16, 17}}</string>
                                                                                                <reference key="NSSuperview" ref="290149761"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="588679996"/>
                                                                                        </object>
                                                                                        <object class="NSMutableArray" key="NSTableColumns">
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 17}, {243, 78}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="334049559"/>
                                                                        <reference key="NSDocView" ref="334049559"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{224, 17}, {15, 102}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="533265052"/>
                                                                        <reference key="NSTarget" ref="290149761"/>
                                                                        <string key="NSAction">_doScroller:</string>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{1, 119}, {223, 15}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="294638385"/>
                                                                        <int key="NSsFlags">1</int>
                                                                        <reference key="NSTarget" ref="290149761"/>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 0}, {243, 17}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="1071020862"/>
                                                                        <reference key="NSDocView" ref="1071020862"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                        </object>
                                                        <string key="NSFrame">{{10, 127}, {245, 96}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
-                                                       <reference key="NSNextKeyView" ref="588679996"/>
+                                                       <reference key="NSNextKeyView" ref="185303975"/>
                                                        <int key="NSsFlags">562</int>
                                                        <reference key="NSVScroller" ref="529165266"/>
                                                        <reference key="NSHScroller" ref="533265052"/>
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{10, 107}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="298407635"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="175577443">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{27, 107}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="757630142"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="72795477">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 97}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1056330804"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">-2147483634</int>
                                                        <string key="NSFrame">{{0, 25}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
+                                                       <reference key="NSNextKeyView" ref="870983347"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                                <int key="NSCellFlags">67239424</int>
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 82}, {126, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="304298489"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1048447927">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 60}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="534528258"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="59217156">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 39}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="571925225"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="486776658">
                                                        <int key="NSvFlags">292</int>
                                                        <string key="NSFrame">{{10, 9}, {62, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
+                                                       <reference key="NSNextKeyView" ref="889445631"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="978069596">
                                                                <int key="NSCellFlags">-2080244224</int>
                                                        <int key="NSvFlags">289</int>
                                                        <string key="NSFrame">{{193, 9}, {62, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
-                                                       <reference key="NSNextKeyView" ref="870983347"/>
+                                                       <reference key="NSNextKeyView"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="631288671">
                                                                <int key="NSCellFlags">-2080244224</int>
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 55}, {174, 22}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="994885696"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSPopUpButtonCell" key="NSCell" id="67388244">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{87, 37}, {168, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
-                                                       <reference key="NSNextKeyView" ref="889445631"/>
+                                                       <reference key="NSNextKeyView" ref="679315731"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="876021736">
                                                                <int key="NSCellFlags">-1804468671</int>
                                        </object>
                                        <string key="NSFrame">{{7, 11}, {265, 412}}</string>
                                        <reference key="NSSuperview"/>
-                                       <reference key="NSWindow"/>
                                        <reference key="NSNextKeyView" ref="470064219"/>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
                                                <string key="label">enabled: canRemove</string>
                                                <reference key="source" ref="298407635"/>
                                                <reference key="destination" ref="1051118663"/>
-                                               <object class="NSNibBindingConnector" key="connector">
+                                               <object class="NSNibBindingConnector" key="connector" id="437492186">
                                                        <reference key="NSSource" ref="298407635"/>
                                                        <reference key="NSDestination" ref="1051118663"/>
                                                        <string key="NSLabel">enabled: canRemove</string>
                                        </object>
                                        <int key="connectionID">998</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="889445631"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="889445631"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1008</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="870983347"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="870983347"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1013</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="571925225"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="571925225"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1016</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="534528258"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="534528258"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1019</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled2: node.sharingAccount</string>
+                                               <reference key="source" ref="298407635"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="298407635"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled2: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled2</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSArray" key="dict.sortedKeys">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <string>NSMultipleValuesPlaceholder</string>
+                                                                       <string>NSNoSelectionPlaceholder</string>
+                                                                       <string>NSNotApplicablePlaceholder</string>
+                                                                       <string>NSNullPlaceholder</string>
+                                                                       <string>NSValueTransformerName</string>
+                                                               </object>
+                                                               <object class="NSMutableArray" key="dict.values">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <string>SharingAccountBoolTransformer</string>
+                                                               </object>
+                                                       </object>
+                                                       <reference key="NSPreviousConnector" ref="437492186"/>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1023</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="294638385"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="294638385"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1026</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="334049559"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="334049559"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">1030</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">999</int>
-               </object>
-               <object class="IBClassDescriber" key="IBDocument.Classes">
-                       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">MetadataKeyFormatter</string>
-                                       <string key="superclassName">NSFormatter</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/MetadataKeyFormatter.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">PithosContainerNodeInfoController</string>
-                                       <string key="superclassName">PithosNodeInfoController</string>
-                                       <object class="NSMutableDictionary" key="outlets">
-                                               <string key="NS.key.0">metadataDictionaryController</string>
-                                               <string key="NS.object.0">NSDictionaryController</string>
-                                       </object>
-                                       <object class="NSMutableDictionary" key="toOneOutletInfosByName">
-                                               <string key="NS.key.0">metadataDictionaryController</string>
-                                               <object class="IBToOneOutletInfo" key="NS.object.0">
-                                                       <string key="name">metadataDictionaryController</string>
-                                                       <string key="candidateClassName">NSDictionaryController</string>
-                                               </object>
-                                       </object>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/PithosContainerNodeInfoController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">PithosNodeInfoController</string>
-                                       <string key="superclassName">NSWindowController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/PithosNodeInfoController.h</string>
-                                       </object>
-                               </object>
-                       </object>
+                       <int key="maxID">1030</int>
                </object>
+               <object class="IBClassDescriber" key="IBDocument.Classes"/>
                <int key="IBDocument.localizationMode">0</int>
                <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
index 4c3d5ca..043dea4 100644 (file)
 + (ASIPithosObjectRequest *)objectDataRequestWithContainerName:(NSString *)containerName 
                                                     objectName:(NSString *)objectName 
                                                    toDirectory:(NSString *)directoryPath 
-                                                 checkIfExists:(BOOL)ifExists;
+                                                 checkIfExists:(BOOL)ifExists 
+                                                sharingAccount:(NSString *)sharingAccount;
 + (NSArray *)objectDataRequestsForSubdirWithContainerName:(NSString *)containerName 
                                                objectName:(NSString *)objectName 
                                               toDirectory:(NSString *)directoryPath 
-                                            checkIfExists:(BOOL)ifExists;
+                                            checkIfExists:(BOOL)ifExists 
+                                           sharingAccount:(NSString *)sharingAccount;
 
 + (ASIPithosObjectRequest *)writeObjectDataRequestWithContainerName:(NSString *)containerName
                                                          objectName:(NSString *)objectName
                                                     objectName:(NSString *)objectName 
                                       destinationContainerName:(NSString *)destinationContainerName 
                                          destinationObjectName:(NSString *)destinationObjectName 
-                                                 checkIfExists:(BOOL)ifExists;
+                                                 checkIfExists:(BOOL)ifExists 
+                                                sharingAccount:(NSString *)sharingAccount;
 + (NSArray *)copyObjectRequestsForSubdirWithContainerName:(NSString *)containerName 
                                                objectName:(NSString *)objectName 
                                  destinationContainerName:(NSString *)destinationContainerName 
                                     destinationObjectName:(NSString *)destinationObjectName 
-                                            checkIfExists:(BOOL)ifExists;
+                                            checkIfExists:(BOOL)ifExists 
+                                           sharingAccount:(NSString *)sharingAccount;
 
 
 + (ASIPithosObjectRequest *)moveObjectRequestWithContainerName:(NSString *)containerName 
                               error:(NSError **)error isDirectory:(BOOL *)isDirectory;
 + (BOOL)proceedIfObjectExistsAtContainerName:(NSString *)containerName objectName:(NSString *)objectName;
 + (NSArray *)objectsWithContainerName:(NSString *)containerName objectNamePrefix:(NSString *)objectNamePrefix
-                            delimiter:(NSString *)delimiter;
+                            delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount;
 + (NSArray *)objectsForSubdirWithContainerName:(NSString *)containerName objectName:(NSString *)objectName
-                                     delimiter:(NSString *)delimiter;
+                                     delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount;
 + (NSString *)safeObjectNameForContainerName:(NSString *)containerName objectName:(NSString *)objectName;
 + (NSString *)safeSubdirNameForContainerName:(NSString *)containerName subdirName:(NSString *)subdirName;
 
index 20ba66a..5421fbd 100644 (file)
@@ -49,7 +49,8 @@
 + (ASIPithosObjectRequest *)objectDataRequestWithContainerName:(NSString *)containerName 
                                                     objectName:(NSString *)objectName 
                                                    toDirectory:(NSString *)directoryPath 
-                                                 checkIfExists:(BOOL)ifExists {
+                                                 checkIfExists:(BOOL)ifExists 
+                                                sharingAccount:(NSString *)sharingAccount {
     NSString *fileName = [objectName lastPathComponent];
     if([objectName hasSuffix:@"/"])
         fileName = [fileName stringByAppendingString:@"/"];    
@@ -89,6 +90,8 @@
 
     ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest objectDataRequestWithContainerName:containerName 
                                                                                             objectName:objectName];
+    if (sharingAccount)
+        [objectRequest setRequestUserFromDefaultTo:sharingAccount];
     objectRequest.downloadDestinationPath = destinationPath;
     objectRequest.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                               fileName, @"fileName", 
 + (NSArray *)objectDataRequestsForSubdirWithContainerName:(NSString *)containerName 
                                                objectName:(NSString *)objectName 
                                               toDirectory:(NSString *)directoryPath 
-                                            checkIfExists:(BOOL)ifExists {
+                                            checkIfExists:(BOOL)ifExists 
+                                           sharingAccount:(NSString *)sharingAccount {
     NSString *subdirName = [objectName lastPathComponent];
     NSString *destinationPath = [directoryPath stringByAppendingPathComponent:subdirName];
     if (ifExists && [[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) {
             return nil;
     }
     
-    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil];
+    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName 
+                                                     delimiter:nil sharingAccount:sharingAccount];
     if (objects == nil)
         return nil;
     
             [objectRequests addObject:[self objectDataRequestWithContainerName:containerName 
                                                                     objectName:object.name 
                                                                    toDirectory:objectDirectoryPath 
-                                                                 checkIfExists:NO]];
+                                                                 checkIfExists:NO 
+                                                                sharingAccount:sharingAccount]];
         }
     }
     
 #pragma mark Delete
 
 + (NSArray *)deleteObjectRequestsForSubdirWithContainerName:(NSString *)containerName objectName:(NSString *)objectName {
-    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil];
+    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil sharingAccount:nil];
     if (objects == nil)
         return nil;
 
                                                     objectName:(NSString *)objectName 
                                       destinationContainerName:(NSString *)destinationContainerName 
                                          destinationObjectName:(NSString *)destinationObjectName 
-                                                 checkIfExists:(BOOL)ifExists {
+                                                 checkIfExists:(BOOL)ifExists 
+                                                sharingAccount:(NSString *)sharingAccount {
     if (ifExists && ![self proceedIfObjectExistsAtContainerName:destinationContainerName objectName:destinationObjectName])
         return nil;
     
                                                                                   destinationContainerName:destinationContainerName 
                                                                                      destinationObjectName:destinationObjectName 
                                                                                              sourceVersion:nil];
+    if (sharingAccount) 
+        [objectRequest setRequestUserFromDefaultTo:sharingAccount];
     return objectRequest;
 }
 
                                                objectName:(NSString *)objectName 
                                  destinationContainerName:(NSString *)destinationContainerName 
                                     destinationObjectName:(NSString *)destinationObjectName 
-                                            checkIfExists:(BOOL)ifExists {
+                                            checkIfExists:(BOOL)ifExists 
+                                           sharingAccount:(NSString *)sharingAccount {
     if (ifExists && ![self proceedIfObjectExistsAtContainerName:destinationContainerName objectName:destinationObjectName])
         return nil;
     
-    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil];
+    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName 
+                                                     delimiter:nil sharingAccount:sharingAccount];
     if (objects == nil)
         return nil;
     
     NSMutableArray *objectRequests = [NSMutableArray arrayWithCapacity:([objects count] + 1)];
+    ASIPithosObjectRequest *objectRequest;
     if ([objectName isEqualToString:destinationObjectName]) {
-        if (![objectName hasSuffix:@"/"])
-            [objectRequests addObject:[ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
-                                                                                          objectName:objectName 
-                                                                                         contentType:nil 
-                                                                                     contentEncoding:nil 
-                                                                                  contentDisposition:nil 
-                                                                                            manifest:nil 
-                                                                                             sharing:nil 
-                                                                                            isPublic:ASIPithosObjectRequestPublicIgnore 
-                                                                                            metadata:nil 
-                                                                            destinationContainerName:destinationContainerName 
-                                                                               destinationObjectName:objectName 
-                                                                                       sourceVersion:nil]];
+        if (![objectName hasSuffix:@"/"]) {
+            objectRequest = [ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
+                                                                                objectName:objectName 
+                                                                               contentType:nil 
+                                                                           contentEncoding:nil 
+                                                                        contentDisposition:nil 
+                                                                                  manifest:nil 
+                                                                                   sharing:nil 
+                                                                                  isPublic:ASIPithosObjectRequestPublicIgnore 
+                                                                                  metadata:nil 
+                                                                  destinationContainerName:destinationContainerName 
+                                                                     destinationObjectName:objectName 
+                                                                             sourceVersion:nil];
+            if (sharingAccount)
+                [objectRequest setRequestUserFromDefaultTo:sharingAccount];
+            [objectRequests addObject:objectRequest];
+        }
         for (ASIPithosObject *object in objects) {
-            [objectRequests addObject:[ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
-                                                                                          objectName:object.name 
-                                                                                         contentType:nil 
-                                                                                     contentEncoding:nil 
-                                                                                  contentDisposition:nil 
-                                                                                            manifest:nil 
-                                                                                             sharing:nil 
-                                                                                            isPublic:ASIPithosObjectRequestPublicIgnore 
-                                                                                            metadata:nil 
-                                                                            destinationContainerName:destinationContainerName 
-                                                                               destinationObjectName:object.name 
-                                                                                       sourceVersion:nil]];
+            objectRequest = [ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
+                                                                                objectName:object.name 
+                                                                               contentType:nil 
+                                                                           contentEncoding:nil 
+                                                                        contentDisposition:nil 
+                                                                                  manifest:nil 
+                                                                                   sharing:nil 
+                                                                                  isPublic:ASIPithosObjectRequestPublicIgnore 
+                                                                                  metadata:nil 
+                                                                  destinationContainerName:destinationContainerName 
+                                                                     destinationObjectName:object.name 
+                                                                             sourceVersion:nil];
+            if (sharingAccount)
+                [objectRequest setRequestUserFromDefaultTo:sharingAccount];
+            [objectRequests addObject:objectRequest];
         }
     } else {
         if (![objectName hasSuffix:@"/"]) {
-            [objectRequests addObject:[ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
-                                                                                          objectName:objectName 
-                                                                                         contentType:nil 
-                                                                                     contentEncoding:nil 
-                                                                                  contentDisposition:nil 
-                                                                                            manifest:nil 
-                                                                                             sharing:nil 
-                                                                                            isPublic:ASIPithosObjectRequestPublicIgnore 
-                                                                                            metadata:nil 
-                                                                            destinationContainerName:destinationContainerName 
-                                                                               destinationObjectName:destinationObjectName 
-                                                                                       sourceVersion:nil]];
+            objectRequest = [ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
+                                                                                objectName:objectName 
+                                                                               contentType:nil 
+                                                                           contentEncoding:nil 
+                                                                        contentDisposition:nil 
+                                                                                  manifest:nil 
+                                                                                   sharing:nil 
+                                                                                  isPublic:ASIPithosObjectRequestPublicIgnore 
+                                                                                  metadata:nil 
+                                                                  destinationContainerName:destinationContainerName 
+                                                                     destinationObjectName:destinationObjectName 
+                                                                             sourceVersion:nil];
+            if (sharingAccount)
+                [objectRequest setRequestUserFromDefaultTo:sharingAccount];
+            [objectRequests addObject:objectRequest];
         }
         NSRange prefixRange = NSMakeRange(0, [objectName length]);
         NSString *newObjectName;
                                                                    withString:destinationObjectName
                                                                       options:NSAnchoredSearch
                                                                         range:prefixRange];
-            [objectRequests addObject:[ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
-                                                                                          objectName:object.name
-                                                                                         contentType:nil 
-                                                                                     contentEncoding:nil 
-                                                                                  contentDisposition:nil 
-                                                                                            manifest:nil 
-                                                                                             sharing:nil 
-                                                                                            isPublic:ASIPithosObjectRequestPublicIgnore 
-                                                                                            metadata:nil 
-                                                                            destinationContainerName:destinationContainerName 
-                                                                               destinationObjectName:newObjectName 
-                                                                                       sourceVersion:nil]];
+            objectRequest = [ASIPithosObjectRequest copyObjectDataRequestWithContainerName:containerName 
+                                                                                objectName:object.name 
+                                                                               contentType:nil 
+                                                                           contentEncoding:nil 
+                                                                        contentDisposition:nil 
+                                                                                  manifest:nil 
+                                                                                   sharing:nil 
+                                                                                  isPublic:ASIPithosObjectRequestPublicIgnore 
+                                                                                  metadata:nil 
+                                                                  destinationContainerName:destinationContainerName 
+                                                                     destinationObjectName:newObjectName 
+                                                                             sourceVersion:nil];
+            if (sharingAccount)
+                [objectRequest setRequestUserFromDefaultTo:sharingAccount];
+            [objectRequests addObject:objectRequest];
         }
     }
     
     if (ifExists && ![self proceedIfObjectExistsAtContainerName:destinationContainerName objectName:destinationObjectName])
         return nil;
     
-    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil];
+    NSArray *objects = [self objectsForSubdirWithContainerName:containerName objectName:objectName delimiter:nil sharingAccount:nil];
     if (objects == nil)
         return nil;
     
 
 // List of objects at the given container/object path, with prefix and or delimiter
 + (NSArray *)objectsWithContainerName:(NSString *)containerName objectNamePrefix:(NSString *)objectNamePrefix 
-                            delimiter:(NSString *)delimiter {
+                            delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount {
     NSMutableArray *objects = [NSMutableArray array];
     NSString *marker = nil;
     do {
                                                                                                                 meta:nil 
                                                                                                               shared:NO 
                                                                                                                until:nil];
+        if (sharingAccount)
+            [containerRequest setRequestUserFromDefaultTo:sharingAccount];
         [containerRequest startSynchronous];
         if ([containerRequest error]) {
             [self httpRequestErrorAlertWithRequest:containerRequest];
 // List of objects at the given container/object path, that may be a subdir or an application/directory, 
 // with prefix and or delimiter
 + (NSArray *)objectsForSubdirWithContainerName:(NSString *)containerName objectName:(NSString *)objectName 
-                                     delimiter:(NSString *)delimiter {
+                                     delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount {
     NSString *subdirNamePrefix = [NSString stringWithString:objectName];
     if (![subdirNamePrefix hasSuffix:@"/"])
         subdirNamePrefix = [subdirNamePrefix stringByAppendingString:@"/"];
-    return [self objectsWithContainerName:containerName objectNamePrefix:subdirNamePrefix delimiter:delimiter];
+    return [self objectsWithContainerName:containerName objectNamePrefix:subdirNamePrefix 
+                                delimiter:delimiter sharingAccount:sharingAccount];
 }
 
 // A safe object name at the given container/object path
     }
     NSArray *objects = [self objectsWithContainerName:containerName 
                                      objectNamePrefix:[objectNamePrefix stringByDeletingLastPathComponent] 
-                                            delimiter:@"/"];
+                                            delimiter:@"/" 
+                                       sharingAccount:nil];
     if (objects == nil)
         return nil;
     if ([objects count] == 0)
     }
     NSArray *objects = [self objectsWithContainerName:containerName 
                                      objectNamePrefix:[subdirNamePrefix stringByDeletingLastPathComponent] 
-                                            delimiter:@"/"];
+                                            delimiter:@"/" 
+                                       sharingAccount:nil];
     if (objects == nil)
         return nil;
     if ([objects count] == 0)
index fa2f9f7..e4594b0 100644 (file)
@@ -51,6 +51,7 @@
     
     PithosNode *parent;
     BOOL shared;
+    NSString *sharingAccount;
     NSMutableArray *children;
     NSMutableArray *newChildren;
     
@@ -66,6 +67,7 @@
 
 @property(nonatomic, assign) PithosNode *parent;
 @property(nonatomic, assign) BOOL shared;
+@property(nonatomic, retain) NSString *sharingAccount;
 @property(nonatomic, readonly) NSArray *children;
 
 @property(nonatomic, retain) NSString *displayName;
index 4ae40d9..4f1528a 100644 (file)
@@ -39,7 +39,7 @@
 #import "PithosNodeInfoController.h"
 
 @implementation PithosNode
-@synthesize parent, shared, displayName, isLeafItem, icon;
+@synthesize parent, shared, sharingAccount, displayName, isLeafItem, icon;
 @dynamic url, children, pithosContainer, pithosObject;
 
 #pragma mark -
@@ -56,6 +56,7 @@
 
 - (void)dealloc {
     [pithosNodeInfoController release];
+    [sharingAccount release];
     [icon release];
     [displayName release];
     [newChildren release];
 }
 
 #pragma mark -
+#pragma mark Properties
+
+- (void)setShared:(BOOL)aShared {
+    if (shared != aShared) {
+        shared = aShared;
+        [url release];
+        url = nil;
+    }
+}
+
+- (void)setSharingAccount:(NSString *)aSharingAccount {
+    if (![sharingAccount isEqualToString:aSharingAccount]) {
+        [sharingAccount release];
+        sharingAccount = [aSharingAccount retain];
+        [url release];
+        url = nil;
+    }
+}
+
+#pragma mark -
 #pragma mark Actions
 
 - (void)invalidateChildren {
index d396d4b..7688f79 100644 (file)
 #pragma mark Properties
 
 - (NSString *)url {
-    if (url == nil) 
-        url = [[NSString alloc] initWithFormat:@"object %@/%@/%@", [ASIPithosRequest storageURL], pithosContainer.name, pithosObject.name];
+    if (url == nil)
+        url = [[NSString alloc] initWithFormat:@"object %@/%@/%@%@", 
+               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
+               pithosContainer.name, 
+               pithosObject.name, 
+               (shared ? @"?shared" : @"")];
     return url;
 }
 
     @synchronized(self) {
         if (applyMetadataObjectRequest == nil) {
             [[pithosNodeInfoController window] makeFirstResponder:nil];
-            applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
-                                                                                                    objectName:pithosObject.name 
-                                                                                               contentEncoding:pithosObject.contentEncoding 
-                                                                                            contentDisposition:pithosObject.contentDisposition 
-                                                                                                      manifest:pithosObject.manifest 
-                                                                                                       sharing:(pithosObject.sharing ? pithosObject.sharing : @"")
-                                                                                                      isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
-                                                                                                      metadata:pithosObject.metadata
-                                                                                                        update:NO] retain];
+            if (sharingAccount) {
+                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
+                                                                                                        objectName:pithosObject.name 
+                                                                                                   contentEncoding:nil 
+                                                                                                contentDisposition:nil 
+                                                                                                          manifest:nil 
+                                                                                                           sharing:nil
+                                                                                                          isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
+                                                                                                          metadata:pithosObject.metadata
+                                                                                                            update:NO] retain];
+                [applyMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
+            } else {
+                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
+                                                                                                        objectName:pithosObject.name 
+                                                                                                   contentEncoding:pithosObject.contentEncoding 
+                                                                                                contentDisposition:pithosObject.contentDisposition 
+                                                                                                          manifest:pithosObject.manifest 
+                                                                                                           sharing:(pithosObject.sharing ? pithosObject.sharing : @"")
+                                                                                                          isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
+                                                                                                          metadata:pithosObject.metadata
+                                                                                                            update:NO] retain];
+            }
             applyMetadataObjectRequest.delegate = self;
             applyMetadataObjectRequest.didFinishSelector = @selector(objectRequestFinished:);
             applyMetadataObjectRequest.didFailSelector = @selector(objectRequestFailed:);
         if (refreshMetadataObjectRequest == nil) {
             refreshMetadataObjectRequest = [[ASIPithosObjectRequest objectMetadataRequestWithContainerName:pithosContainer.name 
                                                                                                 objectName:pithosObject.name] retain];
+            if (sharingAccount)
+                [refreshMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
             refreshMetadataObjectRequest.delegate = self;
             refreshMetadataObjectRequest.didFinishSelector = @selector(objectRequestFinished:);
             refreshMetadataObjectRequest.didFailSelector = @selector(objectRequestFailed:);
index 396a8d9..9c7e60d 100755 (executable)
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
-               <int key="IBDocument.SystemTarget">1070</int>
-               <string key="IBDocument.SystemVersion">11B26</string>
-               <string key="IBDocument.InterfaceBuilderVersion">1617</string>
-               <string key="IBDocument.AppKitVersion">1138</string>
-               <string key="IBDocument.HIToolboxVersion">566.00</string>
+               <int key="IBDocument.SystemTarget">1060</int>
+               <string key="IBDocument.SystemVersion">10K549</string>
+               <string key="IBDocument.InterfaceBuilderVersion">1306</string>
+               <string key="IBDocument.AppKitVersion">1038.36</string>
+               <string key="IBDocument.HIToolboxVersion">461.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                       <string key="NS.object.0">1617</string>
+                       <string key="NS.object.0">1306</string>
                </object>
                <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -61,7 +61,6 @@
                                <string key="NSWindowTitle">Window</string>
                                <string key="NSWindowClass">NSWindow</string>
                                <nil key="NSViewClass"/>
-                               <nil key="NSUserInterfaceItemIdentifier"/>
                                <string key="NSWindowContentMaxSize">{400, 634}</string>
                                <string key="NSWindowContentMinSize">{265, 634}</string>
                                <object class="NSView" key="NSWindowView" id="1006">
@@ -86,7 +85,6 @@
                                                        </object>
                                                        <string key="NSFrame">{{10, 592}, {32, 32}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="56844250"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSImageCell" key="NSCell" id="689737374">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{47, 609}, {148, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="335436590"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="974224135">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{47, 589}, {60, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="969715508"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="935332902">
                                                        <int key="NSvFlags">265</int>
                                                        <string key="NSFrame">{{190, 609}, {68, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="86167308"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="8803370">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{107, 592}, {151, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="773635799"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1005531049">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 578}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="67996369"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 563}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1042818350"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="532119727">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 511}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="838884408"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1002426647">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 541}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1059051766"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="394856129">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 526}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="122746281"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="303440755">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 496}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="600006232"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="999705685">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 481}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="390812603"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="693260766">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 466}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="402838882"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1061069897">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 511}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="462992757"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="982292666">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 541}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="860907333"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="997558256">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 526}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="626534516"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="28801404">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 496}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="886319680"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="13882105">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 481}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="130231867"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="854644441">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 79}, {114, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="427259584"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="512185388">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 58}, {114, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1051253766"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1056681407">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 37}, {114, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="517022610"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="100186419">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 466}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="754158675"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="603172790">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 453}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="212288772"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 438}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="290149761"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="804456721">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 101}, {91, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="871337072"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="419133220">
                                                                                        <int key="NSvFlags">4352</int>
                                                                                        <string key="NSFrameSize">{243, 78}</string>
                                                                                        <reference key="NSSuperview" ref="588679996"/>
-                                                                                       <reference key="NSWindow"/>
-                                                                                       <reference key="NSNextKeyView" ref="185303975"/>
+                                                                                       <reference key="NSNextKeyView" ref="529165266"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSTableHeaderView" key="NSHeaderView" id="1071020862">
                                                                                                <reference key="NSNextResponder" ref="185303975"/>
                                                                                                <int key="NSvFlags">256</int>
                                                                                                <string key="NSFrameSize">{243, 17}</string>
                                                                                                <reference key="NSSuperview" ref="185303975"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="103059877"/>
                                                                                                <reference key="NSTableView" ref="334049559"/>
                                                                                        </object>
                                                                                                <int key="NSvFlags">-2147483392</int>
                                                                                                <string key="NSFrame">{{224, 0}, {16, 17}}</string>
                                                                                                <reference key="NSSuperview" ref="290149761"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="588679996"/>
                                                                                        </object>
                                                                                        <object class="NSMutableArray" key="NSTableColumns">
                                                                                                </object>
                                                                                        </object>
                                                                                        <double key="NSRowHeight">17</double>
-                                                                                       <int key="NSTvFlags">1925185536</int>
+                                                                                       <int key="NSTvFlags">1388314624</int>
                                                                                        <reference key="NSDelegate"/>
                                                                                        <reference key="NSDataSource"/>
                                                                                        <int key="NSGridStyleMask">1</int>
                                                                                        <int key="NSDraggingSourceMaskForNonLocal">0</int>
                                                                                        <bool key="NSAllowsTypeSelect">YES</bool>
                                                                                        <int key="NSTableViewDraggingDestinationStyle">0</int>
-                                                                                       <int key="NSTableViewGroupRowStyle">1</int>
                                                                                </object>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 17}, {243, 78}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="334049559"/>
                                                                        <reference key="NSDocView" ref="334049559"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{224, 17}, {15, 102}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="533265052"/>
                                                                        <reference key="NSTarget" ref="290149761"/>
                                                                        <string key="NSAction">_doScroller:</string>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{1, 119}, {223, 15}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="294638385"/>
                                                                        <int key="NSsFlags">1</int>
                                                                        <reference key="NSTarget" ref="290149761"/>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 0}, {243, 17}}</string>
                                                                        <reference key="NSSuperview" ref="290149761"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="1071020862"/>
                                                                        <reference key="NSDocView" ref="1071020862"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                        </object>
                                                        <string key="NSFrame">{{10, 334}, {245, 96}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
-                                                       <reference key="NSNextKeyView" ref="588679996"/>
-                                                       <int key="NSsFlags">133682</int>
+                                                       <reference key="NSNextKeyView" ref="185303975"/>
+                                                       <int key="NSsFlags">562</int>
                                                        <reference key="NSVScroller" ref="529165266"/>
                                                        <reference key="NSHScroller" ref="533265052"/>
                                                        <reference key="NSContentView" ref="588679996"/>
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{10, 314}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="298407635"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="175577443">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{27, 314}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="757630142"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="72795477">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 304}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="1056330804"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">14</int>
                                                        <string key="NSFrame">{{0, 116}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="45330831"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">-2147483634</int>
                                                        <string key="NSFrame">{{0, 23}, {265, 5}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="870983347"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{7, 289}, {126, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="304298489"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1048447927">
                                                                                        <int key="NSvFlags">4352</int>
                                                                                        <string key="NSFrameSize">{243, 78}</string>
                                                                                        <reference key="NSSuperview" ref="105333262"/>
-                                                                                       <reference key="NSWindow"/>
-                                                                                       <reference key="NSNextKeyView" ref="71056061"/>
+                                                                                       <reference key="NSNextKeyView" ref="930830008"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSTableHeaderView" key="NSHeaderView" id="670247128">
                                                                                                <reference key="NSNextResponder" ref="71056061"/>
                                                                                                <int key="NSvFlags">256</int>
                                                                                                <string key="NSFrameSize">{243, 17}</string>
                                                                                                <reference key="NSSuperview" ref="71056061"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="991651942"/>
                                                                                                <reference key="NSTableView" ref="247900786"/>
                                                                                        </object>
                                                                                                <int key="NSvFlags">-2147483392</int>
                                                                                                <string key="NSFrame">{{224, 0}, {16, 17}}</string>
                                                                                                <reference key="NSSuperview" ref="544793652"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="105333262"/>
                                                                                        </object>
                                                                                        <object class="NSMutableArray" key="NSTableColumns">
                                                                                                                        <int key="NSDraggingSourceMaskForNonLocal">0</int>
                                                                                                                        <bool key="NSAllowsTypeSelect">YES</bool>
                                                                                                                        <int key="NSTableViewDraggingDestinationStyle">0</int>
-                                                                                                                       <int key="NSTableViewGroupRowStyle">1</int>
                                                                                                                </object>
                                                                                                                <bool key="NSButtonBordered">NO</bool>
                                                                                                        </object>
                                                                                        <reference key="NSBackgroundColor" ref="392809818"/>
                                                                                        <reference key="NSGridColor" ref="320747002"/>
                                                                                        <double key="NSRowHeight">17</double>
-                                                                                       <int key="NSTvFlags">1925185536</int>
+                                                                                       <int key="NSTvFlags">1388314624</int>
                                                                                        <reference key="NSDelegate"/>
                                                                                        <reference key="NSDataSource"/>
                                                                                        <int key="NSGridStyleMask">1</int>
                                                                                        <int key="NSDraggingSourceMaskForNonLocal">0</int>
                                                                                        <bool key="NSAllowsTypeSelect">YES</bool>
                                                                                        <int key="NSTableViewDraggingDestinationStyle">0</int>
-                                                                                       <int key="NSTableViewGroupRowStyle">1</int>
                                                                                </object>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 17}, {243, 78}}</string>
                                                                        <reference key="NSSuperview" ref="544793652"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="247900786"/>
                                                                        <reference key="NSDocView" ref="247900786"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{224, 17}, {15, 102}}</string>
                                                                        <reference key="NSSuperview" ref="544793652"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="1002056463"/>
                                                                        <reference key="NSTarget" ref="544793652"/>
                                                                        <string key="NSAction">_doScroller:</string>
                                                                        <int key="NSvFlags">-2147483392</int>
                                                                        <string key="NSFrame">{{1, 80}, {243, 15}}</string>
                                                                        <reference key="NSSuperview" ref="544793652"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="413572703"/>
                                                                        <int key="NSsFlags">1</int>
                                                                        <reference key="NSTarget" ref="544793652"/>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 0}, {243, 17}}</string>
                                                                        <reference key="NSSuperview" ref="544793652"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="670247128"/>
                                                                        <reference key="NSDocView" ref="670247128"/>
                                                                        <reference key="NSBGColor" ref="465271680"/>
                                                        </object>
                                                        <string key="NSFrame">{{10, 146}, {245, 96}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
-                                                       <reference key="NSNextKeyView" ref="105333262"/>
-                                                       <int key="NSsFlags">133682</int>
+                                                       <reference key="NSNextKeyView" ref="71056061"/>
+                                                       <int key="NSsFlags">562</int>
                                                        <reference key="NSVScroller" ref="413572703"/>
                                                        <reference key="NSHScroller" ref="930830008"/>
                                                        <reference key="NSContentView" ref="105333262"/>
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{10, 126}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="218462401"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="579341820">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{27, 126}, {18, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="293642782"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="104364229">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{83, 248}, {61, 18}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="544793652"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="51989911">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{84, 267}, {174, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="459717130"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="436016527">
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{12, 267}, {72, 14}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="645911602"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="59217156">
                                                        <int key="NSvFlags">292</int>
                                                        <string key="NSFrame">{{10, 9}, {62, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="889445631"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="978069596">
                                                        <int key="NSvFlags">289</int>
                                                        <string key="NSFrame">{{193, 9}, {62, 17}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
+                                                       <reference key="NSNextKeyView"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="631288671">
                                                                <int key="NSCellFlags">-2080244224</int>
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{131, 77}, {124, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="966224034"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="912139381">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{131, 56}, {124, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="881202165"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="101465959">
                                                        <int key="NSvFlags">270</int>
                                                        <string key="NSFrame">{{131, 35}, {124, 19}}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="995990816"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="515912205">
                                                        </object>
                                                </object>
                                        </object>
-                                       <string key="NSFrameSize">{265, 634}</string>
+                                       <string key="NSFrame">{{7, 11}, {265, 634}}</string>
                                        <reference key="NSSuperview"/>
-                                       <reference key="NSWindow"/>
                                        <reference key="NSNextKeyView" ref="470064219"/>
                                </object>
-                               <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
+                               <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
                                <string key="NSMinSize">{265, 656}</string>
                                <string key="NSMaxSize">{400, 656}</string>
-                               <bool key="NSWindowIsRestorable">YES</bool>
                        </object>
                        <object class="NSUserDefaultsController" id="942694500">
                                <bool key="NSSharedInstance">YES</bool>
                                                <string key="label">enabled: canRemove</string>
                                                <reference key="source" ref="298407635"/>
                                                <reference key="destination" ref="1051118663"/>
-                                               <object class="NSNibBindingConnector" key="connector">
+                                               <object class="NSNibBindingConnector" key="connector" id="512694035">
                                                        <reference key="NSSource" ref="298407635"/>
                                                        <reference key="NSDestination" ref="1051118663"/>
                                                        <string key="NSLabel">enabled: canRemove</string>
                                                <string key="label">enabled: canRemove</string>
                                                <reference key="source" ref="218462401"/>
                                                <reference key="destination" ref="86063028"/>
-                                               <object class="NSNibBindingConnector" key="connector">
+                                               <object class="NSNibBindingConnector" key="connector" id="123211226">
                                                        <reference key="NSSource" ref="218462401"/>
                                                        <reference key="NSDestination" ref="86063028"/>
                                                        <string key="NSLabel">enabled: canRemove</string>
                                        </object>
                                        <int key="connectionID">908</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="889445631"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="889445631"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">AllowedToBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">931</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="870983347"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="870983347"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">AllowedToBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">934</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="459717130"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="459717130"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">AllowedToBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">956</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled2: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="298407635"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="298407635"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled2: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled2</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSArray" key="dict.sortedKeys">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <string>NSMultipleValuesPlaceholder</string>
+                                                                       <string>NSNoSelectionPlaceholder</string>
+                                                                       <string>NSNotApplicablePlaceholder</string>
+                                                                       <string>NSNullPlaceholder</string>
+                                                                       <string>NSValueTransformerName</string>
+                                                               </object>
+                                                               <object class="NSMutableArray" key="dict.values">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <string>AllowedToBoolTransformer</string>
+                                                               </object>
+                                                       </object>
+                                                       <reference key="NSPreviousConnector" ref="512694035"/>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">959</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="294638385"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="294638385"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">AllowedToBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">963</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.pithosObject.allowedTo</string>
+                                               <reference key="source" ref="334049559"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="334049559"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.pithosObject.allowedTo</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.pithosObject.allowedTo</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">AllowedToBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">966</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="427259584"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="427259584"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">968</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="1051253766"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="1051253766"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">970</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="517022610"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="517022610"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">972</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="1002056463"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="1002056463"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">974</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled2: node.sharingAccount</string>
+                                               <reference key="source" ref="218462401"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="218462401"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled2: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled2</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSArray" key="dict.sortedKeys">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <string>NSMultipleValuesPlaceholder</string>
+                                                                       <string>NSNoSelectionPlaceholder</string>
+                                                                       <string>NSNotApplicablePlaceholder</string>
+                                                                       <string>NSNullPlaceholder</string>
+                                                                       <string>NSValueTransformerName</string>
+                                                               </object>
+                                                               <object class="NSMutableArray" key="dict.values">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <integer value="-1"/>
+                                                                       <string>SharingAccountBoolTransformer</string>
+                                                               </object>
+                                                       </object>
+                                                       <reference key="NSPreviousConnector" ref="123211226"/>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">976</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: node.sharingAccount</string>
+                                               <reference key="source" ref="247900786"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="247900786"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">enabled: node.sharingAccount</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">node.sharingAccount</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingAccountBoolTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">978</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">927</int>
-               </object>
-               <object class="IBClassDescriber" key="IBDocument.Classes">
-                       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">MetadataKeyFormatter</string>
-                                       <string key="superclassName">NSFormatter</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/MetadataKeyFormatter.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">PithosNodeInfoController</string>
-                                       <string key="superclassName">NSWindowController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/PithosNodeInfoController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">PithosObjectNodeInfoController</string>
-                                       <string key="superclassName">PithosNodeInfoController</string>
-                                       <object class="NSMutableDictionary" key="outlets">
-                                               <bool key="EncodedWithXMLCoder">YES</bool>
-                                               <object class="NSArray" key="dict.sortedKeys">
-                                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <string>metadataDictionaryController</string>
-                                                       <string>sharingDictionaryController</string>
-                                               </object>
-                                               <object class="NSMutableArray" key="dict.values">
-                                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <string>NSDictionaryController</string>
-                                                       <string>NSDictionaryController</string>
-                                               </object>
-                                       </object>
-                                       <object class="NSMutableDictionary" key="toOneOutletInfosByName">
-                                               <bool key="EncodedWithXMLCoder">YES</bool>
-                                               <object class="NSArray" key="dict.sortedKeys">
-                                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <string>metadataDictionaryController</string>
-                                                       <string>sharingDictionaryController</string>
-                                               </object>
-                                               <object class="NSMutableArray" key="dict.values">
-                                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <object class="IBToOneOutletInfo">
-                                                               <string key="name">metadataDictionaryController</string>
-                                                               <string key="candidateClassName">NSDictionaryController</string>
-                                                       </object>
-                                                       <object class="IBToOneOutletInfo">
-                                                               <string key="name">sharingDictionaryController</string>
-                                                               <string key="candidateClassName">NSDictionaryController</string>
-                                                       </object>
-                                               </object>
-                                       </object>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/PithosObjectNodeInfoController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">SharingNameFormatter</string>
-                                       <string key="superclassName">NSFormatter</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">./Classes/SharingNameFormatter.h</string>
-                                       </object>
-                               </object>
-                       </object>
+                       <int key="maxID">978</int>
                </object>
+               <object class="IBClassDescriber" key="IBDocument.Classes"/>
                <int key="IBDocument.localizationMode">0</int>
                <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
diff --git a/pithos-macos/PithosSharingAccountsNode.h b/pithos-macos/PithosSharingAccountsNode.h
new file mode 100644 (file)
index 0000000..4a7b730
--- /dev/null
@@ -0,0 +1,46 @@
+//
+//  PithosSharingAccountsNode.h
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "PithosNode.h"
+@class ASIPithosRequest;
+
+@interface PithosSharingAccountsNode : PithosNode {
+    NSMutableArray *sharingAccounts;
+    ASIPithosRequest *sharingAccountsRequest;
+}
+
+@end
\ No newline at end of file
diff --git a/pithos-macos/PithosSharingAccountsNode.m b/pithos-macos/PithosSharingAccountsNode.m
new file mode 100644 (file)
index 0000000..53394ce
--- /dev/null
@@ -0,0 +1,187 @@
+//
+//  PithosAccountNode.m
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "PithosSharingAccountsNode.h"
+#import "PithosAccountNode.h"
+#import "ASIPithosRequest.h"
+#import "ASIPithosAccount.h"
+#import "ASIDownloadCache.h"
+#import "PithosFileUtilities.h"
+
+@implementation PithosSharingAccountsNode
+
+#pragma mark -
+#pragma mark Object Lifecycle
+
+- (id)init {
+    if ((self == [super init])) {
+        self.sharingAccount = @"";
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [sharingAccountsRequest clearDelegatesAndCancel];
+    [sharingAccountsRequest release];
+    [sharingAccounts release];
+    [super dealloc];
+}
+
+#pragma mark -
+#pragma mark Properties
+
+- (NSString *)url {
+    if (url == nil) 
+        url = [[ASIPithosRequest storageURLPrefix] copy];
+    return url;
+}
+
+- (NSArray *)children {
+    @synchronized(self) {
+        switch (freshness) {
+            case PithosNodeStateFresh:
+                break;
+            case PithosNodeStateRefreshNeeded:
+                freshness = PithosNodeStateRefreshing;
+                sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 
+                                                                                         marker:nil] retain];
+                sharingAccountsRequest.delegate = self;
+                sharingAccountsRequest.didFinishSelector = @selector(sharingAccountsRequestFinished:);
+                sharingAccountsRequest.didFailSelector = @selector(sharingAccountsRequestFailed:);
+                sharingAccountsRequest.downloadCache = [ASIDownloadCache sharedCache];
+                [sharingAccountsRequest startAsynchronous];
+                break;
+            case PithosNodeStateRefreshing:
+                break;
+            case PithosNodeStateRefreshFinished:
+                if (newChildren) {
+                    [children release];
+                    children = newChildren;
+                    newChildren = nil;
+                }
+                freshness = PithosNodeStateFresh;
+            default:
+                break;
+        }
+        return children;
+    }
+}
+
+- (NSString *)displayName {
+    if (displayName == nil)
+        return [NSString stringWithString:@"sharing accounts"];
+    return [[displayName copy] autorelease];
+}
+
+#pragma mark -
+#pragma mark ASIHTTPRequestDelegate
+
+- (void)sharingAccountsRequestFinished:(ASIPithosRequest *)request {
+    NSLog(@"URL: %@", [sharingAccountsRequest url]);
+    NSLog(@"cached: %d", [sharingAccountsRequest didUseCachedResponse]);
+    
+    NSArray *someSharingAccounts = [sharingAccountsRequest sharingAccounts];
+    if (sharingAccounts == nil) {
+        sharingAccounts = [[NSMutableArray alloc] initWithArray:someSharingAccounts];
+    } else {
+        [sharingAccounts addObjectsFromArray:someSharingAccounts];
+    }
+    if ([someSharingAccounts count] < 10000) {
+        if (!sharingAccountsRequest.didUseCachedResponse || ([sharingAccounts count] != [someSharingAccounts count]) || !children) {
+            // Save new children
+            NSLog(@"using newChildren");
+            newChildren = [[NSMutableArray alloc] init];
+            NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
+            for (ASIPithosAccount *account in sharingAccounts) {
+                if (![account.name isEqualToString:[ASIPithosRequest authUser]]) {
+                    PithosAccountNode *node = [[[PithosAccountNode alloc] init] autorelease];
+                    node.parent = self;
+                    node.shared = shared;
+                    node.sharingAccount = account.name;
+                    if (children) {
+                        NSUInteger oldIndex = [children indexOfObject:node];
+                        if (oldIndex != NSNotFound) {
+                            // Use the same pointer value, if possible
+                            node = [children objectAtIndex:oldIndex];
+                            [keptNodes addIndex:oldIndex];
+                        }
+                    }
+                    [newChildren addObject:node];
+                }
+            }
+            [[children objectsAtIndexes:
+              [[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [children count])] indexesPassingTest:^(NSUInteger idx, BOOL *stop){
+                if ([keptNodes containsIndex:idx])
+                    return NO;
+                return YES;
+            }]] makeObjectsPerformSelector:@selector(pithosNodeWillBeRemoved)];
+        }
+        // Else cache was used and all results were fetched during this request, so existing children can be reused
+        [sharingAccountsRequest release];
+        sharingAccountsRequest = nil;
+        [sharingAccounts release];
+        sharingAccounts = nil;
+        @synchronized(self) {
+            freshness = PithosNodeStateRefreshFinished;
+        }
+        // Notify observers that children are updated
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"PithosSharingAccountsNodeChildrenUpdated" object:self];
+    } else {
+        [sharingAccountsRequest release];
+        // Do an additional request to fetch more objects
+        sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 
+                                                                                 marker:[[someSharingAccounts lastObject] name]] retain];
+        sharingAccountsRequest.delegate = self;
+        sharingAccountsRequest.downloadCache = [ASIDownloadCache sharedCache];
+        [sharingAccountsRequest startAsynchronous];
+    }
+}
+
+- (void)accountRequestFailed:(ASIPithosRequest *)request {
+    [PithosFileUtilities httpRequestErrorAlertWithRequest:request];
+    [newChildren release];
+    newChildren = nil;
+    [sharingAccountsRequest release];
+    sharingAccountsRequest = nil;
+    [sharingAccounts release];
+    sharingAccounts = nil;
+    @synchronized(self) {
+        freshness = PithosNodeStateRefreshNeeded;
+    }
+}
+
+@end
index d634daa..bed0011 100644 (file)
@@ -81,8 +81,12 @@ static NSImage *sharedIcon = nil;
 #pragma mark Properties
 
 - (NSString *)url {
-    if (url == nil) 
-        url = [[NSString alloc] initWithFormat:@"subdir %@/%@/%@", [ASIPithosRequest storageURL], pithosContainer.name, prefix];
+    if (url == nil)
+        url = [[NSString alloc] initWithFormat:@"subdir %@/%@/%@%@", 
+               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
+               pithosContainer.name, 
+               prefix, 
+               (shared ? @"?shared" : @"")];
     return url;
 }
 
@@ -244,15 +248,28 @@ static NSImage *sharedIcon = nil;
                 }
             } else {
                 [[pithosNodeInfoController window] makeFirstResponder:nil];
-                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
-                                                                                                        objectName:pithosObject.name 
-                                                                                                   contentEncoding:pithosObject.contentEncoding
-                                                                                                contentDisposition:pithosObject.contentDisposition 
-                                                                                                          manifest:pithosObject.manifest 
-                                                                                                           sharing:(pithosObject.sharing ? pithosObject.sharing : @"") 
-                                                                                                          isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
-                                                                                                          metadata:pithosObject.metadata
-                                                                                                            update:NO] retain];
+                if (sharingAccount) {
+                    applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
+                                                                                                            objectName:pithosObject.name 
+                                                                                                       contentEncoding:nil
+                                                                                                    contentDisposition:nil
+                                                                                                              manifest:nil 
+                                                                                                               sharing:nil 
+                                                                                                              isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
+                                                                                                              metadata:pithosObject.metadata
+                                                                                                                update:NO] retain];
+                    [applyMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
+                } else {
+                    applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
+                                                                                                            objectName:pithosObject.name 
+                                                                                                       contentEncoding:pithosObject.contentEncoding
+                                                                                                    contentDisposition:pithosObject.contentDisposition 
+                                                                                                              manifest:pithosObject.manifest 
+                                                                                                               sharing:(pithosObject.sharing ? pithosObject.sharing : @"") 
+                                                                                                              isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
+                                                                                                              metadata:pithosObject.metadata
+                                                                                                                update:NO] retain];
+                }
                 applyMetadataObjectRequest.delegate = self;
                 applyMetadataObjectRequest.didFinishSelector = @selector(objectRequestFinished:);
                 applyMetadataObjectRequest.didFailSelector = @selector(objectRequestFailed:);
@@ -269,6 +286,8 @@ static NSImage *sharedIcon = nil;
         } else if (refreshMetadataObjectRequest == nil) {
             refreshMetadataObjectRequest = [[ASIPithosObjectRequest objectMetadataRequestWithContainerName:pithosContainer.name 
                                                                                                 objectName:prefix] retain];
+            if (sharingAccount)
+                [refreshMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
             refreshMetadataObjectRequest.delegate = self;
             refreshMetadataObjectRequest.didFinishSelector = @selector(objectRequestFinished:);
             refreshMetadataObjectRequest.didFailSelector = @selector(objectRequestFailed:);
diff --git a/pithos-macos/SharingAccountBoolTransformer.h b/pithos-macos/SharingAccountBoolTransformer.h
new file mode 100644 (file)
index 0000000..78a1685
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  SharingAccountBoolTransformer.h
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+@interface SharingAccountBoolTransformer : NSValueTransformer
+@end
diff --git a/pithos-macos/SharingAccountBoolTransformer.m b/pithos-macos/SharingAccountBoolTransformer.m
new file mode 100644 (file)
index 0000000..873c60d
--- /dev/null
@@ -0,0 +1,60 @@
+//
+//  SharingAccountBoolTransformer.m
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "SharingAccountBoolTransformer.h"
+
+@implementation SharingAccountBoolTransformer
+
++ (Class)transformedValueClass {
+       return [NSNumber class];
+}
+
++ (BOOL)allowsReverseTransformation {
+       return NO;
+}
+
+- (id)transformedValue:(id)value {
+    if (value == nil)
+        return [NSNumber numberWithBool:YES];
+    return [NSNumber numberWithBool:NO];
+}
+
++ (void)initialize {
+    [[NSValueTransformer class] setValueTransformer:[self new] forName:@"SharingAccountBoolTransformer"];
+}
+
+@end
index bfb1f93..eb4a36b 100644 (file)
@@ -39,6 +39,7 @@
 #import "PithosBrowserController.h"
 #import "PithosPreferencesController.h"
 #import "ASIPithosRequest.h"
+#import "ASIDownloadCache.h"
 
 @implementation pithos_macosAppDelegate
 @synthesize storageURLPrefix, publicURLPrefix;
 - (void)authenticateWithAuthUser:(NSString *)authUser authToken:(NSString *)authToken {
     NSLog(@"Authentication - storageURLPrefix:%@, authUser:%@, authToken:%@", storageURLPrefix, authUser, authToken);
     if ([authUser length] && [authToken length]) {
+        [[ASIDownloadCache sharedCache] clearCachedResponsesForStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
+        [ASIPithosRequest setAuthURL:storageURLPrefix];
         [ASIPithosRequest setStorageURLPrefix:storageURLPrefix];
         [ASIPithosRequest setAuthUser:authUser];
         [ASIPithosRequest setAuthToken:authToken];