chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pweschm...@apache.org
Subject svn commit: r1448154 [2/3] - in /chemistry/objectivecmis/trunk: ObjectiveCMIS.xcodeproj/ ObjectiveCMIS/Bindings/ ObjectiveCMIS/Bindings/AtomPub/ ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/ ObjectiveCMIS/Client/ ObjectiveCMIS/Common/ ObjectiveCMIS/Uti...
Date Wed, 20 Feb 2013 13:19:00 GMT
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h Wed Feb 20 13:18:59 2013
@@ -30,9 +30,9 @@
  * Retrieves the object with the given object identifier.
  * completionBlock returns objectData for object or nil if unsuccessful
  */
-- (void)retrieveObject:(NSString *)objectId
+- (CMISRequest*)retrieveObject:(NSString *)objectId
                 filter:(NSString *)filter
-         relationShips:(CMISIncludeRelationship)includeRelationship
+         relationships:(CMISIncludeRelationship)relationships
       includePolicyIds:(BOOL)includePolicyIds
        renditionFilder:(NSString *)renditionFilter
             includeACL:(BOOL)includeACL
@@ -43,9 +43,9 @@
  * Retrieves an object using its path.
  * completionBlock returns objectData for object or nil if unsuccessful
  */
-- (void)retrieveObjectByPath:(NSString *)path
+- (CMISRequest*)retrieveObjectByPath:(NSString *)path
                       filter:(NSString *)filter
-               relationShips:(CMISIncludeRelationship)includeRelationship
+               relationships:(CMISIncludeRelationship)relationships
             includePolicyIds:(BOOL)includePolicyIds
              renditionFilder:(NSString *)renditionFilter
                   includeACL:(BOOL)includeACL
@@ -86,13 +86,14 @@
  * This is not possible without introducing a new HTTP header.
  * completionBlock - returns NSError nil if successful
  */
-- (void)deleteContentOfObject:(CMISStringInOutParameter *)objectIdParam
+- (CMISRequest*)deleteContentOfObject:(CMISStringInOutParameter *)objectIdParam
                   changeToken:(CMISStringInOutParameter *)changeTokenParam
               completionBlock:(void (^)(NSError *error))completionBlock;
 
 /**
  * Changes the content of the given document to the content of a given file.
  *
+ * It is recommended that a mime type is provided. In case no value is given - the mime type defaults to application/octet-stream.
  * Optional overwrite flag: If TRUE (default), then the Repository MUST replace the existing content stream for the
  * object (if any) with the input contentStream. If FALSE, then the Repository MUST only set the input
  * contentStream for the object if the object currently does not have a content-stream.
@@ -103,6 +104,7 @@
  */
 - (CMISRequest*)changeContentOfObject:(CMISStringInOutParameter *)objectIdParam
                       toContentOfFile:(NSString *)filePath
+                             mimeType:(NSString *)mimeType
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeTokenParam
                       completionBlock:(void (^)(NSError *error))completionBlock
@@ -111,6 +113,7 @@
 /**
  * Changes the content of the given document to the content from a give input stream.
  *
+ * It is recommended that a mime type is provided. In case no value is given - the mime type defaults to application/octet-stream.
  * Optional overwrite flag: If TRUE (default), then the Repository MUST replace the existing content stream for the
  * object (if any) with the input contentStream. If FALSE, then the Repository MUST only set the input
  * contentStream for the object if the object currently does not have a content-stream.
@@ -123,6 +126,7 @@
                toContentOfInputStream:(NSInputStream *)inputStream
                         bytesExpected:(unsigned long long)bytesExpected
                              filename:(NSString *)filename
+                             mimeType:(NSString *)mimeType
                     overwriteExisting:(BOOL)overwrite
                           changeToken:(CMISStringInOutParameter *)changeToken
                       completionBlock:(void (^)(NSError *error))completionBlock
@@ -159,7 +163,7 @@
  * The allVersions parameter is currently ignored.
  * completionBlock returns true if successful
  */
-- (void)deleteObject:(NSString *)objectId
+- (CMISRequest*)deleteObject:(NSString *)objectId
          allVersions:(BOOL)allVersions
      completionBlock:(void (^)(BOOL objectDeleted, NSError *error))completionBlock;
 
@@ -167,9 +171,9 @@
  * Creates a new folder with given properties under the provided parent folder.
  * completionBlock returns objectId for the newly created folder or nil if unsuccessful
  */
-- (void)createFolderInParentFolder:(NSString *)folderObjectId
-                        properties:(CMISProperties *)properties
-                   completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
+- (CMISRequest*)createFolderInParentFolder:(NSString *)folderObjectId
+                                properties:(CMISProperties *)properties
+                           completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
 
 /**
  * Deletes the given folder and all of its subfolder and files
@@ -178,20 +182,20 @@
  * completionBlock returns array of failed objects if any. NSError will be nil if successful
  *
  */
-- (void)deleteTree:(NSString *)folderObjectId
-        allVersion:(BOOL)allVersions
-     unfileObjects:(CMISUnfileObject)unfileObjects
- continueOnFailure:(BOOL)continueOnFailure
-   completionBlock:(void (^)(NSArray *failedObjects, NSError *error))completionBlock;
+- (CMISRequest*)deleteTree:(NSString *)folderObjectId
+                allVersion:(BOOL)allVersions
+             unfileObjects:(CMISUnfileObject)unfileObjects
+         continueOnFailure:(BOOL)continueOnFailure
+           completionBlock:(void (^)(NSArray *failedObjects, NSError *error))completionBlock;
 
 /**
  * Updates the properties of the given object.
  * completionBlock returns NSError nil if successful
  */
-- (void)updatePropertiesForObject:(CMISStringInOutParameter *)objectIdParam
-                       properties:(CMISProperties *)properties
-                      changeToken:(CMISStringInOutParameter *)changeTokenParam
-                  completionBlock:(void (^)(NSError *error))completionBlock;
+- (CMISRequest*)updatePropertiesForObject:(CMISStringInOutParameter *)objectIdParam
+                               properties:(CMISProperties *)properties
+                              changeToken:(CMISStringInOutParameter *)changeTokenParam
+                          completionBlock:(void (^)(NSError *error))completionBlock;
 
 /**
  * Gets the list of associated Renditions for the specified object.
@@ -201,10 +205,10 @@
  *       Ie. the whole set is <b>always</b> returned.
  * completionBlock returns array of associated renditions or nil if unsuccessful
  */
-- (void)retrieveRenditions:(NSString *)objectId
-                renditionFilter:(NSString *)renditionFilter
-                    maxItems:(NSNumber *)maxItems
-                    skipCount:(NSNumber *)skipCount
-           completionBlock:(void (^)(NSArray *renditions, NSError *error))completionBlock;
+- (CMISRequest*)retrieveRenditions:(NSString *)objectId
+                   renditionFilter:(NSString *)renditionFilter
+                          maxItems:(NSNumber *)maxItems
+                         skipCount:(NSNumber *)skipCount
+                   completionBlock:(void (^)(NSArray *renditions, NSError *error))completionBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h Wed Feb 20 13:18:59 2013
@@ -21,6 +21,7 @@
 #import "CMISRepositoryInfo.h"
 
 @class CMISTypeDefinition;
+@class CMISRequest;
 
 @protocol CMISRepositoryService <NSObject>
 
@@ -28,20 +29,20 @@
  * Returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
  * completionBlock returns array of repositories or nil if unsuccessful
  */
-- (void)retrieveRepositoriesWithCompletionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
+- (CMISRequest*)retrieveRepositoriesWithCompletionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
 
 /**
  * Returns the repository info for the repository with the given id
  * completionBlock returns repository or nil if unsuccessful
  */
-- (void)retrieveRepositoryInfoForId:(NSString *)repositoryId
+- (CMISRequest*)retrieveRepositoryInfoForId:(NSString *)repositoryId
                     completionBlock:(void (^)(CMISRepositoryInfo *repositoryInfo, NSError *error))completionBlock;
 
 /**
  * Returns the type definitions
  * completionBlock returns type definition or nil if unsuccessful
  */
-- (void)retrieveTypeDefinition:(NSString *)typeId
+- (CMISRequest*)retrieveTypeDefinition:(NSString *)typeId
                completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h Wed Feb 20 13:18:59 2013
@@ -23,6 +23,7 @@
 @class CMISCollection;
 @class CMISObject;
 @class CMISObjectData;
+@class CMISRequest;
 
 @protocol CMISVersioningService <NSObject>
 
@@ -38,10 +39,10 @@
  * @param includeAllowableActions
  * @param completionBlock returns object data if found or nil otherwise
  */
-- (void)retrieveObjectOfLatestVersion:(NSString *)objectId
+- (CMISRequest*)retrieveObjectOfLatestVersion:(NSString *)objectId
                                 major:(BOOL)major
                                filter:(NSString *)filter
-                 includeRelationShips:(CMISIncludeRelationship)includeRelationships
+                        relationships:(CMISIncludeRelationship)relationships
                      includePolicyIds:(BOOL)includePolicyIds
                       renditionFilter:(NSString *)renditionFilter
                            includeACL:(BOOL)includeACL
@@ -55,26 +56,11 @@
  * @param includeAllowableActions
  * @param completionBlock returns array of all versioned objects or nil otherwise
  */
-- (void)retrieveAllVersions:(NSString *)objectId
-                     filter:(NSString *)filter
-    includeAllowableActions:(BOOL)includeAllowableActions
-            completionBlock:(void (^)(NSArray *objects, NSError *error))completionBlock;
-
-/* deprecated
-- (CMISObjectData *)retrieveObjectOfLatestVersion:(NSString *)objectId
-                                            major:(BOOL)major
-                                           filter:(NSString *)filter
-                             includeRelationShips:(CMISIncludeRelationship)includeRelationships
-                                 includePolicyIds:(BOOL)includePolicyIds
-                                  renditionFilter:(NSString *)renditionFilter
-                                       includeACL:(BOOL)includeACL
-                          includeAllowableActions:(BOOL)includeAllowableActions
-                                            error:(NSError **)error;
-
-- (NSArray *)retrieveAllVersions:(NSString *)objectId
-                          filter:(NSString *)filter
-         includeAllowableActions:(BOOL)includeAllowableActions
-                           error:(NSError * *)error;
- */
+- (CMISRequest*)retrieveAllVersions:(NSString *)objectId
+                             filter:(NSString *)filter
+            includeAllowableActions:(BOOL)includeAllowableActions
+                    completionBlock:(void (^)(NSArray *objects, NSError *error))completionBlock;
+
+
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h Wed Feb 20 13:18:59 2013
@@ -39,25 +39,25 @@
  * Retrieves a collection of all versions of this document. 
  * The completionBlock returns collection of all documents or nil if unsuccessful
  */
-- (void)retrieveAllVersionsWithCompletionBlock:(void (^)(CMISCollection *allVersionsOfDocument, NSError *error))completionBlock;
+- (CMISRequest*)retrieveAllVersionsWithCompletionBlock:(void (^)(CMISCollection *allVersionsOfDocument, NSError *error))completionBlock;
 
 /**
  * Retrieves a collection of all versions of this document with paging options.
  * The completionBlock returns collection of all documents or nil if unsuccessful
  */
-- (void)retrieveAllVersionsWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISCollection *collection, NSError *error))completionBlock;
+- (CMISRequest*)retrieveAllVersionsWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISCollection *collection, NSError *error))completionBlock;
 
 /**
  * Retrieves the lastest version of this document.
  * The completionBlock returns the CMIS document or nil if unsuccessful
  */
-- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+- (CMISRequest*)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
 
 /**
  * Retrieves the lastest version of this document with paging options.
  * The completionBlock returns the CMIS document or nil if unsuccessful
  */
-- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
+- (CMISRequest*)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
                                      operationContext:(CMISOperationContext *)operationContext
                                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
 
@@ -87,6 +87,7 @@
  * completionBlock will return NSError nil if successful
  */
 - (CMISRequest*)changeContentToContentOfFile:(NSString *)filePath
+                                    mimeType:(NSString *)mimeType
                                    overwrite:(BOOL)overwrite
                              completionBlock:(void (^)(NSError *error))completionBlock
                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
@@ -102,6 +103,7 @@
 - (CMISRequest*)changeContentToContentOfInputStream:(NSInputStream *)inputStream
                                       bytesExpected:(unsigned long long)bytesExpected
                                            fileName:(NSString *)fileName
+                                           mimeType:(NSString *)mimeType
                                           overwrite:(BOOL)overwrite
                                     completionBlock:(void (^)(NSError *error))completionBlock
                                       progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
@@ -110,12 +112,12 @@
  * Deletes the content of this document.
  * completionBlock will return NSError nil if successful
  */
-- (void)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock;
+- (CMISRequest*)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock;
 
 /**
  * Deletes the document from the document store.
  * completionBlock return true if successful
  */
-- (void)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock;
+- (CMISRequest*)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m Wed Feb 20 13:18:59 2013
@@ -62,14 +62,14 @@
     return self;
 }
 
-- (void)retrieveAllVersionsWithCompletionBlock:(void (^)(CMISCollection *allVersionsOfDocument, NSError *error))completionBlock
+- (CMISRequest*)retrieveAllVersionsWithCompletionBlock:(void (^)(CMISCollection *allVersionsOfDocument, NSError *error))completionBlock
 {
-    [self retrieveAllVersionsWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveAllVersionsWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveAllVersionsWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISCollection *collection, NSError *error))completionBlock
+- (CMISRequest*)retrieveAllVersionsWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISCollection *collection, NSError *error))completionBlock
 {
-    [self.binding.versioningService retrieveAllVersions:self.identifier
+    return [self.binding.versioningService retrieveAllVersions:self.identifier
            filter:operationContext.filterString includeAllowableActions:operationContext.includeAllowableActions completionBlock:^(NSArray *objects, NSError *error) {
                if (error) {
                    log(@"Error while retrieving all versions: %@", error.description);
@@ -81,12 +81,14 @@
 }
 
 - (CMISRequest*)changeContentToContentOfFile:(NSString *)filePath
+                                    mimeType:(NSString *)mimeType
                                    overwrite:(BOOL)overwrite
                              completionBlock:(void (^)(NSError *error))completionBlock
                                progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
 {
     return [self.binding.objectService changeContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier]
                                              toContentOfFile:filePath
+                                                    mimeType:mimeType
                                            overwriteExisting:overwrite
                                                  changeToken:[CMISStringInOutParameter inOutParameterUsingInParameter:self.changeToken]
                                              completionBlock:completionBlock
@@ -96,6 +98,7 @@
 - (CMISRequest*)changeContentToContentOfInputStream:(NSInputStream *)inputStream
                                       bytesExpected:(unsigned long long)bytesExpected
                                            fileName:(NSString *)filename
+                                           mimeType:(NSString *)mimeType
                                           overwrite:(BOOL)overwrite
                                     completionBlock:(void (^)(NSError *error))completionBlock
                                       progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
@@ -104,36 +107,37 @@
                                       toContentOfInputStream:inputStream
                                                bytesExpected:bytesExpected
                                                     filename:filename
+                                                    mimeType:mimeType
                                            overwriteExisting:overwrite
                                                  changeToken:[CMISStringInOutParameter inOutParameterUsingInParameter:self.changeToken]
                                              completionBlock:completionBlock
                                                progressBlock:progressBlock];
 }
 
-- (void)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock
+- (CMISRequest*)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock
 {
-    [self.binding.objectService deleteContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier]
+    return [self.binding.objectService deleteContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier]
                                       changeToken:[CMISStringInOutParameter inOutParameterUsingInParameter:self.changeToken]
                                       completionBlock:completionBlock];
 }
 
-- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
+- (CMISRequest*)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
 {
-    [self retrieveObjectOfLatestVersionWithMajorVersion:major operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveObjectOfLatestVersionWithMajorVersion:major operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
+- (CMISRequest*)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
                                      operationContext:(CMISOperationContext *)operationContext
                                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
 {
-    [self.binding.versioningService retrieveObjectOfLatestVersion:self.identifier
-                                                            major:major filter:operationContext.filterString
-                                             includeRelationShips:operationContext.includeRelationShips
-                                                 includePolicyIds:operationContext.includePolicies
-                                                  renditionFilter:operationContext.renditionFilterString
-                                                       includeACL:operationContext.includeACLs
-                                          includeAllowableActions:operationContext.includeAllowableActions
-                                                  completionBlock:^(CMISObjectData *objectData, NSError *error) {
+    return [self.binding.versioningService retrieveObjectOfLatestVersion:self.identifier
+                                                                   major:major filter:operationContext.filterString
+                                                           relationships:operationContext.relationships
+                                                        includePolicyIds:operationContext.includePolicies
+                                                         renditionFilter:operationContext.renditionFilterString
+                                                              includeACL:operationContext.includeACLs
+                                                 includeAllowableActions:operationContext.includeAllowableActions
+                                                         completionBlock:^(CMISObjectData *objectData, NSError *error) {
             if (error) {
                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
             } else {
@@ -167,9 +171,9 @@
 }
 
 
-- (void)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock
+- (CMISRequest*)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock
 {
-    [self.binding.objectService deleteObject:self.identifier allVersions:YES completionBlock:completionBlock];
+    return [self.binding.objectService deleteObject:self.identifier allVersions:YES completionBlock:completionBlock];
 }
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.h Wed Feb 20 13:18:59 2013
@@ -28,14 +28,14 @@
  * CompletionBlock will return array or nil if unsuccessful
  * CompletionBlock will return nil for root folder and non-fileable objects.
  */
-- (void)retrieveParentsWithCompletionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock;
+- (CMISRequest*)retrieveParentsWithCompletionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock;
 
 /**
  * Returns all the parents of this object as an array of CMISFolder objects with paging options
  * CompletionBlock will return array or nil if unsuccessful
  * CompletionBlock will return nil for root folder and non-fileable objects.
  */
-- (void)retrieveParentsWithOperationContext:(CMISOperationContext *)operationContext 
+- (CMISRequest*)retrieveParentsWithOperationContext:(CMISOperationContext *)operationContext 
                             completionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock;
 
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m Wed Feb 20 13:18:59 2013
@@ -25,17 +25,17 @@
 @implementation CMISFileableObject
 
 
-- (void)retrieveParentsWithCompletionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock
+- (CMISRequest*)retrieveParentsWithCompletionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock
 {
     return [self retrieveParentsWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveParentsWithOperationContext:(CMISOperationContext *)operationContext
+- (CMISRequest*)retrieveParentsWithOperationContext:(CMISOperationContext *)operationContext
                             completionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock
 {
-    [self.binding.navigationService retrieveParentsForObject:self.identifier
+    return [self.binding.navigationService retrieveParentsForObject:self.identifier
                                                       filter:operationContext.filterString
-                                               relationships:operationContext.includeRelationShips
+                                               relationships:operationContext.relationships
                                              renditionFilter:operationContext.renditionFilterString
                                      includeAllowableActions:operationContext.includeAllowableActions
                                   includeRelativePathSegment:operationContext.includePathSegments

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h Wed Feb 20 13:18:59 2013
@@ -34,7 +34,7 @@
  *
  * The completionBlock will return paged results with instances of CMISObject or nil if unsuccessful.
  */
-- (void)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+- (CMISRequest*)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
 
 /**
  * Checks if this folder is the root folder.
@@ -45,36 +45,36 @@
  * Gets the parent folder object.
  * The completionBlock will return CMISFolder object or nil if unsuccessful.
  */
-- (void)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
+- (CMISRequest*)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
 
 /**
  * Retrieves the children of this folder as a paged result using the provided operation context.
  *
  * The completionBlock will return paged results with instances of CMISObject or nil if unsuccessful.
  */
-- (void)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+- (CMISRequest*)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
 
 /**
- * creates a folder with sepcified properties
+ * creates a folder with specified properties
  * completionBlock returns object Id of newly created folder or nil if not successful
  */
-- (void)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
+- (CMISRequest*)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
 
 /**
- * creates a document with sepcified properties, mime Type
+ * creates a document with specified properties, mime Type
  * completionBlock returns object Id of newly created document or nil if not successful
  */
-- (void)createDocumentFromFilePath:(NSString *)filePath
+- (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           mimeType:(NSString *)mimeType
                         properties:(NSDictionary *)properties
                    completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
 
 /**
- * creates a document with sepcified properties, mime Type
+ * creates a document with specified properties, mime Type
  * completionBlock returns object Id of newly created document or nil if not successful
  */
-- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
+- (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType
                            properties:(NSDictionary *)properties
                         bytesExpected:(unsigned long long)bytesExpected
@@ -83,10 +83,10 @@
 
 
 /**
- * creates a document with sepcified properties, mime Type
+ * creates a document with specified properties, mime Type
  * completionBlock returns list of failed objects (if any) 
  */
-- (void)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
+- (CMISRequest*)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
                           unfileObjects:(CMISUnfileObject)unfileObjects
                       continueOnFailure:(BOOL)continueOnFailure
                         completionBlock:(void (^)(NSArray *failedObjects, NSError *error))completionBlock;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m Wed Feb 20 13:18:59 2013
@@ -25,6 +25,7 @@
 #import "CMISOperationContext.h"
 #import "CMISObjectList.h"
 #import "CMISSession.h"
+#import "CMISRequest.h"
 
 @interface CMISFolder ()
 
@@ -44,9 +45,9 @@
     return self;
 }
 
-- (void)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
+- (CMISRequest*)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
 {
-    [self retrieveChildrenWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveChildrenWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
 - (BOOL)isRootFolder
@@ -54,13 +55,14 @@
     return [self.identifier isEqualToString:self.session.repositoryInfo.rootFolderId];
 }
 
-- (void)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
+- (CMISRequest*)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
 {
     if ([self isRootFolder])
     {
         completionBlock(nil, nil);
+        return nil;
     } else {
-        [self retrieveParentsWithCompletionBlock:^(NSArray *parentFolders, NSError *error) {
+        return [self retrieveParentsWithCompletionBlock:^(NSArray *parentFolders, NSError *error) {
             if (parentFolders.count > 0) {
                 completionBlock([parentFolders objectAtIndex:0], error);
             } else {
@@ -70,15 +72,16 @@
     }
 }
 
-- (void)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
+- (CMISRequest*)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock)
     {
         // Fetch results through navigationService
-        [self.binding.navigationService retrieveChildren:self.identifier
+        request = [self.binding.navigationService retrieveChildren:self.identifier
                                                  orderBy:operationContext.orderBy
                                                   filter:operationContext.filterString
-                                           relationShips:operationContext.includeRelationShips
+                                           relationships:operationContext.relationships
                                          renditionFilter:operationContext.renditionFilterString
                                  includeAllowableActions:operationContext.includeAllowableActions
                                       includePathSegment:operationContext.includePathSegments
@@ -108,31 +111,35 @@
                                   completionBlock(result, nil);
                               }
                           }];
+    return request;
 }
 
-- (void)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+- (CMISRequest*)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.session.objectConverter convertProperties:properties
                                     forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
                                     completionBlock:^(CMISProperties *properties, NSError *error) {
                      if (error) {
                          completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
                      } else {
-                         [self.binding.objectService createFolderInParentFolder:self.identifier
+                         request = [self.binding.objectService createFolderInParentFolder:self.identifier
                                                                      properties:properties
                                                                 completionBlock:^(NSString *objectId, NSError *error) {
                                                                     completionBlock(objectId, error);
                                                                 }];
                      }
                  }];
+    return request;
 }
 
-- (void)createDocumentFromFilePath:(NSString *)filePath
+- (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           mimeType:(NSString *)mimeType
                         properties:(NSDictionary *)properties
                    completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
                      progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.session.objectConverter convertProperties:properties
                                     forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
                                     completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
@@ -142,7 +149,7 @@
                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
             }
         } else {
-            [self.binding.objectService createDocumentFromFilePath:filePath
+            request = [self.binding.objectService createDocumentFromFilePath:filePath
                                                           mimeType:mimeType
                                                         properties:convertedProperties
                                                           inFolder:self.identifier
@@ -150,15 +157,17 @@
                                                      progressBlock:progressBlock];
         }
     }];
+    return request;
 }
 
-- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
+- (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType
                            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
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.session.objectConverter convertProperties:properties forObjectTypeId:kCMISPropertyObjectTypeIdValueDocument completionBlock:^(CMISProperties *convertedProperties, NSError *error){
         if (nil == convertedProperties){
             log(@"Could not convert properties: %@", error.description);
@@ -166,7 +175,7 @@
                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
             }
         } else {
-            [self.binding.objectService createDocumentFromInputStream:inputStream
+            request = [self.binding.objectService createDocumentFromInputStream:inputStream
                                                              mimeType:mimeType
                                                            properties:convertedProperties
                                                              inFolder:self.identifier
@@ -175,15 +184,16 @@
                                                         progressBlock:progressBlock];
         }
     }];
+    return request;
 }
 
 
-- (void)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
+- (CMISRequest*)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
                           unfileObjects:(CMISUnfileObject)unfileObjects
                       continueOnFailure:(BOOL)continueOnFailure
                         completionBlock:(void (^)(NSArray *failedObjects, NSError *error))completionBlock
 {
-    [self.binding.objectService deleteTree:self.identifier allVersion:deleteAllversions
+    return [self.binding.objectService deleteTree:self.identifier allVersion:deleteAllversions
                                     unfileObjects:unfileObjects continueOnFailure:continueOnFailure completionBlock:completionBlock];
 }
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.h Wed Feb 20 13:18:59 2013
@@ -26,7 +26,7 @@
 @property (nonatomic, strong) NSString *filterString;
 @property (nonatomic, assign) BOOL includeAllowableActions;
 @property (nonatomic, assign) BOOL includeACLs;
-@property (nonatomic, assign) CMISIncludeRelationship includeRelationShips;
+@property (nonatomic, assign) CMISIncludeRelationship relationships;
 @property (nonatomic, assign) BOOL includePolicies;
 @property (nonatomic, strong) NSString *renditionFilterString;
 @property (nonatomic, strong) NSString *orderBy;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISOperationContext.m Wed Feb 20 13:18:59 2013
@@ -29,7 +29,7 @@
     defaultContext.includeAllowableActions = YES;
     defaultContext.includeACLs = NO;
     defaultContext.includePolicies = NO;
-    defaultContext.includeRelationShips = CMISIncludeRelationshipNone;
+    defaultContext.relationships = CMISIncludeRelationshipNone;
     defaultContext.renditionFilterString = nil;
     defaultContext.orderBy = nil;
     defaultContext.includePathSegments = NO;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.h Wed Feb 20 13:18:59 2013
@@ -20,10 +20,15 @@
 #import <Foundation/Foundation.h>
 
 @class CMISHttpRequest;
+@protocol CMISCancellableRequest <NSObject>
+
+- (void)cancel;
+
+@end
 
 @interface CMISRequest : NSObject
 
-@property (nonatomic, weak) id httpRequest;
+@property (nonatomic, strong) id httpRequest;
 @property (nonatomic, readonly, getter = isCancelled) BOOL cancelled;
 
 /**
@@ -31,4 +36,7 @@
  */
 - (void)cancel;
 
+
 @end
+
+

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRequest.m Wed Feb 20 13:18:59 2013
@@ -22,26 +22,37 @@
 @interface CMISRequest ()
 
 @property (nonatomic, getter = isCancelled) BOOL cancelled;
-
 @end
 
 
 @implementation CMISRequest
 
+- (id)init
+{
+    self = [super init];
+    if (nil != self)
+    {
+        self.cancelled = NO;
+    }
+    return self;
+}
 
 - (void)cancel
 {
     self.cancelled = YES;
-    
-    [self.httpRequest cancel];
+    if ([self.httpRequest respondsToSelector:@selector(cancel)]){
+        [self.httpRequest cancel];
+    }
 }
 
+
 - (void)setHttpRequest:(id)httpRequest
 {
     _httpRequest = httpRequest;
-    
-    if (self.isCancelled && [httpRequest respondsToSelector:@selector(cancel)]) {
-        [httpRequest cancel];
+    if (self.isCancelled){
+        if ([httpRequest respondsToSelector:@selector(cancel)]) {
+            [httpRequest cancel];
+        }
     }
 }
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h Wed Feb 20 13:18:59 2013
@@ -67,27 +67,27 @@
  * Retrieves the root folder for the repository.
  * completionBlock returns the root folder of the repo or nil if unsuccessful
  */
-- (void)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
+- (CMISRequest*)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
 
 /**
  * Retrieves the root folder for the repository using the provided operation context.
  * completionBlock returns a folder of the repo or nil if unsuccessful
  */
-- (void)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext
+- (CMISRequest*)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext
                            completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
  
 /**
  * Retrieves the object with the given identifier.
  * completionBlock returns the CMIS object or nil if unsuccessful
   */
-- (void)retrieveObject:(NSString *)objectId
+- (CMISRequest*)retrieveObject:(NSString *)objectId
        completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
 
 /**
   * Retrieves the object with the given identifier, using the provided operation context.
   * completionBlock returns the CMIS object or nil if unsuccessful
   */
-- (void)retrieveObject:(NSString *)objectId
+- (CMISRequest*)retrieveObject:(NSString *)objectId
       operationContext:(CMISOperationContext *)operationContext
        completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
 
@@ -95,7 +95,7 @@
  * Retrieves the object for the given path.
  * completionBlock returns the CMIS object or nil if unsuccessful
  */
-- (void)retrieveObjectByPath:(NSString *)path
+- (CMISRequest*)retrieveObjectByPath:(NSString *)path
              completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
 
  
@@ -103,7 +103,7 @@
  * Retrieves the object for the given path, using the provided operation context.
  * completionBlock returns the CMIS object or nil if unsuccessful
  */
-- (void)retrieveObjectByPath:(NSString *)path
+- (CMISRequest*)retrieveObjectByPath:(NSString *)path
             operationContext:(CMISOperationContext *)operationContext
              completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
 
@@ -111,13 +111,13 @@
  * Retrieves the definition for the given type.
  * completionBlock returns the CMIS type definition or nil if unsuccessful
  */
-- (void)retrieveTypeDefinition:(NSString *)typeId 
+- (CMISRequest*)retrieveTypeDefinition:(NSString *)typeId 
                completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;
 /**
  * Retrieves all objects matching the given cmis query.
  * completionBlock returns the search results as a paged results object or nil if unsuccessful.
  */
-- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
+- (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
                                       completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock;
 
 /**
@@ -125,7 +125,7 @@
  * and using the parameters provided in the operation context.
  * completionBlock returns the search results as a paged results object or nil if unsuccessful.
  */
-- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
+- (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
                                      operationContext:(CMISOperationContext *)operationContext
                                       completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock;
 
@@ -134,7 +134,7 @@
  * Returns a paged result set, containing CMISObject instances.
  * completionBlock returns the search results as a paged results object or nil if unsuccessful.
  */
-- (void)queryObjectsWithTypeid:(NSString *)typeId
+- (CMISRequest*)queryObjectsWithTypeid:(NSString *)typeId
                    whereClause:(NSString *)whereClause
              searchAllVersions:(BOOL)searchAllVersion
               operationContext:(CMISOperationContext *)operationContext
@@ -145,7 +145,7 @@
  * Creates a folder in the provided folder.
  * completionBlock returns the object Id of the newly created folder or nil if unsuccessful
  */
-- (void)createFolder:(NSDictionary *)properties
+- (CMISRequest*)createFolder:(NSDictionary *)properties
             inFolder:(NSString *)folderObjectId
      completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
 
@@ -172,7 +172,7 @@
  * Creates a cmis document using the content from the file path.
  * completionBlock returns object Id of newly created object or nil if unsuccessful
  */
-- (void)createDocumentFromFilePath:(NSString *)filePath
+- (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           mimeType:(NSString *)mimeType
                         properties:(NSDictionary *)properties
                           inFolder:(NSString *)folderObjectId
@@ -183,7 +183,7 @@
  * Creates a cmis document using the content from the given stream.
  * completionBlock returns object Id of newly created object or nil if unsuccessful
  */
-- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
+- (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType
                            properties:(NSDictionary *)properties
                              inFolder:(NSString *)folderObjectId

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Wed Feb 20 13:18:59 2013
@@ -26,6 +26,7 @@
 #import "CMISQueryResult.h"
 #import "CMISErrors.h"
 #import "CMISOperationContext.h"
+#import "CMISRequest.h"
 #import "CMISPagedResult.h"
 #import "CMISTypeDefinition.h"
 #import "CMISNetworkProvider.h"
@@ -165,15 +166,15 @@
 
 #pragma mark CMIS operations
 
-- (void)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
+- (CMISRequest*)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
 {
-    [self retrieveFolderWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveFolderWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
+- (CMISRequest*)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
 {
     NSString *rootFolderId = self.repositoryInfo.rootFolderId;
-    [self retrieveObject:rootFolderId operationContext:operationContext completionBlock:^(CMISObject *rootFolder, NSError *error) {
+    return [self retrieveObject:rootFolderId operationContext:operationContext completionBlock:^(CMISObject *rootFolder, NSError *error) {
         if (rootFolder != nil && ![rootFolder isKindOfClass:[CMISFolder class]]) {
             completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime detailedDescription:@"Root folder object is not a folder!"]);
         } else {
@@ -182,30 +183,30 @@
     }];
 }
 
-- (void)retrieveObject:(NSString *)objectId completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+- (CMISRequest*)retrieveObject:(NSString *)objectId completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
 {
-    [self retrieveObject:objectId operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveObject:objectId operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveObject:(NSString *)objectId
+- (CMISRequest*)retrieveObject:(NSString *)objectId
       operationContext:(CMISOperationContext *)operationContext
        completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
 {
     if (objectId == nil) {
         completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:@"Must provide object id"]);
-        return;
+        return nil;
     }
 
     // TODO: cache the object
 
-    [self.binding.objectService retrieveObject:objectId
-                                        filter:operationContext.filterString
-                                 relationShips:operationContext.includeRelationShips
-                              includePolicyIds:operationContext.includePolicies
-                               renditionFilder:operationContext.renditionFilterString
-                                    includeACL:operationContext.includeACLs
-                       includeAllowableActions:operationContext.includeAllowableActions
-                               completionBlock:^(CMISObjectData *objectData, NSError *error) {
+    return [self.binding.objectService retrieveObject:objectId
+                                               filter:operationContext.filterString
+                                        relationships:operationContext.relationships
+                                     includePolicyIds:operationContext.includePolicies
+                                      renditionFilder:operationContext.renditionFilterString
+                                           includeACL:operationContext.includeACLs
+                              includeAllowableActions:operationContext.includeAllowableActions
+                                      completionBlock:^(CMISObjectData *objectData, NSError *error) {
                                             if (error) {
                                                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeObjectNotFound]);
                                             } else {
@@ -218,18 +219,18 @@
                                         }];
 }
 
-- (void)retrieveObjectByPath:(NSString *)path completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+- (CMISRequest*)retrieveObjectByPath:(NSString *)path completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
 {
-    [self retrieveObjectByPath:path operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self retrieveObjectByPath:path operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)retrieveObjectByPath:(NSString *)path
+- (CMISRequest*)retrieveObjectByPath:(NSString *)path
             operationContext:(CMISOperationContext *)operationContext
              completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
 {
-    [self.binding.objectService retrieveObjectByPath:path
+    return [self.binding.objectService retrieveObjectByPath:path
                                               filter:operationContext.filterString
-                                       relationShips:operationContext.includeRelationShips
+                                       relationships:operationContext.relationships
                                     includePolicyIds:operationContext.includePolicies
                                      renditionFilder:operationContext.renditionFilterString
                                           includeACL:operationContext.includeACLs
@@ -246,25 +247,26 @@
                                      }];
 }
 
-- (void)retrieveTypeDefinition:(NSString *)typeId completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock
+- (CMISRequest*)retrieveTypeDefinition:(NSString *)typeId completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock
 {
     return [self.binding.repositoryService retrieveTypeDefinition:typeId completionBlock:completionBlock];
 }
 
-- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
+- (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
 {
-    [self query:statement searchAllVersions:searchAllVersion operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+    return [self query:statement searchAllVersions:searchAllVersion operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
 }
 
-- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
+- (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
                                      operationContext:(CMISOperationContext *)operationContext
                                       completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock){
         // Fetch results through discovery service
-        [self.binding.discoveryService query:statement
+       request = [self.binding.discoveryService query:statement
                                                   searchAllVersions:searchAllVersion
-                                                  relationShips:operationContext.includeRelationShips
+                                                  relationships:operationContext.relationships
                                                   renditionFilter:operationContext.renditionFilterString
                                                   includeAllowableActions:operationContext.includeAllowableActions
                                                   maxItems:[NSNumber numberWithInt:maxItems]
@@ -299,9 +301,10 @@
                                         completionBlock(result, nil);
                                     }
                                 }];
+    return request;
 }
 
-- (void)queryObjectsWithTypeDefinition:(CMISTypeDefinition *)typeDefinition
+- (CMISRequest*)queryObjectsWithTypeDefinition:(CMISTypeDefinition *)typeDefinition
                            whereClause:(NSString *)whereClause
                      searchAllVersions:(BOOL)searchAllVersion
                       operationContext:(CMISOperationContext *)operationContext
@@ -326,18 +329,20 @@
         [statement appendFormat:@" ORDER BY %@", operationContext.orderBy];
     }
     
+    __block CMISRequest *request = [[CMISRequest alloc] init];
+    
     // Fetch block for paged results
     CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock)
     {
         // Fetch results through discovery service
-        [self.binding.discoveryService query:statement
-                           searchAllVersions:searchAllVersion
-                               relationShips:operationContext.includeRelationShips
-                             renditionFilter:operationContext.renditionFilterString
-                     includeAllowableActions:operationContext.includeAllowableActions
-                                    maxItems:[NSNumber numberWithInt:maxItems]
-                                   skipCount:[NSNumber numberWithInt:skipCount]
-                             completionBlock:^(CMISObjectList *objectList, NSError *error) {
+        request = [self.binding.discoveryService query:statement
+                                     searchAllVersions:searchAllVersion
+                                         relationships:operationContext.relationships
+                                       renditionFilter:operationContext.renditionFilterString
+                               includeAllowableActions:operationContext.includeAllowableActions
+                                              maxItems:[NSNumber numberWithInt:maxItems]
+                                             skipCount:[NSNumber numberWithInt:skipCount]
+                                       completionBlock:^(CMISObjectList *objectList, NSError *error) {
                                  if (error) {
                                      pageBlockCompletionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
                                  } else {
@@ -368,15 +373,16 @@
                                         completionBlock(result, nil);
                                     }
                                 }];
+    return request;
 }
 
-- (void)queryObjectsWithTypeid:(NSString *)typeId
+- (CMISRequest*)queryObjectsWithTypeid:(NSString *)typeId
                    whereClause:(NSString *)whereClause
              searchAllVersions:(BOOL)searchAllVersion
               operationContext:(CMISOperationContext *)operationContext
                completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
 {
-    [self retrieveTypeDefinition:typeId
+    return [self retrieveTypeDefinition:typeId
                  completionBlock:^(CMISTypeDefinition *typeDefinition, NSError *internalError) {
                      if (internalError != nil) {
                          NSError *error = [CMISErrors cmisError:internalError cmisErrorCode:kCMISErrorCodeRuntime];
@@ -391,23 +397,25 @@
                  }];
 }
 
-- (void)createFolder:(NSDictionary *)properties
+- (CMISRequest*)createFolder:(NSDictionary *)properties
             inFolder:(NSString *)folderObjectId
      completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.objectConverter convertProperties:properties
                             forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
                             completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
                                if (error) {
                                    completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
                                } else {
-                                   [self.binding.objectService createFolderInParentFolder:folderObjectId
+                                  request = [self.binding.objectService createFolderInParentFolder:folderObjectId
                                                                                properties:convertedProperties
                                                                           completionBlock:^(NSString *objectId, NSError *error) {
                                                                               completionBlock(objectId, error);
                                                                           }];
                                }
                            }];
+    return request;
 }
 
 - (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
@@ -435,12 +443,13 @@
 }
 
 
-- (void)createDocumentFromFilePath:(NSString *)filePath
+- (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           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
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.objectConverter convertProperties:properties
                             forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
                             completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
@@ -450,7 +459,7 @@
                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
             }
         } else {
-            [self.binding.objectService createDocumentFromFilePath:filePath
+            request = [self.binding.objectService createDocumentFromFilePath:filePath
                                                           mimeType:mimeType
                                                         properties:convertedProperties
                                                       inFolder:folderObjectId
@@ -458,9 +467,10 @@
                                                      progressBlock:progressBlock];
         }
     }];
+    return request;
 }
 
-- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
+- (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType
                            properties:(NSDictionary *)properties
                              inFolder:(NSString *)folderObjectId
@@ -468,6 +478,7 @@
                       completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
                         progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
 {
+    __block CMISRequest *request = [[CMISRequest alloc] init];
     [self.objectConverter convertProperties:properties
                             forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
                             completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
@@ -477,7 +488,7 @@
                 completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
             }
         } else {
-            [self.binding.objectService createDocumentFromInputStream:inputStream
+            request = [self.binding.objectService createDocumentFromInputStream:inputStream
                                                              mimeType:mimeType
                                                            properties:convertedProperties
                                                              inFolder:folderObjectId
@@ -486,6 +497,7 @@
                                                         progressBlock:progressBlock];
         }
     }];
+    return request;
 }
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h Wed Feb 20 13:18:59 2013
@@ -41,12 +41,14 @@ typedef enum {
  * @param body the data for the upload (maybe nil)
  * @param headers any additional headers to be used in the request (maybe nil)
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invoke:(NSURL *)url
     httpMethod:(CMISHttpRequestMethod)httpRequestMethod
        session:(CMISBindingSession *)session
           body:(NSData *)body
        headers:(NSDictionary *)additionalHeaders
+   cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
 /**
@@ -57,12 +59,14 @@ completionBlock:(void (^)(CMISHttpRespon
  * @param inputStream the stream pointing to the source to be uploaded. Must be an instance or extension of NSInputStream
  * @param headers any additional headers to be used in the request (maybe nil)
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invoke:(NSURL *)url
     httpMethod:(CMISHttpRequestMethod)httpRequestMethod
        session:(CMISBindingSession *)session
    inputStream:(NSInputStream *)inputStream
        headers:(NSDictionary *)additionalHeaders
+   cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
 
@@ -84,9 +88,9 @@ completionBlock:(void (^)(CMISHttpRespon
    inputStream:(NSInputStream *)inputStream
        headers:(NSDictionary *)additionalHeaders
  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
- requestObject:(CMISRequest *)requestObject;
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
 /**
  * Invoke method used for downloads, 
@@ -104,10 +108,9 @@ completionBlock:(void (^)(CMISHttpRespon
        session:(CMISBindingSession *)session
   outputStream:(NSOutputStream *)outputStream
  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
- requestObject:(CMISRequest*)requestObject;
-
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
 
 /**
@@ -115,12 +118,15 @@ completionBlock:(void (^)(CMISHttpRespon
  * @param url the RESTful API URL to be used
  * @param session
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invokeGET:(NSURL *)url
           session:(CMISBindingSession *)session
+      cmisRequest:(CMISRequest *)cmisRequest
   completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
 
+
 /**
  * Convenience POST invoke method. Use for creating new content
  * @param url the RESTful API URL to be used
@@ -128,13 +134,16 @@ completionBlock:(void (^)(CMISHttpRespon
  * @param body the data to be posted
  * @param additionalHeaders any additional headers to be used in the request (optional)
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invokePOST:(NSURL *)url
            session:(CMISBindingSession *)session
               body:(NSData *)body
            headers:(NSDictionary *)additionalHeaders
+       cmisRequest:(CMISRequest *)cmisRequest
    completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
+
 /**
  * Convenience PUT invoke method. Use for updating existing content
  * @param url the RESTful API URL to be used
@@ -142,23 +151,29 @@ completionBlock:(void (^)(CMISHttpRespon
  * @param body the data to be uploaded
  * @param additionalHeaders any additional headers to be used in the request (optional)
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invokePUT:(NSURL *)url
           session:(CMISBindingSession *)session
              body:(NSData *)body
           headers:(NSDictionary *)additionalHeaders
+      cmisRequest:(CMISRequest *)cmisRequest
   completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
+
 /**
  * Convenience DELETE invoke method
  * @param url the RESTful API URL to be used
  * @param session
  * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
  */
 - (void)invokeDELETE:(NSURL *)url
              session:(CMISBindingSession *)session
+         cmisRequest:(CMISRequest *)cmisRequest
      completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
 
 
+
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64Encoder.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64Encoder.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64Encoder.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64Encoder.m Wed Feb 20 13:18:59 2013
@@ -131,7 +131,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
             @autoreleasepool {
                 [fileHandle seekToFileOffset:currentOffset];
                 NSData *chunkOfData = [fileHandle readDataOfLength:524288]; // 512 kb
-                [FileUtil appendToFileAtPath:destinationFilePath data:[self dataByEncodingText:chunkOfData]];
+                [CMISFileUtil appendToFileAtPath:destinationFilePath data:[self dataByEncodingText:chunkOfData]];
                 currentOffset += chunkOfData.length;
             }
         }
@@ -154,7 +154,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
             if (length > 0) {
                 [chunkOfData setLength:length];
                 NSData *encodedChunkOfData = [self dataByEncodingText:chunkOfData];
-                [FileUtil appendToFileAtPath:destinationFilePath data:encodedChunkOfData];
+                [CMISFileUtil appendToFileAtPath:destinationFilePath data:encodedChunkOfData];
             } else {
                 break;
             }

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDateUtil.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDateUtil.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDateUtil.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDateUtil.h Wed Feb 20 13:18:59 2013
@@ -27,6 +27,7 @@
 
 /// converts a NSDate object into an ISO compliant date string
 + (NSString*)stringFromDate:(NSDate*)date;
+
 /// parses an ISO compliant string and returns the date
 + (NSDate *)dateFromString:(NSString *)string;
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m Wed Feb 20 13:18:59 2013
@@ -37,18 +37,30 @@
        session:(CMISBindingSession *)session
           body:(NSData *)body
        headers:(NSDictionary *)additionalHeaders
+   cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
     NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
                                                                            httpMethod:httpRequestMethod
                                                                               session:session];
-    
-    [CMISHttpRequest startRequest:urlRequest
-                       httpMethod:httpRequestMethod
-                      requestBody:body
-                          headers:additionalHeaders
-           authenticationProvider:session.authenticationProvider
-                  completionBlock:completionBlock];
+    if (!cmisRequest.isCancelled)
+    {
+        CMISHttpRequest* request = [CMISHttpRequest startRequest:urlRequest
+                                                      httpMethod:httpRequestMethod
+                                                     requestBody:body
+                                                         headers:additionalHeaders
+                                          authenticationProvider:session.authenticationProvider
+                                                 completionBlock:completionBlock];
+        if (request)
+        {
+            cmisRequest.httpRequest = request;
+        }
+    } else {
+        if (completionBlock) {
+            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeCancelled
+                                                 detailedDescription:@"Request was cancelled"]);
+        }
+    }
 }
 
 - (void)invoke:(NSURL *)url
@@ -56,20 +68,32 @@ completionBlock:(void (^)(CMISHttpRespon
        session:(CMISBindingSession *)session
    inputStream:(NSInputStream *)inputStream
        headers:(NSDictionary *)additionalHeaders
+   cmisRequest:(CMISRequest *)cmisRequest
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
-    NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
-                                                                           httpMethod:httpRequestMethod
-                                                                              session:session];
-    
-    [CMISHttpUploadRequest startRequest:urlRequest
-                             httpMethod:httpRequestMethod
-                            inputStream:inputStream
-                                headers:additionalHeaders
-                          bytesExpected:0
-                 authenticationProvider:session.authenticationProvider
-                        completionBlock:completionBlock
-                          progressBlock:nil];
+    if (!cmisRequest.isCancelled) {
+        NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
+                                                                               httpMethod:httpRequestMethod
+                                                                                  session:session];
+        
+        CMISHttpUploadRequest* request = [CMISHttpUploadRequest startRequest:urlRequest
+                                                           httpMethod:httpRequestMethod
+                                                          inputStream:inputStream
+                                                              headers:additionalHeaders
+                                                        bytesExpected:0
+                                               authenticationProvider:session.authenticationProvider
+                                                      completionBlock:completionBlock
+                                                        progressBlock:nil];
+        if (request)
+        {
+            cmisRequest.httpRequest = request;
+        }
+    } else {
+        if (completionBlock) {
+            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeCancelled
+                                                 detailedDescription:@"Request was cancelled"]);
+        }
+    }
 }
 
 - (void)invoke:(NSURL *)url
@@ -78,24 +102,26 @@ completionBlock:(void (^)(CMISHttpRespon
    inputStream:(NSInputStream *)inputStream
        headers:(NSDictionary *)additionalHeaders
  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
- requestObject:(CMISRequest *)requestObject
 {
-    if (!requestObject.isCancelled) {
+    if (!cmisRequest.isCancelled) {
         NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
                                                                                httpMethod:httpRequestMethod
                                                                                   session:session];
         
-        CMISHttpUploadRequest *uploadRequest = [CMISHttpUploadRequest startRequest:urlRequest
-                                                                        httpMethod:httpRequestMethod
-                                                                       inputStream:inputStream
-                                                                           headers:additionalHeaders
-                                                                     bytesExpected:bytesExpected
-                                                            authenticationProvider:session.authenticationProvider
-                                                                   completionBlock:completionBlock
-                                                                     progressBlock:progressBlock];
-        requestObject.httpRequest = uploadRequest;
+        CMISHttpUploadRequest* request = [CMISHttpUploadRequest startRequest:urlRequest
+                                                           httpMethod:httpRequestMethod
+                                                          inputStream:inputStream
+                                                              headers:additionalHeaders
+                                                        bytesExpected:bytesExpected
+                                               authenticationProvider:session.authenticationProvider
+                                                      completionBlock:completionBlock
+                                                        progressBlock:progressBlock];
+        if (request){
+            cmisRequest.httpRequest = request;
+        }
     } else {
         if (completionBlock) {
             completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeCancelled
@@ -109,23 +135,25 @@ completionBlock:(void (^)(CMISHttpRespon
        session:(CMISBindingSession *)session
   outputStream:(NSOutputStream *)outputStream
  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
- requestObject:(CMISRequest *)requestObject
 {
-    if (!requestObject.isCancelled) {
+    if (!cmisRequest.isCancelled) {
         NSMutableURLRequest *urlRequest = [CMISDefaultNetworkProvider createRequestForUrl:url
                                                                                httpMethod:HTTP_GET
                                                                                   session:session];
         
-        CMISHttpDownloadRequest *downloadRequest = [CMISHttpDownloadRequest startRequest:urlRequest
-                                                                              httpMethod:httpRequestMethod
-                                                                            outputStream:outputStream
-                                                                           bytesExpected:bytesExpected
-                                                                  authenticationProvider:session.authenticationProvider
-                                                                         completionBlock:completionBlock
-                                                                           progressBlock:progressBlock];
-        requestObject.httpRequest = downloadRequest;
+        CMISHttpDownloadRequest* request = [CMISHttpDownloadRequest startRequest:urlRequest
+                                                             httpMethod:httpRequestMethod
+                                                           outputStream:outputStream
+                                                          bytesExpected:bytesExpected
+                                                 authenticationProvider:session.authenticationProvider
+                                                        completionBlock:completionBlock
+                                                          progressBlock:progressBlock];
+        if (request) {
+            cmisRequest.httpRequest = request;
+        }
     } else {
         if (completionBlock) {
             completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeCancelled
@@ -137,6 +165,7 @@ completionBlock:(void (^)(CMISHttpRespon
 
 - (void)invokeGET:(NSURL *)url
           session:(CMISBindingSession *)session
+      cmisRequest:(CMISRequest *)cmisRequest
   completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
     return [self invoke:url
@@ -144,6 +173,7 @@ completionBlock:(void (^)(CMISHttpRespon
                 session:session
                    body:nil
                 headers:nil
+            cmisRequest:cmisRequest
         completionBlock:completionBlock];
 }
 
@@ -151,6 +181,7 @@ completionBlock:(void (^)(CMISHttpRespon
            session:(CMISBindingSession *)session
               body:(NSData *)body
            headers:(NSDictionary *)additionalHeaders
+       cmisRequest:(CMISRequest *)cmisRequest
    completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
     return [self invoke:url
@@ -158,6 +189,7 @@ completionBlock:(void (^)(CMISHttpRespon
                 session:session
                    body:body
                 headers:additionalHeaders
+            cmisRequest:cmisRequest
         completionBlock:completionBlock];
 }
 
@@ -165,6 +197,7 @@ completionBlock:(void (^)(CMISHttpRespon
           session:(CMISBindingSession *)session
              body:(NSData *)body
           headers:(NSDictionary *)additionalHeaders
+      cmisRequest:(CMISRequest *)cmisRequest
   completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
     return [self invoke:url
@@ -172,11 +205,13 @@ completionBlock:(void (^)(CMISHttpRespon
                 session:session
                    body:body
                 headers:additionalHeaders
+            cmisRequest:cmisRequest
         completionBlock:completionBlock];
 }
 
 - (void)invokeDELETE:(NSURL *)url
              session:(CMISBindingSession *)session
+         cmisRequest:(CMISRequest *)cmisRequest
      completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
 {
     return [self invoke:url
@@ -184,6 +219,7 @@ completionBlock:(void (^)(CMISHttpRespon
                 session:session
                    body:nil
                 headers:nil
+            cmisRequest:cmisRequest
         completionBlock:completionBlock];
 }
 



Mime
View raw message