Revision 919cb043 pithos-macos/PithosObjectNode.m
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:); |
Also available in: Unified diff