You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by pw...@apache.org on 2013/03/04 16:14:25 UTC

svn commit: r1452344 [1/2] - in /chemistry/objectivecmis/trunk: ObjectiveCMIS.xcodeproj/ ObjectiveCMIS/Bindings/ ObjectiveCMIS/Bindings/AtomPub/ ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/ ObjectiveCMIS/Client/ ObjectiveCMIS/Common/ ObjectiveCMIS/Uti...

Author: pweschmidt
Date: Mon Mar  4 15:14:24 2013
New Revision: 1452344

URL: http://svn.apache.org/r1452344
Log:
The main change is the introduction of base64 encoding while streaming content to a CMIS server. Additional changes include cleanups and logging. A new unit test has been introduced to test the base64 streaming with a very small file (2 bytes)

Added:
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.m
Modified:
    chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISNavigationService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRendition.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
    chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj Mon Mar  4 15:14:24 2013
@@ -30,7 +30,10 @@
 		4E3C32A816C4EF190099B21E /* CMISAtomPubVersioningService.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E3C32A616C4EF190099B21E /* CMISAtomPubVersioningService.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		4E3C32A916C4EF190099B21E /* CMISAtomPubVersioningService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E3C32A716C4EF190099B21E /* CMISAtomPubVersioningService.m */; };
 		4E3E14B316AFFB190057CE22 /* CMISNetworkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E3E14B116AFFB190057CE22 /* CMISNetworkProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4E9CE52F16D50083004C7934 /* CMISLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E9CE52E16D50083004C7934 /* CMISLog.h */; };
+		4E41596F16E0A06200B52587 /* small_test.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4E41596E16E0A06200B52587 /* small_test.txt */; };
+		4E785C2916D7D76F00FC36FB /* CMISBase64InputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E785C2716D7D76F00FC36FB /* CMISBase64InputStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4E785C2A16D7D76F00FC36FB /* CMISBase64InputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E785C2816D7D76F00FC36FB /* CMISBase64InputStream.m */; };
+		4E9CE52F16D50083004C7934 /* CMISLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E9CE52E16D50083004C7934 /* CMISLog.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		4EA61BD71564F70C00C759E4 /* CMISStringInOutParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EA61BD31564F70C00C759E4 /* CMISStringInOutParameter.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		4EA61BD81564F70C00C759E4 /* CMISStringInOutParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EA61BD41564F70C00C759E4 /* CMISStringInOutParameter.m */; };
 		4EA61BD91564F70C00C759E4 /* CMISStringInOutParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EA61BD41564F70C00C759E4 /* CMISStringInOutParameter.m */; };
@@ -223,6 +226,9 @@
 		4E3C32A616C4EF190099B21E /* CMISAtomPubVersioningService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMISAtomPubVersioningService.h; sourceTree = "<group>"; };
 		4E3C32A716C4EF190099B21E /* CMISAtomPubVersioningService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMISAtomPubVersioningService.m; sourceTree = "<group>"; };
 		4E3E14B116AFFB190057CE22 /* CMISNetworkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISNetworkProvider.h; path = Common/CMISNetworkProvider.h; sourceTree = "<group>"; };
+		4E41596E16E0A06200B52587 /* small_test.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = small_test.txt; sourceTree = "<group>"; };
+		4E785C2716D7D76F00FC36FB /* CMISBase64InputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISBase64InputStream.h; path = Utils/CMISBase64InputStream.h; sourceTree = "<group>"; };
+		4E785C2816D7D76F00FC36FB /* CMISBase64InputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CMISBase64InputStream.m; path = Utils/CMISBase64InputStream.m; sourceTree = "<group>"; };
 		4E9CE52E16D50083004C7934 /* CMISLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISLog.h; path = Utils/CMISLog.h; sourceTree = "<group>"; };
 		4EA61BD31564F70C00C759E4 /* CMISStringInOutParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISStringInOutParameter.h; path = Utils/CMISStringInOutParameter.h; sourceTree = "<group>"; };
 		4EA61BD41564F70C00C759E4 /* CMISStringInOutParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CMISStringInOutParameter.m; path = Utils/CMISStringInOutParameter.m; sourceTree = "<group>"; };
@@ -494,6 +500,7 @@
 		828072BC15153DE900EF635C /* ObjectiveCMISTests */ = {
 			isa = PBXGroup;
 			children = (
+				4E41596E16E0A06200B52587 /* small_test.txt */,
 				FE417D6815761A34009056D3 /* CMISBaseTest.h */,
 				FE417D6815761A34009056D0 /* CMISBaseTest.m */,
 				82C1C63F15358733009B7B92 /* test_file_2.txt */,
@@ -642,6 +649,8 @@
 				4EA61BD41564F70C00C759E4 /* CMISStringInOutParameter.m */,
 				4EA61BD51564F70C00C759E4 /* CMISURLUtil.h */,
 				4EA61BD61564F70C00C759E4 /* CMISURLUtil.m */,
+				4E785C2716D7D76F00FC36FB /* CMISBase64InputStream.h */,
+				4E785C2816D7D76F00FC36FB /* CMISBase64InputStream.m */,
 			);
 			name = Utils;
 			sourceTree = "<group>";
@@ -797,9 +806,10 @@
 				BD5C9713162C11E3002DDC6E /* CMISHttpResponse.h in Headers */,
 				4E3E14B316AFFB190057CE22 /* CMISNetworkProvider.h in Headers */,
 				4E10ABFF16B916B500E2287E /* CMISDefaultNetworkProvider.h in Headers */,
+				4E9CE52F16D50083004C7934 /* CMISLog.h in Headers */,
+				4E785C2916D7D76F00FC36FB /* CMISBase64InputStream.h in Headers */,
 				4E3C32A816C4EF190099B21E /* CMISAtomPubVersioningService.h in Headers */,
 				BD30D33D162D7DD7001FFF80 /* CMISRequest.h in Headers */,
-				4E9CE52F16D50083004C7934 /* CMISLog.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -886,6 +896,7 @@
 				750CB2C0159C56A5004576F7 /* FolderChildren-opencmis.xml in Resources */,
 				750CB2C5159C672B004576F7 /* AtomFeedWithExtensions.xml in Resources */,
 				750CB2C8159C76D1004576F7 /* AtomPubServiceDocument.xml in Resources */,
+				4E41596F16E0A06200B52587 /* small_test.txt in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1008,6 +1019,7 @@
 				4E39DF61163A767B00F21DE6 /* CMISAtomParserUtil.m in Sources */,
 				4E10AC0016B916B500E2287E /* CMISDefaultNetworkProvider.m in Sources */,
 				4E3C32A916C4EF190099B21E /* CMISAtomPubVersioningService.m in Sources */,
+				4E785C2A16D7D76F00FC36FB /* CMISBase64InputStream.m in Sources */,
 				82895A1B16D8A8C5007BC80A /* CMISLog.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.h Mon Mar  4 15:14:24 2013
@@ -50,4 +50,12 @@
 */
 - (NSString *)generateAtomEntryXml;
 
+- (NSString *)xmlStartElement;
+
+- (NSString *)xmlContentStartElement;
+
+- (NSString *)xmlContentEndElement;
+
+- (NSString *)xmlPropertiesElements;
+
 @end
\ No newline at end of file

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=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m Mon Mar  4 15:14:24 2013
@@ -52,7 +52,7 @@
 
 @property (nonatomic, strong) NSMutableString *internalXml;
 @property (nonatomic, strong) NSString *internalFilePath;
-
+- (NSString *)xmlExtensionElements:(NSArray *)extensionElements;
 @end
 
 @implementation CMISAtomEntryWriter
@@ -68,72 +68,32 @@
 @synthesize internalXml = _internalXml;
 @synthesize internalFilePath = _internalFilePath;
 
-
-- (NSString *)generateAtomEntryXml
+- (NSString *)xmlStartElement
 {
-    [self addEntryStartElement];
-
-    if (self.contentFilePath || self.inputStream)
-    {
-        [self addContent];
-    }
-
-    [self addProperties];
-
-    // Return result
-    if (self.generateXmlInMemory)
-    {
-        return self.internalXml;
-    }
-    else
-    {
-        return self.internalFilePath;
-    }
+    return [NSString stringWithFormat:
+                                   @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                                   "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"  >"
+                                   "<id>urn:uuid:00000000-0000-0000-0000-00000000000</id>"
+                                   "<title>%@</title>",
+                                   [self.cmisProperties propertyValueForId:kCMISPropertyName]];
 }
 
-- (void)addEntryStartElement
+- (NSString *)xmlContentStartElement
 {
-    NSString *atomEntryXmlStart = [NSString stringWithFormat:
-           @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-            "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"  >"
-                "<id>urn:uuid:00000000-0000-0000-0000-00000000000</id>"
-                "<title>%@</title>",
-            [self.cmisProperties propertyValueForId:kCMISPropertyName]];
-
-    [self appendStringToReturnResult:atomEntryXmlStart];
+    return [NSString stringWithFormat:@"<cmisra:content>""<cmisra:mediatype>%@</cmisra:mediatype>""<cmisra:base64>", self.mimeType];
+    
 }
 
-- (void)addContent
+- (NSString *)xmlContentEndElement
 {
-    NSString *contentXMLStart = [NSString stringWithFormat:@"<cmisra:content>""<cmisra:mediatype>%@</cmisra:mediatype>""<cmisra:base64>", self.mimeType];
-    [self appendStringToReturnResult:contentXMLStart];
-
-    // Generate the base64 representation of the content
-    if (self.contentFilePath) {
-        if (self.generateXmlInMemory) {
-            NSString *encodedContent = [CMISBase64Encoder encodeContentOfFile:self.contentFilePath];
-            [self appendToInMemoryXml:encodedContent];
-        } else {
-            [CMISBase64Encoder encodeContentOfFile:self.contentFilePath appendToFile:self.internalFilePath];
-        }
-    } else if (self.inputStream) {
-        if (self.generateXmlInMemory)
-        {
-            NSString *encodedContent = [CMISBase64Encoder encodeContentFromInputStream:self.inputStream];
-            [self appendToInMemoryXml:encodedContent];
-        } else {
-            [CMISBase64Encoder encodeContentFromInputStream:self.inputStream appendToFile:self.internalFilePath];
-        }
-    }
-
-    NSString *contentXMLEnd = @"</cmisra:base64></cmisra:content>";
-    [self appendStringToReturnResult:contentXMLEnd];
+    return @"</cmisra:base64></cmisra:content>";
 }
 
-- (void)addProperties
+- (NSString *)xmlPropertiesElements
 {
-    [self appendStringToReturnResult:@"<cmisra:object><cmis:properties>"];
-
+    NSMutableString *properties = [NSMutableString string];
+    [properties appendString:@"<cmisra:object><cmis:properties>"];
+    
     // TODO: support for multi valued properties
     for (id propertyKey in self.cmisProperties.propertiesDictionary)
     {
@@ -142,99 +102,91 @@
         {
             case CMISPropertyTypeString:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyString propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyString propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSString *propertyStringValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyStringValue stringByAddingXMLEntities]]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyStringValue stringByAddingXMLEntities]]];
                 }
-
-                [self appendStringToReturnResult:@"</cmis:propertyString>"];
+                [properties appendString:@"</cmis:propertyString>"];
                 break;
             }
             case CMISPropertyTypeInteger:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyInteger propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
-
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyInteger propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
+                
                 for (NSNumber *propertyIntegerValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", propertyIntegerValue.stringValue]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", propertyIntegerValue.stringValue]];
                 }
-
-                [self appendStringToReturnResult:@"</cmis:propertyInteger>"];
+                [properties appendString:@"</cmis:propertyInteger>"];
                 break;
             }
             case CMISPropertyTypeDecimal:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyDecimal propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyDecimal propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSNumber *propertyDecimalValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", propertyDecimalValue.stringValue]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", propertyDecimalValue.stringValue]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyDecimal>"];
+                [properties appendString:@"</cmis:propertyDecimal>"];
                 break;
             }
             case CMISPropertyTypeBoolean:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyBoolean propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyBoolean propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSNumber *propertyBooleanValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>",
-                                                      propertyBooleanValue.boolValue ? @"true" : @"false"]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>",
+                                              propertyBooleanValue.boolValue ? @"true" : @"false"]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyBoolean>"];
+                [properties appendString:@"</cmis:propertyBoolean>"];
                 break;
             }
             case CMISPropertyTypeId:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyId propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyId propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSString *propertyIdValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyIdValue stringByAddingXMLEntities]]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyIdValue stringByAddingXMLEntities]]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyId>"];
+                [properties appendString:@"</cmis:propertyId>"];
                 break;
             }
             case CMISPropertyTypeDateTime:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyDateTime propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyDateTime propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSDate *propertyDateTimeValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [CMISDateUtil stringFromDate:propertyDateTimeValue]]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [CMISDateUtil stringFromDate:propertyDateTimeValue]]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyDateTime>"];
+                [properties appendString:@"</cmis:propertyDateTime>"];
                 break;
             }
             case CMISPropertyTypeUri:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyUri propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyUri propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSURL *propertyUriValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [[propertyUriValue path] stringByAddingXMLEntities]]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [[propertyUriValue path] stringByAddingXMLEntities]]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyUri>"];
+                [properties appendString:@"</cmis:propertyUri>"];
                 break;
             }
             case CMISPropertyTypeHtml:
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:propertyHtml propertyDefinitionId=\"%@\">",
-                                                  [propertyData.identifier stringByAddingXMLEntities]]];
+                [properties appendString:[NSString stringWithFormat:@"<cmis:propertyHtml propertyDefinitionId=\"%@\">",
+                                          [propertyData.identifier stringByAddingXMLEntities]]];
                 
                 for (NSString *propertyHtmlValue in propertyData.values) {
-                    [self appendStringToReturnResult:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyHtmlValue stringByAddingXMLEntities]]];
+                    [properties appendString:[NSString stringWithFormat:@"<cmis:value>%@</cmis:value>", [propertyHtmlValue stringByAddingXMLEntities]]];
                 }
-                
-                [self appendStringToReturnResult:@"</cmis:propertyHtml>"];
+                [properties appendString:@"</cmis:propertyHtml>"];
                 break;
             }
             default:
@@ -244,50 +196,113 @@
             }
         }
     }
-
+    
     // Add extensions to properties
     if (self.cmisProperties.extensions != nil)
     {
-        [self addExtensionElements:self.cmisProperties.extensions];
+        [properties appendString:[self xmlExtensionElements:self.cmisProperties.extensions]];
+//        [self xmlExtensionElements:self.cmisProperties.extensions];
     }
-
-    [self appendStringToReturnResult:@"</cmis:properties></cmisra:object></entry>"];
+    [properties appendString:@"</cmis:properties></cmisra:object></entry>"];
+    
+    return properties;
 }
 
-- (void) addExtensionElements:(NSArray *)extensionElements
+- (NSString *)xmlExtensionElements:(NSArray *)extensionElements
 {
+    NSMutableString *extensions = [NSMutableString string];
     for (CMISExtensionElement *extensionElement in extensionElements)
     {
         // Opening XML tag
-        [self appendStringToReturnResult:[NSString stringWithFormat:@"<%@ xmlns=\"%@\"", extensionElement.name, extensionElement.namespaceUri]];
-
+        [extensions appendString:[NSString stringWithFormat:@"<%@ xmlns=\"%@\"", extensionElement.name, extensionElement.namespaceUri]];
+        
         // Attributes
         if (extensionElement.attributes != nil)
         {
             for (NSString *attributeName in extensionElement.attributes)
             {
-                [self appendStringToReturnResult:[NSString stringWithFormat:@" %@=\"%@\"",
-                                                  [attributeName stringByAddingXMLEntities],
-                                                  [[extensionElement.attributes objectForKey:attributeName] stringByAddingXMLEntities]]];
+                [extensions appendString:[NSString stringWithFormat:@" %@=\"%@\"",
+                                          [attributeName stringByAddingXMLEntities],
+                                          [[extensionElement.attributes objectForKey:attributeName] stringByAddingXMLEntities]]];
             }
         }
-        [self appendStringToReturnResult:@">"];
-
+        [extensions appendString:@">"];
+        
         // Value
         if (extensionElement.value != nil)
         {
-            [self appendStringToReturnResult:[extensionElement.value stringByAddingXMLEntities]];
+            [extensions appendString:[extensionElement.value stringByAddingXMLEntities]];
         }
-
+        
         // Children
         if (extensionElement.children != nil && extensionElement.children.count > 0)
         {
-            [self addExtensionElements:extensionElement.children];
+            [extensions appendString:[self xmlExtensionElements:extensionElement.children]];
         }
-
+        
         // Closing XML tag
-        [self appendStringToReturnResult:[NSString stringWithFormat:@"</%@>", extensionElement.name]];
+        [extensions appendString:[NSString stringWithFormat:@"</%@>", extensionElement.name]];
+    }
+    return extensions;
+}
+
+
+- (NSString *)generateAtomEntryXml
+{
+    [self addEntryStartElement];
+    
+    if (self.contentFilePath || self.inputStream)
+    {
+        [self addContent];
+    }
+    
+    [self addProperties];
+    
+    // Return result
+    if (self.generateXmlInMemory)
+    {
+        return self.internalXml;
+    }
+    else
+    {
+        return self.internalFilePath;
+    }
+}
+
+
+- (void)addEntryStartElement
+{
+    [self appendStringToReturnResult:[self xmlStartElement]];
+}
+
+- (void)addContent
+{
+    [self appendStringToReturnResult:[self xmlContentStartElement]];
+
+    // Generate the base64 representation of the content
+    if (self.contentFilePath) {
+        if (self.generateXmlInMemory) {
+            NSString *encodedContent = [CMISBase64Encoder encodeContentOfFile:self.contentFilePath];
+            [self appendToInMemoryXml:encodedContent];
+        } else {
+            [CMISBase64Encoder encodeContentOfFile:self.contentFilePath appendToFile:self.internalFilePath];
+        }
+    } else if (self.inputStream) {
+        if (self.generateXmlInMemory)
+        {
+            NSString *encodedContent = [CMISBase64Encoder encodeContentFromInputStream:self.inputStream];
+            [self appendToInMemoryXml:encodedContent];
+        } else {
+            [CMISBase64Encoder encodeContentFromInputStream:self.inputStream appendToFile:self.internalFilePath];
+        }
     }
+
+    [self appendStringToReturnResult:[self xmlContentEndElement]];
+}
+
+- (void)addProperties
+{
+    [self appendStringToReturnResult:[self xmlPropertiesElements]];
 }
 
 #pragma mark Helper methods

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m Mon Mar  4 15:14:24 2013
@@ -28,6 +28,7 @@
 #import "CMISURLUtil.h"
 #import "CMISFileUtil.h"
 #import "CMISRequest.h"
+#import "CMISBase64InputStream.h"
 #import "CMISLog.h"
 
 @implementation CMISAtomPubObjectService
@@ -698,7 +699,10 @@
      }];
 }
 
-
+/**
+ This method uses a new invoke call on the CMISNetworkProvider. This new method was introduced to allow for base64 encoding while
+ streaming. See CMISHttpUploadRequest for more details on how it is done.
+ */
 - (void)sendAtomEntryXmlToLink:(NSString *)link
              httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
                     properties:(CMISProperties *)properties
@@ -718,38 +722,17 @@
         return;
     }
     
-    // Generate XML
-    NSString *writeResult = [self createAtomEntryWriter:properties
-                                     contentInputStream:contentInputStream
-                                        contentMimeType:contentMimeType
-                                    isXmlStoredInMemory:NO];
-    
-    // Start the asynchronous POST http call
-    NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:writeResult];
-    
-    NSError *fileSizeError = nil;
-    unsigned long long fileSize = [CMISFileUtil fileSizeForFileAtPath:writeResult error:&fileSizeError];
-    if (fileSizeError) {
-        CMISLogError(@"Could not determine file size of %@ : %@", writeResult, [fileSizeError description]);
-    }
-    
+        
     [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
                                      httpMethod:HTTP_POST
                                         session:self.bindingSession
-                                    inputStream:inputStream
+                                    inputStream:contentInputStream
                                         headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
-                                  bytesExpected:fileSize
+                                  bytesExpected:bytesExpected
                                     cmisRequest:request
+                                 cmisProperties:properties
+                                       mimeType:contentMimeType
                                 completionBlock:^(CMISHttpResponse *response, NSError *error) {
-         // close stream to and delete temporary file
-         [inputStream close];
-         NSError *fileError = nil;
-         [[NSFileManager defaultManager] removeItemAtPath:writeResult error:&fileError];
-         if (fileError) {
-             // the upload itself is not impacted by this error, so do not report it in the completion block
-             CMISLogError(@"Could not delete temporary file %@: %@", writeResult, [fileError description]);
-         }
-         
          if (error) {
              CMISLogError(@"HTTP error when creating/uploading content: %@", error);
              if (completionBlock) {
@@ -779,6 +762,162 @@
        progressBlock:progressBlock];
 }
 
+/**
+ This is the original version of the 'sendAtomEntryXmlToLink' method.
+ It creates a temporary file to store the base64 encoded data in. It is from this file that the upload starts
+ */
+- (void)sendAtomEntryXmlToLinkUsingTmpFile:(NSString *)link
+                         httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
+                                properties:(CMISProperties *)properties
+                        contentInputStream:(NSInputStream *)contentInputStream
+                           contentMimeType:(NSString *)contentMimeType
+                             bytesExpected:(unsigned long long)bytesExpected
+                               cmisRequest:(CMISRequest*)request
+                           completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+                             progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+{
+    // Validate param
+    if (link == nil) {
+        CMISLogError(@"Could not retrieve link from object to do creation or update");
+        if (completionBlock) {
+            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:nil]);
+        }
+        return;
+    }
+    
+    
+    // Generate XML
+     NSString *writeResult = [self createAtomEntryWriter:properties
+                                      contentInputStream:contentInputStream
+                                         contentMimeType:contentMimeType
+                                     isXmlStoredInMemory:NO];
+     
+     
+     NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:writeResult];
+     NSError *fileSizeError = nil;
+     unsigned long long fileSize = [CMISFileUtil fileSizeForFileAtPath:writeResult error:&fileSizeError];
+     if (fileSizeError) {
+         CMISLogError(@"Could not determine file size of %@ : %@", writeResult, [fileSizeError description]);
+     }
+    
+    [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
+                                     httpMethod:HTTP_POST
+                                        session:self.bindingSession
+                                    inputStream:inputStream
+                                        headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
+                                  bytesExpected:fileSize
+                                    cmisRequest:request
+                                completionBlock:^(CMISHttpResponse *response, NSError *error) {
+                                    // close stream to and delete temporary file
+                                    [inputStream close];
+                                    
+                                     NSError *fileError = nil;
+                                     [[NSFileManager defaultManager] removeItemAtPath:writeResult error:&fileError];
+                                     if (fileError) {
+                                     // the upload itself is not impacted by this error, so do not report it in the completion block
+                                     CMISLogError(@"Could not delete temporary file %@: %@", writeResult, [fileError description]);
+                                     }
+                                    if (error) {
+                                        CMISLogError(@"HTTP error when creating/uploading content: %@", error);
+                                        if (completionBlock) {
+                                            completionBlock(nil, error);
+                                        }
+                                    } else if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) {
+                                        if (completionBlock) {
+                                            NSError *parseError = nil;
+                                            CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:response.data];
+                                            [atomEntryParser parseAndReturnError:&parseError];
+                                            if (parseError == nil) {
+                                                completionBlock(atomEntryParser.objectData.identifier, nil);
+                                            } else {
+                                                CMISLogError(@"Error while parsing response: %@", [parseError description]);
+                                                completionBlock(nil, [CMISErrors cmisError:parseError cmisErrorCode:kCMISErrorCodeUpdateConflict]);
+                                            }
+                                        }
+                                    } else {
+                                        CMISLogError(@"Invalid http response status code when creating/uploading content: %d", response.statusCode);
+                                        CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
+                                        if (completionBlock) {
+                                            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
+                                                                                 detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %d", response.statusCode]]);
+                                        }
+                                    }
+                                }
+                                  progressBlock:progressBlock];
+}
+
+/**
+ This is an alternative implementation of the 'sendAtomEntryXmlToLink' method. It is using base64 streaming. In contrast to the method above
+ it is using a custom class CMISBase64InputStream, which inherits directly from NSInputStream. 
+ The class, however, has to use some of the "private" API functions. See the class for more explanations
+ */
+- (void)sendAtomEntryXmlToLinkUsingBase64InputStream:(NSString *)link
+                                   httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
+                                          properties:(CMISProperties *)properties
+                                  contentInputStream:(NSInputStream *)contentInputStream
+                                     contentMimeType:(NSString *)contentMimeType
+                                       bytesExpected:(unsigned long long)bytesExpected
+                                         cmisRequest:(CMISRequest*)request
+                                     completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+                                       progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+{
+    // Validate param
+    if (link == nil) {
+        CMISLogError(@"Could not retrieve link from object to do creation or update");
+        if (completionBlock) {
+            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:nil]);
+        }
+        return;
+    }
+    
+    
+    // Generate XML
+     CMISBase64InputStream *inputStream = [[CMISBase64InputStream alloc] initWithInputStream:contentInputStream
+                                                                              cmisProperties:properties
+                                                                                    mimeType:contentMimeType
+                                                                             nonEncodedBytes:bytesExpected];
+    
+    [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
+                                     httpMethod:HTTP_POST
+                                        session:self.bindingSession
+                                    inputStream:inputStream
+                                        headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
+                                  bytesExpected:bytesExpected
+                                    cmisRequest:request
+                                completionBlock:^(CMISHttpResponse *response, NSError *error) {
+                                    // close stream to and delete temporary file
+                                    [inputStream close];
+                                    
+                                    if (error) {
+                                        CMISLogError(@"HTTP error when creating/uploading content: %@", error);
+                                        if (completionBlock) {
+                                            completionBlock(nil, error);
+                                        }
+                                    } else if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) {
+                                        if (completionBlock) {
+                                            NSError *parseError = nil;
+                                            CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:response.data];
+                                            [atomEntryParser parseAndReturnError:&parseError];
+                                            if (parseError == nil) {
+                                                completionBlock(atomEntryParser.objectData.identifier, nil);
+                                            } else {
+                                                CMISLogError(@"Error while parsing response: %@", [parseError description]);
+                                                completionBlock(nil, [CMISErrors cmisError:parseError cmisErrorCode:kCMISErrorCodeUpdateConflict]);
+                                            }
+                                        }
+                                    } else {
+                                        CMISLogError(@"Invalid http response status code when creating/uploading content: %d", response.statusCode);
+                                        CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
+                                        if (completionBlock) {
+                                            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
+                                                                                 detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %d", response.statusCode]]);
+                                        }
+                                    }
+                                }
+                                  progressBlock:progressBlock];
+}
+
+
 
 /**
  * Helper method: creates a writer for the xml needed to upload a file.

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h Mon Mar  4 15:14:24 2013
@@ -33,7 +33,6 @@
 */
 /** launches a query on the server with the parameters specified
  * completionBlock returns the found object list or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersions
                                                 relationships:(CMISIncludeRelationship)relationships

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISNavigationService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISNavigationService.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISNavigationService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISNavigationService.h Mon Mar  4 15:14:24 2013
@@ -29,7 +29,6 @@
 /**
  * Retrieves the children for the given object identifier.
  * completionBlock returns object list or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveChildren:(NSString *)objectId
                  orderBy:(NSString *)orderBy
@@ -48,7 +47,6 @@
  *
  * TODO: OpenCMIS returns an ObjectParentData object .... is this necessary?
  * completionBlock returns array of parents or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveParentsForObject:(NSString *)objectId
                           filter:(NSString *)filter

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISObjectService.h Mon Mar  4 15:14:24 2013
@@ -29,7 +29,6 @@
 /**
  * Retrieves the object with the given object identifier.
  * completionBlock returns objectData for object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObject:(NSString *)objectId
                 filter:(NSString *)filter
@@ -43,7 +42,6 @@
 /**
  * Retrieves an object using its path.
  * completionBlock returns objectData for object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObjectByPath:(NSString *)path
                       filter:(NSString *)filter
@@ -58,8 +56,6 @@
  * 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
- * @return cancellable request.
- *
  */
 - (CMISRequest*)downloadContentOfObject:(NSString *)objectId
                                streamId:(NSString *)streamId
@@ -71,8 +67,6 @@
  * 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
- * @return cancellable request.
- *
  */
 - (CMISRequest*)downloadContentOfObject:(NSString *)objectId
                                streamId:(NSString *)streamId
@@ -89,7 +83,6 @@
  * NOTE for atom pub binding: deleteContentStream: This does not return the new object id and change token as specified by the domain model.
  * This is not possible without introducing a new HTTP header.
  * completionBlock - returns NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)deleteContentOfObject:(CMISStringInOutParameter *)objectIdParam
                   changeToken:(CMISStringInOutParameter *)changeTokenParam
@@ -106,7 +99,6 @@
  * NOTE for atom pub binding: This does not return the new object id and change token as specified by the domain model.
  * (This is not possible without introducing a new HTTP header).
  * completionBlock - returns NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)changeContentOfObject:(CMISStringInOutParameter *)objectIdParam
                       toContentOfFile:(NSString *)filePath
@@ -127,7 +119,6 @@
  * NOTE for atom pub binding: This does not return the new object id and change token as specified by the domain model.
  * (This is not possible without introducing a new HTTP header).
  * completionBlock - returns NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)changeContentOfObject:(CMISStringInOutParameter *)objectId
                toContentOfInputStream:(NSInputStream *)inputStream
@@ -143,7 +134,6 @@
  * uploads the file from the given path to the given folder.
  *
  * completionBlock - returns NSError nil if successful
- * @return cancellable request.
 */
 - (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                                   mimeType:(NSString *)mimeType
@@ -156,7 +146,6 @@
  * uploads the file from the given input stream to the given folder.
  *
  * completionBlock - returns NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                                      mimeType:(NSString *)mimeType
@@ -171,7 +160,6 @@
  *
  * The allVersions parameter is currently ignored.
  * completionBlock returns true if successful
- * @return cancellable request.
  */
 - (CMISRequest*)deleteObject:(NSString *)objectId
          allVersions:(BOOL)allVersions
@@ -190,8 +178,6 @@
  *
  * Returns a list of objects which failed to be deleted.
  * completionBlock returns array of failed objects if any. NSError will be nil if successful
- * @return cancellable request.
- *
  */
 - (CMISRequest*)deleteTree:(NSString *)folderObjectId
                 allVersion:(BOOL)allVersions
@@ -202,7 +188,6 @@
 /**
  * Updates the properties of the given object.
  * completionBlock returns NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)updatePropertiesForObject:(CMISStringInOutParameter *)objectIdParam
                                properties:(CMISProperties *)properties
@@ -216,7 +201,6 @@
  * Note: the paging parameters (maxItems and skipCount) are not used in the atom pub binding.
  *       Ie. the whole set is <b>always</b> returned.
  * completionBlock returns array of associated renditions or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveRenditions:(NSString *)objectId
                    renditionFilter:(NSString *)renditionFilter

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISRepositoryService.h Mon Mar  4 15:14:24 2013
@@ -28,14 +28,12 @@
 /**
  * Returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
  * completionBlock returns array of repositories or nil if unsuccessful
- * @return cancellable request.
  */
 - (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
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveRepositoryInfoForId:(NSString *)repositoryId
                     completionBlock:(void (^)(CMISRepositoryInfo *repositoryInfo, NSError *error))completionBlock;
@@ -43,7 +41,6 @@
 /**
  * Returns the type definitions
  * completionBlock returns type definition or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveTypeDefinition:(NSString *)typeId
                completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISVersioningService.h Mon Mar  4 15:14:24 2013
@@ -38,7 +38,6 @@
  * @param includeACL
  * @param includeAllowableActions
  * @param completionBlock returns object data if found or nil otherwise
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObjectOfLatestVersion:(NSString *)objectId
                                 major:(BOOL)major
@@ -56,7 +55,6 @@
  * @param filter
  * @param includeAllowableActions
  * @param completionBlock returns array of all versioned objects or nil otherwise
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveAllVersions:(NSString *)objectId
                              filter:(NSString *)filter

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.h Mon Mar  4 15:14:24 2013
@@ -38,28 +38,24 @@
 /**
  * Retrieves a collection of all versions of this document. 
  * The completionBlock returns collection of all documents or nil if unsuccessful
- * @return cancellable request.
  */
 - (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
- * @return cancellable request.
  */
 - (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
- * @return cancellable request.
  */
 - (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
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
                                      operationContext:(CMISOperationContext *)operationContext
@@ -68,7 +64,6 @@
 /**
  * Downloads the content to a local file and returns the filepath.
  * completionBlock will return NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)downloadContentToFile:(NSString *)filePath
                       completionBlock:(void (^)(NSError *error))completionBlock
@@ -78,7 +73,6 @@
 /**
  * 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
- * @return cancellable request.
  */
 - (CMISRequest*)downloadContentToOutputStream:(NSOutputStream *)outputStream
                               completionBlock:(void (^)(NSError *error))completionBlock
@@ -91,7 +85,6 @@
  * 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.
  * completionBlock will return NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)changeContentToContentOfFile:(NSString *)filePath
                                     mimeType:(NSString *)mimeType
@@ -106,7 +99,6 @@
  * 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.
  * completionBlock will return NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)changeContentToContentOfInputStream:(NSInputStream *)inputStream
                                       bytesExpected:(unsigned long long)bytesExpected
@@ -119,14 +111,12 @@
 /**
  * Deletes the content of this document.
  * completionBlock will return NSError nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock;
 
 /**
  * Deletes the document from the document store.
  * completionBlock return true if successful
- * @return cancellable request.
  */
 - (CMISRequest*)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock;
 

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.h Mon Mar  4 15:14:24 2013
@@ -33,7 +33,6 @@
  * Retrieves the children of this folder as a paged result.
  *
  * The completionBlock will return paged results with instances of CMISObject or nil if unsuccessful.
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
 
@@ -45,7 +44,6 @@
 /**
  * Gets the parent folder object.
  * The completionBlock will return CMISFolder object or nil if unsuccessful.
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
 
@@ -53,21 +51,18 @@
  * 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.
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
 
 /**
  * creates a folder with specified properties
  * completionBlock returns object Id of newly created folder or nil if not successful
- * @return cancellable request.
  */
 - (CMISRequest*)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
 
 /**
  * creates a document with specified properties, mime Type
  * completionBlock returns object Id of newly created document or nil if not successful
- * @return cancellable request.
  */
 - (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           mimeType:(NSString *)mimeType
@@ -78,7 +73,6 @@
 /**
  * creates a document with specified properties, mime Type
  * completionBlock returns object Id of newly created document or nil if not successful
- * @return cancellable request.
  */
 - (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType
@@ -91,7 +85,6 @@
 /**
  * creates a document with specified properties, mime Type
  * completionBlock returns list of failed objects (if any) 
- * @return cancellable request.
  */
 - (CMISRequest*)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
                           unfileObjects:(CMISUnfileObject)unfileObjects

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRendition.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRendition.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRendition.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISRendition.h Mon Mar  4 15:14:24 2013
@@ -35,14 +35,12 @@
 /**
  * retrieves the rendition, e.g. thumbnail of a document
  * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveRenditionDocumentWithCompletionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
 
 /**
  * retrieves the rendition, e.g. thumbnail of a document
  * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveRenditionDocumentWithOperationContext:(CMISOperationContext *)operationContext
                                       completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
@@ -50,7 +48,6 @@
 /**
  * downloads the rendition of a document e.g. thumbnail of a document to a file
  * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)downloadRenditionContentToFile:(NSString *)filePath
                        completionBlock:(void (^)(NSError *error))completionBlock
@@ -59,7 +56,6 @@
 /**
  * downloads the rendition of a document e.g. thumbnail of a document to a file
  * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)downloadRenditionContentToOutputStream:(NSOutputStream *)outputStream
                                completionBlock:(void (^)(NSError *error))completionBlock

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h Mon Mar  4 15:14:24 2013
@@ -50,7 +50,6 @@
 // returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
 /**
  * completionBlock returns a list of repositories or nil if unsuccessful
- * @return cancellable request if CMISSession can be created successfully, or nil otherwise.
  */
 + (CMISRequest*)arrayOfRepositories:(CMISSessionParameters *)sessionParameters
             completionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
@@ -58,7 +57,6 @@
 
 /**
  * completionBlock returns a CMIS session or nil if unsuccessful
- * @return cancellable request if CMISSession can be created successfully, or nil otherwise.
  */
 + (CMISRequest*)connectWithSessionParameters:(CMISSessionParameters *)sessionParameters
                      completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock;
@@ -68,14 +66,12 @@
 /**
  * Retrieves the root folder for the repository.
  * completionBlock returns the root folder of the repo or nil if unsuccessful
- * @return cancellable request.
  */
 - (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
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext
                            completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
@@ -83,7 +79,6 @@
 /**
  * Retrieves the object with the given identifier.
  * completionBlock returns the CMIS object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObject:(NSString *)objectId
        completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
@@ -91,7 +86,6 @@
 /**
   * Retrieves the object with the given identifier, using the provided operation context.
   * completionBlock returns the CMIS object or nil if unsuccessful
- * @return cancellable request.
   */
 - (CMISRequest*)retrieveObject:(NSString *)objectId
       operationContext:(CMISOperationContext *)operationContext
@@ -100,7 +94,6 @@
 /**
  * Retrieves the object for the given path.
  * completionBlock returns the CMIS object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObjectByPath:(NSString *)path
              completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
@@ -109,7 +102,6 @@
 /**
  * Retrieves the object for the given path, using the provided operation context.
  * completionBlock returns the CMIS object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)retrieveObjectByPath:(NSString *)path
             operationContext:(CMISOperationContext *)operationContext
@@ -118,14 +110,12 @@
 /**
  * Retrieves the definition for the given type.
  * completionBlock returns the CMIS type definition or nil if unsuccessful
- * @return cancellable request.
  */
 - (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.
- * @return cancellable request.
  */
 - (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
                                       completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock;
@@ -134,7 +124,6 @@
  * Retrieves all objects matching the given cmis query, as CMISQueryResult objects.
  * and using the parameters provided in the operation context.
  * completionBlock returns the search results as a paged results object or nil if unsuccessful.
- * @return cancellable request.
  */
 - (CMISRequest*)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
                                      operationContext:(CMISOperationContext *)operationContext
@@ -144,7 +133,6 @@
  * Queries for a specific type of objects.
  * Returns a paged result set, containing CMISObject instances.
  * completionBlock returns the search results as a paged results object or nil if unsuccessful.
- * @return cancellable request.
  */
 - (CMISRequest*)queryObjectsWithTypeid:(NSString *)typeId
                    whereClause:(NSString *)whereClause
@@ -156,7 +144,6 @@
 /**
  * Creates a folder in the provided folder.
  * completionBlock returns the object Id of the newly created folder or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)createFolder:(NSDictionary *)properties
             inFolder:(NSString *)folderObjectId
@@ -166,7 +153,6 @@
 /**
  * Downloads the content of object with the provided object id to the given path.
  * completionBlock NSError will be nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
                                      toFile:(NSString *)filePath
@@ -176,7 +162,6 @@
 /**
  * Downloads the content of object with the provided object id to the given stream.
  * completionBlock NSError will be nil if successful
- * @return cancellable request.
  */
 - (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
                              toOutputStream:(NSOutputStream*)outputStream
@@ -186,7 +171,6 @@
 /**
  * Creates a cmis document using the content from the file path.
  * completionBlock returns object Id of newly created object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
                           mimeType:(NSString *)mimeType
@@ -198,7 +182,6 @@
 /**
  * Creates a cmis document using the content from the given stream.
  * completionBlock returns object Id of newly created object or nil if unsuccessful
- * @return cancellable request.
  */
 - (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
                              mimeType:(NSString *)mimeType

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Mon Mar  4 15:14:24 2013
@@ -462,11 +462,11 @@
             }
         } else {
             request = [self.binding.objectService createDocumentFromFilePath:filePath
-                                                          mimeType:mimeType
-                                                        properties:convertedProperties
-                                                      inFolder:folderObjectId
-                                                   completionBlock:completionBlock
-                                                     progressBlock:progressBlock];
+                                                                    mimeType:mimeType
+                                                                  properties:convertedProperties
+                                                                    inFolder:folderObjectId
+                                                             completionBlock:completionBlock
+                                                               progressBlock:progressBlock];
         }
     }];
     return request;

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h?rev=1452344&r1=1452343&r2=1452344&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISNetworkProvider.h Mon Mar  4 15:14:24 2013
@@ -13,6 +13,7 @@
  */
 
 #import <Foundation/Foundation.h>
+#import "CMISProperties.h"
 typedef enum {
     HTTP_GET,
     HTTP_POST,
@@ -92,6 +93,36 @@ completionBlock:(void (^)(CMISHttpRespon
 completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
  progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
 
+
+/**
+ * Invoke method used for uploads, i.e. POST/PUT requests. This method is used for encoding base64 data while streaming
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @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 bytesExpected the size of the content to be uploaded
+ * @param cmisRequest will be used to set the cancellable request to the one created by the invode method
+ * @param cmisProperties 
+ * @param mimeType
+ * @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
+   inputStream:(NSInputStream *)inputStream
+       headers:(NSDictionary *)additionalHeaders
+ bytesExpected:(unsigned long long)bytesExpected
+   cmisRequest:(CMISRequest *)cmisRequest
+cmisProperties:(CMISProperties *)cmisProperties
+      mimeType:(NSString *)mimeType
+completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+ progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+
+
+
 /**
  * Invoke method used for downloads, 
  * @param url the RESTful API URL to be used

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.h?rev=1452344&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISBase64InputStream.h Mon Mar  4 15:14:24 2013
@@ -0,0 +1,31 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+#import "CMISProperties.h"
+
+
+@interface CMISBase64InputStream : NSInputStream <NSStreamDelegate>
+@property (nonatomic, assign, readonly) NSUInteger encodedBytes;
+- (id)initWithInputStream:(NSInputStream *)nonEncodedStream
+           cmisProperties:(CMISProperties *)cmisProperties
+                 mimeType:(NSString *)mimeType
+          nonEncodedBytes:(NSUInteger)nonEncodedBytes;
+
+@end