Revision 78355da3
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccount.h | ||
---|---|---|
38 | 38 |
|
39 | 39 |
@interface ASIPithosAccount : NSObject { |
40 | 40 |
NSString *name; |
41 |
NSUInteger count; |
|
42 |
NSDate *lastModified; |
|
43 |
NSUInteger bytes; |
|
41 |
NSUInteger containerCount; |
|
42 |
NSUInteger bytesUsed; |
|
43 |
NSDate *untilTimestamp; |
|
44 |
NSMutableDictionary *groups; |
|
45 |
NSMutableDictionary *metadata; |
|
46 |
NSDate *lastModified; |
|
44 | 47 |
} |
45 | 48 |
|
46 | 49 |
@property (retain) NSString *name; |
47 |
@property (assign) NSUInteger count; |
|
50 |
@property (assign) NSUInteger containerCount; |
|
51 |
@property (assign) NSUInteger bytesUsed; |
|
52 |
@property (retain) NSDate *untilTimestamp; |
|
53 |
@property (nonatomic, retain) NSMutableDictionary *groups; |
|
54 |
@property (retain) NSMutableDictionary *metadata; |
|
48 | 55 |
@property (retain) NSDate *lastModified; |
49 |
@property (assign) NSUInteger bytes; |
|
50 | 56 |
|
51 | 57 |
+ (id)account; |
52 | 58 |
|
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccount.m | ||
---|---|---|
37 | 37 |
#import "ASIPithosAccount.h" |
38 | 38 |
|
39 | 39 |
@implementation ASIPithosAccount |
40 |
@synthesize name, count, lastModified, bytes;
|
|
40 |
@synthesize name, containerCount, bytesUsed, untilTimestamp, groups, metadata, lastModified;
|
|
41 | 41 |
|
42 | 42 |
+ (id)account { |
43 | 43 |
ASIPithosAccount *account = [[[self alloc] init] autorelease]; |
... | ... | |
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
- (NSString *)description { |
48 |
return [NSString stringWithFormat:@"name: %@, count: %lu, lastModified: %@, bytes: %lu",
|
|
49 |
name, count, lastModified, bytes];
|
|
48 |
return [NSString stringWithFormat:@"name: %@, containerCount: %lu, bytesUsed: %lu, untilTimestamp: %@, groups: %@, metadata: %@, lastModified: %@",
|
|
49 |
name, containerCount, bytesUsed, untilTimestamp, groups, metadata, lastModified];
|
|
50 | 50 |
} |
51 | 51 |
|
52 |
-(void) dealloc { |
|
52 |
- (void) dealloc {
|
|
53 | 53 |
[lastModified release]; |
54 |
[metadata release]; |
|
55 |
[groups release]; |
|
56 |
[untilTimestamp release]; |
|
54 | 57 |
[name release]; |
55 | 58 |
[super dealloc]; |
56 | 59 |
} |
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccountRequest.h | ||
---|---|---|
70 | 70 |
- (NSDictionary *)metadata; |
71 | 71 |
- (NSDate *)lastModified; |
72 | 72 |
|
73 |
- (ASIPithosAccount *)account; |
|
74 |
|
|
73 | 75 |
// GET storageURL |
74 | 76 |
+ (id)listContainersRequest; |
75 | 77 |
// GET storageURL?[limit=limit]&[marker=marker]&[shared=]&[until=untilTimestamp] |
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccountRequest.m | ||
---|---|---|
35 | 35 |
// or implied, of GRNET S.A. |
36 | 36 |
|
37 | 37 |
#import "ASIPithosAccountRequest.h" |
38 |
#import "ASIPithosAccount.h" |
|
38 | 39 |
#import "ASIPithosContainer.h" |
39 | 40 |
|
40 | 41 |
@implementation ASIPithosAccountRequest |
... | ... | |
137 | 138 |
return nil; |
138 | 139 |
} |
139 | 140 |
|
141 |
- (ASIPithosAccount *)account { |
|
142 |
ASIPithosAccount *account = [ASIPithosAccount account]; |
|
143 |
account.containerCount = [self containerCount]; |
|
144 |
account.bytesUsed = [self bytesUsed]; |
|
145 |
account.untilTimestamp = [self untilTimestamp]; |
|
146 |
account.groups = (NSMutableDictionary *)[self groups]; |
|
147 |
account.metadata = (NSMutableDictionary *)[self metadata]; |
|
148 |
account.lastModified = [self lastModified]; |
|
149 |
return account; |
|
150 |
} |
|
151 |
|
|
152 |
|
|
140 | 153 |
#pragma mark - |
141 | 154 |
#pragma mark GET |
142 | 155 |
|
... | ... | |
256 | 269 |
options:NSBackwardsSearch |
257 | 270 |
range:NSMakeRange(([currentContent length] - 3), 1)]]; |
258 | 271 |
} else if ([elementName isEqualToString:@"x_container_until_timestamp"]) { |
259 |
currentContainer.untilTimestamp = [NSDate dateWithTimeIntervalSince1970:[currentContent intValue]];
|
|
272 |
currentContainer.untilTimestamp = [NSDate dateWithTimeIntervalSince1970:[currentContent doubleValue]];
|
|
260 | 273 |
} else if ([elementName rangeOfString:@"x_container_policy_"].location == 0) { |
261 | 274 |
if (currentContainer.policy == nil) |
262 | 275 |
currentContainer.policy = [NSMutableDictionary dictionary]; |
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosContainerRequest.m | ||
---|---|---|
172 | 172 |
container.blockSize = [self blockSize]; |
173 | 173 |
container.blockHash = [self blockHash]; |
174 | 174 |
container.objectMeta = (NSMutableArray *)[self objectMeta]; |
175 |
[self objectMeta]; |
|
176 | 175 |
return container; |
177 | 176 |
} |
178 | 177 |
|
... | ... | |
434 | 433 |
} else if ([elementName isEqualToString:@"x_object_version"]) { |
435 | 434 |
currentObject.version = currentContent; |
436 | 435 |
} else if ([elementName isEqualToString:@"x_object_version_timestamp"]) { |
437 |
currentObject.versionTimestamp = [NSDate dateWithTimeIntervalSince1970:[currentContent intValue]];
|
|
436 |
currentObject.versionTimestamp = [NSDate dateWithTimeIntervalSince1970:[currentContent doubleValue]];
|
|
438 | 437 |
} else if ([elementName isEqualToString:@"x_object_modified_by"]) { |
439 | 438 |
currentObject.modifiedBy = currentContent; |
440 | 439 |
} else if ([elementName isEqualToString:@"x_object_manifest"]) { |
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosObjectRequest.m | ||
---|---|---|
200 | 200 |
} |
201 | 201 |
|
202 | 202 |
- (NSUInteger)objectContentLength { |
203 |
return [[[self responseHeaders] objectForKey:@"Content-Length"] intValue]; |
|
203 |
NSString *objectContentLengthString = [[self responseHeaders] objectForKey:@"Content-Length"]; |
|
204 |
if (objectContentLengthString) |
|
205 |
return [objectContentLengthString intValue]; |
|
206 |
return 0; |
|
204 | 207 |
} |
205 | 208 |
|
206 | 209 |
- (NSString *)contentType { |
... | ... | |
1606 | 1609 |
bytes = [[attributeDict valueForKey:@"bytes"] intValue]; |
1607 | 1610 |
} else if ((objectRequestType == ASIPithosObjectRequestVersions) && [elementName isEqualToString:@"version"]) { |
1608 | 1611 |
self.currentObject = [ASIPithosObject object]; |
1609 |
currentObject.versionTimestamp = [NSDate dateWithTimeIntervalSince1970:[[attributeDict valueForKey:@"timestamp"] intValue]];
|
|
1612 |
currentObject.versionTimestamp = [NSDate dateWithTimeIntervalSince1970:[[attributeDict valueForKey:@"timestamp"] doubleValue]];
|
|
1610 | 1613 |
} |
1611 | 1614 |
self.currentContent = @""; |
1612 | 1615 |
} |
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosRequest.m | ||
---|---|---|
254 | 254 |
if ([elementName isEqualToString:@"name"]) { |
255 | 255 |
currentAccount.name = currentContent; |
256 | 256 |
} else if ([elementName isEqualToString:@"count"]) { |
257 |
currentAccount.count = [currentContent intValue]; |
|
257 |
currentAccount.containerCount = [currentContent intValue];
|
|
258 | 258 |
} else if ([elementName isEqualToString:@"last_modified"]) { |
259 | 259 |
currentAccount.lastModified = [[self dateFormatterWithFormatId:0] dateFromString: |
260 | 260 |
[currentContent stringByReplacingOccurrencesOfString:@":" |
... | ... | |
262 | 262 |
options:NSBackwardsSearch |
263 | 263 |
range:NSMakeRange(([currentContent length] - 3), 1)]]; |
264 | 264 |
} else if ([elementName isEqualToString:@"bytes"]) { |
265 |
currentAccount.bytes = [currentContent intValue]; |
|
265 |
currentAccount.bytesUsed = [currentContent intValue];
|
|
266 | 266 |
} else if ([elementName isEqualToString:@"account"]) { |
267 | 267 |
[sharingAccounts addObject:currentAccount]; |
268 | 268 |
self.currentAccount = nil; |
Also available in: Unified diff