Revision 919cb043

b/pithos-apple-common
1
Subproject commit 30650f5a979e5acaff4a85aa953298c83ce320a7
1
Subproject commit 2fb7b1fcdad91383badae1b73245c1c02f3d56e0
b/pithos-macos.xcodeproj/project.pbxproj
45 45
		613629B9143E51E000363787 /* GroupAndGroupMemberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 613629B8143E51E000363787 /* GroupAndGroupMemberFormatter.m */; };
46 46
		6139837113EFEECC004CE444 /* FileSystemBrowserCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6139837013EFEECC004CE444 /* FileSystemBrowserCell.m */; };
47 47
		613BA8631461520E00FACAA5 /* NonEmptyStringFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 613BA8621461520E00FACAA5 /* NonEmptyStringFormatter.m */; };
48
		614299A914CEF0E7008D973A /* ASIPithos.m in Sources */ = {isa = PBXBuildFile; fileRef = 614299A814CEF0E7008D973A /* ASIPithos.m */; };
48 49
		61433BC9141BA1CE00CD978D /* HashMapHash.m in Sources */ = {isa = PBXBuildFile; fileRef = 61433BC8141BA1CE00CD978D /* HashMapHash.m */; };
49 50
		614592BC1417CE70002E7A8C /* ASIPithosAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 614592BB1417CE70002E7A8C /* ASIPithosAccount.m */; };
50 51
		6152D08C143200CC00803874 /* PithosSharingAccountsNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6152D08B143200CC00803874 /* PithosSharingAccountsNode.m */; };
......
158 159
		6139837013EFEECC004CE444 /* FileSystemBrowserCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileSystemBrowserCell.m; path = "pithos-macos/FileSystemBrowserCell.m"; sourceTree = "<group>"; };
159 160
		613BA8611461520E00FACAA5 /* NonEmptyStringFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NonEmptyStringFormatter.h; path = "pithos-macos/NonEmptyStringFormatter.h"; sourceTree = "<group>"; };
160 161
		613BA8621461520E00FACAA5 /* NonEmptyStringFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NonEmptyStringFormatter.m; path = "pithos-macos/NonEmptyStringFormatter.m"; sourceTree = "<group>"; };
162
		614299A714CEF0E7008D973A /* ASIPithos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIPithos.h; sourceTree = "<group>"; };
163
		614299A814CEF0E7008D973A /* ASIPithos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIPithos.m; sourceTree = "<group>"; };
161 164
		61433BC7141BA1CE00CD978D /* HashMapHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HashMapHash.h; path = "pithos-macos/HashMapHash.h"; sourceTree = "<group>"; };
162 165
		61433BC8141BA1CE00CD978D /* HashMapHash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HashMapHash.m; path = "pithos-macos/HashMapHash.m"; sourceTree = "<group>"; };
163 166
		614592BA1417CE70002E7A8C /* ASIPithosAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIPithosAccount.h; sourceTree = "<group>"; };
......
338 341
		610DD33013E6BD8B00ED982F /* Pithos */ = {
339 342
			isa = PBXGroup;
340 343
			children = (
344
				614299A714CEF0E7008D973A /* ASIPithos.h */,
345
				614299A814CEF0E7008D973A /* ASIPithos.m */,
341 346
				610DD33B13E6BD8B00ED982F /* ASIPithosRequest.h */,
342 347
				610DD33C13E6BD8B00ED982F /* ASIPithosRequest.m */,
343 348
				610DD33113E6BD8B00ED982F /* ASIPithosAccountRequest.h */,
......
653 658
				6154BF501456A83200EE353A /* UsingSizeTransformer.m in Sources */,
654 659
				6154BF531456EE4900EE353A /* DirPathFileURLTransformer.m in Sources */,
655 660
				613BA8631461520E00FACAA5 /* NonEmptyStringFormatter.m in Sources */,
661
				614299A914CEF0E7008D973A /* ASIPithos.m in Sources */,
656 662
			);
657 663
			runOnlyForDeploymentPostprocessing = 0;
658 664
		};
b/pithos-macos/PithosAccountNode.h
2 2
//  PithosAccountNode.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
36 36
// or implied, of GRNET S.A.
37 37

  
38 38
#import "PithosNode.h"
39
@class ASIPithos;
39 40
@class ASIPithosAccountRequest;
40 41
@class ASIPithosAccount;
41 42

  
42 43
@interface PithosAccountNode : PithosNode {
44
    ASIPithos *pithos;
43 45
    ASIPithosAccount *pithosAccount;
44 46
    
45 47
    NSMutableArray *containers;
......
49 51
    ASIPithosAccountRequest *refreshMetadataAccountRequest;
50 52
}
51 53

  
54
@property(nonatomic, retain) ASIPithos *pithos;
52 55
@property(nonatomic, retain) ASIPithosAccount *pithosAccount;
53 56

  
57
- (id)initWithPithos:(ASIPithos *)aPithos;
58

  
54 59
- (void)applyInfo;
55 60
- (void)refreshInfo;
56 61

  
b/pithos-macos/PithosAccountNode.m
2 2
//  PithosAccountNode.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
37 37

  
38 38
#import "PithosAccountNode.h"
39 39
#import "PithosContainerNode.h"
40
#import "ASIPithos.h"
40 41
#import "ASIPithosAccountRequest.h"
41 42
#import "ASIPithosAccount.h"
42 43
#import "ASIPithosContainer.h"
......
47 48
static NSImage *sharedIcon = nil;
48 49

  
49 50
@implementation PithosAccountNode
50
@synthesize pithosAccount;
51
@synthesize pithos, pithosAccount;
51 52

  
52 53
+ (void)initialize {
53 54
	if (self == [PithosAccountNode class])
......
57 58
#pragma mark -
58 59
#pragma mark Object Lifecycle
59 60

  
61
- (id)initWithPithos:(ASIPithos *)aPithos {
62
    if ((self = [super init])) {
63
        self.pithos = aPithos;
64
    }
65
    return self;
66
}
67

  
60 68
- (void)dealloc {
61 69
    [accountRequest clearDelegatesAndCancel];
62 70
    [accountRequest release];
......
66 74
    [applyMetadataAccountRequest release];
67 75
    [containers release];
68 76
    [pithosAccount release];
77
    [pithos release];
69 78
    [super dealloc];
70 79
}
71 80

  
......
75 84
- (NSString *)url {
76 85
    if (url == nil)
77 86
        url = [[NSString alloc] initWithFormat:@"%@%@", 
78
               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
87
               (sharingAccount ? [pithos storageURLWithAuthUser:sharingAccount] : pithos.storageURL), 
79 88
               (shared ? @"?shared" : @"")];
80 89
    return url;
81 90
}
......
87 96
                break;
88 97
            case PithosNodeStateRefreshNeeded:
89 98
                freshness = PithosNodeStateRefreshing;
90
                accountRequest = [[ASIPithosAccountRequest listContainersRequestWithLimit:0 
91
                                                                                   marker:nil 
92
                                                                                   shared:shared 
93
                                                                                    until:nil] retain];
99
                accountRequest = [[ASIPithosAccountRequest listContainersRequestWithPithos:pithos 
100
                                                                                     limit:0 
101
                                                                                    marker:nil 
102
                                                                                    shared:shared 
103
                                                                                     until:nil] retain];
94 104
                if (sharingAccount)
95
                    [accountRequest setRequestUserFromDefaultTo:sharingAccount];
105
                    [accountRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
96 106
                accountRequest.delegate = self;
97 107
                accountRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
98 108
                accountRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
191 201
                newChildren = [[NSMutableArray alloc] init];
192 202
                NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
193 203
                for (ASIPithosContainer *container in containers) {
194
                    PithosContainerNode *node = [[[PithosContainerNode alloc] initWithPithosContainer:container] autorelease];
204
                    PithosContainerNode *node = [[[PithosContainerNode alloc] initWithPithos:pithos pithosContainer:container] autorelease];
195 205
                    node.parent = self;
196 206
                    node.shared = shared;
197 207
                    node.sharingAccount = sharingAccount;
......
227 237
        } else {
228 238
            [accountRequest release];
229 239
            // Do an additional request to fetch more objects
230
            accountRequest = [[ASIPithosAccountRequest listContainersRequestWithLimit:0 
231
                                                                               marker:[[someContainers lastObject] name] 
232
                                                                               shared:shared 
233
                                                                                until:nil] retain];
240
            accountRequest = [[ASIPithosAccountRequest listContainersRequestWithPithos:pithos 
241
                                                                                 limit:0 
242
                                                                                marker:[[someContainers lastObject] name] 
243
                                                                                shared:shared 
244
                                                                                 until:nil] retain];
234 245
            if (sharingAccount)
235
                [accountRequest setRequestUserFromDefaultTo:sharingAccount];
246
                [accountRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
236 247
            accountRequest.delegate = self;
237 248
            accountRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
238 249
            accountRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
312 323
            NSMutableDictionary *groups = pithosAccount.groups;
313 324
            if ([groups count] == 0)
314 325
                groups = [NSMutableDictionary dictionaryWithObject:@"" forKey:@"group"];
315
            applyMetadataAccountRequest = [[ASIPithosAccountRequest updateAccountMetadataRequestWithGroups:groups 
326
            applyMetadataAccountRequest = [[ASIPithosAccountRequest updateAccountMetadataRequestWithPithos:pithos 
327
                                                                                                    groups:groups 
316 328
                                                                                                  metadata:pithosAccount.metadata 
317 329
                                                                                                    update:NO] retain];
318 330
            applyMetadataAccountRequest.delegate = self;
......
332 344
- (void)refreshInfo {
333 345
    @synchronized(self) {
334 346
        if (refreshMetadataAccountRequest == nil) {
335
            refreshMetadataAccountRequest = [[ASIPithosAccountRequest accountMetadataRequest] retain];
347
            refreshMetadataAccountRequest = [[ASIPithosAccountRequest accountMetadataRequestWithPithos:pithos] retain];
336 348
            refreshMetadataAccountRequest.delegate = self;
337 349
            refreshMetadataAccountRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
338 350
            refreshMetadataAccountRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
b/pithos-macos/PithosBrowserController.h
2 2
//  PithosBrowserController.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
37 37

  
38 38
#import <Cocoa/Cocoa.h>
39 39
#import "PithosActivityFacility.h"
40
@class ASIPithos;
40 41
@class PithosNode;
41 42
@class PithosAccountNode;
42 43
@class PithosSharingAccountsNode;
......
45 46
@class ASINetworkQueue;
46 47

  
47 48
@interface PithosBrowserController : NSWindowController <NSBrowserDelegate, NSSplitViewDelegate, NSOutlineViewDelegate, NSOutlineViewDataSource, NSMenuDelegate, PithosActivityFacilityDelegate> {
49
    BOOL browserInitialized;
50
    
51
    ASIPithos *pithos;
52
    
48 53
    PithosNode *rootNode;
49 54
    PithosAccountNode *accountNode;
50 55
    PithosEmptyNode *containersNode;
......
89 94
    dispatch_queue_t downloadQueue;
90 95
}
91 96

  
97
@property (nonatomic, retain) ASIPithos *pithos;
98

  
92 99
@property (nonatomic, retain) PithosAccountNode *accountNode;
93 100

  
94 101
@property (nonatomic, assign) IBOutlet NSSplitView *verticalSplitView;
b/pithos-macos/PithosBrowserController.m
2 2
//  PithosBrowserController.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
47 47
#import "FileSystemBrowserCell.h"
48 48
#import "ASINetworkQueue.h"
49 49
#import "ASIPithosRequest.h"
50
#import "ASIPithos.h"
50 51
#import "ASIPithosContainerRequest.h"
51 52
#import "ASIPithosObjectRequest.h"
52 53
#import "ASIPithosAccount.h"
......
99 100
@end
100 101

  
101 102
@interface PithosBrowserController (Private)
102
- (void)resetContainers:(NSNotification *)notification;
103 103
- (BOOL)uploadFiles:(NSArray *)filenames toNode:(PithosNode *)destinationNode;
104 104
- (BOOL)moveNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode;
105 105
- (BOOL)copyNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode;
106 106
@end
107 107

  
108 108
@implementation PithosBrowserController
109
@synthesize pithos;
109 110
@synthesize accountNode;
110 111
@synthesize verticalSplitView, horizontalSplitView, leftTopView, leftBottomView, outlineView, browser, outlineViewMenu, browserMenu;
111 112
@synthesize draggedNodes, draggedParentNode;
......
150 151
    [containersNode release];
151 152
    [accountNode release];
152 153
    [rootNode release];
154
    [pithos release];
153 155
    [super dealloc];
154 156
}
155 157

  
156
- (void)awakeFromNib {
157
    [super awakeFromNib];
158
    
158
- (void)initBrowser {
159 159
    [browser registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSFilesPromisePboardType, nil]];
160 160
    [browser setDraggingSourceOperationMask:(NSDragOperationCopy|NSDragOperationMove) forLocal:YES];
161 161
    [browser setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
......
165 165
    [outlineView setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
166 166
    
167 167
    [browser setCellClass:[PithosBrowserCell class]];
168
    [browser setAllowsBranchSelection:YES];
169
    [browser setAllowsMultipleSelection:YES];
170
    [browser setAllowsEmptySelection:YES];
171
    [browser setAllowsTypeSelect:YES];
168 172
    
169 173
    moveNetworkQueue = [[ASINetworkQueue alloc] init];
170 174
    moveNetworkQueue.shouldCancelAllRequestsOnFailure = NO;
......
189 193
    deleteQueue = dispatch_queue_create("gr.grnet.pithos.DeleteQueue", NULL);
190 194
    uploadQueue = dispatch_queue_create("gr.grnet.pithos.UploadQueue", NULL);
191 195
    downloadQueue = dispatch_queue_create("gr.grnet.pithos.DownloadQueue", NULL);
192
}
193

  
194
- (void)resetContainers:(NSNotification *)notification {
195
    [refreshTimer invalidate];
196
    [refreshTimer release];
197
    
198
    [moveNetworkQueue cancelAllOperations];
199
    [copyNetworkQueue cancelAllOperations];
200
    [deleteNetworkQueue cancelAllOperations];
201
    [uploadNetworkQueue cancelAllOperations];
202
    [downloadNetworkQueue cancelAllOperations];
203
    
204
    rootNode = nil;
205
    [browser loadColumnZero];
206
    [containersNodeChildren removeAllObjects];
207
    [outlineView reloadData];
208
	// Expand the folder outline view
209
    [outlineView expandItem:nil expandChildren:YES];
210
	[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
211
    
212
    // Refresh account
213
    [accountNode refresh];
214
    [mySharedNode refresh];
215
    [othersSharedNode refresh];
216
    
217
    [activityFacility reset];
218
    
219
    refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(forceRefresh:) userInfo:self repeats:YES] retain];
220
}
221

  
222
- (void)windowDidLoad {
223
    [super windowDidLoad];
224 196
    
225 197
    [activityProgressIndicator setUsesThreadedAnimation:YES];
226 198
    [activityProgressIndicator setMinValue:0.0];
227 199
    [activityProgressIndicator setMaxValue:1.0];
228 200
    activityFacility = [PithosActivityFacility defaultPithosActivityFacility];
229
    activityFacility.delegate = self;
230 201
    
231
    self.accountNode = [[[PithosAccountNode alloc] init] autorelease];
202
    self.accountNode = [[[PithosAccountNode alloc] initWithPithos:pithos] autorelease];
232 203
    containersNode = [[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil];
233 204
    containersNodeChildren = [[NSMutableArray alloc] init];
234 205
    sharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil];
235
    mySharedNode = [[PithosAccountNode alloc] init];
206
    mySharedNode = [[PithosAccountNode alloc] initWithPithos:pithos];
236 207
    mySharedNode.displayName = @"my shared";
237 208
    mySharedNode.shared = YES;
238 209
    mySharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
239
    othersSharedNode = [[PithosSharingAccountsNode alloc] init];
210
    othersSharedNode = [[PithosSharingAccountsNode alloc] initWithPithos:pithos];
240 211
    othersSharedNode.displayName = @"others shared";
241 212
    othersSharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)];
242 213
    
......
268 239
                                             selector:@selector(pithosNodeChildrenUpdated:) 
269 240
                                                 name:@"PithosSharingAccountsNodeChildrenUpdated" 
270 241
                                               object:othersSharedNode];
271
    // Updated authentication credentials reset containers in the outline view 
272
    [[NSNotificationCenter defaultCenter] addObserver:self 
273
                                             selector:@selector(resetContainers:) 
274
                                                 name:@"PithosAuthenticationCredentialsUpdated" 
275
                                               object:nil];
276 242
    // Request for browser refresh 
277 243
    [[NSNotificationCenter defaultCenter] addObserver:self 
278 244
                                             selector:@selector(pithosBrowserRefreshNeeded:) 
279 245
                                                 name:@"PithosBrowserRefreshNeeeded" 
280
                                               object:nil];    
246
                                               object:nil];
247
}
248

  
249
- (void)resetBrowser {
250
    [refreshTimer invalidate];
251
    [refreshTimer release];
252
    
253
    [moveNetworkQueue cancelAllOperations];
254
    [copyNetworkQueue cancelAllOperations];
255
    [deleteNetworkQueue cancelAllOperations];
256
    [uploadNetworkQueue cancelAllOperations];
257
    [downloadNetworkQueue cancelAllOperations];
258
    
259
    rootNode = nil;
260
    [browser loadColumnZero];
261
    [containersNodeChildren removeAllObjects];
262
    [outlineView reloadData];
263
	// Expand the folder outline view
264
    [outlineView expandItem:nil expandChildren:YES];
265
	[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
266
    
267
    activityFacility.delegate = nil;
268
    [activityProgressIndicator setDoubleValue:1.0];
269
    [activityProgressIndicator stopAnimation:self];
270
}
271

  
272
- (void)startBrowser {
273
    accountNode.pithos = pithos;
274
    [accountNode refresh];
275
    mySharedNode.pithos = pithos;
276
    [mySharedNode refresh];
277
    othersSharedNode.pithos = pithos;
278
    [othersSharedNode refresh];
279
    
280
    [activityFacility reset];
281
    activityFacility.delegate = self;
282
    
283
    refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(forceRefresh:) userInfo:self repeats:YES] retain];
284
}
285

  
286
- (void)setPithos:(ASIPithos *)aPithos {
287
    if (aPithos && [aPithos isNotEqualTo:pithos]) {
288
        [self resetBrowser];
289
        [pithos release];
290
        pithos = [aPithos retain];
291
        [self startBrowser];
292
    }
293
}
294

  
295
- (void)windowDidLoad {
296
    [super windowDidLoad];
297
    if (browser && !browserInitialized) {
298
        browserInitialized = YES;
299
        [self initBrowser];
300
    }
281 301
}
282 302

  
283 303
#pragma mark -
......
325 345
    BOOL refreshAccountNode = NO;
326 346
    if (!containerPithosFound) {
327 347
        // Create pithos node
328
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithContainerName:@"pithos"];
348
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithPithos:pithos 
349
                                                                                                            containerName:@"pithos"];
329 350
        [[PithosUtilities prepareRequest:containerRequest priority:NSOperationQueuePriorityVeryHigh] startAsynchronous];
330 351
        while (![containerRequest isFinished]) {
331 352
            usleep(1);
......
338 359
    }
339 360
    if (!containerTrashFound) {
340 361
        // Create trash node
341
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithContainerName:@"trash"];
362
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithPithos:pithos 
363
                                                                                                            containerName:@"trash"];
342 364
        [[PithosUtilities prepareRequest:containerRequest priority:NSOperationQueuePriorityVeryHigh] startAsynchronous];
343 365
        while (![containerRequest isFinished]) {
344 366
            usleep(1);
......
474 496
                destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
475 497
            NSError *error = nil;
476 498
            BOOL isDirectory;
477
            if ([PithosUtilities objectExistsAtContainerName:node.pithosContainer.name 
478
                                                  objectName:destinationObjectName 
479
                                                       error:&error 
480
                                                 isDirectory:&isDirectory 
481
                                              sharingAccount:nil]) {
499
            if ([PithosUtilities objectExistsAtPithos:pithos 
500
                                        containerName:node.pithosContainer.name 
501
                                           objectName:destinationObjectName 
502
                                                error:&error 
503
                                          isDirectory:&isDirectory 
504
                                       sharingAccount:nil]) {
482 505
                NSAlert *alert = [[[NSAlert alloc] init] autorelease];
483 506
                [alert setMessageText:@"Name Taken"];
484 507
                [alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
......
490 513
                [pool drain];
491 514
                return;
492 515
            }
493
            ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithContainerName:node.pithosContainer.name 
494
                                                                                             objectName:node.pithosObject.name 
495
                                                                               destinationContainerName:node.pithosContainer.name 
496
                                                                                  destinationObjectName:destinationObjectName 
497
                                                                                          checkIfExists:NO];
516
            ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithPithos:pithos 
517
                                                                                   containerName:node.pithosContainer.name 
518
                                                                                      objectName:node.pithosObject.name 
519
                                                                        destinationContainerName:node.pithosContainer.name 
520
                                                                           destinationObjectName:destinationObjectName 
521
                                                                                   checkIfExists:NO];
498 522
            if (objectRequest) {
499 523
                objectRequest.delegate = self;
500 524
                objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
533 557
            NSString *destinationObjectName = [[node.pithosObject.name stringByDeletingLastPathComponent] stringByAppendingPathComponent:newName];
534 558
            NSError *error = nil;
535 559
            BOOL isDirectory;
536
            if ([PithosUtilities objectExistsAtContainerName:node.pithosContainer.name 
537
                                                  objectName:destinationObjectName 
538
                                                       error:&error 
539
                                                 isDirectory:&isDirectory 
540
                                              sharingAccount:nil]) {
560
            if ([PithosUtilities objectExistsAtPithos:pithos 
561
                                        containerName:node.pithosContainer.name 
562
                                           objectName:destinationObjectName 
563
                                                error:&error 
564
                                          isDirectory:&isDirectory 
565
                                       sharingAccount:nil]) {
541 566
                NSAlert *alert = [[[NSAlert alloc] init] autorelease];
542 567
                [alert setMessageText:@"Name Taken"];
543 568
                [alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
......
551 576
            }
552 577
            if (node.pithosObject.subdir)
553 578
                destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
554
            NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithContainerName:node.pithosContainer.name 
555
                                                                                         objectName:node.pithosObject.name 
556
                                                                           destinationContainerName:node.pithosContainer.name 
557
                                                                              destinationObjectName:destinationObjectName 
558
                                                                                      checkIfExists:NO];
579
            NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithPithos:pithos 
580
                                                                               containerName:node.pithosContainer.name 
581
                                                                                  objectName:node.pithosObject.name 
582
                                                                    destinationContainerName:node.pithosContainer.name 
583
                                                                       destinationObjectName:destinationObjectName 
584
                                                                               checkIfExists:NO];
559 585
            if (objectRequests) {
560 586
                for (ASIPithosObjectRequest *objectRequest in objectRequests) {
561 587
                    objectRequest.delegate = self;
......
640 666
            if (choice == NSAlertFirstButtonReturn) {
641 667
                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
642 668
                    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
643
                    NSArray *objectRequests = [PithosUtilities objectDataRequestsForSubdirWithContainerName:node.pithosContainer.name 
644
                                                                                                     objectName:node.pithosObject.name 
645
                                                                                                    toDirectory:[dropDestination path] 
646
                                                                                                  checkIfExists:YES 
647
                                                                                                 sharingAccount:node.sharingAccount];
669
                    NSArray *objectRequests = [PithosUtilities objectDataRequestsForSubdirWithPithos:pithos 
670
                                                                                       containerName:node.pithosContainer.name 
671
                                                                                          objectName:node.pithosObject.name 
672
                                                                                         toDirectory:[dropDestination path] 
673
                                                                                       checkIfExists:YES 
674
                                                                                      sharingAccount:node.sharingAccount];
648 675
                    if (objectRequests) {
649 676
                        for (__block ASIPithosObjectRequest *objectRequest in objectRequests) {
650 677
                            [names addObject:[objectRequest.userInfo objectForKey:@"fileName"]];
......
687 714
        } else {
688 715
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
689 716
                NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
690
                __block ASIPithosObjectRequest *objectRequest = [PithosUtilities objectDataRequestWithContainerName:node.pithosContainer.name 
691
                                                                                                         objectName:node.pithosObject.name 
692
                                                                                                        toDirectory:[dropDestination path] 
693
                                                                                                      checkIfExists:YES 
694
                                                                                                     sharingAccount:node.sharingAccount];
717
                __block ASIPithosObjectRequest *objectRequest = [PithosUtilities objectDataRequestWithPithos:pithos 
718
                                                                                               containerName:node.pithosContainer.name 
719
                                                                                                  objectName:node.pithosObject.name 
720
                                                                                                 toDirectory:[dropDestination path] 
721
                                                                                               checkIfExists:YES 
722
                                                                                              sharingAccount:node.sharingAccount];
695 723
                if (objectRequest) {
696 724
                    [names addObject:[objectRequest.userInfo objectForKey:@"fileName"]];
697 725
                    objectRequest.delegate = self;
......
855 883
    else
856 884
        objectNamePrefix = [NSString string];
857 885
    if ((destinationNode.pithosContainer.blockHash == nil) || (destinationNode.pithosContainer.blockSize == 0)) {
858
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest containerMetadataRequestWithContainerName:containerName];
886
        ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest containerMetadataRequestWithPithos:pithos 
887
                                                                                                      containerName:containerName];
859 888
        [[PithosUtilities prepareRequest:containerRequest priority:NSOperationQueuePriorityVeryHigh] startAsynchronous];
860 889
        while (![containerRequest isFinished]) {
861 890
            usleep(1);
......
888 917
                    if (error)
889 918
                        NSLog(@"contentType detection error: %@", error);
890 919
                    NSArray *hashes = nil;
891
                    ASIPithosObjectRequest *objectRequest = [PithosUtilities writeObjectDataRequestWithContainerName:containerName 
892
                                                                                                          objectName:objectName 
893
                                                                                                         contentType:contentType 
894
                                                                                                           blockSize:blockSize 
895
                                                                                                           blockHash:blockHash 
896
                                                                                                             forFile:filePath 
897
                                                                                                       checkIfExists:YES 
898
                                                                                                              hashes:&hashes 
899
                                                                                                      sharingAccount:destinationNode.sharingAccount];
920
                    ASIPithosObjectRequest *objectRequest = [PithosUtilities writeObjectDataRequestWithPithos:pithos 
921
                                                                                                containerName:containerName 
922
                                                                                                   objectName:objectName 
923
                                                                                                  contentType:contentType 
924
                                                                                                    blockSize:blockSize 
925
                                                                                                    blockHash:blockHash 
926
                                                                                                      forFile:filePath 
927
                                                                                                checkIfExists:YES 
928
                                                                                                       hashes:&hashes 
929
                                                                                               sharingAccount:destinationNode.sharingAccount];
900 930
                    if (objectRequest) {
901 931
                        objectRequest.delegate = self;
902 932
                        objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
952 982
                        NSMutableArray *filePaths = nil;
953 983
                        NSMutableArray *hashesArrays = nil;
954 984
                        NSMutableArray *directoryObjectRequests = nil;
955
                        NSArray *objectRequests = [PithosUtilities writeObjectDataRequestsWithContainerName:containerName 
956
                                                                                                     objectName:objectName 
957
                                                                                                      blockSize:blockSize 
958
                                                                                                      blockHash:blockHash 
959
                                                                                                   forDirectory:filePath 
960
                                                                                                  checkIfExists:YES 
961
                                                                                                    objectNames:&objectNames
962
                                                                                                   contentTypes:&contentTypes
963
                                                                                                      filePaths:&filePaths
964
                                                                                                   hashesArrays:&hashesArrays 
965
                                                                                        directoryObjectRequests:&directoryObjectRequests 
966
                                                                                                 sharingAccount:destinationNode.sharingAccount];
985
                        NSArray *objectRequests = [PithosUtilities writeObjectDataRequestsWithPithos:pithos 
986
                                                                                       containerName:containerName 
987
                                                                                          objectName:objectName 
988
                                                                                           blockSize:blockSize 
989
                                                                                           blockHash:blockHash 
990
                                                                                        forDirectory:filePath 
991
                                                                                       checkIfExists:YES 
992
                                                                                         objectNames:&objectNames
993
                                                                                        contentTypes:&contentTypes
994
                                                                                           filePaths:&filePaths
995
                                                                                        hashesArrays:&hashesArrays 
996
                                                                             directoryObjectRequests:&directoryObjectRequests 
997
                                                                                      sharingAccount:destinationNode.sharingAccount];
967 998
                        for (ASIPithosObjectRequest *objectRequest in directoryObjectRequests) {
968 999
                            objectRequest.delegate = self;
969 1000
                            objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
1053 1084
                NSString *destinationObjectName = [objectNamePrefix stringByAppendingPathComponent:node.displayName];
1054 1085
                if ([node.pithosObject.name hasSuffix:@"/"])
1055 1086
                    destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
1056
                ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithContainerName:node.pithosContainer.name 
1057
                                                                                                     objectName:node.pithosObject.name 
1058
                                                                                       destinationContainerName:containerName 
1059
                                                                                          destinationObjectName:destinationObjectName 
1060
                                                                                                  checkIfExists:YES];
1087
                ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithPithos:pithos 
1088
                                                                                       containerName:node.pithosContainer.name 
1089
                                                                                          objectName:node.pithosObject.name 
1090
                                                                            destinationContainerName:containerName 
1091
                                                                               destinationObjectName:destinationObjectName 
1092
                                                                                       checkIfExists:YES];
1061 1093
                if (objectRequest) {
1062 1094
                    objectRequest.delegate = self;
1063 1095
                    objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
1093 1125
                NSString *destinationObjectName = [objectNamePrefix stringByAppendingPathComponent:node.displayName];
1094 1126
                if (node.pithosObject.subdir)
1095 1127
                    destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
1096
                NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithContainerName:node.pithosContainer.name 
1097
                                                                                                 objectName:node.pithosObject.name 
1098
                                                                                   destinationContainerName:containerName 
1099
                                                                                      destinationObjectName:destinationObjectName 
1100
                                                                                              checkIfExists:YES];
1128
                NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithPithos:pithos 
1129
                                                                                   containerName:node.pithosContainer.name 
1130
                                                                                      objectName:node.pithosObject.name 
1131
                                                                        destinationContainerName:containerName 
1132
                                                                           destinationObjectName:destinationObjectName 
1133
                                                                                   checkIfExists:YES];
1101 1134
                if (objectRequests) {
1102 1135
                    for (ASIPithosObjectRequest *objectRequest in objectRequests) {
1103 1136
                        objectRequest.delegate = self;
......
1157 1190
                    if ([node.pithosObject.name hasSuffix:@"/"])
1158 1191
                        destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
1159 1192
                } else {
1160
                    destinationObjectName = [PithosUtilities safeObjectNameForContainerName:containerName 
1161
                                                                                 objectName:node.pithosObject.name];
1193
                    destinationObjectName = [PithosUtilities safeObjectNameForPithos:pithos 
1194
                                                                       containerName:containerName 
1195
                                                                          objectName:node.pithosObject.name];
1162 1196
                }
1163
                ASIPithosObjectRequest *objectRequest = [PithosUtilities copyObjectRequestWithContainerName:node.pithosContainer.name 
1164
                                                                                                     objectName:node.pithosObject.name 
1165
                                                                                       destinationContainerName:containerName 
1166
                                                                                          destinationObjectName:destinationObjectName 
1167
                                                                                                  checkIfExists:YES 
1168
                                                                                                 sharingAccount:node.sharingAccount];
1197
                ASIPithosObjectRequest *objectRequest = [PithosUtilities copyObjectRequestWithPithos:pithos 
1198
                                                                                       containerName:node.pithosContainer.name 
1199
                                                                                          objectName:node.pithosObject.name 
1200
                                                                            destinationContainerName:containerName 
1201
                                                                               destinationObjectName:destinationObjectName 
1202
                                                                                       checkIfExists:YES 
1203
                                                                                      sharingAccount:node.sharingAccount];
1169 1204
                if (objectRequest) {
1170 1205
                    objectRequest.delegate = self;
1171 1206
                    objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
1204 1239
                    if (node.pithosObject.subdir)
1205 1240
                        destinationObjectName = [destinationObjectName stringByAppendingString:@"/"];
1206 1241
                } else {
1207
                    destinationObjectName = [PithosUtilities safeSubdirNameForContainerName:containerName 
1208
                                                                                     subdirName:node.pithosObject.name];
1242
                    destinationObjectName = [PithosUtilities safeSubdirNameForPithos:pithos 
1243
                                                                       containerName:containerName 
1244
                                                                          subdirName:node.pithosObject.name];
1209 1245
                }
1210
                NSArray *objectRequests = [PithosUtilities copyObjectRequestsForSubdirWithContainerName:node.pithosContainer.name 
1211
                                                                                                 objectName:node.pithosObject.name 
1212
                                                                                   destinationContainerName:containerName 
1213
                                                                                      destinationObjectName:destinationObjectName 
1214
                                                                                              checkIfExists:YES 
1215
                                                                                             sharingAccount:node.sharingAccount];
1246
                NSArray *objectRequests = [PithosUtilities copyObjectRequestsForSubdirWithPithos:pithos 
1247
                                                                                   containerName:node.pithosContainer.name 
1248
                                                                                      objectName:node.pithosObject.name 
1249
                                                                        destinationContainerName:containerName 
1250
                                                                           destinationObjectName:destinationObjectName 
1251
                                                                                   checkIfExists:YES 
1252
                                                                                  sharingAccount:node.sharingAccount];
1216 1253
                if (objectRequests) {
1217 1254
                    for (ASIPithosObjectRequest *objectRequest in objectRequests) {
1218 1255
                        objectRequest.delegate = self;
......
1431 1468
        }
1432 1469
        NSLog(@"object is missing hashes: %@", objectRequest.url);
1433 1470
        NSIndexSet *missingBlocks = [PithosUtilities missingBlocksForHashes:[objectRequest.userInfo objectForKey:@"hashes"]
1434
                                                  withMissingHashesResponse:[objectRequest responseString]];
1471
                                                          withMissingHashes:[objectRequest hashes]];
1435 1472
        NSUInteger blockSize = [[objectRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue];
1436 1473
        if (totalBytes >= [missingBlocks count]*blockSize)
1437 1474
            currentBytes = totalBytes - [missingBlocks count]*blockSize;
......
1442 1479
                                currentBytes:currentBytes];
1443 1480
        });
1444 1481
        NSUInteger missingBlockIndex = [missingBlocks firstIndex];
1445
        __block ASIPithosContainerRequest *newContainerRequest = [PithosUtilities updateContainerDataRequestWithContainerName:[objectRequest.userInfo objectForKey:@"containerName"] 
1446
                                                                                                                    blockSize:blockSize 
1447
                                                                                                                      forFile:[objectRequest.userInfo objectForKey:@"filePath"] 
1448
                                                                                                            missingBlockIndex:missingBlockIndex 
1449
                                                                                                               sharingAccount:[objectRequest.userInfo objectForKey:@"sharingAccount"]];
1482
        __block ASIPithosContainerRequest *newContainerRequest = [PithosUtilities updateContainerDataRequestWithPithos:pithos 
1483
                                                                                                         containerName:[objectRequest.userInfo objectForKey:@"containerName"] 
1484
                                                                                                             blockSize:blockSize 
1485
                                                                                                               forFile:[objectRequest.userInfo objectForKey:@"filePath"] 
1486
                                                                                                     missingBlockIndex:missingBlockIndex 
1487
                                                                                                        sharingAccount:[objectRequest.userInfo objectForKey:@"sharingAccount"]];
1450 1488
        newContainerRequest.delegate = self;
1451 1489
        newContainerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
1452 1490
        newContainerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
1482 1520
        missingBlockIndex = [missingBlocks indexGreaterThanIndex:missingBlockIndex];
1483 1521
        if (missingBlockIndex == NSNotFound) {
1484 1522
            NSArray *hashes = [containerRequest.userInfo objectForKey:@"hashes"];
1485
            ASIPithosObjectRequest *newObjectRequest = [PithosUtilities writeObjectDataRequestWithContainerName:[containerRequest.userInfo objectForKey:@"containerName"] 
1486
                                                                                                     objectName:[containerRequest.userInfo objectForKey:@"objectName"] 
1487
                                                                                                    contentType:[containerRequest.userInfo objectForKey:@"contentType"] 
1488
                                                                                                      blockSize:blockSize 
1489
                                                                                                      blockHash:[containerRequest.userInfo objectForKey:@"blockHash"]
1490
                                                                                                        forFile:[containerRequest.userInfo objectForKey:@"filePath"] 
1491
                                                                                                  checkIfExists:NO 
1492
                                                                                                         hashes:&hashes 
1493
                                                                                                 sharingAccount:[containerRequest.userInfo objectForKey:@"sharingAccount"]];
1523
            ASIPithosObjectRequest *newObjectRequest = [PithosUtilities writeObjectDataRequestWithPithos:pithos 
1524
                                                                                           containerName:[containerRequest.userInfo objectForKey:@"containerName"] 
1525
                                                                                              objectName:[containerRequest.userInfo objectForKey:@"objectName"] 
1526
                                                                                             contentType:[containerRequest.userInfo objectForKey:@"contentType"] 
1527
                                                                                               blockSize:blockSize 
1528
                                                                                               blockHash:[containerRequest.userInfo objectForKey:@"blockHash"]
1529
                                                                                                 forFile:[containerRequest.userInfo objectForKey:@"filePath"] 
1530
                                                                                           checkIfExists:NO 
1531
                                                                                                  hashes:&hashes 
1532
                                                                                          sharingAccount:[containerRequest.userInfo objectForKey:@"sharingAccount"]];
1494 1533
            newObjectRequest.delegate = self;
1495 1534
            newObjectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
1496 1535
            newObjectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
1501 1540
            [(NSMutableDictionary *)(newObjectRequest.userInfo) setObject:NSStringFromSelector(@selector(uploadObjectUsingHashMapFinished:)) forKey:@"didFinishSelector"];
1502 1541
            [uploadNetworkQueue addOperation:[PithosUtilities prepareRequest:newObjectRequest priority:[[newObjectRequest.userInfo objectForKey:@"priority"] integerValue]]];
1503 1542
        } else {
1504
            __block ASIPithosContainerRequest *newContainerRequest = [PithosUtilities updateContainerDataRequestWithContainerName:[containerRequest.userInfo objectForKey:@"containerName"]
1505
                                                                                                                        blockSize:[[containerRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]
1506
                                                                                                                          forFile:[containerRequest.userInfo objectForKey:@"filePath"] 
1507
                                                                                                                missingBlockIndex:missingBlockIndex 
1508
                                                                                                                   sharingAccount:[containerRequest.userInfo objectForKey:@"sharingAccount"]];
1543
            __block ASIPithosContainerRequest *newContainerRequest = [PithosUtilities updateContainerDataRequestWithPithos:pithos 
1544
                                                                                                             containerName:[containerRequest.userInfo objectForKey:@"containerName"]
1545
                                                                                                                 blockSize:[[containerRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue]
1546
                                                                                                                   forFile:[containerRequest.userInfo objectForKey:@"filePath"] 
1547
                                                                                                         missingBlockIndex:missingBlockIndex 
1548
                                                                                                            sharingAccount:[containerRequest.userInfo objectForKey:@"sharingAccount"]];
1509 1549
            newContainerRequest.delegate = self;
1510 1550
            newContainerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
1511 1551
            newContainerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
1907 1947
    if ([node class] == [PithosContainerNode class]) {
1908 1948
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
1909 1949
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1910
            NSString *safeObjectName = [PithosUtilities safeSubdirNameForContainerName:node.pithosContainer.name 
1911
                                                                                subdirName:@"untitled folder"];
1950
            NSString *safeObjectName = [PithosUtilities safeSubdirNameForPithos:pithos 
1951
                                                                  containerName:node.pithosContainer.name 
1952
                                                                     subdirName:@"untitled folder"];
1912 1953
            NSString *fileName = [safeObjectName lastPathComponent];
1913
            ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest writeObjectDataRequestWithContainerName:node.pithosContainer.name 
1914
                                                                                                         objectName:safeObjectName 
1915
                                                                                                           eTag:nil 
1916
                                                                                                    contentType:@"application/directory" 
1917
                                                                                                contentEncoding:nil 
1918
                                                                                             contentDisposition:nil 
1919
                                                                                                       manifest:nil 
1920
                                                                                                        sharing:nil 
1921
                                                                                                       isPublic:ASIPithosObjectRequestPublicIgnore 
1922
                                                                                                       metadata:nil 
1923
                                                                                                           data:[NSData data]];
1954
            ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest writeObjectDataRequestWithPithos:pithos 
1955
                                                                                               containerName:node.pithosContainer.name 
1956
                                                                                                  objectName:safeObjectName 
1957
                                                                                                        eTag:nil 
1958
                                                                                                 contentType:@"application/directory" 
1959
                                                                                             contentEncoding:nil 
1960
                                                                                          contentDisposition:nil 
1961
                                                                                                    manifest:nil 
1962
                                                                                                     sharing:nil 
1963
                                                                                                    isPublic:ASIPithosObjectRequestPublicIgnore 
1964
                                                                                                    metadata:nil 
1965
                                                                                                        data:[NSData data]];
1924 1966
            objectRequest.delegate = self;
1925 1967
            objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
1926 1968
            objectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
1949 1991
               (node.pithosObject.subdir || ![node.pithosObject.name hasSuffix:@"/"])) {
1950 1992
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
1951 1993
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1952
            NSString *safeObjectName = [PithosUtilities safeSubdirNameForContainerName:node.pithosContainer.name 
1953
                                                                               subdirName:[node.pithosObject.name stringByAppendingPathComponent:@"untitled folder"]];
1994
            NSString *safeObjectName = [PithosUtilities safeSubdirNameForPithos:pithos 
1995
                                                                  containerName:node.pithosContainer.name 
1996
                                                                     subdirName:[node.pithosObject.name stringByAppendingPathComponent:@"untitled folder"]];
1954 1997
            NSString *fileName = [safeObjectName lastPathComponent];
1955
            ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest writeObjectDataRequestWithContainerName:node.pithosContainer.name 
1956
                                                                                                        objectName:safeObjectName 
1957
                                                                                                              eTag:nil 
1958
                                                                                                       contentType:@"application/directory" 
1959
                                                                                                   contentEncoding:nil 
1960
                                                                                                contentDisposition:nil 
1961
                                                                                                          manifest:nil 
1962
                                                                                                           sharing:nil 
1963
                                                                                                          isPublic:ASIPithosObjectRequestPublicIgnore 
1964
                                                                                                          metadata:nil 
1965
                                                                                                              data:[NSData data]];
1998
            ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest writeObjectDataRequestWithPithos:pithos 
1999
                                                                                               containerName:node.pithosContainer.name 
2000
                                                                                                  objectName:safeObjectName 
2001
                                                                                                        eTag:nil 
2002
                                                                                                 contentType:@"application/directory" 
2003
                                                                                             contentEncoding:nil 
2004
                                                                                          contentDisposition:nil 
2005
                                                                                                    manifest:nil 
2006
                                                                                                     sharing:nil 
2007
                                                                                                    isPublic:ASIPithosObjectRequestPublicIgnore 
2008
                                                                                                    metadata:nil 
2009
                                                                                                        data:[NSData data]];
1966 2010
            objectRequest.delegate = self;
1967 2011
            objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
1968 2012
            objectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
2005 2049
                NSString *fileName = [node.pithosObject.name lastPathComponent];
2006 2050
                if ([node.pithosObject.name hasSuffix:@"/"])
2007 2051
                    fileName = [fileName stringByAppendingString:@"/"];
2008
                ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest deleteObjectRequestWithContainerName:node.pithosContainer.name 
2009
                                                                                                          objectName:node.pithosObject.name];
2052
                ASIPithosObjectRequest *objectRequest = [ASIPithosObjectRequest deleteObjectRequestWithPithos:pithos 
2053
                                                                                                containerName:node.pithosContainer.name 
2054
                                                                                                   objectName:node.pithosObject.name];
2010 2055
                objectRequest.delegate = self;
2011 2056
                objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
2012 2057
                objectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
2033 2078
        } else if ([node class] == [PithosSubdirNode class]) {
2034 2079
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
2035 2080
                NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2036
                NSArray *objectRequests = [PithosUtilities deleteObjectRequestsForSubdirWithContainerName:node.pithosContainer.name 
2037
                                                                                               objectName:node.pithosObject.name];
2081
                NSArray *objectRequests = [PithosUtilities deleteObjectRequestsForSubdirWithPithos:pithos 
2082
                                                                                     containerName:node.pithosContainer.name 
2083
                                                                                        objectName:node.pithosObject.name];
2038 2084
                if (objectRequests) {
2039 2085
                    for (ASIPithosObjectRequest *objectRequest in objectRequests) {
2040 2086
                        objectRequest.delegate = self;
......
2074 2120
             [node.pithosObject.name hasSuffix:@"/"])) {
2075 2121
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
2076 2122
                NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2077
                NSString *safeObjectName = [PithosUtilities safeObjectNameForContainerName:@"trash" 
2078
                                                                                    objectName:node.pithosObject.name];
2123
                NSString *safeObjectName = [PithosUtilities safeObjectNameForPithos:pithos 
2124
                                                                      containerName:@"trash" 
2125
                                                                         objectName:node.pithosObject.name];
2079 2126
                if (safeObjectName) {
2080
                    ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithContainerName:node.pithosContainer.name 
2081
                                                                                                         objectName:node.pithosObject.name 
2082
                                                                                           destinationContainerName:@"trash" 
2083
                                                                                              destinationObjectName:safeObjectName 
2084
                                                                                                      checkIfExists:NO];
2127
                    ASIPithosObjectRequest *objectRequest = [PithosUtilities moveObjectRequestWithPithos:pithos 
2128
                                                                                           containerName:node.pithosContainer.name 
2129
                                                                                              objectName:node.pithosObject.name 
2130
                                                                                destinationContainerName:@"trash" 
2131
                                                                                   destinationObjectName:safeObjectName 
2132
                                                                                           checkIfExists:NO];
2085 2133
                    if (objectRequest) {
2086 2134
                        objectRequest.delegate = self;
2087 2135
                        objectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
2115 2163
        } else if ([node class] == [PithosSubdirNode class]) {
2116 2164
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
2117 2165
                NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2118
                NSString *safeObjectName = [PithosUtilities safeSubdirNameForContainerName:@"trash" 
2119
                                                                                    subdirName:node.pithosObject.name];
2166
                NSString *safeObjectName = [PithosUtilities safeSubdirNameForPithos:pithos 
2167
                                                                      containerName:@"trash" 
2168
                                                                         subdirName:node.pithosObject.name];
2120 2169
                if (safeObjectName) {
2121
                    NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithContainerName:node.pithosContainer.name 
2122
                                                                                                     objectName:node.pithosObject.name 
2123
                                                                                       destinationContainerName:@"trash" 
2124
                                                                                          destinationObjectName:safeObjectName 
2125
                                                                                                  checkIfExists:NO];
2170
                    NSArray *objectRequests = [PithosUtilities moveObjectRequestsForSubdirWithPithos:pithos 
2171
                                                                                       containerName:node.pithosContainer.name 
2172
                                                                                          objectName:node.pithosObject.name 
2173
                                                                            destinationContainerName:@"trash" 
2174
                                                                               destinationObjectName:safeObjectName 
2175
                                                                                       checkIfExists:NO];
2126 2176
                    if (objectRequests) {
2127 2177
                        for (ASIPithosObjectRequest *objectRequest in objectRequests) {
2128 2178
                            objectRequest.delegate = self;
b/pithos-macos/PithosContainerNode.h
2 2
//  PithosContainerNode.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
36 36
// or implied, of GRNET S.A.
37 37

  
38 38
#import "PithosNode.h"
39
@class ASIPithos;
39 40
@class ASIPithosContainer;
40 41
@class ASIPithosContainerRequest;
41 42

  
42 43
@interface PithosContainerNode : PithosNode {
44
    ASIPithos *pithos;
43 45
    ASIPithosContainer *pithosContainer;
44 46
    
45 47
    NSMutableArray *objects;
......
54 56
    NSNumber *policyQuota;
55 57
}
56 58

  
57
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer;
58
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon;
59
- (id)initWithContainerName:(NSString *)aContainerName;
60
- (id)initWithContainerName:(NSString *)aContainerName icon:(NSImage *)anIcon;
59
- (id)initWithPithos:(ASIPithos *)aPithos pithosContainer:(ASIPithosContainer *)aPithosContainer;
60
- (id)initWithPithos:(ASIPithos *)aPithos pithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon;
61
- (id)initWithPithos:(ASIPithos *)aPithos containerName:(NSString *)aContainerName;
62
- (id)initWithPithos:(ASIPithos *)aPithos containerName:(NSString *)aContainerName icon:(NSImage *)anIcon;
61 63

  
64
@property(nonatomic, retain) ASIPithos *pithos;
62 65
@property(nonatomic, retain) ASIPithosContainer *pithosContainer;
63 66
@property(nonatomic, retain) NSString *prefix;
64 67
@property(nonatomic, retain) NSString *policyVersioning;
b/pithos-macos/PithosContainerNode.m
2 2
//  PithosContainerNode.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
38 38
#import "PithosContainerNode.h"
39 39
#import "PithosObjectNode.h"
40 40
#import "PithosSubdirNode.h"
41
#import "ASIPithos.h"
41 42
#import "ASIPithosContainerRequest.h"
42 43
#import "ASIPithosContainer.h"
43 44
#import "ASIPithosObject.h"
......
49 50
static NSImage *sharedIcon = nil;
50 51

  
51 52
@implementation PithosContainerNode
52
@synthesize pithosContainer, prefix;
53
@synthesize pithos, pithosContainer, prefix;
53 54
@synthesize policyVersioning, policyQuota;
54 55

  
55 56
+ (void)initialize {
......
60 61
#pragma mark -
61 62
#pragma mark Object Lifecycle
62 63

  
63
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon {
64
- (id)initWithPithos:(ASIPithos *)aPithos pithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon {
64 65
    if ((self = [super init])) {
66
        self.pithos = aPithos;
65 67
        self.pithosContainer = aPithosContainer;
66 68
        prefix = nil;
67 69
        self.icon = anIcon;
......
70 72
    return self;
71 73
}
72 74

  
73
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer {
74
    return [self initWithPithosContainer:aPithosContainer icon:nil];
75
- (id)initWithPithos:(ASIPithos *)aPithos pithosContainer:(ASIPithosContainer *)aPithosContainer {
76
    return [self initWithPithos:aPithos pithosContainer:aPithosContainer icon:nil];
75 77
}
76 78

  
77
- (id)initWithContainerName:(NSString *)aContainerName icon:(NSImage *)anIcon {
79
- (id)initWithPithos:(ASIPithos *)aPithos containerName:(NSString *)aContainerName icon:(NSImage *)anIcon {
78 80
    ASIPithosContainer *container = [ASIPithosContainer container];
79 81
    container.name = aContainerName;
80
    return [self initWithPithosContainer:container icon:anIcon];
82
    return [self initWithPithos:aPithos pithosContainer:container icon:anIcon];
81 83
}
82 84

  
83
- (id)initWithContainerName:(NSString *)aContainerName {
84
    return [self initWithContainerName:aContainerName icon:nil];
85
- (id)initWithPithos:(ASIPithos *)aPithos containerName:(NSString *)aContainerName {
86
    return [self initWithPithos:aPithos containerName:aContainerName icon:nil];
85 87
}
86 88

  
87 89
- (void)dealloc {
......
97 99
    [prefix release];
98 100
    [objects release];
99 101
    [pithosContainer release];
102
    [pithos release];
100 103
    [super dealloc];
101 104
}
102 105

  
......
106 109
- (NSString *)url {
107 110
    if (url == nil)
108 111
        url = [[NSString alloc] initWithFormat:@"%@/%@%@", 
109
               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
112
               (sharingAccount ? [pithos storageURLWithAuthUser:sharingAccount] : pithos.storageURL), 
110 113
               pithosContainer.name, 
111 114
               (shared ? @"?shared" : @"")];
112 115
    return url;
......
119 122
                break;
120 123
            case PithosNodeStateRefreshNeeded:
121 124
                freshness = PithosNodeStateRefreshing;
122
                containerRequest = [[ASIPithosContainerRequest listObjectsRequestWithContainerName:pithosContainer.name 
123
                                                                                             limit:0 
124
                                                                                            marker:nil 
125
                                                                                            prefix:prefix 
126
                                                                                         delimiter:@"/" 
127
                                                                                              path:nil 
128
                                                                                              meta:nil 
129
                                                                                            shared:shared 
130
                                                                                             until:nil] retain];
125
                containerRequest = [[ASIPithosContainerRequest listObjectsRequestWithPithos:pithos 
126
                                                                              containerName:pithosContainer.name 
127
                                                                                      limit:0 
128
                                                                                     marker:nil 
129
                                                                                     prefix:prefix 
130
                                                                                  delimiter:@"/" 
131
                                                                                       path:nil 
132
                                                                                       meta:nil 
133
                                                                                     shared:shared 
134
                                                                                      until:nil] retain];
131 135
                if (sharingAccount)
132
                    [containerRequest setRequestUserFromDefaultTo:sharingAccount];
136
                    [containerRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
133 137
                containerRequest.delegate = self;
134 138
                containerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
135 139
                containerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
262 266
                            NSUInteger sameNameObjectIndex = [objectNames indexOfObject:[object.name substringToIndex:([object.name length] - 1)]];
263 267
                            if ((sameNameObjectIndex == NSNotFound) || 
264 268
                                ![PithosUtilities isContentTypeDirectory:[[objects objectAtIndex:sameNameObjectIndex] contentType]]) {
265
                                PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
269
                                PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithos:pithos 
270
                                                                                   pithosContainer:pithosContainer 
271
                                                                                      pithosObject:object] autorelease];
266 272
                                node.parent = self;
267 273
                                node.shared = shared;
268 274
                                node.sharingAccount = sharingAccount;
......
281 287
                                [newChildren addObject:node];
282 288
                            }
283 289
                        } else if ([PithosUtilities isContentTypeDirectory:object.contentType]) {
284
                            PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
290
                            PithosSubdirNode *node = [[[PithosSubdirNode alloc] initWithPithos:pithos 
291
                                                                               pithosContainer:pithosContainer 
292
                                                                                  pithosObject:object] autorelease];
285 293
                            node.parent = self;
286 294
                            node.shared = shared;
287 295
                            node.sharingAccount = sharingAccount;
......
297 305
                            }
298 306
                            [newChildren addObject:node];
299 307
                        } else {
300
                            PithosObjectNode *node = [[[PithosObjectNode alloc] initWithPithosContainer:pithosContainer pithosObject:object] autorelease];
308
                            PithosObjectNode *node = [[[PithosObjectNode alloc] initWithPithos:pithos 
309
                                                                               pithosContainer:pithosContainer 
310
                                                                                  pithosObject:object] autorelease];
301 311
                            node.parent = self;
302 312
                            node.shared = shared;
303 313
                            node.sharingAccount = sharingAccount;
......
336 346
        } else {
337 347
            [containerRequest release];
338 348
            // Do an additional request to fetch more objects
339
            containerRequest = [[ASIPithosContainerRequest listObjectsRequestWithContainerName:pithosContainer.name 
340
                                                                                         limit:0 
341
                                                                                        marker:[[someObjects lastObject] name] 
342
                                                                                        prefix:prefix 
343
                                                                                     delimiter:@"/" 
344
                                                                                          path:nil 
345
                                                                                          meta:nil 
346
                                                                                        shared:shared 
347
                                                                                         until:nil] retain];
349
            containerRequest = [[ASIPithosContainerRequest listObjectsRequestWithPithos:pithos 
350
                                                                          containerName:pithosContainer.name 
351
                                                                                  limit:0 
352
                                                                                 marker:[[someObjects lastObject] name] 
353
                                                                                 prefix:prefix 
354
                                                                              delimiter:@"/" 
355
                                                                                   path:nil 
356
                                                                                   meta:nil 
357
                                                                                 shared:shared 
358
                                                                                  until:nil] retain];
348 359
            if (sharingAccount)
349
                [containerRequest setRequestUserFromDefaultTo:sharingAccount];
360
                [containerRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
350 361
            containerRequest.delegate = self;
351 362
            containerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
352 363
            containerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
425 436
    @synchronized(self) {
426 437
        if (applyMetadataContainerRequest == nil) {
427 438
            [[pithosNodeInfoController window] makeFirstResponder:nil];
428
            applyMetadataContainerRequest = [[ASIPithosContainerRequest updateContainerMetadataRequestWithContainerName:pithosContainer.name 
429
                                                                                                                 policy:[NSDictionary dictionaryWithObjectsAndKeys:
430
                                                                                                                         policyVersioning, @"versioning", 
431
                                                                                                                         [policyQuota stringValue], @"quota", 
432
                                                                                                                         nil] 
433
                                                                                                               metadata:pithosContainer.metadata 
434
                                                                                                                 update:NO] retain];
439
            applyMetadataContainerRequest = [[ASIPithosContainerRequest updateContainerMetadataRequestWithPithos:pithos 
440
                                                                                                   containerName:pithosContainer.name 
441
                                                                                                          policy:[NSDictionary dictionaryWithObjectsAndKeys:
442
                                                                                                                  policyVersioning, @"versioning", 
443
                                                                                                                  [policyQuota stringValue], @"quota", 
444
                                                                                                                  nil] 
445
                                                                                                        metadata:pithosContainer.metadata 
446
                                                                                                          update:NO] retain];
435 447
            applyMetadataContainerRequest.delegate = self;
436 448
            applyMetadataContainerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
437 449
            applyMetadataContainerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
449 461
- (void)refreshInfo {
450 462
    @synchronized(self) {
451 463
        if (refreshMetadataContainerRequest == nil) {
452
            refreshMetadataContainerRequest = [[ASIPithosContainerRequest containerMetadataRequestWithContainerName:pithosContainer.name] retain];
464
            refreshMetadataContainerRequest = [[ASIPithosContainerRequest containerMetadataRequestWithPithos:pithos 
465
                                                                                               containerName:pithosContainer.name] retain];
453 466
            refreshMetadataContainerRequest.delegate = self;
454 467
            refreshMetadataContainerRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
455 468
            refreshMetadataContainerRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
b/pithos-macos/PithosObjectNode.h
2 2
//  PithosObjectNode.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
36 36
// or implied, of GRNET S.A.
37 37

  
38 38
#import "PithosNode.h"
39
@class ASIPithos;
39 40
@class ASIPithosContainer;
40 41
@class ASIPithosObject;
41 42
@class ASIPithosObjectRequest;
42 43

  
43 44
@interface PithosObjectNode : PithosNode {
45
    ASIPithos *pithos;
44 46
    ASIPithosContainer *pithosContainer;
45 47
    ASIPithosObject *pithosObject;
46 48
    
......
50 52
    BOOL isPublic;
51 53
}
52 54

  
53
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer pithosObject:(ASIPithosObject *)aPithosObject;
55
- (id)initWithPithos:(ASIPithos *)aPithos 
56
     pithosContainer:(ASIPithosContainer *)aPithosContainer 
57
        pithosObject:(ASIPithosObject *)aPithosObject;
54 58

  
59
@property (nonatomic, retain) ASIPithos *pithos;
55 60
@property (nonatomic, retain) ASIPithosContainer *pithosContainer;
56 61
@property (nonatomic, retain) ASIPithosObject *pithosObject;
57 62
@property (nonatomic, assign) BOOL isPublic;
b/pithos-macos/PithosObjectNode.m
2 2
//  PithosObjectNode.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
37 37

  
38 38
#import "PithosObjectNode.h"
39 39
#import "ASIPithosRequest.h"
40
#import "ASIPithos.h"
40 41
#import "ASIPithosObjectRequest.h"
41 42
#import "ASIPithosContainer.h"
42 43
#import "ASIPithosObject.h"
......
45 46
#import "PithosObjectNodeInfoController.h"
46 47

  
47 48
@implementation PithosObjectNode
48
@synthesize pithosContainer, pithosObject;
49
@synthesize pithos, pithosContainer, pithosObject;
49 50
@synthesize isPublic;
50 51

  
51 52
#pragma mark -
52 53
#pragma mark Object Lifecycle
53 54

  
54
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer pithosObject:(ASIPithosObject *)aPithosObject {
55
- (id)initWithPithos:(ASIPithos *)aPithos 
56
     pithosContainer:(ASIPithosContainer *)aPithosContainer 
57
        pithosObject:(ASIPithosObject *)aPithosObject {
55 58
    if ((self = [super init])) {
59
        self.pithos = aPithos;
56 60
        self.pithosContainer = aPithosContainer;
57 61
        self.pithosObject = aPithosObject;
58 62
        isLeafItem = YES;
......
67 71
    [applyMetadataObjectRequest release];
68 72
    [pithosObject release];
69 73
    [pithosContainer release];
74
    [pithos release];
70 75
    [super dealloc];
71 76
}
72 77

  
......
76 81
- (NSString *)url {
77 82
    if (url == nil)
78 83
        url = [[NSString alloc] initWithFormat:@"object %@/%@/%@%@", 
79
               (sharingAccount ? [ASIPithosRequest storageURLWithAuthUser:sharingAccount] : [ASIPithosRequest storageURL]), 
84
               (sharingAccount ? [pithos storageURLWithAuthUser:sharingAccount] : pithos.storageURL), 
80 85
               pithosContainer.name, 
81 86
               pithosObject.name, 
82 87
               (shared ? @"?shared" : @"")];
......
172 177
        if (applyMetadataObjectRequest == nil) {
173 178
            [[pithosNodeInfoController window] makeFirstResponder:nil];
174 179
            if (sharingAccount) {
175
                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
176
                                                                                                        objectName:pithosObject.name 
177
                                                                                                   contentEncoding:nil 
178
                                                                                                contentDisposition:nil 
179
                                                                                                          manifest:nil 
180
                                                                                                           sharing:nil
181
                                                                                                          isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
182
                                                                                                          metadata:pithosObject.metadata
183
                                                                                                            update:NO] retain];
184
                [applyMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
180
                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithPithos:pithos 
181
                                                                                              containerName:pithosContainer.name 
182
                                                                                                 objectName:pithosObject.name 
183
                                                                                            contentEncoding:nil 
184
                                                                                         contentDisposition:nil 
185
                                                                                                   manifest:nil 
186
                                                                                                    sharing:nil
187
                                                                                                   isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
188
                                                                                                   metadata:pithosObject.metadata
189
                                                                                                     update:NO] retain];
190
                [applyMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
185 191
            } else {
186
                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithContainerName:pithosContainer.name 
187
                                                                                                        objectName:pithosObject.name 
188
                                                                                                   contentEncoding:pithosObject.contentEncoding 
189
                                                                                                contentDisposition:pithosObject.contentDisposition 
190
                                                                                                          manifest:pithosObject.manifest 
191
                                                                                                           sharing:(pithosObject.sharing ? pithosObject.sharing : @"")
192
                                                                                                          isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
193
                                                                                                          metadata:pithosObject.metadata
194
                                                                                                            update:NO] retain];
192
                applyMetadataObjectRequest = [[ASIPithosObjectRequest updateObjectMetadataRequestWithPithos:pithos 
193
                                                                                              containerName:pithosContainer.name 
194
                                                                                                 objectName:pithosObject.name 
195
                                                                                            contentEncoding:pithosObject.contentEncoding 
196
                                                                                         contentDisposition:pithosObject.contentDisposition 
197
                                                                                                   manifest:pithosObject.manifest 
198
                                                                                                    sharing:(pithosObject.sharing ? pithosObject.sharing : @"")
199
                                                                                                   isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
200
                                                                                                   metadata:pithosObject.metadata
201
                                                                                                     update:NO] retain];
195 202
            }
196 203
            applyMetadataObjectRequest.delegate = self;
197 204
            applyMetadataObjectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
......
210 217
- (void)refreshInfo {
211 218
    @synchronized(self) {
212 219
        if (refreshMetadataObjectRequest == nil) {
213
            refreshMetadataObjectRequest = [[ASIPithosObjectRequest objectMetadataRequestWithContainerName:pithosContainer.name 
214
                                                                                                objectName:pithosObject.name] retain];
220
            refreshMetadataObjectRequest = [[ASIPithosObjectRequest objectMetadataRequestWithPithos:pithos 
221
                                                                                      containerName:pithosContainer.name 
222
                                                                                         objectName:pithosObject.name] retain];
215 223
            if (sharingAccount)
216
                [refreshMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount];
224
                [refreshMetadataObjectRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos];
217 225
            refreshMetadataObjectRequest.delegate = self;
218 226
            refreshMetadataObjectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
219 227
            refreshMetadataObjectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
b/pithos-macos/PithosSharingAccountsNode.h
2 2
//  PithosSharingAccountsNode.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
37 37

  
38 38
#import "PithosNode.h"
39 39
@class ASIPithosRequest;
40
@class ASIPithos;
40 41

  
41 42
@interface PithosSharingAccountsNode : PithosNode {
43
    ASIPithos *pithos;
44
    
42 45
    NSMutableArray *sharingAccounts;
43 46
    ASIPithosRequest *sharingAccountsRequest;
44 47
}
45 48

  
49
@property(nonatomic, retain) ASIPithos *pithos;
50

  
51
- (id)initWithPithos:(ASIPithos *)aPithos;
52

  
46 53
@end
b/pithos-macos/PithosSharingAccountsNode.m
2 2
//  PithosAccountNode.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
38 38
#import "PithosSharingAccountsNode.h"
39 39
#import "PithosAccountNode.h"
40 40
#import "ASIPithosRequest.h"
41
#import "ASIPithos.h"
41 42
#import "ASIPithosAccount.h"
42 43
#import "ASIDownloadCache.h"
43 44
#import "PithosUtilities.h"
44 45
#import "PithosActivityFacility.h"
45 46

  
46 47
@implementation PithosSharingAccountsNode
48
@synthesize pithos;
47 49

  
48 50
#pragma mark -
49 51
#pragma mark Object Lifecycle
50 52

  
51
- (id)init {
53
- (id)initWithPithos:(ASIPithos *)aPithos {
52 54
    if ((self = [super init])) {
55
        self.pithos = aPithos;
53 56
        self.sharingAccount = @"";
54 57
    }
55 58
    return self;
......
59 62
    [sharingAccountsRequest clearDelegatesAndCancel];
60 63
    [sharingAccountsRequest release];
61 64
    [sharingAccounts release];
65
    [pithos release];
62 66
    [super dealloc];
63 67
}
64 68

  
......
67 71

  
68 72
- (NSString *)url {
69 73
    if (url == nil) 
70
        url = [[ASIPithosRequest storageURLPrefix] copy];
74
        url = [pithos.storageURLPrefix copy];
71 75
    return url;
72 76
}
73 77

  
......
78 82
                break;
79 83
            case PithosNodeStateRefreshNeeded:
80 84
                freshness = PithosNodeStateRefreshing;
81
                sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 
82
                                                                                         marker:nil] retain];
85
                sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithPithos:pithos limit:0 marker:nil] retain];
83 86
                sharingAccountsRequest.delegate = self;
84 87
                sharingAccountsRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
85 88
                sharingAccountsRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
......
170 173
                newChildren = [[NSMutableArray alloc] init];
171 174
                NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
172 175
                for (ASIPithosAccount *account in sharingAccounts) {
173
                    if (![account.name isEqualToString:[ASIPithosRequest authUser]]) {
176
                    if (![account.name isEqualToString:pithos.authUser]) {
174 177
                        PithosAccountNode *node = [[[PithosAccountNode alloc] init] autorelease];
175 178
                        node.parent = self;
176 179
                        node.shared = shared;
......
207 210
        } else {
208 211
            [sharingAccountsRequest release];
209 212
            // Do an additional request to fetch more objects
210
            sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 
211
                                                                                     marker:[[someSharingAccounts lastObject] name]] retain];
213
            sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithPithos:pithos 
214
                                                                                       limit:0 
215
                                                                                      marker:[[someSharingAccounts lastObject] name]] retain];
212 216
            sharingAccountsRequest.delegate = self;
213 217
            sharingAccountsRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:);
214 218
            sharingAccountsRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:);
b/pithos-macos/PithosSubdirNode.h
2 2
//  PithosSubdirNode.h
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
50 50
    BOOL refreshParent;
51 51
}
52 52

  
53
- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer pithosObject:(ASIPithosObject *)aPithosObject;
53
- (id)initWithPithos:(ASIPithos *)aPithos 
54
     pithosContainer:(ASIPithosContainer *)aPithosContainer 
55
        pithosObject:(ASIPithosObject *)aPithosObject;
54 56

  
55 57
@property (nonatomic, retain) ASIPithosObject *pithosObject;
56 58
@property (nonatomic, assign) BOOL isPublic;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff