chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1425870 [8/13] - in /chemistry/objectivecmis/trunk: ./ ObjectiveCMIS.xcodeproj/ ObjectiveCMIS.xcodeproj/project.xcworkspace/ ObjectiveCMIS/ ObjectiveCMIS/Bindings/ ObjectiveCMIS/Bindings/AtomPub/ ObjectiveCMIS/Bindings/AtomPub/AtomPubParse...
Date Wed, 26 Dec 2012 10:48:37 GMT
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,500 @@
+/*
+    Licensed 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 "CMISSession.h"
+#import "CMISConstants.h"
+#import "CMISObjectConverter.h"
+#import "CMISStandardAuthenticationProvider.h"
+#import "CMISBindingFactory.h"
+#import "CMISObjectList.h"
+#import "CMISQueryResult.h"
+#import "CMISErrors.h"
+#import "CMISOperationContext.h"
+#import "CMISPagedResult.h"
+#import "CMISTypeDefinition.h"
+
+@interface CMISSession ()
+@property (nonatomic, strong, readwrite) CMISObjectConverter *objectConverter;
+@property (nonatomic, assign, readwrite) BOOL isAuthenticated;
+@property (nonatomic, strong, readwrite) id<CMISBinding> binding;
+@property (nonatomic, strong, readwrite) CMISRepositoryInfo *repositoryInfo;
+// Returns a CMISSession using the given session parameters.
+- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters;
+
+// Authenticates using the CMISSessionParameters and returns if the authentication was succesful
+- (void)authenticateWithCompletionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock;
+@end
+
+@interface CMISSession (PrivateMethods)
+- (BOOL)authenticateAndReturnError:(NSError **)error;
+@end
+
+@implementation CMISSession
+
+@synthesize isAuthenticated = _isAuthenticated;
+@synthesize binding = _binding;
+@synthesize repositoryInfo = _repositoryInfo;
+@synthesize sessionParameters = _sessionParameters;
+@synthesize objectConverter = _objectConverter;
+
+#pragma mark -
+#pragma mark Setup
+
++ (void)arrayOfRepositories:(CMISSessionParameters *)sessionParameters completionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock
+{
+    CMISSession *session = [[CMISSession alloc] initWithSessionParameters:sessionParameters];
+    
+    // TODO: validate session parameters?
+    
+    // return list of repositories
+    [session.binding.repositoryService retrieveRepositoriesWithCompletionBlock:completionBlock];
+}
+
++ (void)connectWithSessionParameters:(CMISSessionParameters *)sessionParameters
+                     completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock
+{
+    CMISSession *session = [[CMISSession alloc] initWithSessionParameters:sessionParameters];
+    if (session)
+    {
+        [session authenticateWithCompletionBlock:completionBlock];
+    }
+    else
+    {
+        completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
+                                         withDetailedDescription:@"Not enough session parameters to connect"]);
+    }
+}
+
+#pragma internal authentication methods
+
+- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters
+{
+    self = [super init];
+    if (self)
+    {
+        self.sessionParameters = sessionParameters;
+        self.isAuthenticated = NO;
+    
+        // setup authentication provider if not present
+        if (self.sessionParameters.authenticationProvider == nil)
+        {
+            NSString *username = self.sessionParameters.username;
+            NSString *password = self.sessionParameters.password;
+            if (username == nil || password == nil)
+            {
+                log(@"No username or password provided for standard authentication provider");
+                return nil;
+            }
+            
+            self.sessionParameters.authenticationProvider = [[CMISStandardAuthenticationProvider alloc] initWithUsername:username
+                                                                                                             andPassword:password];
+        }
+
+        // create the binding the session will use
+        CMISBindingFactory *bindingFactory = [[CMISBindingFactory alloc] init];
+        self.binding = [bindingFactory bindingWithParameters:sessionParameters];
+
+        id objectConverterClassValue = [self.sessionParameters objectForKey:kCMISSessionParameterObjectConverterClassName];
+        if (objectConverterClassValue != nil && [objectConverterClassValue isKindOfClass:[NSString class]])
+        {
+            NSString *objectConverterClassName = (NSString *)objectConverterClassValue;
+            log(@"Using a custom object converter class: %@", objectConverterClassName);
+            self.objectConverter = [[NSClassFromString(objectConverterClassName) alloc] initWithSession:self];
+        }
+        else // default
+        {
+            self.objectConverter = [[CMISObjectConverter alloc] initWithSession:self];
+        }
+    
+        // TODO: setup locale
+        // TODO: setup default session parameters
+        // TODO: setup caches
+    }
+    
+    return self;
+}
+
+- (void)authenticateWithCompletionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock
+{
+    // TODO: validate session parameters, extract the checks below?
+    
+    // check repository id is present
+    if (self.sessionParameters.repositoryId == nil)
+    {
+        NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
+                                     withDetailedDescription:@"Must provide repository id"];
+        log(@"Error: %@", error.description);
+        completionBlock(nil, error);
+        return;
+    }
+    
+    if (self.sessionParameters.authenticationProvider == nil) {
+        NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeUnauthorized withDetailedDescription:@"Must provide authentication provider"];
+        log(@"Error: %@", error.description);
+        completionBlock(nil, error);
+        return;
+    }
+    
+    // TODO: use authentication provider to make sure we have enough credentials, it may need to make another call to get a ticket or do handshake i.e. NTLM.
+    
+    // get repository info
+    [self.binding.repositoryService retrieveRepositoryInfoForId:self.sessionParameters.repositoryId completionBlock:^(CMISRepositoryInfo *repositoryInfo, NSError *error) {
+        self.repositoryInfo = repositoryInfo;
+        if (self.repositoryInfo == nil)
+        {
+            if (error)
+            {
+                log(@"Error because repositoryInfo is nil: %@", error.description);
+                completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeInvalidArgument]);
+            }
+            else
+            {
+                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
+                                                 withDetailedDescription:@"Could not fetch repository information"]);
+            }
+        } else {
+            // no errors have occurred so set authenticated flag and return success flag
+            self.isAuthenticated = YES;
+            completionBlock(self, nil);
+        }
+    }];
+}
+
+
+#pragma mark CMIS operations
+
+- (void)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
+{
+    [self retrieveFolderWithOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+}
+
+- (void)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock
+{
+    NSString *rootFolderId = self.repositoryInfo.rootFolderId;
+    [self retrieveObject:rootFolderId withOperationContext:operationContext completionBlock:^(CMISObject *rootFolder, NSError *error) {
+        if (rootFolder != nil && ![rootFolder isKindOfClass:[CMISFolder class]]) {
+            completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime withDetailedDescription:@"Root folder object is not a folder!"]);
+        } else {
+            completionBlock((CMISFolder *)rootFolder, nil);
+        }
+    }];
+}
+
+- (void)retrieveObject:(NSString *)objectId completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+{
+    [self retrieveObject:objectId withOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+}
+
+- (void)retrieveObject:(NSString *)objectId withOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+{
+    if (objectId == nil)
+    {
+        completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Must provide object id"]);
+        return;
+    }
+
+    // TODO: cache the object
+
+    [self.binding.objectService retrieveObject:objectId
+                                    withFilter:operationContext.filterString
+                       andIncludeRelationShips:operationContext.includeRelationShips
+                           andIncludePolicyIds:operationContext.isIncludePolicies
+                            andRenditionFilder:operationContext.renditionFilterString
+                                 andIncludeACL:operationContext.isIncluseACLs
+                    andIncludeAllowableActions:operationContext.isIncludeAllowableActions
+                               completionBlock:^(CMISObjectData *objectData, NSError *error) {
+                                            if (error) {
+                                                completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeObjectNotFound]);
+                                            } else {
+                                                CMISObject *object = nil;
+                                                if (objectData) {
+                                                    object = [self.objectConverter convertObject:objectData];
+                                                }
+                                                completionBlock(object, nil);
+                                            }
+                                        }];
+}
+
+- (void)retrieveObjectByPath:(NSString *)path completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+{
+    [self retrieveObjectByPath:path withOperationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+}
+
+- (void)retrieveObjectByPath:(NSString *)path withOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
+{
+    [self.binding.objectService retrieveObjectByPath:path
+                                          withFilter:operationContext.filterString
+                             andIncludeRelationShips:operationContext.includeRelationShips
+                                 andIncludePolicyIds:operationContext.isIncludePolicies
+                                  andRenditionFilder:operationContext.renditionFilterString
+                                       andIncludeACL:operationContext.isIncluseACLs
+                          andIncludeAllowableActions:operationContext.isIncludeAllowableActions
+                                     completionBlock:^(CMISObjectData *objectData, NSError *error) {
+                                         if (objectData != nil && error == nil) {
+                                             completionBlock([self.objectConverter convertObject:objectData], nil);
+                                         } else {
+                                             if (error == nil) {
+                                                 error = [[NSError alloc] init]; // TODO: create a proper error object
+                                             }
+                                             completionBlock(nil, error);
+                                         }
+                                     }];
+}
+
+- (void)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
+{
+    [self query:statement searchAllVersions:searchAllVersion operationContext:[CMISOperationContext defaultOperationContext] completionBlock:completionBlock];
+}
+
+- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
+                                     operationContext:(CMISOperationContext *)operationContext
+                                      completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
+{
+    CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock)
+    {
+        // Fetch results through discovery service
+        [self.binding.discoveryService query:statement
+                                                  searchAllVersions:searchAllVersion
+                                                  includeRelationShips:operationContext.includeRelationShips
+                                                  renditionFilter:operationContext.renditionFilterString
+                                                  includeAllowableActions:operationContext.isIncludeAllowableActions
+                                                  maxItems:[NSNumber numberWithInt:maxItems]
+                                                  skipCount:[NSNumber numberWithInt:skipCount]
+                                                  completionBlock:^(CMISObjectList *objectList, NSError *error) {
+                                                      if (error) {
+                                                          pageBlockCompletionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+                                                      } else {
+                                                          // Fill up return result
+                                                          CMISFetchNextPageBlockResult *result = [[CMISFetchNextPageBlockResult alloc] init];
+                                                          result.hasMoreItems = objectList.hasMoreItems;
+                                                          result.numItems = objectList.numItems;
+                                                          
+                                                          NSMutableArray *resultArray = [[NSMutableArray alloc] init];
+                                                          result.resultArray = resultArray;
+                                                          for (CMISObjectData *objectData in objectList.objects)
+                                                          {
+                                                              [resultArray addObject:[CMISQueryResult queryResultUsingCmisObjectData:objectData andWithSession:self]];
+                                                          }
+                                                          pageBlockCompletionBlock(result, nil);
+                                                      }
+                                                  }];
+    };
+
+    [CMISPagedResult pagedResultUsingFetchBlock:fetchNextPageBlock
+                             andLimitToMaxItems:operationContext.maxItemsPerPage
+                          andStartFromSkipCount:operationContext.skipCount
+                                completionBlock:^(CMISPagedResult *result, NSError *error) {
+                                    // Return nil and populate error in case something went wrong
+                                    if (error) {
+                                        completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+                                    } else {
+                                        completionBlock(result, nil);
+                                    }
+                                }];
+}
+
+- (void)queryObjectsWithTypeDefinition:(CMISTypeDefinition *)typeDefinition
+                       withWhereClause:(NSString *)whereClause
+                     searchAllVersions:(BOOL)searchAllVersion
+                      operationContext:(CMISOperationContext *)operationContext
+                       completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
+{
+    // Creating the cmis query using the input params
+    NSMutableString *statement = [[NSMutableString alloc] init];
+    
+    // Filter
+    [statement appendFormat:@"SELECT %@", (operationContext.filterString != nil ? operationContext.filterString : @"*")];
+    
+    // Type
+    [statement appendFormat:@" FROM %@", typeDefinition.queryName];
+    
+    // Where
+    if (whereClause != nil)
+    {
+        [statement appendFormat:@" WHERE %@", whereClause];
+    }
+    
+    // Order by
+    if (operationContext.orderBy != nil)
+    {
+        [statement appendFormat:@" ORDER BY %@", operationContext.orderBy];
+    }
+    
+    // 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
+                        includeRelationShips:operationContext.includeRelationShips
+                             renditionFilter:operationContext.renditionFilterString
+                     includeAllowableActions:operationContext.isIncludeAllowableActions
+                                    maxItems:[NSNumber numberWithInt:maxItems]
+                                   skipCount:[NSNumber numberWithInt:skipCount]
+                             completionBlock:^(CMISObjectList *objectList, NSError *error) {
+                                 if (error) {
+                                     pageBlockCompletionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+                                 } else {
+                                     // Fill up return result
+                                     CMISFetchNextPageBlockResult *result = [[CMISFetchNextPageBlockResult alloc] init];
+                                     result.hasMoreItems = objectList.hasMoreItems;
+                                     result.numItems = objectList.numItems;
+                                     
+                                     NSMutableArray *resultArray = [[NSMutableArray alloc] init];
+                                     result.resultArray = resultArray;
+                                     for (CMISObjectData *objectData in objectList.objects)
+                                     {
+                                         [resultArray addObject:[self.objectConverter convertObject:objectData]];
+                                     }
+                                     pageBlockCompletionBlock(result, nil);
+                                 }
+                             }];
+    };
+    
+    [CMISPagedResult pagedResultUsingFetchBlock:fetchNextPageBlock
+                             andLimitToMaxItems:operationContext.maxItemsPerPage
+                          andStartFromSkipCount:operationContext.skipCount
+                                completionBlock:^(CMISPagedResult *result, NSError *error) {
+                                    // Return nil and populate error in case something went wrong
+                                    if (error) {
+                                        completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+                                    } else {
+                                        completionBlock(result, nil);
+                                    }
+                                }];
+}
+
+- (void)queryObjectsWithTypeid:(NSString *)typeId
+               withWhereClause:(NSString *)whereClause
+             searchAllVersions:(BOOL)searchAllVersion
+              operationContext:(CMISOperationContext *)operationContext
+               completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
+{
+    [self retrieveTypeDefinition:typeId
+                 completionBlock:^(CMISTypeDefinition *typeDefinition, NSError *internalError) {
+                     if (internalError != nil) {
+                         NSError *error = [CMISErrors cmisError:internalError withCMISErrorCode:kCMISErrorCodeRuntime];
+                         completionBlock(nil, error);
+                     } else {
+                         [self queryObjectsWithTypeDefinition:typeDefinition
+                                              withWhereClause:whereClause
+                                            searchAllVersions:searchAllVersion
+                                             operationContext:operationContext
+                                              completionBlock:completionBlock];
+                     }
+                 }];
+}
+
+- (void)createFolder:(NSDictionary *)properties
+            inFolder:(NSString *)folderObjectId
+     completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+{
+    [self.objectConverter convertProperties:properties
+                            forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
+                            completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
+                               if (error) {
+                                   completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+                               } else {
+                                   [self.binding.objectService createFolderInParentFolder:folderObjectId
+                                                                           withProperties:convertedProperties
+                                                                          completionBlock:^(NSString *objectId, NSError *error) {
+                                                                              completionBlock(objectId, error);
+                                                                          }];
+                               }
+                           }];
+}
+
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                                     toFile:(NSString *)filePath
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+{
+    return [self.binding.objectService downloadContentOfObject:objectId
+                                                  withStreamId:nil
+                                                        toFile:filePath
+                                               completionBlock:completionBlock
+                                                 progressBlock:progressBlock];
+}
+
+- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
+                             toOutputStream:(NSOutputStream *)outputStream
+                            completionBlock:(void (^)(NSError *error))completionBlock
+                              progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
+{
+    return [self.binding.objectService downloadContentOfObject:objectId
+                                                  withStreamId:nil
+                                                toOutputStream:outputStream
+                                               completionBlock:completionBlock
+                                                 progressBlock:progressBlock];
+}
+
+
+- (void)createDocumentFromFilePath:(NSString *)filePath withMimeType:(NSString *)mimeType
+                    withProperties:(NSDictionary *)properties inFolder:(NSString *)folderObjectId
+                   completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+{
+    [self.objectConverter convertProperties:properties
+                            forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
+                            completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
+        if (error) {
+            log(@"Could not convert properties: %@", error.description);
+            if (completionBlock) {
+                completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+            }
+        } else {
+            [self.binding.objectService createDocumentFromFilePath:filePath
+                                                      withMimeType:mimeType
+                                                    withProperties:convertedProperties
+                                                      inFolder:folderObjectId
+                                                   completionBlock:completionBlock
+                                                     progressBlock:progressBlock];
+        }
+    }];
+}
+
+- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
+                         withMimeType:(NSString *)mimeType
+                       withProperties:(NSDictionary *)properties
+                             inFolder:(NSString *)folderObjectId
+                        bytesExpected:(unsigned long long)bytesExpected
+                      completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
+                        progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
+{
+    [self.objectConverter convertProperties:properties
+                            forObjectTypeId:[properties objectForKey:kCMISPropertyObjectTypeId]
+                            completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
+        if (error) {
+            log(@"Could not convert properties: %@", error.description);
+            if (completionBlock) {
+                completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
+            }
+        } else {
+            [self.binding.objectService createDocumentFromInputStream:inputStream
+                                                         withMimeType:mimeType
+                                                       withProperties:convertedProperties
+                                                             inFolder:folderObjectId
+                                                        bytesExpected:bytesExpected
+                                                      completionBlock:completionBlock
+                                                        progressBlock:progressBlock];
+        }
+    }];
+}
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,34 @@
+/*
+    Licensed 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 "CMISExtensionData.h"
+
+
+@interface CMISAllowableActions : CMISExtensionData
+
+// Allowable actions as a NSSet of NSString objects, nil if unknown
+@property (nonatomic, strong, readonly) NSSet *allowableActionsSet;
+
+// Designated Initializer
+- (id)init;
+// Use this init method when initializing with a raw NSDictionary parsed from an AtomPub Response
+- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict;
+- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray;
+
+// Returns an NSSet of NSNumber of objects.  The NSNumber objects map to the CMISActionType enum
+- (NSSet *)allowableActionTypesSet;
+// Set the allowable actions with a raw NSDictionary parsed from an AtomPub Response
+- (void)setAllowableActionsWithDictionary:(NSDictionary *)allowableActionsDict;
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,95 @@
+/*
+    Licensed 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 "CMISAllowableActions.h"
+#import "CMISEnums.h"
+
+#define INT_OBJ(x) [NSNumber numberWithInt:x]
+
+@interface CMISAllowableActions ()
+
+@property (nonatomic, strong, readwrite) NSSet *allowableActionsSet;
+
+@end
+
+
+@implementation CMISAllowableActions
+@synthesize allowableActionsSet = _allowableActionsSet;
+
+- (id)init
+{
+    self = [super init];
+
+    return self;
+}
+
+- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict
+{
+    self = [self init];
+    if (self)
+    {   
+        [self setAllowableActionsWithDictionary:allowableActionsDict];
+    }
+    return self;
+}
+
+- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray
+{
+    self = [self initWithAllowableActionsDictionary:allowableActionsDict];
+    if (self)
+    {
+        self.extensions = extensionElementArray;
+    }
+    return self;
+}
+
+- (NSSet *)allowableActionTypesSet
+{
+    NSArray *actionsArray = [[NSArray alloc] initWithObjects:CMISAllowableActionsArray];
+    
+    NSMutableSet *allowableActionTypesSet = [NSMutableSet set];
+    for (NSString *actionStrValue in self.allowableActionsSet) 
+    {
+        // TODO: Check that the idx is valid in the defined enum
+        
+        NSInteger idx = [actionsArray indexOfObject:actionStrValue];
+        [allowableActionTypesSet addObject:INT_OBJ(idx)];
+    }
+    return [allowableActionTypesSet copy];
+}
+
+- (void)setAllowableActionsWithDictionary:(NSDictionary *)allowableActionsDict
+{
+    NSSet *filteredSet = [allowableActionsDict keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *aMethod) 
+                          {
+                              return [obj isEqualToString:@"true"];
+                          }];
+    [self setAllowableActionsSet:filteredSet];
+}
+
+
+// TODO: Create helper methods for the different action types.  Example
+// - (BOOL)canCreateDocument
+
+
+#pragma mark -
+#pragma mark Overrides
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"CMIS Allowable Actions: %@", self.allowableActionsSet];
+}
+
+
+@end
\ No newline at end of file

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,31 @@
+/*
+    Licensed 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>
+
+@protocol CMISAuthenticationProvider
+
+/**
+* Returns a set of HTTP headers (key-value pairs) that should be added to a
+* HTTP call. This will be called by the AtomPub and the Web Services
+* binding. You might want to check the binding in use before you set the
+* headers.
+*
+* @return the HTTP headers or nil if no additional headers should be set
+*/
+@property(nonatomic, strong, readonly) NSDictionary *httpHeadersToApply;
+
+- (void)updateWithHttpURLResponse:(NSHTTPURLResponse*)httpUrlResponse;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,44 @@
+/*
+    Licensed 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>
+
+// Properties
+extern NSString * const kCMISPropertyObjectId;
+extern NSString * const kCMISPropertyName;
+extern NSString * const kCMISPropertyPath;
+extern NSString * const kCMISPropertyCreatedBy;
+extern NSString * const kCMISPropertyCreationDate;
+extern NSString * const kCMISPropertyModifiedBy;
+extern NSString * const kCMISPropertyModificationDate;
+extern NSString * const kCMISProperyContentStreamId;
+extern NSString * const kCMISPropertyContentStreamFileName;
+extern NSString * const kCMISPropertyContentStreamLength;
+extern NSString * const kCMISPropertyContentStreamMediaType;
+extern NSString * const kCMISPropertyObjectTypeId;
+extern NSString * const kCMISPropertyVersionSeriesId;
+extern NSString * const kCMISPropertyVersionLabel;
+extern NSString * const kCMISPropertyIsLatestVersion;
+extern NSString * const kCMISPropertyIsMajorVersion;
+extern NSString * const kCMISPropertyIsLatestMajorVersion;
+extern NSString * const kCMISPropertyChangeToken;
+extern NSString * const kCMISPropertyBaseTypeId;
+
+// Property values
+extern NSString * const kCMISPropertyObjectTypeIdValueDocument;
+extern NSString * const kCMISPropertyObjectTypeIdValueFolder;
+
+// Session cache keys
+
+extern NSString * const kCMISSessionKeyWorkspaces;

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,47 @@
+/*
+    Licensed 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 "CMISConstants.h"
+
+// Properties
+
+NSString * const kCMISPropertyObjectId = @"cmis:objectId";
+NSString * const kCMISPropertyName = @"cmis:name";
+NSString * const kCMISPropertyPath = @"cmis:path";
+NSString * const kCMISPropertyCreatedBy = @"cmis:createdBy";
+NSString * const kCMISPropertyCreationDate = @"cmis:creationDate";
+NSString * const kCMISPropertyModifiedBy = @"cmis:lastModifiedBy";
+NSString * const kCMISPropertyModificationDate = @"cmis:lastModificationDate";
+NSString * const kCMISProperyContentStreamId = @"cmis:contentStreamId";
+NSString * const kCMISPropertyContentStreamFileName = @"cmis:contentStreamFileName";
+NSString * const kCMISPropertyContentStreamLength = @"cmis:contentStreamLength";
+NSString * const kCMISPropertyContentStreamMediaType = @"cmis:contentStreamMimeType";
+NSString * const kCMISPropertyObjectTypeId = @"cmis:objectTypeId";
+NSString * const kCMISPropertyVersionSeriesId = @"cmis:versionSeriesId";
+NSString * const kCMISPropertyVersionLabel = @"cmis:versionLabel";
+NSString * const kCMISPropertyIsLatestVersion = @"cmis:isLatestVersion";
+NSString * const kCMISPropertyIsMajorVersion = @"cmis:isMajorVersion";
+NSString * const kCMISPropertyIsLatestMajorVersion = @"cmis:isLatestMajorVersion";
+NSString * const kCMISPropertyChangeToken = @"cmis:changeToken";
+NSString * const kCMISPropertyBaseTypeId = @"cmis:baseTypeId";
+
+// Property values
+
+NSString * const kCMISPropertyObjectTypeIdValueDocument = @"cmis:document";
+NSString * const kCMISPropertyObjectTypeIdValueFolder = @"cmis:folder";
+
+// Session cache keys
+
+NSString * const kCMISSessionKeyWorkspaces = @"cmis_session_key_workspaces";
+

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISConstants.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,137 @@
+/*
+    Licensed 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>
+
+// Binding type
+typedef enum 
+{
+    CMISBindingTypeAtomPub,
+    CMISBindingTypeCustom
+} CMISBindingType;
+
+// Base type
+typedef enum
+{
+    CMISBaseTypeDocument,
+    CMISBaseTypeFolder,
+    CMISBaseTypeRelationship,
+    CMISBaseTypePolicy
+} CMISBaseType;
+
+typedef enum
+{
+    CMISIncludeRelationshipNone,
+    CMISIncludeRelationshipSource,
+    CMISIncludeRelationshipTarget,
+    CMISIncludeRelationshipBoth
+} CMISIncludeRelationship;
+
+// Property types
+typedef enum
+{
+    CMISPropertyTypeBoolean = 0,
+    CMISPropertyTypeId,
+    CMISPropertyTypeInteger,
+    CMISPropertyTypeDateTime,
+    CMISPropertyTypeDecimal,
+    CMISPropertyTypeHtml,
+    CMISPropertyTypeString,
+    CMISPropertyTypeUri
+} CMISPropertyType;
+
+// Property cardinality options
+typedef enum
+{
+    CMISCardinalitySingle,
+    CMISCardinalityMulti
+} CMISCardinality;
+
+// Property updatability options
+typedef enum
+{
+    CMISUpdatabilityReadOnly,
+    CMISUpdatabilityReadWrite,
+    CMISUpdatabilityWhenCheckedOut,
+    CMISUpdatabilityOnCreate
+} CMISUpdatability;
+
+// Allowable action type
+typedef enum
+{
+    CMISActionCanDeleteObject,
+    CMISActionCanUpdateProperties,
+    CMISActionCanGetProperties,
+    CMISActionCanGetObjectRelationships,
+    CMISActionCanGetObjectParents,
+    CMISActionCanGetFolderParent,
+    CMISActionCanGetFolderTree,
+    CMISActionCanGetDescendants,
+    CMISActionCanMoveObject,
+    CMISActionCanDeleteContentStream,
+    CMISActionCanCheckOut,
+    CMISActionCanCancelCheckOut,
+    CMISActionCanCheckIn,
+    CMISActionCanSetContentStream,
+    CMISActionCanGetAllVersions,
+    CMISActionCanAddObjectToFolder,
+    CMISActionCanRemoveObjectFromFolder,
+    CMISActionCanGetContentStream,
+    CMISActionCanApplyPolicy,
+    CMISActionCanGetAppliedPolicies,
+    CMISActionCanRemovePolicy,
+    CMISActionCanGetChildren,
+    CMISActionCanCreateDocument,
+    CMISActionCanCreateFolder,
+    CMISActionCanCreateRelationship,
+    CMISActionCanDeleteTree,
+    CMISActionCanGetRenditions,
+    CMISActionCanGetACL,
+    CMISActionCanApplyACL
+} CMISActionType;
+
+// AllowableAction String Array, the objects defined MUST be in the same order as those in enum CMISActionType
+#define CMISAllowableActionsArray @"canDeleteObject", @"canUpdateProperties", @"canGetProperties", \
+    @"canGetObjectRelationships", @"canGetObjectParents", @"canGetFolderParent", @"canGetFolderTree", \
+    @"canGetDescendants", @"canMoveObject", @"canDeleteContentStream", @"canCheckOut", \
+    @"canCancelCheckOut",  @"canCheckIn", @"canSetContentStream", @"canGetAllVersions", \
+    @"canAddObjectToFolder", @"canRemoveObjectFromFolder", @"canGetContentStream", @"canApplyPolicy", \
+    @"canGetAppliedPolicies", @"canRemovePolicy", @"canGetChildren", @"canCreateDocument", @"canCreateFolder", \
+    @"canCreateRelationship", @"canDeleteTree", @"canGetRenditions", @"canGetACL", @"canApplyACL", nil
+
+// Extension Levels
+typedef enum
+{
+    CMISExtensionLevelObject,
+    CMISExtensionLevelProperties,
+    CMISExtensionLevelAllowableActions
+    // TODO expose the remaining extensions as they are implemented
+    // CMISExtensionLevelAcl, CMISExtensionLevelPolicies, CMISExtensionLevelChangeEvent
+
+} CMISExtensionLevel;
+
+// UnfileObject
+typedef enum
+{
+    CMISUnfile,
+    CMISDeleteSingleFiled,
+    CMISDelete,  // default
+} CMISUnfileObject;
+
+@interface CMISEnums : NSObject 
+
++ (NSString *)stringForIncludeRelationShip:(CMISIncludeRelationship)includeRelationship;
++ (NSString *)stringForUnfileObject:(CMISUnfileObject)unfileObject;
+
+@end
\ No newline at end of file

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,64 @@
+/*
+    Licensed 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 "CMISEnums.h"
+
+@implementation CMISEnums
+
++ (NSString *)stringForIncludeRelationShip:(CMISIncludeRelationship)includeRelationship
+{
+    NSString *includeRelationShipString = nil;
+    switch (includeRelationship)
+    {
+        case (CMISIncludeRelationshipNone):
+            includeRelationShipString = @"none";
+            break;
+        case (CMISIncludeRelationshipSource):
+            includeRelationShipString = @"source";
+            break;
+        case (CMISIncludeRelationshipTarget):
+            includeRelationShipString = @"target";
+            break;
+        case (CMISIncludeRelationshipBoth):
+            includeRelationShipString = @"both";
+            break;
+        default:
+            log(@"Invalid enum type %d", includeRelationship);
+            break;
+    }
+    return includeRelationShipString;
+}
+
++ (NSString *)stringForUnfileObject:(CMISUnfileObject)unfileObject;
+{
+    NSString *unfileObjectString = nil;
+    switch (unfileObject)
+    {
+        case CMISUnfile:
+            unfileObjectString = @"unfile";
+            break;
+        case  CMISDeleteSingleFiled:
+            unfileObjectString = @"deletesinglefiled";
+            break;
+        case CMISDelete:
+            unfileObjectString = @"delete";
+            break;
+        default:
+            log(@"Inavlid enum type %d", unfileObject);
+            break;
+    }
+    return unfileObjectString;
+}
+
+@end
\ No newline at end of file

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,122 @@
+/*
+    Licensed 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 <Foundation/FoundationErrors.h>
+#import <Foundation/NSURLError.h>
+
+
+
+/** error codes defined in CMIS
+ */
+typedef enum
+{
+    //error range for basic errors - not covered in the spec but
+    // present in the OpenCMIS Java lib
+    kCMISErrorCodeBasicMinimum = 0,
+    kCMISErrorCodeBasicMaximum = 255,
+
+    //basic CMIS errors
+    kCMISErrorCodeNoReturn = 0,
+    kCMISErrorCodeConnection = 1,
+    kCMISErrorCodeProxyAuthentication = 2,
+    kCMISErrorCodeUnauthorized = 3,
+    kCMISErrorCodeNoRootFolderFound = 4,
+    kCMISErrorCodeNoRepositoryFound = 5,
+    kCMISErrorCodeCancelled = 6,
+    
+    //error ranges for General errors
+    kCMISErrorCodeGeneralMinimum = 256,
+    kCMISErrorCodeGeneralMaximum = 511,
+    
+    //General errors/exceptions as defined in 2.2.1.4.1
+    kCMISErrorCodeInvalidArgument = 256,
+    kCMISErrorCodeObjectNotFound = 257,
+    kCMISErrorCodeNotSupported = 258,
+    kCMISErrorCodePermissionDenied = 259,
+    kCMISErrorCodeRuntime = 260,
+    
+    
+    //error ranges for CMIS specific errors
+    kCMISErrorCodeSpecificMinimum = 512,
+    kCMISErrorCodeSpecificMaximum = 1023,
+    
+    //Specific errors/exceptions as defined in 2.2.1.4.2
+    kCMISErrorCodeConstraint = 512,
+    kCMISErrorCodeContentAlreadyExists = 513,
+    kCMISErrorCodeFilterNotValid = 514,
+    kCMISErrorCodeNameConstraintViolation = 515,
+    kCMISErrorCodeStorage = 516,
+    kCMISErrorCodeStreamNotSupported = 517,
+    kCMISErrorCodeUpdateConflict = 518,
+    kCMISErrorCodeVersioning = 519
+    
+}CMISErrorCodes;
+
+
+extern NSString * const kCMISErrorDomainName;
+//to be used in the userInfo dictionary as Localized error description
+//Basic Errors
+extern NSString * const kCMISErrorDescriptionNoReturn;
+extern NSString * const kCMISErrorDescriptionConnection;
+extern NSString * const kCMISErrorDescriptionProxyAuthentication;
+extern NSString * const kCMISErrorDescriptionUnauthorized;
+extern NSString * const kCMISErrorDescriptionNoRootFolderFound;
+extern NSString * const kCMISErrorDescriptionRepositoryNotFound;
+//General errors as defined in 2.2.1.4.1 of spec
+extern NSString * const kCMISErrorDescriptionInvalidArgument;
+extern NSString * const kCMISErrorDescriptionObjectNotFound;
+extern NSString * const kCMISErrorDescriptionNotSupported;
+extern NSString * const kCMISErrorDescriptionPermissionDenied;
+extern NSString * const kCMISErrorDescriptionRuntime;
+//Specific errors as defined in 2.2.1.4.2
+extern NSString * const kCMISErrorDescriptionConstraint;
+extern NSString * const kCMISErrorDescriptionContentAlreadyExists;
+extern NSString * const kCMISErrorDescriptionFilterNotValid;
+extern NSString * const kCMISErrorDescriptionNameConstraintViolation;
+extern NSString * const kCMISErrorDescriptionStorage;
+extern NSString * const kCMISErrorDescriptionStreamNotSupported;
+extern NSString * const kCMISErrorDescriptionUpdateConflict;
+extern NSString * const kCMISErrorDescriptionVersioning;
+
+/** This class defines Errors in the Objective-C CMIS library
+ 
+ All CMIS errors are based on NSError class.
+ CMIS errors are created either 
+ 
+ - directly. This is the case when an error is captured by one of the methods/classes in the CMIS library
+ - indirectly. Errors have been created by classes/methods outside the CMIS library. Example errors created through NSURLConnection. In this case, the underlying error is copied into the CMIS error using the NSUnderlyingErrorKey in the userInfo Dictionary.
+ 
+ */
+@interface CMISErrors : NSObject
+/** Create a CMIS error based on an underlying error
+ 
+ This is the indirect way of creating CMIS errors
+ 
+ @param error The underlying NSError object
+ @param code the CMIS error code
+ @return the CMIS error as NSError object with error domain org.apache.chemistry.objectivecmis
+ */
++ (NSError *)cmisError:(NSError *)error withCMISErrorCode:(CMISErrorCodes)code;
+/** Creates a new CMIS error
+ 
+ This is the direct way of creating CMIS errors
+ 
+ @param code the CMIS Error code to be used
+ @param detailedDescription a detailed description to be added to the localizedDescription. Use nil if none is available/needed.
+ @return the CMIS error as NSError object with error domain org.apache.chemistry.objectivecmis
+ */
++ (NSError *)createCMISErrorWithCode:(CMISErrorCodes)code withDetailedDescription:(NSString *)detailedDescription;
+@end
+

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,130 @@
+/*
+    Licensed 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 "CMISErrors.h"
+
+NSString * const kCMISErrorDomainName = @"org.apache.chemistry.objectivecmis";
+//to be used in the userInfo dictionary as Localized error description
+
+/**
+ Note, the string definitions below should not be used by themselves. Rather, they should be used to 
+ obtain the localized string. Therefore, the proper use in the code would be e.g.
+ NSLocalizedString(kCMISNoReturnErrorDescription,kCMISNoReturnErrorDescription)
+ (the second parameter in NSLocalizedString is a Comment and may be set to nil)
+ */
+//Basic Errors
+
+NSString * const kCMISErrorDescriptionNoReturn = @"Unknown Error";
+NSString * const kCMISErrorDescriptionConnection = @"Connection Error";
+NSString * const kCMISErrorDescriptionProxyAuthentication = @"Proxy Authentication Error";
+NSString * const kCMISErrorDescriptionUnauthorized = @"Unauthorized access error";
+NSString * const kCMISErrorDescriptionNoRootFolderFound =  @"Root Folder Not Found Error";
+NSString * const kCMISErrorDescriptionRepositoryNotFound =  @"Repository Not Found Error";
+
+//General errors as defined in 2.2.1.4.1 of spec
+NSString * const kCMISErrorDescriptionInvalidArgument = @"Invalid Argument Error";
+NSString * const kCMISErrorDescriptionObjectNotFound = @"Object Not Found Error";
+NSString * const kCMISErrorDescriptionNotSupported = @"Not supported Error";
+NSString * const kCMISErrorDescriptionPermissionDenied = @"Permission Denied Error";
+NSString * const kCMISErrorDescriptionRuntime = @"Runtime Error";
+
+//Specific errors as defined in 2.2.1.4.2
+NSString * const kCMISErrorDescriptionConstraint = @"Constraint Error";
+NSString * const kCMISErrorDescriptionContentAlreadyExists = @"Content Already Exists Error";
+NSString * const kCMISErrorDescriptionFilterNotValid = @"Filter Not Valid Error";
+NSString * const kCMISErrorDescriptionNameConstraintViolation = @"Name Constraint Violation Error";
+NSString * const kCMISErrorDescriptionStorage = @"Storage Error";
+NSString * const kCMISErrorDescriptionStreamNotSupported = @"Stream Not Supported Error";
+NSString * const kCMISErrorDescriptionUpdateConflict = @"Update Conflict Error";
+NSString * const kCMISErrorDescriptionVersioning = @"Versioning Error";
+
+@interface CMISErrors ()
++ (NSString *)localizedDescriptionForCode:(CMISErrorCodes)code;
+@end
+
+@implementation CMISErrors
+
++ (NSError *)cmisError:(NSError *)error withCMISErrorCode:(CMISErrorCodes)code
+{
+    if (error == nil) {//shouldn't really get there
+        return nil;
+    }
+    if ([error.domain isEqualToString:kCMISErrorDomainName]) {
+        return error;
+    }
+    NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary];
+    [errorInfo setValue:[CMISErrors localizedDescriptionForCode:code] forKey:NSLocalizedDescriptionKey];
+    [errorInfo setObject:error forKey:NSUnderlyingErrorKey];
+    return [NSError errorWithDomain:kCMISErrorDomainName code:code userInfo:errorInfo];
+}
+
++ (NSError *)createCMISErrorWithCode:(CMISErrorCodes)code withDetailedDescription:(NSString *)detailedDescription
+{
+    NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary];
+    [errorInfo setValue:[CMISErrors localizedDescriptionForCode:code] forKey:NSLocalizedDescriptionKey];
+    if (detailedDescription != nil) {
+        [errorInfo setValue:detailedDescription forKey:NSLocalizedFailureReasonErrorKey];
+    }
+    
+    return [NSError errorWithDomain:kCMISErrorDomainName code:code userInfo:errorInfo];
+}
+
++ (NSString *)localizedDescriptionForCode:(CMISErrorCodes)code
+{
+    switch (code) {
+        case kCMISErrorCodeNoReturn:
+            return kCMISErrorDescriptionNoReturn;
+        case kCMISErrorCodeConnection:
+            return kCMISErrorDescriptionConnection;
+        case kCMISErrorCodeProxyAuthentication:
+            return kCMISErrorDescriptionProxyAuthentication;
+        case kCMISErrorCodeUnauthorized:
+            return kCMISErrorDescriptionUnauthorized;
+        case kCMISErrorCodeNoRootFolderFound:
+            return kCMISErrorDescriptionNoRootFolderFound;
+        case kCMISErrorCodeNoRepositoryFound:
+            return kCMISErrorDescriptionRepositoryNotFound;
+        case kCMISErrorCodeInvalidArgument:
+            return kCMISErrorDescriptionInvalidArgument;
+        case kCMISErrorCodeObjectNotFound:
+            return kCMISErrorDescriptionObjectNotFound;
+        case kCMISErrorCodeNotSupported:
+            return kCMISErrorDescriptionNotSupported;
+        case kCMISErrorCodePermissionDenied:
+            return kCMISErrorDescriptionPermissionDenied;
+        case kCMISErrorCodeRuntime:
+            return kCMISErrorDescriptionRuntime;
+        case kCMISErrorCodeConstraint:
+            return kCMISErrorDescriptionConstraint;
+        case kCMISErrorCodeContentAlreadyExists:
+            return kCMISErrorDescriptionContentAlreadyExists;
+        case kCMISErrorCodeFilterNotValid:
+            return kCMISErrorDescriptionFilterNotValid;
+        case kCMISErrorCodeNameConstraintViolation:
+            return kCMISErrorDescriptionNameConstraintViolation;
+        case kCMISErrorCodeStorage:
+            return kCMISErrorDescriptionStorage;
+        case kCMISErrorCodeStreamNotSupported:
+            return kCMISErrorDescriptionStreamNotSupported;
+        case kCMISErrorCodeUpdateConflict:
+            return kCMISErrorDescriptionUpdateConflict;
+        case kCMISErrorCodeVersioning:
+            return kCMISErrorDescriptionVersioning;
+        default:
+            return kCMISErrorDescriptionNoReturn;
+    }
+    
+}
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISErrors.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,25 @@
+/*
+    Licensed 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 "CMISExtensionElement.h"
+
+@interface CMISExtensionData : NSObject
+
+/** 
+ * Returns an Array of CMISExtensionElement objects 
+ */
+@property (nonatomic, strong) NSArray *extensions;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,21 @@
+/*
+    Licensed 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 "CMISExtensionData.h"
+
+@implementation CMISExtensionData
+
+@synthesize extensions = _extensions;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionData.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,39 @@
+/*
+    Licensed 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>
+
+/**
+ * This class represents a single node in the extension tree.
+ */
+@interface CMISExtensionElement : NSObject
+
+/** @return The name of the extension node.
+ */
+@property (nonatomic, strong, readonly) NSString *name;
+@property (nonatomic, strong, readonly) NSString *namespaceUri;
+@property (nonatomic, strong, readonly) NSString *value;
+@property (nonatomic, strong, readonly) NSDictionary *attributes;
+@property (nonatomic, strong, readonly) NSArray *children;
+
+
+/// Node Initializer
+- (id)initNodeWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict children:(NSArray *)children;
+/// Leaf Initializer
+- (id)initLeafWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict value:(NSString *)value;
+
+// TODO GHL Should children be nil or empty array?
+// TODO GHL Should attributes be nil or empty dictionary?
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,89 @@
+/*
+    Licensed 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 "CMISExtensionElement.h"
+
+@interface CMISExtensionElement ()
+
+@property (nonatomic, strong, readwrite) NSString *name;
+@property (nonatomic, strong, readwrite) NSString *namespaceUri;
+@property (nonatomic, strong, readwrite) NSString *value;
+@property (nonatomic, strong, readwrite) NSDictionary *attributes;
+@property (nonatomic, strong, readwrite) NSArray *children;
+
+/// Designated Initializer.  This initializer is private since we do not want the user to use one of the two public init methods defined in the header
+- (id)initWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri;
+
+@end
+
+@implementation CMISExtensionElement
+
+@synthesize name = _name;
+@synthesize namespaceUri = _namespaceUri;
+@synthesize value = _value;
+@synthesize attributes = _attributes;
+@synthesize children = _children;
+
+#pragma mark -
+#pragma mark Initializers
+
+- (id)initWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri
+{
+    self = [super init];
+    if (self)
+    {
+        self.name = name;
+        self.namespaceUri = namespaceUri;
+    }
+    return self;
+}
+
+- (id)initNodeWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict children:(NSArray *)children
+{
+    self = [self initWithName:name namespaceUri:namespaceUri];
+    if (self)
+    {
+        self.value = nil;
+        self.attributes = attributesDict;
+        self.children = children;
+    }
+    return self;
+}
+
+- (id)initLeafWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict value:(NSString *)value
+{
+    self = [self initWithName:name namespaceUri:namespaceUri];
+    if (self)
+    {
+        self.value = value;
+        self.attributes = attributesDict;
+        self.children = nil;
+    }
+    return self;
+}
+
+#pragma mark - 
+#pragma mark NSObject Overrides
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"CMISExtensionElement: %@%@ %@: %@", 
+            (self.namespaceUri ? ([NSString stringWithFormat:@"{%@}", self.namespaceUri]) : @""), 
+            self.name, 
+            (([self.attributes count] > 0) ? self.attributes : @"{}"), 
+            ((self.children.count == 0)  ? self.value : self.children)];
+}
+
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISExtensionElement.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,34 @@
+/*
+    Licensed 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 "CMISEnums.h"
+#import "CMISProperties.h"
+#import "CMISAllowableActions.h"
+#import "CMISLinkRelations.h"
+#import "CMISExtensionData.h"
+
+@class CMISRenditionData;
+
+@interface CMISObjectData : CMISExtensionData
+
+@property (nonatomic, strong) NSString *identifier; 
+@property (nonatomic, assign) CMISBaseType baseType;
+@property (nonatomic, strong) CMISProperties *properties;
+@property (nonatomic, strong) CMISLinkRelations *linkRelations;
+@property (nonatomic, strong) NSURL *contentUrl;
+@property (nonatomic, strong) CMISAllowableActions *allowableActions;
+@property (nonatomic, strong) NSArray *renditions; // An array containing CMISRenditionData objects
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,28 @@
+/*
+    Licensed 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 "CMISObjectData.h"
+#import "CMISRenditionData.h"
+
+@implementation CMISObjectData
+
+@synthesize identifier = _identifier;
+@synthesize baseType = _baseType;
+@synthesize properties = _properties;
+@synthesize linkRelations = _linkRelations;
+@synthesize contentUrl = _contentUrl;
+@synthesize allowableActions = _allowableActions;
+@synthesize renditions = _renditions;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISObjectData.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,66 @@
+/*
+    Licensed 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 "CMISPropertyData.h"
+#import "CMISExtensionData.h"
+
+@interface CMISProperties : CMISExtensionData
+
+// Dictionary of property id -> CMISPropertyData
+@property (nonatomic, strong, readonly) NSDictionary *propertiesDictionary;
+
+// List of CMISPropertyData objects
+@property (nonatomic, strong, readonly) NSArray *propertyList;
+
+// adds a property
+- (void)addProperty:(CMISPropertyData *)propertyData;
+
+/**
+* Returns a property by id.
+* <p>
+* Since repositories are not obligated to add property ids to their query
+* result properties, this method might not always work as expected with
+* some repositories. Use {@link #getPropertyByQueryName(String)} instead.
+*/
+- (CMISPropertyData *)propertyForId:(NSString *)id;
+
+/**
+* Returns a property by query name or alias.
+*/
+- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName;
+
+/**
+* Returns a property (single) value by id.
+*/
+- (id)propertyValueForId:(NSString *)propertyId;
+
+/**
+* Returns a property (single) value by query name or alias.
+*
+* @see #getPropertyByQueryName(String)
+*/
+- (id)propertyValueForQueryName:(NSString *)queryName;
+
+/**
+* Returns a property multi-value by id.
+*/
+- (NSArray *)propertyMultiValueById:(NSString *)id;
+
+/**
+* Returns a property multi-value by query name or alias.
+*/
+- (NSArray *)propertyMultiValueByQueryName:(NSString *)queryName;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,89 @@
+/*
+    Licensed 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 "CMISProperties.h"
+
+@interface CMISProperties ()
+@property (nonatomic, strong) NSMutableDictionary *internalPropertiesByIdDict;
+@property (nonatomic, strong) NSMutableDictionary *internalPropertiesByQueryNameDict;
+@end
+
+@implementation CMISProperties
+
+@synthesize internalPropertiesByIdDict = _internalPropertiesByIdDict;
+@synthesize internalPropertiesByQueryNameDict = _internalPropertiesByQueryNameDict;
+@synthesize propertiesDictionary = _propertiesDictionary;
+@synthesize propertyList = _propertyList;
+
+
+- (void)addProperty:(CMISPropertyData *)propertyData
+{
+    if (self.internalPropertiesByIdDict == nil)
+    {
+        self.internalPropertiesByIdDict = [NSMutableDictionary dictionary];
+    }
+    [self.internalPropertiesByIdDict setObject:propertyData forKey:propertyData.identifier];
+
+    if (propertyData.queryName != nil)
+    {
+        if (self.internalPropertiesByQueryNameDict == nil)
+        {
+            self.internalPropertiesByQueryNameDict = [NSMutableDictionary dictionary];
+        }
+        [self.internalPropertiesByQueryNameDict setObject:propertyData forKey:propertyData.queryName];
+    }
+}
+
+- (NSDictionary *)propertiesDictionary
+{
+    return [NSDictionary dictionaryWithDictionary:self.internalPropertiesByIdDict];
+}
+
+- (NSArray *)propertyList
+{
+    return [NSArray arrayWithArray:self.internalPropertiesByIdDict.allValues];
+}
+
+- (CMISPropertyData *)propertyForId:(NSString *)id
+{
+    return [self.internalPropertiesByIdDict objectForKey:id];
+}
+
+- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName
+{
+    return [self.internalPropertiesByQueryNameDict objectForKey:queryName];
+}
+
+- (id)propertyValueForId:(NSString *)propertyId
+{
+    return [[self propertyForId:propertyId] firstValue];
+}
+
+- (id)propertyValueForQueryName:(NSString *)queryName
+{
+    return [[self propertyForQueryName:queryName] firstValue];
+}
+
+- (NSArray *)propertyMultiValueById:(NSString *)id
+{
+    return [[self propertyForId:id] values];
+}
+
+- (NSArray *)propertyMultiValueByQueryName:(NSString *)queryName
+{
+    return [[self propertyForQueryName:queryName] values];
+}
+
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISProperties.m
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.h?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.h Wed Dec 26 10:48:33 2012
@@ -0,0 +1,78 @@
+/*
+    Licensed 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 "CMISEnums.h"
+
+@interface CMISPropertyData : NSObject
+
+@property (nonatomic, strong) NSString *identifier;
+@property (nonatomic, strong) NSString *localName;
+@property (nonatomic, strong) NSString *displayName;
+@property (nonatomic, strong) NSString *queryName;
+
+@property CMISPropertyType type;
+
+// Returns the list of values of this property. 
+// For a single value property this is a list with one entry
+@property (nonatomic, copy) NSArray *values;
+
+// Returns the first entry of the list of values.
+@property (nonatomic, assign, readonly) id firstValue;
+
+/** Convenience method for retrieving the string value. Returns nil if property is not of string type */
+- (NSString *)propertyStringValue;
+
+/** Convenience method for retrieving the integer value. Returns nil if property is not of integer type */
+- (NSNumber *)propertyIntegerValue;
+
+/** Convenience method for retrieving the id value. Returns nil if property is not of id type */
+- (NSString *)propertyIdValue;
+
+/** Convenience method for retrieving the datetime value. Returns nil if property is not of datetime type */
+- (NSDate *)propertyDateTimeValue;
+
+/** Convenience method for retrieving the boolean value. Returns nil if property is not of boolean type */
+- (NSNumber *)propertyBooleanValue;
+
+/** Convenience method for retrieving the decimal value. Returns nil if property is not of decimal type */
+- (NSNumber *)propertyDecimalValue;
+
+/** Creation of a multi-value property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withArrayValue:(NSArray *)value type:(CMISPropertyType)type;
+
+/** Creation of a string property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withStringValue:(NSString *)value;
+
+/** Creation of an integer property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withIntegerValue:(NSInteger)value;
+
+/** Creation of a decimal property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withDecimalValue:(NSNumber *)value;
+
+/** Creation of an id property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withIdValue:(NSString *)value;
+
+/** Creation of a datetime property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withDateTimeValue:(NSDate *)value;
+
+/** Creation of a boolean property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withBoolValue:(BOOL)value;
+
+/** Creation of a uri property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withUriValue:(NSURL *)value;
+
+/** Creation of a uri property */
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withHtmlValue:(NSString *)value;
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.m?rev=1425870&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.m Wed Dec 26 10:48:33 2012
@@ -0,0 +1,166 @@
+/*
+    Licensed 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 "CMISPropertyData.h"
+
+@interface CMISPropertyData ()
+
++ (CMISPropertyData *)createPropertyInternal:(NSString *)id value:(id)value type:(CMISPropertyType)type;
+
+@end
+
+@implementation CMISPropertyData
+
+@synthesize identifier = _identifier;
+@synthesize localName = _localName;
+@synthesize displayName = _displayName;
+@synthesize queryName = _queryName;
+@synthesize values = _values;
+@synthesize type = _type;
+
+- (id)firstValue
+{
+    id value = nil;
+    
+    if (self.values != nil && [self.values count] > 0)
+    {
+        value = [self.values objectAtIndex:0];
+    }
+    
+    return value;
+}
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"identifer: %@, localName: %@, displayName: %@, queryName: %@, values: %@", 
+            self.identifier, self.localName, self.displayName, self.queryName, self.values];
+}
+
+#pragma mark Value retrieval convenience methods
+- (NSString *)propertyStringValue
+{
+    if (self.type == CMISPropertyTypeString)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+- (NSNumber *)propertyIntegerValue
+{
+    if (self.type == CMISPropertyTypeInteger)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+- (NSString *)propertyIdValue
+{
+    if (self.type == CMISPropertyTypeId)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+- (NSDate *)propertyDateTimeValue
+{
+    if (self.type == CMISPropertyTypeDateTime)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+- (NSNumber *)propertyBooleanValue
+{
+    if (self.type == CMISPropertyTypeBoolean)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+- (NSNumber *)propertyDecimalValue
+{
+    if (self.type == CMISPropertyTypeDecimal)
+    {
+        return [self firstValue];
+    }
+    return nil;
+}
+
+
+#pragma mark Creation methods
+
++ (CMISPropertyData *)createPropertyInternal:(NSString *)id value:(id)value type:(CMISPropertyType)type
+{
+    CMISPropertyData *propertyData = [[CMISPropertyData alloc] init];
+    propertyData.identifier = id;
+    if ([value isKindOfClass:[NSArray class]]) {
+        propertyData.values = [value copy];
+    } else {
+        propertyData.values = [NSArray arrayWithObject:value];
+    }
+    propertyData.type = type;
+    return propertyData;
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withArrayValue:(NSArray *)value type:(CMISPropertyType)type
+{
+    return [self createPropertyInternal:id value:value type:type];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withStringValue:(NSString *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeString];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withIntegerValue:(NSInteger)value
+{
+    return [self createPropertyInternal:id value:[NSNumber numberWithInteger:value] type:CMISPropertyTypeInteger];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withDecimalValue:(NSNumber *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeDecimal];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withIdValue:(NSString *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeId];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withDateTimeValue:(NSDate *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeDateTime];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withBoolValue:(BOOL)value
+{
+    return [self createPropertyInternal:id value:[NSNumber numberWithBool:value] type:CMISPropertyTypeBoolean];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withUriValue:(NSURL *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeUri];
+}
+
++ (CMISPropertyData *)createPropertyForId:(NSString *)id withHtmlValue:(NSString *)value
+{
+    return [self createPropertyInternal:id value:value type:CMISPropertyTypeHtml];
+}
+
+
+@end

Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISPropertyData.m
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message