chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgr...@apache.org
Subject svn commit: r1578378 [1/2] - in /chemistry/objectivecmis/trunk/ObjectiveCMIS: Bindings/ Bindings/AtomPub/ Bindings/AtomPub/AtomPubParser/ Client/ Common/ Utils/
Date Mon, 17 Mar 2014 13:53:06 GMT
Author: lgross
Date: Mon Mar 17 13:53:05 2014
New Revision: 1578378

URL: http://svn.apache.org/r1578378
Log:
Resume download (download files with range)
Cancel active content transmissions
Support for Secondary Object Type Ids
Read support for ACLs (ACL Parser)
Fix for files with double byte characters in their filename (error body stream exhausted while uploading)
Fix for delete tree method (e.g. For Microsoft Sharepoint)

Modified:
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h Mon Mar 17 13:53:05 2014
@@ -26,10 +26,11 @@
 #import "CMISAllowableActionsParser.h"
 #import "CMISAtomPubExtensionElementParser.h"
 #import "CMISAtomPubExtensionDataParserBase.h"
+#import "CMISAclParser.h"
 
 @protocol CMISAtomEntryParserDelegate;
 
-@interface CMISAtomEntryParser : CMISAtomPubExtensionDataParserBase <NSXMLParserDelegate, CMISAllowableActionsParserDelegate>
+@interface CMISAtomEntryParser : CMISAtomPubExtensionDataParserBase <NSXMLParserDelegate, CMISAllowableActionsParserDelegate, CMISAclParserDelegate>
 
 @property (nonatomic, strong, readonly) CMISObjectData *objectData;
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m Mon Mar 17 13:53:05 2014
@@ -35,6 +35,7 @@
 @property (nonatomic, strong) CMISRenditionData *currentRendition;
 @property (nonatomic, strong) NSMutableArray *currentRenditions;
 @property (nonatomic, strong) NSMutableString *string;
+@property (nonatomic, assign) BOOL isExcatAcl;
 @property (nonatomic, assign) BOOL parsingRelationship;
 
 @property (nonatomic, weak) id<NSXMLParserDelegate, CMISAtomEntryParserDelegate> parentDelegate;
@@ -150,6 +151,9 @@
         } else if ([elementName isEqualToString:kCMISAtomEntryAllowableActions]) {
             // Delegate parsing to child parser for allowableActions element
             self.childParserDelegate = [CMISAllowableActionsParser allowableActionsParserWithParentDelegate:self parser:parser];
+        } else if ([elementName isEqualToString:kCMISAtomEntryAcl]) {
+            // Delegate parsing to child parser for acl element
+            self.childParserDelegate = [CMISAclParser aclParserWithParentDelegate:self parser:parser];
         } else if ([elementName isEqualToString:kCMISCoreRelationship]) {
             // NOTE: we're currently ignoring the relationship element so set a flag to check
             self.parsingRelationship = YES;
@@ -239,7 +243,12 @@
                 }
                 [self.currentRenditions addObject:self.currentRendition];
                 self.currentRendition = nil;
-            }
+        	} else if ([elementName isEqualToString:kCMISAtomEntryExactACL]) {
+            	self.isExcatAcl = [self.string isEqualToString:@"true"] ? YES : NO;
+            	if(self.objectData.acl){
+                	[self.objectData.acl setIsExact:self.isExcatAcl];
+            	}
+			}
         }
         
         // the relationship element has ended
@@ -305,4 +314,10 @@
     self.objectData.allowableActions = allowableActions;
 }
 
+#pragma mark - CMISAclParserDelegate Methods
+-(void)aclParser:(CMISAclParser *)aclParser didFinishParsingAcl:(CMISAcl *)acl{
+    self.objectData.acl = acl;
+    [self.objectData.acl setIsExact:self.isExcatAcl];
+}
+
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m Mon Mar 17 13:53:05 2014
@@ -200,7 +200,7 @@
             }
             default:
             {
-                CMISLogDebug(@"Property type did not match: %u", propertyData.type);
+                CMISLogDebug(@"Property type did not match: %d", propertyData.type);
                 break;
             }
         }

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h Mon Mar 17 13:53:05 2014
@@ -47,6 +47,12 @@ extern NSString * const kCMISAtomEntryVa
 extern NSString * const kCMISAtomEntryContent;
 extern NSString * const kCMISAtomEntrySrc;
 extern NSString * const kCMISAtomEntryAllowableActions;
+extern NSString * const kCMISAtomEntryAcl;
+extern NSString * const kCMISAtomEntryExactACL;
+extern NSString * const kCMISAtomEntryPermission;
+extern NSString * const kCMISAtomEntryPrincipal;
+extern NSString * const kCMISAtomEntryPrincipalId;
+extern NSString * const kCMISAtomEntryDirect;
 
 // Collections
 extern NSString * const kCMISAtomCollectionQuery;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m Mon Mar 17 13:53:05 2014
@@ -47,6 +47,12 @@ NSString * const kCMISAtomEntryValueTrue
 NSString * const kCMISAtomEntryContent = @"content";
 NSString * const kCMISAtomEntrySrc = @"src";
 NSString * const kCMISAtomEntryAllowableActions = @"allowableActions";
+NSString * const kCMISAtomEntryAcl = @"acl";
+NSString * const kCMISAtomEntryExactACL = @"exactACL";
+NSString * const kCMISAtomEntryPermission = @"permission";
+NSString * const kCMISAtomEntryPrincipal = @"principal";
+NSString * const kCMISAtomEntryPrincipalId = @"principalId";
+NSString * const kCMISAtomEntryDirect = @"direct";
 
 // Collections
 NSString * const kCMISAtomCollectionQuery = @"query";

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService%2BProtected.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h Mon Mar 17 13:53:05 2014
@@ -113,6 +113,6 @@
                  bytesExpected:(unsigned long long)bytesExpected
                    cmisRequest:(CMISRequest*)request
                completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-                 progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                 progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m Mon Mar 17 13:53:05 2014
@@ -379,7 +379,7 @@
                                             }
                                         }
                                     } else {
-                                        CMISLogError(@"Invalid http response status code when sending atom entry: %d", response.statusCode);
+                                        CMISLogError(@"Invalid http response status code when sending atom entry: %ld", (long)response.statusCode);
                                         CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
                                         if (completionBlock) {
                                             completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
@@ -397,7 +397,7 @@
                  bytesExpected:(unsigned long long)bytesExpected
                    cmisRequest:(CMISRequest*)request
                completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-                 progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                 progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     // Validate param
     if (link == nil) {
@@ -438,7 +438,7 @@
                                             }
                                         }
                                     } else {
-                                        CMISLogError(@"Invalid http response status code when sending atom entry: %d", response.statusCode);
+                                        CMISLogError(@"Invalid http response status code when sending atom entry: %d", (int)response.statusCode);
                                         CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
                                         if (completionBlock) {
                                             completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m Mon Mar 17 13:53:05 2014
@@ -87,10 +87,31 @@
                         completionBlock:(void (^)(NSError *error))completionBlock
                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    return [self downloadContentOfObject:objectId
+                         streamId:streamId
+                           toFile:filePath
+                           offset:nil
+                           length:nil
+                  completionBlock:completionBlock
+                    progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                        progressBlock(bytesDownloaded, bytesTotal);
+                    }];
+}
+
+- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
+                               streamId:(NSString *)streamId
+                                 toFile:(NSString *)filePath
+                                 offset:(NSDecimalNumber*)offset
+                                 length:(NSDecimalNumber*)length
+                        completionBlock:(void (^)(NSError *error))completionBlock
+                          progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:NO];
     return [self downloadContentOfObject:objectId
                                 streamId:streamId
                           toOutputStream:outputStream
+                                  offset:offset
+                                  length:length
                          completionBlock:completionBlock
                            progressBlock:progressBlock];
 }
@@ -101,6 +122,25 @@
                         completionBlock:(void (^)(NSError *error))completionBlock
                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    return [self downloadContentOfObject:objectId
+                                streamId:streamId
+                          toOutputStream:outputStream
+                                  offset:nil
+                                  length:nil
+                         completionBlock:completionBlock
+                           progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                               progressBlock(bytesDownloaded, bytesTotal);
+                           }];
+}
+
+- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
+                               streamId:(NSString *)streamId
+                         toOutputStream:(NSOutputStream *)outputStream
+                                 offset:(NSDecimalNumber*)offset
+                                 length:(NSDecimalNumber*)length
+                        completionBlock:(void (^)(NSError *error))completionBlock
+                          progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     CMISRequest *request = [[CMISRequest alloc] init];
     
     [self retrieveObjectInternal:objectId
@@ -127,6 +167,8 @@
                                                     session:self.bindingSession
                                                outputStream:outputStream
                                               bytesExpected:streamLength
+                                                     offset:offset
+                                                     length:length
                                                 cmisRequest:request
                                             completionBlock:^(CMISHttpResponse *httpResponse, NSError *error)
                  {
@@ -198,7 +240,7 @@
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeTokenParam
                       completionBlock:(void (^)(NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:filePath];
     if (inputStream == nil) {
@@ -234,7 +276,7 @@
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeTokenParam
                       completionBlock:(void (^)(NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     CMISRequest *request = [[CMISRequest alloc] init];
     // Validate object id param
@@ -307,7 +349,7 @@
                  if (httpResponse.statusCode == 200 || httpResponse.statusCode == 201 || httpResponse.statusCode == 204) {
                      error = nil;
                  } else {
-                     CMISLogError(@"Invalid http response status code when updating content: %d", httpResponse.statusCode);
+                     CMISLogError(@"Invalid http response status code when updating content: %d", (int)httpResponse.statusCode);
                      error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
                                              detailedDescription:[NSString stringWithFormat:@"Could not update content: http status code %li", (long)httpResponse.statusCode]];
                  }
@@ -328,7 +370,7 @@
                                 properties:(CMISProperties *)properties
                                   inFolder:(NSString *)folderObjectId
                            completionBlock:(void (^)(NSString *objectId, NSError *Error))completionBlock
-                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:filePath];
     if (inputStream == nil) {
@@ -361,7 +403,7 @@
                                      inFolder:(NSString *)folderObjectId
                                 bytesExpected:(unsigned long long)bytesExpected // optional
                               completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     // Validate properties
     if ([properties propertyValueForId:kCMISPropertyName] == nil || [properties propertyValueForId:kCMISPropertyObjectTypeId] == nil) {
@@ -492,52 +534,88 @@
     }
     CMISRequest *request = [[CMISRequest alloc] init];
     
+    // find the down links
     [self loadLinkForObjectId:folderObjectId
                      relation:kCMISLinkRelationDown
-                         type:kCMISMediaTypeDescendants
+                         type:nil
                   cmisRequest:request
               completionBlock:^(NSString *link, NSError *error) {
-        if (error) {
-            CMISLogError(@"Error while fetching %@ link : %@", kCMISLinkRelationDown, error.description);
-            completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
-            return;
-        }
-        
-        void (^continueWithLink)(NSString *) = ^(NSString *link) {
+
+        __block NSString *childrenLink = nil;
+
+        void (^continueWithLink)(NSString*) = ^(NSString* link) {
+            if(!link){
+                link = childrenLink;
+            }
+            
+            if(!link){
+                CMISLogError(@"Could not retrieve %@ nor %@ link", kCMISLinkRelationDown, kCMISLinkRelationFolderTree);
+                completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
+                return;
+            }
+            
             link = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterAllVersions value:(allVersions ? @"true" : @"false") urlString:link];
             link = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterUnfileObjects value:[CMISEnums stringForUnfileObject:unfileObjects] urlString:link];
             link = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterContinueOnFailure value:(continueOnFailure ? @"true" : @"false") urlString:link];
-            
+
             [self.bindingSession.networkProvider invokeDELETE:[NSURL URLWithString:link]
-                                                      session:self.bindingSession
-                                                  cmisRequest:request
-                                              completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) {
-                       if (httpResponse) {
-                           // TODO: retrieve failed folders and files and return
-                           completionBlock([NSArray array], nil);
-                       } else {
-                           completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeConnection]);
-                       }
-                   }];
+                                                    session:self.bindingSession
+                                                cmisRequest:request
+                                            completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) {
+                                                if (httpResponse) {
+                                                    // TODO: retrieve failed folders and files and return
+                                                    completionBlock([NSArray array], nil);
+                                                } else {
+                                                    completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeConnection]);
+                                                }
+                                            }];
         };
-        
-        if (link == nil) {
-            [self loadLinkForObjectId:folderObjectId
-                             relation:kCMISLinkRelationFolderTree
-                          cmisRequest:request
-                      completionBlock:^(NSString *link, NSError *error) {
-                if (error) {
-                    CMISLogError(@"Error while fetching %@ link : %@", kCMISLinkRelationFolderTree, error.description);
-                    completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
-                } else if (link == nil) {
-                    CMISLogError(@"Could not retrieve %@ nor %@ link", kCMISLinkRelationDown, kCMISLinkRelationFolderTree);
-                    completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
-                } else {
-                    continueWithLink(link);
-                }
-            }];
+                  
+        void (^continueWithLinkFolderTreeFeed)(NSString*) = ^(NSString* link) {
+            if(!link){
+                [self loadLinkForObjectId:folderObjectId
+                                 relation:kCMISLinkRelationFolderTree
+                                     type:kCMISMediaTypeFeed
+                              cmisRequest:request
+                          completionBlock:^(NSString *link, NSError *error) {
+                              continueWithLink(link);
+                          }];
+            } else {
+                continueWithLink(link);   
+            }
+        };
+                  
+        void (^continueWithLinksFolderTreeDescendants)(NSString*) = ^(NSString* link) {
+            if(!link) {
+                [self loadLinkForObjectId:folderObjectId
+                                 relation:kCMISLinkRelationFolderTree
+                                     type:kCMISMediaTypeDescendants
+                              cmisRequest:request
+                          completionBlock:^(NSString *link, NSError *error) {
+                              continueWithLinkFolderTreeFeed(link);
+                          }];
+            } else {
+                continueWithLinkFolderTreeFeed(link);
+            }
+        };
+                  
+
+        if(link){
+            // found only a children link, but no descendants link
+            // -> try folder tree link
+            childrenLink = link;
+            link = nil;
+            continueWithLinksFolderTreeDescendants(link);
         } else {
-            continueWithLink(link);
+            // found no or two down links
+            // -> get only the descendants link
+            [self loadLinkForObjectId:folderObjectId
+                           relation:kCMISLinkRelationDown
+                               type:kCMISMediaTypeDescendants
+                        cmisRequest:request
+                    completionBlock:^(NSString *link, NSError *error) {
+                        continueWithLinksFolderTreeDescendants(link);
+                    }];
         }
     }];
     return request;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m Mon Mar 17 13:53:05 2014
@@ -182,7 +182,7 @@
              properties:(CMISProperties *)properties
          checkinComment:(NSString *)checkinComment
         completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:filePath];
     if (inputStream == nil) {
@@ -218,7 +218,7 @@
              properties:(CMISProperties *)properties
          checkinComment:(NSString *)checkinComment
         completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     // Validate params
     if (!objectId) {

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h Mon Mar 17 13:53:05 2014
@@ -65,6 +65,20 @@
 
 /**
  * Gets the content stream for the specified Document object, or gets a rendition stream for a specified
+ * rendition of a document or folder object. Downloads the content to a local file.
+ * completionBlock returns objectData for object or nil if unsuccessful
+ * Provides options to resume and cancel download
+ */
+- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
+                               streamId:(NSString *)streamId
+                                 toFile:(NSString *)filePath
+                                 offset:(NSDecimalNumber*)offset
+                                 length:(NSDecimalNumber*)length
+                        completionBlock:(void (^)(NSError *error))completionBlock
+                          progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+/**
+ * Gets the content stream for the specified Document object, or gets a rendition stream for a specified
  * rendition of a document or folder object. Downloads the content to an output stream.
  * completionBlock returns objectData for object or nil if unsuccessful
  */
@@ -75,6 +89,21 @@
                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
 /**
+ * Gets the content stream for the specified Document object, or gets a rendition stream for a specified
+ * rendition of a document or folder object. Downloads the content to an output stream.
+ * completionBlock returns objectData for object or nil if unsuccessful
+ * Provides options to resume and cancel download
+ */
+- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
+                               streamId:(NSString *)streamId
+                         toOutputStream:(NSOutputStream *)outputStream
+                                 offset:(NSDecimalNumber*)offset
+                                 length:(NSDecimalNumber*)length
+                        completionBlock:(void (^)(NSError *error))completionBlock
+                          progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+
+/**
  * Deletes the content stream for the specified document object.
  *
  * A Repository MAY automatically create new Document versions as part of this service method.
@@ -106,7 +135,7 @@
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeTokenParam
                       completionBlock:(void (^)(NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Changes the content of the given document to the content from a give input stream.
@@ -128,7 +157,7 @@
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeToken
                       completionBlock:(void (^)(NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * uploads the file from the given path to the given folder.
@@ -140,7 +169,7 @@
                                 properties:(CMISProperties *)properties
                                   inFolder:(NSString *)folderObjectId
                            completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * uploads the file from the given input stream to the given folder.
@@ -153,7 +182,7 @@
                                      inFolder:(NSString *)folderObjectId
                                 bytesExpected:(unsigned long long)bytesExpected // optional
                               completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Deletes the given object.

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h Mon Mar 17 13:53:05 2014
@@ -99,7 +99,7 @@
              properties:(CMISProperties *)properties
          checkinComment:(NSString *)checkinComment
         completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Checks-in the private working copy (PWC) document from the given an input stream.
@@ -122,6 +122,6 @@
              properties:(CMISProperties *)properties
          checkinComment:(NSString *)checkinComment
         completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
-          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h Mon Mar 17 13:53:05 2014
@@ -79,6 +79,29 @@
                                 progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
 /**
+ * Downloads the content to a local file and returns the filepath.
+ * completionBlock will return NSError nil if successful
+ * Provides options to resume and cancel download
+ */
+- (CMISRequest*)downloadContentToFile:(NSString *)filePath
+                               offset:(NSDecimalNumber*)offset
+                               length:(NSDecimalNumber*)length
+                      completionBlock:(void (^)(NSError *error))completionBlock
+                        progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+
+/**
+ * Downloads the content to an outputstream and returns the handle to the http request in order to allow cancellation.
+ * completionBlock will return NSError nil if successful
+ * Provides options to resume and cancel download
+ */
+- (CMISRequest*)downloadContentToOutputStream:(NSOutputStream *)outputStream
+                                       offset:(NSDecimalNumber*)offset
+                                       length:(NSDecimalNumber*)length
+                              completionBlock:(void (^)(NSError *error))completionBlock
+                                progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+/**
  * Changes the content of this document to the content of the given file.
  *
  * Optional overwrite flag: If TRUE (default), then the Repository MUST replace the existing content stream for the
@@ -90,7 +113,7 @@
                                     mimeType:(NSString *)mimeType
                                    overwrite:(BOOL)overwrite
                              completionBlock:(void (^)(NSError *error))completionBlock
-                               progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                               progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Changes the content of this document to the content of the given input stream.
@@ -106,7 +129,7 @@
                                            mimeType:(NSString *)mimeType
                                           overwrite:(BOOL)overwrite
                                     completionBlock:(void (^)(NSError *error))completionBlock
-                                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Deletes the content of this document.
@@ -139,7 +162,7 @@
                            properties:(CMISProperties *)properties
                        checkinComment:(NSString *)checkinComment
                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Checkin this PWC from a specified input stream and return the checked-in document
@@ -151,6 +174,6 @@
                            properties:(CMISProperties *)properties
                        checkinComment:(NSString *)checkinComment
                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m Mon Mar 17 13:53:05 2014
@@ -87,7 +87,7 @@
                                     mimeType:(NSString *)mimeType
                                    overwrite:(BOOL)overwrite
                              completionBlock:(void (^)(NSError *error))completionBlock
-                               progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                               progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     return [self.binding.objectService changeContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier]
                                              toContentOfFile:filePath
@@ -104,7 +104,7 @@
                                            mimeType:(NSString *)mimeType
                                           overwrite:(BOOL)overwrite
                                     completionBlock:(void (^)(NSError *error))completionBlock
-                                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     return [self.binding.objectService changeContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier]
                                       toContentOfInputStream:inputStream
@@ -156,22 +156,57 @@
                       completionBlock:(void (^)(NSError *error))completionBlock
                         progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    return [self downloadContentToFile:filePath
+                                offset:nil
+                                length:nil
+                       completionBlock:completionBlock
+                         progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                             progressBlock(bytesDownloaded, bytesTotal);
+                         }];
+}
+
+
+- (CMISRequest*)downloadContentToOutputStream:(NSOutputStream *)outputStream
+                              completionBlock:(void (^)(NSError *error))completionBlock
+                                progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+{
+    return [self downloadContentToOutputStream:outputStream
+                                        offset:nil
+                                        length:nil
+                               completionBlock:completionBlock
+                                 progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                                     progressBlock(bytesDownloaded, bytesTotal);
+                                 }];
+}
+
+- (CMISRequest*)downloadContentToFile:(NSString *)filePath
+                               offset:(NSDecimalNumber*)offset
+                               length:(NSDecimalNumber*)length
+                      completionBlock:(void (^)(NSError *error))completionBlock
+                        progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:NO];
     return [self.binding.objectService downloadContentOfObject:self.identifier
                                                       streamId:nil
                                                 toOutputStream:outputStream
+                                                        offset:offset
+                                                        length:length
                                                completionBlock:completionBlock
                                                  progressBlock:progressBlock];
 }
 
 
 - (CMISRequest*)downloadContentToOutputStream:(NSOutputStream *)outputStream
+                                       offset:(NSDecimalNumber*)offset
+                                       length:(NSDecimalNumber*)length
                               completionBlock:(void (^)(NSError *error))completionBlock
-                                progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+                                progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     return [self.binding.objectService downloadContentOfObject:self.identifier
                                                       streamId:nil
                                                 toOutputStream:outputStream
+                                                        offset:offset
+                                                        length:length
                                                completionBlock:completionBlock
                                                  progressBlock:progressBlock];
 }
@@ -216,7 +251,7 @@
                            properties:(CMISProperties *)properties
                        checkinComment:(NSString *)checkinComment
                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     return [self.binding.versioningService checkIn:self.identifier
                                     asMajorVersion:majorVersion
@@ -237,8 +272,8 @@
                 }
             }];
         }
-    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal) {
-        progressBlock(bytesUploaded, bytesTotal);
+    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop) {
+        progressBlock(bytesUploaded, bytesTotal, stop);
     }];
 }
 
@@ -249,7 +284,7 @@
                            properties:(CMISProperties *)properties
                        checkinComment:(NSString *)checkinComment
                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     return [self.binding.versioningService checkIn:self.identifier
                                     asMajorVersion:majorVersion
@@ -271,8 +306,8 @@
                 }
             }];
         }
-    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal) {
-        progressBlock(bytesUploaded, bytesTotal);
+    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop) {
+        progressBlock(bytesUploaded, bytesTotal, stop);
     }];
 }
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h Mon Mar 17 13:53:05 2014
@@ -68,7 +68,7 @@
                           mimeType:(NSString *)mimeType
                         properties:(NSDictionary *)properties
                    completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * creates a document with specified properties, mime Type
@@ -79,7 +79,7 @@
                            properties:(NSDictionary *)properties
                         bytesExpected:(unsigned long long)bytesExpected
                       completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 
 /**

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m Mon Mar 17 13:53:05 2014
@@ -141,7 +141,7 @@
                                   mimeType:(NSString *)mimeType
                                 properties:(NSDictionary *)properties
                            completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.session.objectConverter convertProperties:properties
@@ -169,7 +169,7 @@
                                    properties:(NSDictionary *)properties
                                 bytesExpected:(unsigned long long)bytesExpected
                               completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.session.objectConverter convertProperties:properties forObjectTypeId:kCMISPropertyObjectTypeIdValueDocument completionBlock:^(CMISProperties *convertedProperties, NSError *error){

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h Mon Mar 17 13:53:05 2014
@@ -40,6 +40,7 @@
 //@property (nonatomic, strong, readonly) CMISBaseTypeId *baseTypeId;
 //@property (nonatomic, strong, readonly) CMISObjectType *baseType;
 //@property (nonatomic, strong, readonly) CMISObjectType *type;
+@property (nonatomic, strong, readonly) CMISAcl *acl;
 @property (nonatomic, strong, readonly) CMISAllowableActions *allowableActions;
 @property (nonatomic, strong, readonly) NSArray *renditions; // An array containing CMISRendition objects
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m Mon Mar 17 13:53:05 2014
@@ -33,7 +33,6 @@
 @property (nonatomic, strong, readwrite) CMISSession *session;
 @property (nonatomic, strong, readwrite) id<CMISBinding> binding;
 
-@property (nonatomic, strong, readwrite) NSString *identifier;
 @property (nonatomic, strong, readwrite) NSString *name;
 @property (nonatomic, strong, readwrite) NSString *createdBy;
 @property (nonatomic, strong, readwrite) NSDate *creationDate;
@@ -45,6 +44,7 @@
 
 @property (nonatomic, strong, readwrite) CMISProperties *properties;
 @property (nonatomic, strong, readwrite) CMISAllowableActions *allowableActions;
+@property (nonatomic, strong, readwrite) CMISAcl *acl;
 @property (nonatomic, strong, readwrite) NSArray *renditions;
 
 @property (nonatomic, strong) NSMutableDictionary *extensionsDict;
@@ -72,12 +72,14 @@
         self.changeToken = [[self.properties propertyForId:kCMISPropertyChangeToken] firstValue];
 
         self.allowableActions = objectData.allowableActions;
+        self.acl = objectData.acl;
 
         // Extract Extensions and store in the extensionsDict
         self.extensionsDict = [[NSMutableDictionary alloc] init];
         [self.extensionsDict setObject:[self nonNilArray:objectData.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelObject]];
         [self.extensionsDict setObject:[self nonNilArray:self.properties.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelProperties]];
         [self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelAllowableActions]];
+        [self.extensionsDict setObject:[self nonNilArray:self.acl.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelAcl]];
 
         // Renditions must be converted here, because they need access to the session
         if (objectData.renditions != nil) {

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h Mon Mar 17 13:53:05 2014
@@ -160,6 +160,18 @@
                               progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
 /**
+* Downloads the content of object with the provided object id to the given path.
+* completionBlock NSError will be nil if successful
+* Provides options to resume and cancel download
+*/
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                                     toFile:(NSString *)filePath
+                                     offset:(NSDecimalNumber*)offset
+                                     length:(NSDecimalNumber*)length
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+/**
  * Downloads the content of object with the provided object id to the given stream.
  * completionBlock NSError will be nil if successful
  */
@@ -168,6 +180,19 @@
                             completionBlock:(void (^)(NSError *error))completionBlock
                               progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
+
+/**
+ * Downloads the content of object with the provided object id to the given stream.
+ * completionBlock NSError will be nil if successful
+ * Provides options to resume and cancel download
+ */
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                             toOutputStream:(NSOutputStream *)outputStream
+                                     offset:(NSDecimalNumber*)offset
+                                     length:(NSDecimalNumber*)length
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
 /**
  * Creates a cmis document using the content from the file path.
  * completionBlock returns object Id of newly created object or nil if unsuccessful
@@ -177,7 +202,7 @@
                         properties:(NSDictionary *)properties
                           inFolder:(NSString *)folderObjectId
                    completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * Creates a cmis document using the content from the given stream.
@@ -189,5 +214,5 @@
                              inFolder:(NSString *)folderObjectId
                         bytesExpected:(unsigned long long)bytesExpected
                       completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Mon Mar 17 13:53:05 2014
@@ -443,9 +443,28 @@
                             completionBlock:(void (^)(NSError *error))completionBlock
                               progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    return [self downloadContentOfCMISObject:objectId
+                                      toFile:filePath
+                                      offset:nil
+                                      length:nil
+                             completionBlock:completionBlock
+                               progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                                   progressBlock(bytesDownloaded, bytesTotal);
+                               }];
+}
+
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                                     toFile:(NSString *)filePath
+                                     offset:(NSDecimalNumber*)offset
+                                     length:(NSDecimalNumber*)length
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     return [self.binding.objectService downloadContentOfObject:objectId
                                                       streamId:nil
                                                         toFile:filePath
+                                                        offset:nil
+                                                        length:nil
                                                completionBlock:completionBlock
                                                  progressBlock:progressBlock];
 }
@@ -455,9 +474,28 @@
                             completionBlock:(void (^)(NSError *error))completionBlock
                               progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    return [self downloadContentOfCMISObject:objectId
+                              toOutputStream:outputStream
+                                      offset:nil
+                                      length:nil
+                             completionBlock:completionBlock
+                               progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+                                   progressBlock(bytesDownloaded, bytesTotal);
+                               }];
+}
+
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                             toOutputStream:(NSOutputStream *)outputStream
+                                     offset:(NSDecimalNumber*)offset
+                                     length:(NSDecimalNumber*)length
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     return [self.binding.objectService downloadContentOfObject:objectId
                                                       streamId:nil
                                                 toOutputStream:outputStream
+                                                        offset:offset
+                                                        length:length
                                                completionBlock:completionBlock
                                                  progressBlock:progressBlock];
 }
@@ -467,7 +505,7 @@
                           mimeType:(NSString *)mimeType
                         properties:(NSDictionary *)properties inFolder:(NSString *)folderObjectId
                    completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.objectConverter convertProperties:properties
@@ -496,7 +534,7 @@
                              inFolder:(NSString *)folderObjectId
                         bytesExpected:(unsigned long long)bytesExpected
                       completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
-                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.objectConverter convertProperties:properties

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h Mon Mar 17 13:53:05 2014
@@ -40,6 +40,8 @@ extern NSString * const kCMISPropertyIsL
 extern NSString * const kCMISPropertyChangeToken;
 extern NSString * const kCMISPropertyBaseTypeId;
 extern NSString * const kCMISPropertyCheckinComment;
+extern NSString * const kCMISPropertySecondaryObjectTypeIds;
+extern NSString * const kCMISPropertyDescription;
 // Property values
 extern NSString * const kCMISPropertyObjectTypeIdValueDocument;
 extern NSString * const kCMISPropertyObjectTypeIdValueFolder;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m Mon Mar 17 13:53:05 2014
@@ -41,6 +41,10 @@ NSString * const kCMISPropertyIsLatestMa
 NSString * const kCMISPropertyChangeToken = @"cmis:changeToken";
 NSString * const kCMISPropertyBaseTypeId = @"cmis:baseTypeId";
 NSString * const kCMISPropertyCheckinComment = @"cmis:checkinComment";
+NSString * const kCMISPropertySecondaryObjectTypeIds = @"cmis:secondaryObjectTypeIds";
+NSString * const kCMISPropertyDescription = @"cmis:description";
+
+
 // Property values
 
 NSString * const kCMISPropertyObjectTypeIdValueDocument = @"cmis:document";

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h Mon Mar 17 13:53:05 2014
@@ -120,9 +120,10 @@ typedef NS_ENUM(NSInteger, CMISExtension
 {
     CMISExtensionLevelObject,
     CMISExtensionLevelProperties,
-    CMISExtensionLevelAllowableActions
+    CMISExtensionLevelAllowableActions,
+    CMISExtensionLevelAcl
     // TODO expose the remaining extensions as they are implemented
-    // CMISExtensionLevelAcl, CMISExtensionLevelPolicies, CMISExtensionLevelChangeEvent
+    // CMISExtensionLevelPolicies, CMISExtensionLevelChangeEvent
 
 };
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h Mon Mar 17 13:53:05 2014
@@ -92,7 +92,7 @@ completionBlock:(void (^)(CMISHttpRespon
  bytesExpected:(unsigned long long)bytesExpected
    cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
- progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 
 /**
@@ -120,7 +120,7 @@ completionBlock:(void (^)(CMISHttpRespon
 cmisProperties:(CMISProperties *)cmisProperties
       mimeType:(NSString *)mimeType
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
- progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 
 
@@ -146,6 +146,31 @@ completionBlock:(void (^)(CMISHttpRespon
 
 
 /**
+ * Invoke method used for downloads,
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param outputStream the stream pointing to the destination. Must be an instance or extension of NSOutputStream
+ * @param bytesExpected the size of the content to be downloaded
+ * @param offset the offset of the stream or null to read the stream from the beginning
+ * @param legnth the maximum length of the stream or null to read to the end of the stream
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param progressBlock
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
+ */
+- (void)invoke:(NSURL *)url
+    httpMethod:(CMISHttpRequestMethod)httpRequestMethod
+       session:(CMISBindingSession *)session
+  outputStream:(NSOutputStream *)outputStream
+ bytesExpected:(unsigned long long)bytesExpected
+        offset:(NSDecimalNumber*)offset
+        length:(NSDecimalNumber*)length
+   cmisRequest:(CMISRequest *)cmisRequest
+completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
+
+/**
  * Convenience GET invoke method
  * @param url the RESTful API URL to be used
  * @param session

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h Mon Mar 17 13:53:05 2014
@@ -23,6 +23,7 @@
 #import "CMISAllowableActions.h"
 #import "CMISLinkRelations.h"
 #import "CMISExtensionData.h"
+#import "CMISAcl.h"
 
 @class CMISRenditionData;
 
@@ -34,6 +35,7 @@
 @property (nonatomic, strong) CMISLinkRelations *linkRelations;
 @property (nonatomic, strong) NSURL *contentUrl;
 @property (nonatomic, strong) CMISAllowableActions *allowableActions;
+@property (nonatomic, strong) CMISAcl *acl;
 @property (nonatomic, strong) NSArray *renditions; // An array containing CMISRenditionData objects
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m Mon Mar 17 13:53:05 2014
@@ -101,7 +101,7 @@ completionBlock:(void (^)(CMISHttpRespon
  bytesExpected:(unsigned long long)bytesExpected
    cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
- progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     if (!cmisRequest.isCancelled) {
         NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
@@ -137,7 +137,7 @@ completionBlock:(void (^)(CMISHttpRespon
 cmisProperties:(CMISProperties *)cmisProperties
       mimeType:(NSString *)mimeType
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
- progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     if (!cmisRequest.isCancelled) {
         NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
@@ -175,6 +175,22 @@ completionBlock:(void (^)(CMISHttpRespon
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
  progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
 {
+    [self invoke:url httpMethod:httpRequestMethod session:session outputStream:outputStream bytesExpected:bytesExpected offset:nil length:nil cmisRequest:cmisRequest completionBlock:completionBlock progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop) {
+        progressBlock(bytesDownloaded, bytesTotal);
+    }];
+}
+
+- (void)invoke:(NSURL *)url
+    httpMethod:(CMISHttpRequestMethod)httpRequestMethod
+       session:(CMISBindingSession *)session
+  outputStream:(NSOutputStream *)outputStream
+ bytesExpected:(unsigned long long)bytesExpected
+        offset:(NSDecimalNumber*)offset
+        length:(NSDecimalNumber*)length
+   cmisRequest:(CMISRequest *)cmisRequest
+completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
+{
     if (!cmisRequest.isCancelled) {
         NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
                                                                                httpMethod:HTTP_GET
@@ -184,6 +200,8 @@ completionBlock:(void (^)(CMISHttpRespon
                                                              httpMethod:httpRequestMethod
                                                            outputStream:outputStream
                                                           bytesExpected:bytesExpected
+                                                                 offset:offset
+                                                                 length:length
                                                  authenticationProvider:session.authenticationProvider
                                                         completionBlock:completionBlock
                                                           progressBlock:progressBlock];

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h Mon Mar 17 13:53:05 2014
@@ -41,4 +41,17 @@
                          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
                            progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
+/** starts a URL request for download with a given offset and or length. Data are written to the provided output stream
+ * completionBlock returns a CMISHttpResponse object or nil if unsuccessful
+ */
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
+                              httpMethod:(CMISHttpRequestMethod)httpRequestMethod
+                            outputStream:(NSOutputStream*)outputStream
+                           bytesExpected:(unsigned long long)bytesExpected
+                                  offset:(NSDecimalNumber*)offset
+                                  length:(NSDecimalNumber*)length
+                  authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
+                         completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
+
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m Mon Mar 17 13:53:05 2014
@@ -23,25 +23,45 @@
 
 @interface CMISHttpDownloadRequest ()
 
-@property (nonatomic, copy) void (^progressBlock)(unsigned long long bytesDownloaded, unsigned long long bytesTotal);
+@property (nonatomic, copy) void (^progressBlock)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop);
 @property (nonatomic, assign) unsigned long long bytesDownloaded;
+@property (nonatomic, assign) BOOL cancelled;
+
 - (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 @end
 
 
 @implementation CMISHttpDownloadRequest
 
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
+        httpMethod:(CMISHttpRequestMethod)httpRequestMethod
+      outputStream:(NSOutputStream*)outputStream
+     bytesExpected:(unsigned long long)bytesExpected
+authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
+   completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+     progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+{
+    return [CMISHttpDownloadRequest startRequest:urlRequest
+                               httpMethod:httpRequestMethod
+                             outputStream:outputStream
+                            bytesExpected:bytesExpected
+                   authenticationProvider:authenticationProvider
+                          completionBlock:completionBlock
+                            progressBlock:progressBlock];
+}
 
 + (id)startRequest:(NSMutableURLRequest *)urlRequest
                               httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                             outputStream:(NSOutputStream*)outputStream
                            bytesExpected:(unsigned long long)bytesExpected
+                                  offset:(NSDecimalNumber*)offset
+                                  length:(NSDecimalNumber*)length
                   authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
                          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+                           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     CMISHttpDownloadRequest *httpRequest = [[self alloc] initWithHttpMethod:httpRequestMethod
                                                             completionBlock:completionBlock
@@ -50,6 +70,21 @@
     httpRequest.bytesExpected = bytesExpected;
     httpRequest.authenticationProvider = authenticationProvider;
     
+    //range
+    if ((offset != nil) || (length != nil)) {
+        if (offset == nil) {
+            offset = [NSDecimalNumber zero];
+        }
+        
+        NSMutableString *range = [NSMutableString stringWithFormat:@"bytes=%@-",[offset stringValue]];
+        
+        if ((length != nil) && ([length longLongValue] >= 1)) {
+            [range appendFormat:@"%llu", [offset unsignedLongLongValue] + [length unsignedLongLongValue] - 1];
+        }
+        
+        httpRequest.additionalHeaders = [NSDictionary dictionaryWithObject:range forKey:@"Range"];
+    }
+
     if (![httpRequest startRequest:urlRequest]) {
         httpRequest = nil;
     };
@@ -60,7 +95,7 @@
 
 - (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal, BOOL *stop))progressBlock
 {
     self = [super initWithHttpMethod:httpRequestMethod
                      completionBlock:completionBlock];
@@ -138,7 +173,13 @@
     self.bytesDownloaded += data.length;
     // pass progress to progressBlock
     if (self.progressBlock) {
-        self.progressBlock(self.bytesDownloaded, self.bytesExpected);
+        BOOL cancelled = NO;
+        self.progressBlock(self.bytesDownloaded, self.bytesExpected, &cancelled);
+        
+        // Cancel Download Request if requested
+        if (cancelled == YES) {
+            [self cancel];
+        }
     }
     
 }

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m Mon Mar 17 13:53:05 2014
@@ -198,7 +198,7 @@ NSString * const kCMISExceptionVersionin
         CMISLogTrace(@"Response body: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
     }
     
-    if ( (httpRequestMethod == HTTP_GET && response.statusCode != 200)
+    if ( (httpRequestMethod == HTTP_GET && response.statusCode != 200 && response.statusCode != 206)
         || (httpRequestMethod == HTTP_POST && response.statusCode != 201)
         || (httpRequestMethod == HTTP_DELETE && response.statusCode != 204)
         || (httpRequestMethod == HTTP_PUT && ((response.statusCode < 200 || response.statusCode > 299)))) {

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h?rev=1578378&r1=1578377&r2=1578378&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h Mon Mar 17 13:53:05 2014
@@ -36,7 +36,7 @@
                          bytesExpected:(unsigned long long)bytesExpected
                 authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
                        completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-                         progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+                         progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 /**
  * starts a URL request with a provided input stream. The input stream has to point to the raw NON-encoded data set. This method will use the
@@ -54,6 +54,6 @@ authenticationProvider:(id<CMISAuthentic
     cmisProperties:(CMISProperties *)cmisProperties
           mimeType:(NSString *)mimeType
    completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal, BOOL *stop))progressBlock;
 
 @end



Mime
View raw message