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/02/11 10:28:01 UTC
svn commit: r1444689 [3/4] - in /chemistry/objectivecmis/branches/mdm:
ObjectiveCMIS.xcodeproj/ ObjectiveCMIS/Bindings/
ObjectiveCMIS/Bindings/AtomPub/ ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/
ObjectiveCMIS/Bindings/AtomPub/Objects/ ObjectiveCMIS/...
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObject.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObject.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObject.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObject.m Mon Feb 11 09:27:59 2013
@@ -52,26 +52,10 @@
@implementation CMISObject
-@synthesize session = _session;
-@synthesize binding = _binding;
-@synthesize identifier = _identifier;
-@synthesize name = _name;
-@synthesize createdBy = _createdBy;
-@synthesize creationDate = _creationDate;
-@synthesize lastModifiedBy = _lastModifiedBy;
-@synthesize lastModificationDate = _lastModificationDate;
-@synthesize objectType = _objectType;
-@synthesize changeToken = _changeToken;
-@synthesize properties = _properties;
-@synthesize allowableActions = _allowableActions;
-@synthesize renditions = _renditions;
-@synthesize extensionsDict = _extensionsDict;
-
- (id)initWithObjectData:(CMISObjectData *)objectData withSession:(CMISSession *)session
{
self = [super initWithString:objectData.identifier];
- if (self)
- {
+ if (self) {
self.session = session;
self.binding = session.binding;
@@ -93,11 +77,9 @@
[self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInt:CMISExtensionLevelAllowableActions]];
// Renditions must be converted here, because they need access to the session
- if (objectData.renditions != nil)
- {
+ if (objectData.renditions != nil) {
NSMutableArray *renditions = [NSMutableArray array];
- for (CMISRenditionData *renditionData in objectData.renditions)
- {
+ for (CMISRenditionData *renditionData in objectData.renditions) {
[renditions addObject:[[CMISRendition alloc] initWithRenditionData:renditionData andObjectId:self.identifier andSession:session]];
}
self.renditions = renditions;
@@ -115,16 +97,14 @@
- (void)updateProperties:(NSDictionary *)properties completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
{
// Validate properties param
- if (!properties || properties.count == 0)
- {
+ if (!properties || properties.count == 0) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Properties cannot be nil or empty"]);
return;
}
// Convert properties to an understandable format for the service
[self.session.objectConverter convertProperties:properties forObjectTypeId:self.objectType completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
- if (convertedProperties)
- {
+ if (convertedProperties) {
CMISStringInOutParameter *objectIdInOutParam = [CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier];
CMISStringInOutParameter *changeTokenInOutParam = [CMISStringInOutParameter inOutParameterUsingInParameter:self.changeToken];
[self.binding.objectService
@@ -137,15 +117,11 @@
completionBlock:^(CMISObject *object, NSError *error) {
completionBlock(object, error);
}];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
}
}];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
}
}];
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.h Mon Feb 11 09:27:59 2013
@@ -24,6 +24,8 @@
@property (nonatomic, strong, readonly) NSString *identifier;
+/**
+ */
- (id)initWithString:(NSString *)string;
@end
\ No newline at end of file
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISObjectId.m Mon Feb 11 09:27:59 2013
@@ -26,13 +26,11 @@
@implementation CMISObjectId
-@synthesize identifier = _identifier;
- (id)initWithString:(NSString *)string
{
self = [super init];
- if (self)
- {
+ if (self) {
self.identifier = string;
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.h Mon Feb 11 09:27:59 2013
@@ -34,6 +34,11 @@
@property (nonatomic, assign) NSInteger maxItemsPerPage;
@property (nonatomic, assign) NSInteger skipCount;
+/**
+ * creates a default operationContext instance. The defaults are
+ - 100 items per page
+ - start at first 100 items
+ */
+ (CMISOperationContext *)defaultOperationContext;
@end
\ No newline at end of file
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISOperationContext.m Mon Feb 11 09:27:59 2013
@@ -22,17 +22,6 @@
@implementation CMISOperationContext
-@synthesize filterString = _filterString;
-@synthesize includeAllowableActions = _includeAllowableActions;
-@synthesize includeACLs = _includeACLs;
-@synthesize includeRelationShips = _includeRelationShips;
-@synthesize includePolicies = _includePolicies;
-@synthesize renditionFilterString = _renditionFilterString;
-@synthesize maxItemsPerPage = _maxItemsPerPage;
-@synthesize skipCount = _skipCount;
-@synthesize orderBy = _orderBy;
-@synthesize includePathSegments = _includePathSegments;
-
+ (CMISOperationContext *)defaultOperationContext
{
CMISOperationContext *defaultContext = [[CMISOperationContext alloc] init];
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.h Mon Feb 11 09:27:59 2013
@@ -44,11 +44,23 @@ typedef void (^CMISFetchNextPageBlock)(i
@property (readonly) BOOL hasMoreItems;
@property (readonly) NSInteger numItems;
+/**
+ * completionBlock returns paged results or nil if unsuccessful
+ */
+ (void)pagedResultUsingFetchBlock:(CMISFetchNextPageBlock)fetchNextPageBlock
andLimitToMaxItems:(NSInteger)maxItems andStartFromSkipCount:(NSInteger)skipCount
completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+/**
+ * fetches the next page
+ * completionBlock returns paged result or nil if unsuccessful
+ */
- (void)fetchNextPageWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+
+/**
+ * enumerates through the items in a page
+ * completionBlock returns NSError nil if successful
+ */
- (void)enumerateItemsUsingBlock:(void (^)(CMISObject *object, BOOL *stop))enumerationBlock
completionBlock:(void (^)(NSError *error))completionBlock;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISPagedResult.m Mon Feb 11 09:27:59 2013
@@ -25,9 +25,6 @@
*/
@implementation CMISFetchNextPageBlockResult
-@synthesize resultArray = _resultArray;
-@synthesize hasMoreItems = _hasMoreItems;
-@synthesize numItems = _numItems;
@end
@@ -51,12 +48,6 @@
*/
@implementation CMISPagedResult
-@synthesize resultArray = _resultArray;
-@synthesize hasMoreItems = _hasMoreItems;
-@synthesize numItems = _numItems;
-@synthesize fetchNextPageBlock = _fetchNextPageBlock;
-@synthesize maxItems = _maxItems;
-@synthesize skipCount = _skipCount;
/** Internal init */
@@ -66,8 +57,7 @@
andMaxItems:(NSInteger)maxItems andSkipCount:(NSInteger)skipCount;
{
self = [super init];
- if (self)
- {
+ if (self) {
self.resultArray = resultArray;
self.fetchNextPageBlock = fetchNextPageBlock;
self.hasMoreItems = hasMoreItems;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.h Mon Feb 11 09:27:59 2013
@@ -27,17 +27,36 @@
@interface CMISRendition : CMISRenditionData
+/**
+ initialiser
+ */
- (id)initWithRenditionData:(CMISRenditionData *)renditionData andObjectId:(NSString *)objectId andSession:(CMISSession *)session;
+/**
+ * retrieves the rendition, e.g. thumbnail of a document
+ * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
+ */
- (void)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
+ */
- (void)retrieveRenditionDocumentWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+/**
+ * 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
+ */
- (void)downloadRenditionContentToFile:(NSString *)filePath
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+/**
+ * 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
+ */
- (void)downloadRenditionContentToOutputStream:(NSOutputStream *)outputStream
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRendition.m Mon Feb 11 09:27:59 2013
@@ -31,14 +31,11 @@
@implementation CMISRendition
-@synthesize session = _session;
-@synthesize objectId = _objectId;
- (id)initWithRenditionData:(CMISRenditionData *)renditionData andObjectId:(NSString *)objectId andSession:(CMISSession *)session
{
self = [super initWithRenditionData:renditionData];
- if (self)
- {
+ if (self) {
self.objectId = objectId;
self.session = session;
}
@@ -53,16 +50,14 @@
- (void)retrieveRenditionDocumentWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
{
- if (self.renditionDocumentId == nil)
- {
+ if (self.renditionDocumentId == nil) {
log(@"Cannot retrieve rendition document: no renditionDocumentId was returned by the server.");
completionBlock(nil, nil);
return;
}
[self.session retrieveObject:self.renditionDocumentId withOperationContext:operationContext completionBlock:^(CMISObject *renditionDocument, NSError *error) {
- if (renditionDocument != nil && !([[renditionDocument class] isKindOfClass:[CMISDocument class]]))
- {
+ if (renditionDocument != nil && !([[renditionDocument class] isKindOfClass:[CMISDocument class]])) {
completionBlock(nil, nil);
return;
}
@@ -75,8 +70,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
{
- if (self.objectId == nil || self.streamId == nil)
- {
+ if (self.objectId == nil || self.streamId == nil) {
log(@"Object id or stream id is nil. Both are needed when fetching the content of a rendition");
return;
}
@@ -92,8 +86,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
{
- if (self.objectId == nil || self.streamId == nil)
- {
+ if (self.objectId == nil || self.streamId == nil) {
log(@"Object id or stream id is nil. Both are needed when fetching the content of a rendition");
return;
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.h Mon Feb 11 09:27:59 2013
@@ -26,6 +26,9 @@
@property (nonatomic, weak) id httpRequest;
@property (nonatomic, readonly, getter = isCancelled) BOOL cancelled;
+/**
+ cancel a network request
+ */
- (void)cancel;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISRequest.m Mon Feb 11 09:27:59 2013
@@ -28,8 +28,6 @@
@implementation CMISRequest
-@synthesize httpRequest = _httpRequest;
-@synthesize cancelled = _cancelled;
- (void)cancel
{
@@ -42,8 +40,7 @@
{
_httpRequest = httpRequest;
- if (self.isCancelled && [httpRequest respondsToSelector:@selector(cancel)])
- {
+ if (self.isCancelled && [httpRequest respondsToSelector:@selector(cancel)]) {
[httpRequest cancel];
}
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.h Mon Feb 11 09:27:59 2013
@@ -48,10 +48,16 @@
// *** setup ***
// returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
+/**
+ * completionBlock returns a list of repositories or nil if unsuccessful
+ */
+ (void)arrayOfRepositories:(CMISSessionParameters *)sessionParameters
completionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
+/**
+ * completionBlock returns a CMIS session or nil if unsuccessful
+ */
+ (void)connectWithSessionParameters:(CMISSessionParameters *)sessionParameters
completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock;
@@ -59,37 +65,43 @@
/**
* Retrieves the root folder for the repository.
+ * completionBlock returns the root folder of the repo or nil if unsuccessful
*/
- (void)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
/**
* Retrieves the root folder for the repository using the provided operation context.
+ * completionBlock returns a folder of the repo or nil if unsuccessful
*/
- (void)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
/**
- * Retrieves the object with the given identifier.
+ * Retrieves the object with the given identifier.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObject:(NSString *)objectId
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
* Retrieves the object with the given identifier, using the provided operation context.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObject:(NSString *)objectId
withOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
- * Retrieves the object for the given path.
- */
+ * Retrieves the object for the given path.
+ * completionBlock returns the CMIS object or nil if unsuccessful
+ */
- (void)retrieveObjectByPath:(NSString *)path
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
* Retrieves the object for the given path, using the provided operation context.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObjectByPath:(NSString *)path
withOperationContext:(CMISOperationContext *)operationContext
@@ -97,13 +109,13 @@
/**
* Retrieves the definition for the given type.
+ * completionBlock returns the CMIS type definition or nil if unsuccessful
*/
- (void)retrieveTypeDefinition:(NSString *)typeId
completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;
/**
* Retrieves all objects matching the given cmis query.
- *
- * @return An array of CMISQueryResult objects.
+ * completionBlock returns the search results as a paged results object or nil if unsuccessful.
*/
- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock;
@@ -111,8 +123,7 @@
/**
* Retrieves all objects matching the given cmis query, as CMISQueryResult objects.
* and using the parameters provided in the operation context.
- *
- * @return An array of CMISQueryResult objects.
+ * completionBlock returns the search results as a paged results object or nil if unsuccessful.
*/
- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
operationContext:(CMISOperationContext *)operationContext
@@ -121,6 +132,7 @@
/**
* 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.
*/
- (void)queryObjectsWithTypeid:(NSString *)typeId
withWhereClause:(NSString *)whereClause
@@ -131,6 +143,7 @@
/**
* Creates a folder in the provided folder.
+ * completionBlock returns the object Id of the newly created folder or nil if unsuccessful
*/
- (void)createFolder:(NSDictionary *)properties
inFolder:(NSString *)folderObjectId
@@ -139,6 +152,7 @@
/**
* Downloads the content of object with the provided object id to the given path.
+ * completionBlock NSError will be nil if successful
*/
- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
toFile:(NSString *)filePath
@@ -147,6 +161,7 @@
/**
* Downloads the content of object with the provided object id to the given stream.
+ * completionBlock NSError will be nil if successful
*/
- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
toOutputStream:(NSOutputStream*)outputStream
@@ -155,6 +170,7 @@
/**
* Creates a cmis document using the content from the file path.
+ * completionBlock returns object Id of newly created object or nil if unsuccessful
*/
- (void)createDocumentFromFilePath:(NSString *)filePath
withMimeType:(NSString *)mimeType
@@ -165,6 +181,7 @@
/**
* Creates a cmis document using the content from the given stream.
+ * completionBlock returns object Id of newly created object or nil if unsuccessful
*/
- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
withMimeType:(NSString *)mimeType
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Client/CMISSession.m Mon Feb 11 09:27:59 2013
@@ -49,12 +49,6 @@
@implementation CMISSession
-@synthesize authenticated = _authenticated;
-@synthesize binding = _binding;
-@synthesize repositoryInfo = _repositoryInfo;
-@synthesize sessionParameters = _sessionParameters;
-@synthesize objectConverter = _objectConverter;
-
#pragma mark -
#pragma mark Setup
@@ -72,12 +66,9 @@
completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock
{
CMISSession *session = [[CMISSession alloc] initWithSessionParameters:sessionParameters];
- if (session)
- {
+ if (session) {
[session authenticateWithCompletionBlock:completionBlock];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Not enough session parameters to connect"]);
}
@@ -88,18 +79,15 @@
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters
{
self = [super init];
- if (self)
- {
+ if (self) {
self.sessionParameters = sessionParameters;
self.authenticated = NO;
// setup authentication provider if not present
- if (self.sessionParameters.authenticationProvider == nil)
- {
+ if (self.sessionParameters.authenticationProvider == nil) {
NSString *username = self.sessionParameters.username;
NSString *password = self.sessionParameters.password;
- if (username == nil || password == nil)
- {
+ if (username == nil || password == nil) {
log(@"No username or password provided for standard authentication provider");
return nil;
}
@@ -108,8 +96,7 @@
andPassword:password];
}
- if (self.sessionParameters.networkProvider == nil)
- {
+ if (self.sessionParameters.networkProvider == nil) {
self.sessionParameters.networkProvider = [[CMISDefaultNetworkProvider alloc] init];
}
@@ -118,14 +105,11 @@
self.binding = [bindingFactory bindingWithParameters:sessionParameters];
id objectConverterClassValue = [self.sessionParameters objectForKey:kCMISSessionParameterObjectConverterClassName];
- if (objectConverterClassValue != nil && [objectConverterClassValue isKindOfClass:[NSString class]])
- {
+ 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
- {
+ } else { //default
self.objectConverter = [[CMISObjectConverter alloc] initWithSession:self];
}
@@ -142,8 +126,7 @@
// TODO: validate session parameters, extract the checks below?
// check repository id is present
- if (self.sessionParameters.repositoryId == nil)
- {
+ if (self.sessionParameters.repositoryId == nil) {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Must provide repository id"];
log(@"Error: %@", error.description);
@@ -163,15 +146,11 @@
// get repository info
[self.binding.repositoryService retrieveRepositoryInfoForId:self.sessionParameters.repositoryId completionBlock:^(CMISRepositoryInfo *repositoryInfo, NSError *error) {
self.repositoryInfo = repositoryInfo;
- if (self.repositoryInfo == nil)
- {
- if (error)
- {
+ if (self.repositoryInfo == nil) {
+ if (error) {
log(@"Error because repositoryInfo is nil: %@", error.description);
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeInvalidArgument]);
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Could not fetch repository information"]);
}
@@ -210,8 +189,7 @@
- (void)retrieveObject:(NSString *)objectId withOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
{
- if (objectId == nil)
- {
+ if (objectId == nil) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Must provide object id"]);
return;
}
@@ -278,8 +256,7 @@
operationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
{
- CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock)
- {
+ CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock){
// Fetch results through discovery service
[self.binding.discoveryService query:statement
searchAllVersions:searchAllVersion
@@ -299,8 +276,7 @@
NSMutableArray *resultArray = [[NSMutableArray alloc] init];
result.resultArray = resultArray;
- for (CMISObjectData *objectData in objectList.objects)
- {
+ for (CMISObjectData *objectData in objectList.objects) {
[resultArray addObject:[CMISQueryResult queryResultUsingCmisObjectData:objectData andWithSession:self]];
}
pageBlockCompletionBlock(result, nil);
@@ -337,14 +313,12 @@
[statement appendFormat:@" FROM %@", typeDefinition.queryName];
// Where
- if (whereClause != nil)
- {
+ if (whereClause != nil) {
[statement appendFormat:@" WHERE %@", whereClause];
}
// Order by
- if (operationContext.orderBy != nil)
- {
+ if (operationContext.orderBy != nil) {
[statement appendFormat:@" ORDER BY %@", operationContext.orderBy];
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.h Mon Feb 11 09:27:59 2013
@@ -28,12 +28,20 @@
// Designated Initializer
- (id)init;
-// Use this init method when initializing with a raw NSDictionary parsed from an AtomPub Response
+
+/// Use this init method when initializing with a raw NSDictionary parsed from an AtomPub Response
+/**
+ */
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict;
+
+/**
+ initialises with allowable actions dictionary and optional extension array
+ */
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray;
-// Returns an NSSet of NSNumber of objects. The NSNumber objects map to the CMISActionType enum
+/// 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
+
+/// Set the allowable actions with a raw NSDictionary parsed from an AtomPub Response
- (void)setAllowableActionsWithDictionary:(NSDictionary *)allowableActionsDict;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAllowableActions.m Mon Feb 11 09:27:59 2013
@@ -30,7 +30,6 @@
@implementation CMISAllowableActions
-@synthesize allowableActionsSet = _allowableActionsSet;
- (id)init
{
@@ -42,8 +41,7 @@
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict
{
self = [self init];
- if (self)
- {
+ if (self) {
[self setAllowableActionsWithDictionary:allowableActionsDict];
}
return self;
@@ -52,8 +50,7 @@
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray
{
self = [self initWithAllowableActionsDictionary:allowableActionsDict];
- if (self)
- {
+ if (self) {
self.extensions = extensionElementArray;
}
return self;
@@ -64,8 +61,7 @@
NSArray *actionsArray = [[NSArray alloc] initWithObjects:CMISAllowableActionsArray];
NSMutableSet *allowableActionTypesSet = [NSMutableSet set];
- for (NSString *actionStrValue in self.allowableActionsSet)
- {
+ for (NSString *actionStrValue in self.allowableActionsSet) {
// TODO: Check that the idx is valid in the defined enum
NSInteger idx = [actionsArray indexOfObject:actionStrValue];
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAuthenticationProvider.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAuthenticationProvider.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISAuthenticationProvider.h Mon Feb 11 09:27:59 2013
@@ -31,10 +31,24 @@
*/
@property(nonatomic, strong, readonly) NSDictionary *httpHeadersToApply;
+/**
+ * updates the provider with NSHTTPURLResponse
+ */
- (void)updateWithHttpURLResponse:(NSHTTPURLResponse*)httpUrlResponse;
+/**
+ * checks if provider can authenticate against provided protection space
+ */
- (BOOL)canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
+
+/**
+ * callback when authentication challenge was cancelled
+ */
- (void)didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
+
+/**
+ * callback when authentication challenge was received
+ */
- (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISEnums.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISEnums.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISEnums.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISEnums.m Mon Feb 11 09:27:59 2013
@@ -24,8 +24,7 @@
+ (NSString *)stringForIncludeRelationShip:(CMISIncludeRelationship)includeRelationship
{
NSString *includeRelationShipString = nil;
- switch (includeRelationship)
- {
+ switch (includeRelationship) {
case (CMISIncludeRelationshipNone):
includeRelationShipString = @"none";
break;
@@ -48,8 +47,7 @@
+ (NSString *)stringForUnfileObject:(CMISUnfileObject)unfileObject;
{
NSString *unfileObjectString = nil;
- switch (unfileObject)
- {
+ switch (unfileObject) {
case CMISUnfile:
unfileObjectString = @"unfile";
break;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionData.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionData.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionData.m Mon Feb 11 09:27:59 2013
@@ -21,6 +21,5 @@
@implementation CMISExtensionData
-@synthesize extensions = _extensions;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.h Mon Feb 11 09:27:59 2013
@@ -35,6 +35,7 @@
/// 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;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISExtensionElement.m Mon Feb 11 09:27:59 2013
@@ -34,20 +34,13 @@
@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)
- {
+ if (self) {
self.name = name;
self.namespaceUri = namespaceUri;
}
@@ -57,8 +50,7 @@
- (id)initNodeWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict children:(NSArray *)children
{
self = [self initWithName:name namespaceUri:namespaceUri];
- if (self)
- {
+ if (self) {
self.value = nil;
self.attributes = attributesDict;
self.children = children;
@@ -69,8 +61,7 @@
- (id)initLeafWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict value:(NSString *)value
{
self = [self initWithName:name namespaceUri:namespaceUri];
- if (self)
- {
+ if (self) {
self.value = value;
self.attributes = attributesDict;
self.children = nil;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISNetworkProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISNetworkProvider.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISNetworkProvider.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISNetworkProvider.h Mon Feb 11 09:27:59 2013
@@ -25,6 +25,23 @@ typedef enum {
@protocol CMISNetworkProvider <NSObject>
+/**
+ * CMISNetworkProvider is a protocol used by the CMIS library to invoke network requests.
+ * In case a custom network provider is to be used, this protocol must be implemented and an instance of the
+ * custom class provided in the CMISSessionParameters when creating a CMIS Session.
+ * CMISSessionParameters provides a networkProvider property for that purpose.
+ * All methods in this protocol must be implemented
+ */
+
+/**
+ * A general invoke method, typically used for GET, DELETE HTTP methods
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param body the data for the upload (maybe nil)
+ * @param headers any additional headers to be used in the request (maybe nil)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invoke:(NSURL *)url
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -32,6 +49,15 @@ withHttpMethod:(CMISHttpRequestMethod)ht
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Invoke method used for uploads, i.e. POST/PUT requests
+ * @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 completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invoke:(NSURL *)url
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -40,6 +66,18 @@ withHttpMethod:(CMISHttpRequestMethod)ht
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Invoke method used for uploads, i.e. POST/PUT requests
+ * @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 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 withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
inputStream:(NSInputStream *)inputStream
@@ -49,6 +87,17 @@ completionBlock:(void (^)(CMISHttpRespon
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
requestObject:(CMISRequest *)requestObject;
+/**
+ * Invoke method used for downloads,
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param outputStream the stream pointing to the destination. Must be an instance or extension of NSOutputStream
+ * @param bytesExpected the size of the content to be downloaded
+ * @param 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
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -60,23 +109,51 @@ completionBlock:(void (^)(CMISHttpRespon
+/**
+ * Convenience GET invoke method
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokeGET:(NSURL *)url
withSession:(CMISBindingSession *)session
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience POST invoke method. Use for creating new content
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param body the data to be posted
+ * @param additionalHeaders any additional headers to be used in the request (optional)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokePOST:(NSURL *)url
withSession:(CMISBindingSession *)session
body:(NSData *)body
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience PUT invoke method. Use for updating existing content
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param body the data to be uploaded
+ * @param additionalHeaders any additional headers to be used in the request (optional)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokePUT:(NSURL *)url
withSession:(CMISBindingSession *)session
body:(NSData *)body
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience DELETE invoke method
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokeDELETE:(NSURL *)url
withSession:(CMISBindingSession *)session
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISObjectData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISObjectData.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISObjectData.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISObjectData.m Mon Feb 11 09:27:59 2013
@@ -22,12 +22,5 @@
@implementation CMISObjectData
-@synthesize identifier = _identifier;
-@synthesize baseType = _baseType;
-@synthesize properties = _properties;
-@synthesize linkRelations = _linkRelations;
-@synthesize contentUrl = _contentUrl;
-@synthesize allowableActions = _allowableActions;
-@synthesize renditions = _renditions;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.h Mon Feb 11 09:27:59 2013
@@ -42,30 +42,29 @@
- (CMISPropertyData *)propertyForId:(NSString *)id;
/**
-* Returns a property by query name or alias.
-*/
+ * Returns a property by query name or alias.
+ */
- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName;
/**
-* Returns a property (single) value by id.
-*/
+ * Returns a property (single) value by id.
+ */
- (id)propertyValueForId:(NSString *)propertyId;
/**
-* Returns a property (single) value by query name or alias.
-*
-* @see #getPropertyByQueryName(String)
-*/
+ * Returns a property (single) value by query name or alias.
+ * @see #getPropertyByQueryName(String)
+ */
- (id)propertyValueForQueryName:(NSString *)queryName;
/**
-* Returns a property multi-value by id.
-*/
+ * Returns a property multi-value by id.
+ */
- (NSArray *)propertyMultiValueById:(NSString *)id;
/**
-* Returns a property multi-value by query name or alias.
-*/
+ * Returns a property multi-value by query name or alias.
+ */
- (NSArray *)propertyMultiValueByQueryName:(NSString *)queryName;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISProperties.m Mon Feb 11 09:27:59 2013
@@ -26,24 +26,17 @@
@implementation CMISProperties
-@synthesize internalPropertiesByIdDict = _internalPropertiesByIdDict;
-@synthesize internalPropertiesByQueryNameDict = _internalPropertiesByQueryNameDict;
-@synthesize propertiesDictionary = _propertiesDictionary;
-@synthesize propertyList = _propertyList;
- (void)addProperty:(CMISPropertyData *)propertyData
{
- if (self.internalPropertiesByIdDict == nil)
- {
+ if (self.internalPropertiesByIdDict == nil) {
self.internalPropertiesByIdDict = [NSMutableDictionary dictionary];
}
[self.internalPropertiesByIdDict setObject:propertyData forKey:propertyData.identifier];
- if (propertyData.queryName != nil)
- {
- if (self.internalPropertiesByQueryNameDict == nil)
- {
+ if (propertyData.queryName != nil) {
+ if (self.internalPropertiesByQueryNameDict == nil) {
self.internalPropertiesByQueryNameDict = [NSMutableDictionary dictionary];
}
[self.internalPropertiesByQueryNameDict setObject:propertyData forKey:propertyData.queryName];
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.h Mon Feb 11 09:27:59 2013
@@ -54,31 +54,40 @@
/** Convenience method for retrieving the decimal value. Returns nil if property is not of decimal type */
- (NSNumber *)propertyDecimalValue;
-/** Creation of a multi-value property */
+/** Creation of a multi-value property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withArrayValue:(NSArray *)value type:(CMISPropertyType)type;
-/** Creation of a string property */
+/** Creation of a string property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withStringValue:(NSString *)value;
-/** Creation of an integer property */
+/** Creation of an integer property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withIntegerValue:(NSInteger)value;
-/** Creation of a decimal property */
+/** Creation of a decimal property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withDecimalValue:(NSNumber *)value;
-/** Creation of an id property */
+/** Creation of an id property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withIdValue:(NSString *)value;
-/** Creation of a datetime property */
+/** Creation of a datetime property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withDateTimeValue:(NSDate *)value;
-/** Creation of a boolean property */
+/** Creation of a boolean property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withBoolValue:(BOOL)value;
-/** Creation of a uri property */
+/** Creation of a uri property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withUriValue:(NSURL *)value;
-/** Creation of a uri property */
+/** Creation of a uri property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withHtmlValue:(NSString *)value;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISPropertyData.m Mon Feb 11 09:27:59 2013
@@ -27,19 +27,12 @@
@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)
- {
+ if (self.values != nil && [self.values count] > 0) {
value = [self.values objectAtIndex:0];
}
@@ -55,8 +48,7 @@
#pragma mark Value retrieval convenience methods
- (NSString *)propertyStringValue
{
- if (self.type == CMISPropertyTypeString)
- {
+ if (self.type == CMISPropertyTypeString) {
return [self firstValue];
}
return nil;
@@ -64,8 +56,7 @@
- (NSNumber *)propertyIntegerValue
{
- if (self.type == CMISPropertyTypeInteger)
- {
+ if (self.type == CMISPropertyTypeInteger) {
return [self firstValue];
}
return nil;
@@ -73,8 +64,7 @@
- (NSString *)propertyIdValue
{
- if (self.type == CMISPropertyTypeId)
- {
+ if (self.type == CMISPropertyTypeId) {
return [self firstValue];
}
return nil;
@@ -82,8 +72,7 @@
- (NSDate *)propertyDateTimeValue
{
- if (self.type == CMISPropertyTypeDateTime)
- {
+ if (self.type == CMISPropertyTypeDateTime) {
return [self firstValue];
}
return nil;
@@ -91,8 +80,7 @@
- (NSNumber *)propertyBooleanValue
{
- if (self.type == CMISPropertyTypeBoolean)
- {
+ if (self.type == CMISPropertyTypeBoolean) {
return [self firstValue];
}
return nil;
@@ -100,8 +88,7 @@
- (NSNumber *)propertyDecimalValue
{
- if (self.type == CMISPropertyTypeDecimal)
- {
+ if (self.type == CMISPropertyTypeDecimal) {
return [self firstValue];
}
return nil;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.h Mon Feb 11 09:27:59 2013
@@ -33,9 +33,10 @@
@property (nonatomic, strong) NSString *vendorName;
// TODO the repositoryCapabilities property is currently not types.
-// CMISRepositoryCapabilities needs to be created and replace the raw NSDictionary object
-// that is currently being set from the CMISRepositoryInfoParser
-// ** Use keypaths to get values until the property is properly typed **
+/** CMISRepositoryCapabilities needs to be created and replace the raw NSDictionary object
+ * that is currently being set from the CMISRepositoryInfoParser
+ * Use keypaths to get values until the property is properly typed **
+ */
@property (nonatomic, strong) id repositoryCapabilities;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISRepositoryInfo.m Mon Feb 11 09:27:59 2013
@@ -21,15 +21,6 @@
@implementation CMISRepositoryInfo
-@synthesize identifier = _identifier;
-@synthesize name = _name;
-@synthesize desc = _desc;
-@synthesize rootFolderId = _rootFolderId;
-@synthesize cmisVersionSupported = _cmisVersionSupported;
-@synthesize productName = _productName;
-@synthesize productVersion = _productVersion;
-@synthesize vendorName = _vendorName;
-@synthesize repositoryCapabilities = _repositoryCapabilities;
- (NSString *)description
{
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.h Mon Feb 11 09:27:59 2013
@@ -60,15 +60,21 @@ extern NSString * const kCMISSessionPara
// Network I/O
@property (nonatomic, strong) id<CMISNetworkProvider> networkProvider;
-
+/** init with binding type
+ */
- (id)initWithBindingType:(CMISBindingType)bindingType;
-// Object storage methods
+/// Object storage methods
- (NSArray *)allKeys;
+
- (id)objectForKey:(id)key;
+
- (id)objectForKey:(id)key withDefaultValue:(id)defaultValue;
+
- (void)setObject:(id)object forKey:(id)key;
+
- (void)addEntriesFromDictionary:(NSDictionary *)dictionary;
+
- (void)removeKey:(id)key;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISSessionParameters.m Mon Feb 11 09:27:59 2013
@@ -32,14 +32,6 @@ NSString * const kCMISSessionParameterMo
@implementation CMISSessionParameters
-@synthesize username = _username;
-@synthesize password = _password;
-@synthesize repositoryId = _repositoryId;
-@synthesize bindingType = _bindingType;
-@synthesize atomPubUrl = _atomPubUrl;
-@synthesize authenticationProvider = _authenticationProvider;
-@synthesize sessionData = _sessionData;
-@synthesize networkProvider = _networkProvider;
- (id)init
{
@@ -49,8 +41,7 @@ NSString * const kCMISSessionParameterMo
- (id)initWithBindingType:(CMISBindingType)bindingType
{
self = [super init];
- if (self)
- {
+ if (self) {
self.sessionData = [[NSMutableDictionary alloc] init];
self.bindingType = bindingType;
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h Mon Feb 11 09:27:59 2013
@@ -24,14 +24,15 @@
@property (nonatomic, strong) NSURLCredential *credential;
-/**
- * Initialize with username and password that will be added as authorization header
+/** Initialize with username and password that will be added as authorization header
+ * @param username
+ * @param password
*/
- (id)initWithUsername:(NSString *)username andPassword:(NSString *)password;
-/**
- * Initialize with a credential object that will be provided when a corresponding challenge is received from the server.
+/** Initialize with a credential object that will be provided when a corresponding challenge is received from the server.
* Both client certificate and username / password credentials are supported
+ * @param credential
*/
- (id)initWithCredential:(NSURLCredential *)credential;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m Mon Feb 11 09:27:59 2013
@@ -27,15 +27,11 @@
@implementation CMISStandardAuthenticationProvider
-@synthesize username = _username;
-@synthesize password = _password;
-@synthesize credential = _credential;
- (id)initWithUsername:(NSString *)username andPassword:(NSString *)password
{
self = [super init];
- if (self)
- {
+ if (self) {
self.username = username;
self.password = password;
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.h Mon Feb 11 09:27:59 2013
@@ -21,16 +21,22 @@
@interface CMISBase64Encoder : NSObject
+/// encodes data into base 64 and returns the result as NSString
+ (NSString *)stringByEncodingText:(NSData *)plainText;
+/// returns base64 encoded data for given input data
+ (NSData *)dataByEncodingText:(NSData *)plainText;
+/// base64 encodes the content of a file
+ (NSString *)encodeContentOfFile:(NSString *)sourceFilePath;
+/// base64 encodes data from an input stream
+ (NSString *)encodeContentFromInputStream:(NSInputStream*)inputStream;
+/// base64 encodes data from a source file and appends the encoded result to the given destination file
+ (void)encodeContentOfFile:(NSString *)sourceFilePath andAppendToFile:(NSString *)destinationFilePath;
+/// base64 encodes data from an input stream and appends the encoded data to a given destination file
+ (void)encodeContentFromInputStream:(NSInputStream*)inputStream andAppendToFile:(NSString *)destinationFilePath;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISBase64Encoder.m Mon Feb 11 09:27:59 2013
@@ -41,8 +41,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
NSInteger j = 0;
int remain;
- for (i = 0; i < [plainText length]; i += 3)
- {
+ for (i = 0; i < [plainText length]; i += 3) {
remain = [plainText length] - i;
outputBuffer[j++] = alphabet[(inputBuffer[i] & 0xFC) >> 2];
@@ -69,8 +68,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
NSMutableString *result = [[NSMutableString alloc] init];
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:sourceFilePath];
- if (fileHandle)
- {
+ if (fileHandle) {
// Get the total file length
[fileHandle seekToEndOfFile];
unsigned long long fileLength = [fileHandle offsetInFile];
@@ -79,10 +77,8 @@ static char *alphabet = "ABCDEFGHIJKLMNO
unsigned long long currentOffset = 0ULL;
// Read the data and append it to the file
- while (currentOffset < fileLength)
- {
- @autoreleasepool
- {
+ while (currentOffset < fileLength) {
+ @autoreleasepool {
[fileHandle seekToFileOffset:currentOffset];
NSData *chunkOfData = [fileHandle readDataOfLength:32768];
[result appendString:[self stringByEncodingText:chunkOfData]];
@@ -92,9 +88,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
// Release the file handle
[fileHandle closeFile];
- }
- else
- {
+ } else {
log(@"Could not create a file handle for %@", sourceFilePath);
}
@@ -124,8 +118,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
+ (void)encodeContentOfFile:(NSString *)sourceFilePath andAppendToFile:(NSString *)destinationFilePath
{
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:sourceFilePath];
- if (fileHandle)
- {
+ if (fileHandle) {
// Get the total file length
[fileHandle seekToEndOfFile];
unsigned long long fileLength = [fileHandle offsetInFile];
@@ -134,10 +127,8 @@ static char *alphabet = "ABCDEFGHIJKLMNO
unsigned long long currentOffset = 0ULL;
// Read the data and append it to the file
- while (currentOffset < fileLength)
- {
- @autoreleasepool
- {
+ while (currentOffset < fileLength) {
+ @autoreleasepool {
[fileHandle seekToFileOffset:currentOffset];
NSData *chunkOfData = [fileHandle readDataOfLength:524288]; // 512 kb
[FileUtil appendToFileAtPath:destinationFilePath data:[self dataByEncodingText:chunkOfData]];
@@ -147,9 +138,7 @@ static char *alphabet = "ABCDEFGHIJKLMNO
// Release the file handle
[fileHandle closeFile];
- }
- else
- {
+ } else {
log(@"Could not create a file handle for %@", sourceFilePath);
}
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.h Mon Feb 11 09:27:59 2013
@@ -25,7 +25,9 @@
@interface CMISDateUtil : NSObject
+/// converts a NSDate object into an ISO compliant date string
+ (NSString*)stringFromDate:(NSDate*)date;
+/// parses an ISO compliant string and returns the date
+ (NSDate *)dateFromString:(NSString *)string;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISDateUtil.m Mon Feb 11 09:27:59 2013
@@ -29,8 +29,7 @@
{
static dispatch_once_t predicate = 0;
__strong static NSDateFormatter *dateFormatter = nil;
- dispatch_once(&predicate, ^
- {
+ dispatch_once(&predicate, ^ {
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [NSLocale systemLocale];
dateFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; // ISO8601 calendar not available
@@ -43,13 +42,15 @@
}
-+ (NSString*)stringFromDate:(NSDate*)date {
++ (NSString*)stringFromDate:(NSDate*)date
+{
NSString *string = [[CMISDateUtil CMISDateFormatter] stringFromDate:date];
return string;
}
-+ (NSDate *)dateFromString:(NSString *)string {
++ (NSDate *)dateFromString:(NSString *)string
+{
if (string == nil) {
return nil;
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.h Mon Feb 11 09:27:59 2013
@@ -21,9 +21,9 @@
@interface FileUtil : NSObject
-
+/// appends data to a file with given path
+ (void)appendToFileAtPath:(NSString *)filePath data:(NSData *)data;
-
+/// returns the size of a file at path filePath
+ (unsigned long long)fileSizeForFileAtPath:(NSString *)filePath error:(NSError * *)outError;
@end
\ No newline at end of file
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISFileUtil.m Mon Feb 11 09:27:59 2013
@@ -26,8 +26,7 @@
{
NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
- if (fileHandle)
- {
+ if (fileHandle) {
[fileHandle seekToEndOfFile];
[fileHandle writeData:data];
}
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h Mon Feb 11 09:27:59 2013
@@ -30,6 +30,9 @@
@property (nonatomic, readonly) unsigned long long bytesDownloaded;
+/** starts a URL request for download. Data are written to the provided output stream
+ * completionBlock returns a CMISHttpResponse object or nil if unsuccessful
+ */
+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest*)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
outputStream:(NSOutputStream*)outputStream
@@ -37,7 +40,7 @@
authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
-
+/// designated initialiser. Do not use directly, instead call the startRequest class method above
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m Mon Feb 11 09:27:59 2013
@@ -30,10 +30,6 @@
@implementation CMISHttpDownloadRequest
-@synthesize outputStream = _outputStream;
-@synthesize progressBlock = _progressBlock;
-@synthesize bytesDownloaded = _bytesDownloaded;
-@synthesize bytesExpected = _bytesExpected;
+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.h Mon Feb 11 09:27:59 2013
@@ -34,6 +34,13 @@
@property (nonatomic, strong) id<CMISAuthenticationProvider> authenticationProvider;
@property (nonatomic, copy) void (^completionBlock)(CMISHttpResponse *httpResponse, NSError *error);
+/**
+ * starts a URL request for given HTTP method
+ * @param requestBody (optional)
+ * @param additionalHeaders (optional)
+ * @param authenticationProvider (required)
+ * completionBlock returns a CMISHTTPResponse object or nil if unsuccessful
+ */
+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
requestBody:(NSData*)requestBody
@@ -41,11 +48,17 @@
authenticationProvider:(id<CMISAuthenticationProvider>)authenticationProvider
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * designated initialiser. Do not use this initialiser directly. Instead use the
+ * class method startRequest:withHttpMethod:requestBody:headers:authenticationProvider:completionBlock
+ */
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/// starts the URL request
- (BOOL)startRequest:(NSMutableURLRequest*)urlRequest;
+/// cancel method. This may be called from a CMISRequest object
- (void)cancel;
@end
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpRequest.m Mon Feb 11 09:27:59 2013
@@ -40,14 +40,6 @@ NSString * const kCMISExceptionVersionin
@implementation CMISHttpRequest
-@synthesize requestMethod = _requestMethod;
-@synthesize requestBody = _requestBody;
-@synthesize responseBody = _responseBody;
-@synthesize additionalHeaders = _additionalHeaders;
-@synthesize response = _response;
-@synthesize authenticationProvider = _authenticationProvider;
-@synthesize completionBlock = _completionBlock;
-@synthesize connection = _connection;
+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
@@ -200,8 +192,7 @@ NSString * const kCMISExceptionVersionin
if ( (httpRequestMethod == HTTP_GET && response.statusCode != 200)
|| (httpRequestMethod == HTTP_POST && response.statusCode != 201)
|| (httpRequestMethod == HTTP_DELETE && response.statusCode != 204)
- || (httpRequestMethod == HTTP_PUT && ((response.statusCode < 200 || response.statusCode > 299))))
- {
+ || (httpRequestMethod == HTTP_PUT && ((response.statusCode < 200 || response.statusCode > 299)))) {
log(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
if (error) {
@@ -211,8 +202,7 @@ NSString * const kCMISExceptionVersionin
errorMessage = response.statusCodeMessage; // fall back to HTTP error message
}
- switch (response.statusCode)
- {
+ switch (response.statusCode) {
case 400:
if ([exception isEqualToString:kCMISExceptionFilterNotValid]) {
*error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeFilterNotValid
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.h Mon Feb 11 09:27:59 2013
@@ -25,7 +25,10 @@
@property (nonatomic, strong) NSString *statusCodeMessage;
@property (nonatomic, strong, readonly) NSData *data;
+/// wrapper for returned NSHTTPURLResponse and retrieved data
+ (CMISHttpResponse *)responseUsingURLHTTPResponse:(NSHTTPURLResponse *)HTTPURLResponse andData:(NSData *)data;
+
+/// returns a CMISHttpResponse object with HTTP status code, message headers and any response data
+ (CMISHttpResponse *)responseWithStatusCode:(int)statusCode
statusMessage:(NSString *)message
headers:(NSDictionary *)headers
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpResponse.m Mon Feb 11 09:27:59 2013
@@ -29,10 +29,6 @@
@implementation CMISHttpResponse
-@synthesize statusCode = _statusCode;
-@synthesize data = _data;
-@synthesize statusCodeMessage = _statusCodeMessage;
-@synthesize responseString = _responseString;
+ (CMISHttpResponse *)responseUsingURLHTTPResponse:(NSHTTPURLResponse *)httpUrlResponse andData:(NSData *)data
{
@@ -65,7 +61,8 @@
}
-- (NSString*)exception {
+- (NSString*)exception
+{
NSString *responseString = self.responseString;
if (responseString) {
NSRange begin = [responseString rangeOfString:@"<!--exception-->"];
@@ -83,7 +80,8 @@
}
-- (NSString*)errorMessage {
+- (NSString*)errorMessage
+{
NSString *responseString = self.responseString;
if (responseString) {
NSRange begin = [responseString rangeOfString:@"<!--message-->"];
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h Mon Feb 11 09:27:59 2013
@@ -25,6 +25,11 @@
@property (nonatomic, assign) unsigned long long bytesExpected; // optional; if not set, expected content length from HTTP header is used
@property (nonatomic, readonly) unsigned long long bytesUploaded;
+/**
+ * starts a URL request with a provided input stream. The inputStream will be passed on to the NSMutableURLRequest by using its
+ * setHTTPBodyStream method
+ * completionBlock returns CMISHttpResponse instance or nil if unsuccessful
+ */
+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
inputStream:(NSInputStream*)inputStream
@@ -34,6 +39,7 @@
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+/// designated initialiser. Do not call this method directly. Use the class method startRequest:withHttpMethod:inputStream:headers:bytesExpected:authenticationProvider:completionBlock:progressBlock instead
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m Mon Feb 11 09:27:59 2013
@@ -29,10 +29,6 @@
@implementation CMISHttpUploadRequest
-@synthesize inputStream = _inputStream;
-@synthesize progressBlock = _progressBlock;
-@synthesize bytesExpected = _bytesExpected;
-@synthesize bytesUploaded = _bytesUploaded;
+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
Modified: chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISObjectConverter.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISObjectConverter.m?rev=1444689&r1=1444688&r2=1444689&view=diff
==============================================================================
--- chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISObjectConverter.m (original)
+++ chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Utils/CMISObjectConverter.m Mon Feb 11 09:27:59 2013
@@ -34,13 +34,11 @@
@implementation CMISObjectConverter
-@synthesize session = _session;
- (id)initWithSession:(CMISSession *)session
{
self = [super init];
- if (self)
- {
+ if (self) {
self.session = session;
}
@@ -51,12 +49,9 @@
{
CMISObject *object = nil;
- if (objectData.baseType == CMISBaseTypeDocument)
- {
+ if (objectData.baseType == CMISBaseTypeDocument) {
object = [[CMISDocument alloc] initWithObjectData:objectData withSession:self.session];
- }
- else if (objectData.baseType == CMISBaseTypeFolder)
- {
+ } else if (objectData.baseType == CMISBaseTypeFolder) {
object = [[CMISFolder alloc] initWithObjectData:objectData withSession:self.session];
}
@@ -67,8 +62,7 @@
{
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:[objects count]];
- for (CMISObjectData *object in objects)
- {
+ for (CMISObjectData *object in objects) {
[items addObject:[self convertObject:object]];
}
@@ -95,17 +89,13 @@
for (NSString *propertyId in properties) {
id propertyValue = [properties objectForKey:propertyId];
// If the value is already a CMISPropertyData, we don't need to do anything
- if ([propertyValue isKindOfClass:[CMISPropertyData class]])
- {
+ if ([propertyValue isKindOfClass:[CMISPropertyData class]]) {
[convertedProperties addProperty:(CMISPropertyData *)propertyValue];
- }
- else
- {
+ } else {
// Convert to CMISPropertyData based on the string
CMISPropertyDefinition *propertyDefinition = [typeDefinition propertyDefinitionForId:propertyId];
- if (propertyDefinition == nil)
- {
+ if (propertyDefinition == nil) {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:[NSString stringWithFormat:@"Invalid property '%@' for this object type", propertyId]];
completionBlock(nil, error);
@@ -115,10 +105,8 @@
Class expectedType = nil;
BOOL validType = YES;
- switch (propertyDefinition.propertyType)
- {
- case(CMISPropertyTypeString):
- {
+ switch (propertyDefinition.propertyType) {
+ case(CMISPropertyTypeString): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withStringValue:propertyValue]];
@@ -137,8 +125,7 @@
}
break;
}
- case(CMISPropertyTypeBoolean):
- {
+ case(CMISPropertyTypeBoolean): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
BOOL boolValue = ((NSNumber *) propertyValue).boolValue;
@@ -158,8 +145,7 @@
}
break;
}
- case(CMISPropertyTypeInteger):
- {
+ case(CMISPropertyTypeInteger): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
NSInteger intValue = ((NSNumber *) propertyValue).integerValue;
@@ -179,8 +165,7 @@
}
break;
}
- case(CMISPropertyTypeDecimal):
- {
+ case(CMISPropertyTypeDecimal): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withDecimalValue:propertyValue]];
@@ -199,8 +184,7 @@
}
break;
}
- case(CMISPropertyTypeId):
- {
+ case(CMISPropertyTypeId): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withIdValue:propertyValue]];
@@ -219,8 +203,7 @@
}
break;
}
- case(CMISPropertyTypeDateTime):
- {
+ case(CMISPropertyTypeDateTime): {
if ([propertyValue isKindOfClass:[NSString class]]) {
propertyValue = [CMISDateUtil dateFromString:propertyValue];
}
@@ -245,8 +228,7 @@
}
break;
}
- case(CMISPropertyTypeUri):
- {
+ case(CMISPropertyTypeUri): {
if ([propertyValue isKindOfClass:[NSString class]]) {
propertyValue = [NSURL URLWithString:propertyValue];
}
@@ -271,8 +253,7 @@
}
break;
}
- case(CMISPropertyTypeHtml):
- {
+ case(CMISPropertyTypeHtml): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withHtmlValue:propertyValue]];
@@ -291,8 +272,7 @@
}
break;
}
- default:
- {
+ default: {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:[NSString stringWithFormat:@"Unsupported: cannot convert property type %d", propertyDefinition.propertyType]];
completionBlock(nil, error);
@@ -319,8 +299,7 @@
{
// Validate params
- if (!properties)
- {
+ if (!properties) {
completionBlock(nil, nil);
return;
}