From 5f9fb4e1c46ab8e90539b6ebe0f078fa4ba3e4a5 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 13 May 2014 21:06:59 -0400 Subject: [PATCH] Big refactor for new caching mechanism. --- OpenChange/GNUmakefile | 11 ---- OpenChange/MAPIStoreDBBaseContext.m | 6 +-- OpenChange/MAPIStoreDBFolder.m | 4 +- OpenChange/MAPIStoreFallbackContext.m | 10 ++-- OpenChange/MAPIStoreFolder.m | 6 +-- OpenChange/MAPIStoreMailFolder.m | 6 +-- OpenChange/MAPIStoreMailVolatileMessage.m | 2 +- OpenChange/MAPIStoreTable.m | 2 +- OpenChange/MAPIStoreUserContext.m | 2 +- OpenChange/NSObject+PropertyList.m | 6 +-- OpenChange/SOGoCacheGCSObject+MAPIStore.h | 7 +++ OpenChange/SOGoCacheGCSObject+MAPIStore.m | 42 +++++++++++++++ OpenChange/SOGoMAPIDBMessage.h | 8 ++- OpenChange/SOGoMAPIDBMessage.m | 2 +- OpenChange/dbmsgreader.m | 2 +- {OpenChange => SoObjects/SOGo}/BSONCodec.h | 0 {OpenChange => SoObjects/SOGo}/BSONCodec.m | 0 .../SOGo}/EOBitmaskQualifier.h | 4 +- .../SOGo}/EOBitmaskQualifier.m | 4 +- .../SOGo/EOQualifier+SOGoCacheObject.h | 18 +++---- .../SOGo/EOQualifier+SOGoCacheObject.m | 24 ++++----- .../SOGo/GCSSpecialQueries+SOGoCacheObject.h | 14 +++-- .../SOGo/GCSSpecialQueries+SOGoCacheObject.m | 22 ++++---- SoObjects/SOGo/GNUmakefile | 14 +++++ SoObjects/SOGo/SOGoCacheGCSFolder.h | 20 +++---- SoObjects/SOGo/SOGoCacheGCSFolder.m | 43 +++++++-------- SoObjects/SOGo/SOGoCacheGCSObject.h | 16 +++--- SoObjects/SOGo/SOGoCacheGCSObject.m | 53 +++---------------- SoObjects/SOGo/SOGoCacheObject.h | 14 +++-- SoObjects/SOGo/SOGoCacheObject.m | 10 ++-- 30 files changed, 175 insertions(+), 197 deletions(-) create mode 100644 OpenChange/SOGoCacheGCSObject+MAPIStore.h create mode 100644 OpenChange/SOGoCacheGCSObject+MAPIStore.m rename {OpenChange => SoObjects/SOGo}/BSONCodec.h (100%) rename {OpenChange => SoObjects/SOGo}/BSONCodec.m (100%) rename {OpenChange => SoObjects/SOGo}/EOBitmaskQualifier.h (92%) rename {OpenChange => SoObjects/SOGo}/EOBitmaskQualifier.m (94%) rename OpenChange/EOQualifier+MAPI.h => SoObjects/SOGo/EOQualifier+SOGoCacheObject.h (67%) rename OpenChange/EOQualifier+MAPI.m => SoObjects/SOGo/EOQualifier+SOGoCacheObject.m (83%) diff --git a/OpenChange/GNUmakefile b/OpenChange/GNUmakefile index 3d9fa5b9f..4ad6a0165 100644 --- a/OpenChange/GNUmakefile +++ b/OpenChange/GNUmakefile @@ -46,11 +46,7 @@ $(SOGOBACKEND)_OBJC_FILES += \ MAPIStoreSamDBUtils.m \ MAPIStoreUserContext.m \ \ - SOGoMAPIObject.m \ - \ - SOGoMAPIDBObject.m \ SOGoMAPIDBMessage.m \ - SOGoMAPIDBFolder.m \ \ MAPIStoreAppointmentWrapper.m \ MAPIStoreAttachment.m \ @@ -123,13 +119,6 @@ $(SOGOBACKEND)_OBJC_FILES += \ iCalEvent+MAPIStore.m \ iCalTimeZone+MAPIStore.m \ \ - GCSSpecialQueries+OpenChange.m\ - \ - EOQualifier+MAPI.m \ - \ - EOBitmaskQualifier.m \ - \ - BSONCodec.m \ RTFHandler.m diff --git a/OpenChange/MAPIStoreDBBaseContext.m b/OpenChange/MAPIStoreDBBaseContext.m index d82538083..e1a67fd76 100644 --- a/OpenChange/MAPIStoreDBBaseContext.m +++ b/OpenChange/MAPIStoreDBBaseContext.m @@ -1,8 +1,6 @@ /* MAPIStoreDBBaseContext.m - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +30,7 @@ #import "MAPIStoreDBFolder.h" #import "MAPIStoreMapping.h" #import "MAPIStoreUserContext.h" -#import "SOGoMAPIDBFolder.h" +#import #import "MAPIStoreDBBaseContext.h" diff --git a/OpenChange/MAPIStoreDBFolder.m b/OpenChange/MAPIStoreDBFolder.m index e7ff0811b..70b957852 100644 --- a/OpenChange/MAPIStoreDBFolder.m +++ b/OpenChange/MAPIStoreDBFolder.m @@ -32,7 +32,7 @@ #import #import #import -#import "EOQualifier+MAPI.h" +#import #import "MAPIStoreContext.h" #import "MAPIStoreDBFolderTable.h" #import "MAPIStoreDBMessage.h" @@ -40,7 +40,7 @@ #import "MAPIStoreMapping.h" #import "MAPIStoreTypes.h" #import "MAPIStoreUserContext.h" -#import "SOGoMAPIDBFolder.h" +#import #import "SOGoMAPIDBMessage.h" #import "MAPIStoreDBFolder.h" diff --git a/OpenChange/MAPIStoreFallbackContext.m b/OpenChange/MAPIStoreFallbackContext.m index ea6fa7ff3..1c9a0106b 100644 --- a/OpenChange/MAPIStoreFallbackContext.m +++ b/OpenChange/MAPIStoreFallbackContext.m @@ -1,8 +1,6 @@ /* MAPIStoreFallbackContext.m - this file is part of SOGo * - * Copyright (C) 2011-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +24,7 @@ #import "MAPIStoreUserContext.h" #import "NSString+MAPIStore.h" -#import "SOGoMAPIDBFolder.h" +#import #import "MAPIStoreFallbackContext.h" @@ -51,7 +49,7 @@ inMemCtx: (TALLOC_CTX *) memCtx { struct mapistore_contexts_list *firstContext = NULL, *context; - SOGoMAPIDBFolder *root; + SOGoCacheGCSFolder *root; NSArray *names; NSUInteger count, max; NSString *baseURL, *url, *name; @@ -70,7 +68,7 @@ /* Maybe emsmdbp_provisioning should be fixed in order to only take the uri returned above to avoid deleting its entries... */ - root = [SOGoMAPIDBFolder objectWithName: [self MAPIModuleName] + root = [SOGoCacheGCSFolder objectWithName: [self MAPIModuleName] inContainer: nil]; [root setOwner: userName]; userContext = [MAPIStoreUserContext userContextWithUsername: userName diff --git a/OpenChange/MAPIStoreFolder.m b/OpenChange/MAPIStoreFolder.m index 8368e1b2b..fd54c4a43 100644 --- a/OpenChange/MAPIStoreFolder.m +++ b/OpenChange/MAPIStoreFolder.m @@ -1,8 +1,6 @@ /* MAPIStoreFolder.m - this file is part of SOGo * - * Copyright (C) 2011-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +49,7 @@ #import "NSDate+MAPIStore.h" #import "NSString+MAPIStore.h" #import "NSObject+MAPIStore.h" -#import "SOGoMAPIDBFolder.h" +#import #import "SOGoMAPIDBMessage.h" #include diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index 324c749ea..f0912d8f0 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -59,7 +59,7 @@ #import "NSData+MAPIStore.h" #import "NSString+MAPIStore.h" #import "SOGoMAPIDBMessage.h" -#import "SOGoMAPIDBFolder.h" +#import #import "MAPIStoreMailVolatileMessage.h" @@ -1172,9 +1172,9 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) - (MAPIStoreMessage *) createMessage { - SOGoMAPIObject *childObject; + SOGoCacheObject *childObject; - childObject = [SOGoMAPIObject objectWithName: [SOGoMAPIObject + childObject = [SOGoCacheObject objectWithName: [SOGoCacheObject globallyUniqueObjectId] inContainer: sogoObject]; return [MAPIStoreMailVolatileMessage diff --git a/OpenChange/MAPIStoreMailVolatileMessage.m b/OpenChange/MAPIStoreMailVolatileMessage.m index ed60a8620..c640ab7db 100644 --- a/OpenChange/MAPIStoreMailVolatileMessage.m +++ b/OpenChange/MAPIStoreMailVolatileMessage.m @@ -62,7 +62,7 @@ #import "NSData+MAPIStore.h" #import "NSObject+MAPIStore.h" #import "NSString+MAPIStore.h" -#import "SOGoMAPIObject.h" +#import #import "MAPIStoreMailVolatileMessage.h" diff --git a/OpenChange/MAPIStoreTable.m b/OpenChange/MAPIStoreTable.m index 842fa3afc..3b8270b6c 100644 --- a/OpenChange/MAPIStoreTable.m +++ b/OpenChange/MAPIStoreTable.m @@ -25,7 +25,7 @@ #import #import -#import "EOBitmaskQualifier.h" +#import #import "MAPIStoreActiveTables.h" #import "MAPIStoreObject.h" #import "MAPIStoreTypes.h" diff --git a/OpenChange/MAPIStoreUserContext.m b/OpenChange/MAPIStoreUserContext.m index 7432f91fd..74a9b612a 100644 --- a/OpenChange/MAPIStoreUserContext.m +++ b/OpenChange/MAPIStoreUserContext.m @@ -42,7 +42,7 @@ #import #import -#import "GCSSpecialQueries+OpenChange.h" +#import #import "MAPIApplication.h" #import "MAPIStoreAuthenticator.h" #import "MAPIStoreMapping.h" diff --git a/OpenChange/NSObject+PropertyList.m b/OpenChange/NSObject+PropertyList.m index ce01bd227..07a42d976 100644 --- a/OpenChange/NSObject+PropertyList.m +++ b/OpenChange/NSObject+PropertyList.m @@ -1,8 +1,6 @@ /* dbmsgdump.m - this file is part of SOGo * - * Copyright (C) 2011-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2011-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +31,7 @@ #import #import -#import "BSONCodec.h" +#import const char *indentationStep = " "; diff --git a/OpenChange/SOGoCacheGCSObject+MAPIStore.h b/OpenChange/SOGoCacheGCSObject+MAPIStore.h new file mode 100644 index 000000000..b28efe1ca --- /dev/null +++ b/OpenChange/SOGoCacheGCSObject+MAPIStore.h @@ -0,0 +1,7 @@ +#include + +@interface SOGoCacheGCSObject (MAPIStore) + +- (Class) mapistoreMessageClass; + +@end diff --git a/OpenChange/SOGoCacheGCSObject+MAPIStore.m b/OpenChange/SOGoCacheGCSObject+MAPIStore.m new file mode 100644 index 000000000..d768a3603 --- /dev/null +++ b/OpenChange/SOGoCacheGCSObject+MAPIStore.m @@ -0,0 +1,42 @@ +#include "SOGoCacheGCSObject+MAPIStore.h" + +@implementation SOGoCacheGCSObject (MAPIStore) + +- (Class) mapistoreMessageClass +{ + NSString *className, *mapiMsgClass; + + switch (objectType) + { + case MAPIMessageCacheObject: + mapiMsgClass = [properties + objectForKey: MAPIPropertyKey (PidTagMessageClass)]; + if (mapiMsgClass) + { + if ([mapiMsgClass isEqualToString: @"IPM.StickyNote"]) + className = @"MAPIStoreNotesMessage"; + else + className = @"MAPIStoreDBMessage"; + //[self logWithFormat: @"PidTagMessageClass = '%@', returning '%@'", + // mapiMsgClass, className]; + } + else + { + //[self warnWithFormat: @"PidTagMessageClass is not set, falling back" + // @" to 'MAPIStoreDBMessage'"]; + className = @"MAPIStoreDBMessage"; + } + break; + case MAPIFAICacheObject: + className = @"MAPIStoreFAIMessage"; + break; + default: + [NSException raise: @"MAPIStoreIOException" + format: @"message class should not be queried for objects" + @" of type '%d'", objectType]; + } + + return NSClassFromString (className); +} + +@end diff --git a/OpenChange/SOGoMAPIDBMessage.h b/OpenChange/SOGoMAPIDBMessage.h index 29909a60a..4211988f6 100644 --- a/OpenChange/SOGoMAPIDBMessage.h +++ b/OpenChange/SOGoMAPIDBMessage.h @@ -1,8 +1,6 @@ /* SOGoMAPIDBMessage.h - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,12 +21,12 @@ #ifndef SOGOMAPIDBMESSAGE_H #define SOGOMAPIDBMESSAGE_H -#import "SOGoMAPIDBObject.h" +#import @class NSDate; @class NSString; -@interface SOGoMAPIDBMessage : SOGoMAPIDBObject +@interface SOGoMAPIDBMessage : SOGoCacheGCSObject @end #endif /* SOGOMAPIDBMESSAGE_H */ diff --git a/OpenChange/SOGoMAPIDBMessage.m b/OpenChange/SOGoMAPIDBMessage.m index f17093be1..343b90334 100644 --- a/OpenChange/SOGoMAPIDBMessage.m +++ b/OpenChange/SOGoMAPIDBMessage.m @@ -30,7 +30,7 @@ #import -#import "SOGoMAPIDBFolder.h" +#import #import "SOGoMAPIDBMessage.h" diff --git a/OpenChange/dbmsgreader.m b/OpenChange/dbmsgreader.m index 0119a00c9..97b3356d0 100644 --- a/OpenChange/dbmsgreader.m +++ b/OpenChange/dbmsgreader.m @@ -34,7 +34,7 @@ #import #import "MAPIStoreUserContext.h" -#import "SOGoMAPIDBObject.h" +#import #import "NSObject+PropertyList.m" diff --git a/OpenChange/BSONCodec.h b/SoObjects/SOGo/BSONCodec.h similarity index 100% rename from OpenChange/BSONCodec.h rename to SoObjects/SOGo/BSONCodec.h diff --git a/OpenChange/BSONCodec.m b/SoObjects/SOGo/BSONCodec.m similarity index 100% rename from OpenChange/BSONCodec.m rename to SoObjects/SOGo/BSONCodec.m diff --git a/OpenChange/EOBitmaskQualifier.h b/SoObjects/SOGo/EOBitmaskQualifier.h similarity index 92% rename from OpenChange/EOBitmaskQualifier.h rename to SoObjects/SOGo/EOBitmaskQualifier.h index 405a1f1fa..96b11f035 100644 --- a/OpenChange/EOBitmaskQualifier.h +++ b/SoObjects/SOGo/EOBitmaskQualifier.h @@ -1,8 +1,6 @@ /* EOBitmaskQualifier.h - this file is part of SOGo * - * Copyright (C) 2010-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/OpenChange/EOBitmaskQualifier.m b/SoObjects/SOGo/EOBitmaskQualifier.m similarity index 94% rename from OpenChange/EOBitmaskQualifier.m rename to SoObjects/SOGo/EOBitmaskQualifier.m index 14f3eee93..8ee4a0a69 100644 --- a/OpenChange/EOBitmaskQualifier.m +++ b/SoObjects/SOGo/EOBitmaskQualifier.m @@ -1,8 +1,6 @@ /* EOBitmaskQualifier.m - this file is part of SOGo * - * Copyright (C) 2010-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/OpenChange/EOQualifier+MAPI.h b/SoObjects/SOGo/EOQualifier+SOGoCacheObject.h similarity index 67% rename from OpenChange/EOQualifier+MAPI.h rename to SoObjects/SOGo/EOQualifier+SOGoCacheObject.h index 9fabef4b9..05fe81204 100644 --- a/OpenChange/EOQualifier+MAPI.h +++ b/SoObjects/SOGo/EOQualifier+SOGoCacheObject.h @@ -1,8 +1,6 @@ -/* EOQualifier+MAPI.h - this file is part of SOGo +/* EOQualifier+SOGoCacheObject.h - this file is part of SOGo * - * Copyright (C) 2010-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,17 +18,17 @@ * Boston, MA 02111-1307, USA. */ -#ifndef EOQUALIFIER_MAPI_H -#define EOQUALIFIER_MAPI_H +#ifndef EOQUALIFIER_SOGOCACHEOBJECT_H +#define EOQUALIFIER_SOGOCACHEOBJECT_H #import -@class SOGoMAPIDBObject; +@class SOGoCacheGCSObject; -@interface EOQualifier (MAPIStoreRestrictions) +@interface EOQualifier (SOGoCacheObjectRestrictions) -- (BOOL) evaluateSOGoMAPIDBObject: (SOGoMAPIDBObject *) object; +- (BOOL) evaluateSOGoMAPIDBObject: (SOGoCacheGCSObject *) object; @end -#endif /* EOQUALIFIER_MAPI_H */ +#endif /* EOQUALIFIER_CACHEOBJECT_H */ diff --git a/OpenChange/EOQualifier+MAPI.m b/SoObjects/SOGo/EOQualifier+SOGoCacheObject.m similarity index 83% rename from OpenChange/EOQualifier+MAPI.m rename to SoObjects/SOGo/EOQualifier+SOGoCacheObject.m index 81e77d833..f86f2a11c 100644 --- a/OpenChange/EOQualifier+MAPI.m +++ b/SoObjects/SOGo/EOQualifier+SOGoCacheObject.m @@ -1,8 +1,6 @@ -/* EOQualifier+MAPI.m - this file is part of SOGo +/* EOQualifier+SOGoCacheObject.m - this file is part of SOGo * - * Copyright (C) 2010-2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,11 +27,11 @@ #import #import "EOBitmaskQualifier.h" -#import "SOGoMAPIDBObject.h" +#import "SOGoCacheGCSObject.h" -#import "EOQualifier+MAPI.h" +#import "EOQualifier+SOGoCacheObject.h" -@implementation EOQualifier (MAPIStoreRestrictions) +@implementation EOQualifier (SOGoCacheObjectRestrictions) - (BOOL) _evaluateSOGoMAPIDBObject: (NSDictionary *) properties { @@ -41,7 +39,7 @@ return NO; } -- (BOOL) evaluateSOGoMAPIDBObject: (SOGoMAPIDBObject *) object +- (BOOL) evaluateSOGoMAPIDBObject: (SOGoCacheGCSObject *) object { NSDictionary *properties; BOOL rc; @@ -58,7 +56,7 @@ @end -@implementation EOAndQualifier (MAPIStoreRestrictionsPrivate) +@implementation EOAndQualifier (SOGoCacheRestrictionsPrivate) - (BOOL) _evaluateSOGoMAPIDBObject: (NSDictionary *) properties { @@ -76,7 +74,7 @@ @end -@implementation EOOrQualifier (MAPIStoreRestrictionsPrivate) +@implementation EOOrQualifier (SOGoCacheObjectRestrictionsPrivate) - (BOOL) _evaluateSOGoMAPIDBObject: (NSDictionary *) properties { @@ -94,7 +92,7 @@ @end -@implementation EONotQualifier (MAPIStoreRestrictionsPrivate) +@implementation EONotQualifier (SOGoCacheObjectRestrictionsPrivate) - (BOOL) _evaluateSOGoMAPIDBObject: (NSDictionary *) properties { @@ -103,7 +101,7 @@ @end -@implementation EOKeyValueQualifier (MAPIStoreRestrictionsPrivate) +@implementation EOKeyValueQualifier (SOGoCacheObjectRestrictionsPrivate) typedef BOOL (*EOComparator) (id, SEL, id); @@ -134,7 +132,7 @@ typedef BOOL (*EOComparator) (id, SEL, id); @end -@implementation EOBitmaskQualifier (MAPIStoreRestrictionsPrivate) +@implementation EOBitmaskQualifier (SOGoCacheObjectRestrictionsPrivate) - (BOOL) _evaluateSOGoMAPIDBObject: (NSDictionary *) properties { diff --git a/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.h b/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.h index 4caaca54b..d26c39e42 100644 --- a/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.h +++ b/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.h @@ -1,8 +1,6 @@ -/* GCSSpecialQueries+OpenChange.h - this file is part of SOGo +/* GCSSpecialQueries+SOGoCacheObject.h - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,15 +18,15 @@ * Boston, MA 02111-1307, USA. */ -#ifndef GCSSPECIALQUERIES_OPENCHANGE_H -#define GCSSPECIALQUERIES_OPENCHANGE_H +#ifndef GCSSPECIALQUERIES_SOGOCACHEOBJECT_H +#define GCSSPECIALQUERIES_SOGOCACHEOBJECT_H #import -@interface GCSSpecialQueries (OpenChangeHelpers) +@interface GCSSpecialQueries (SOGoCacheObject) - (NSString *) createOpenChangeFSTableWithName: (NSString *) tableName; @end -#endif /* GCSSPECIALQUERIES_OPENCHANGE_H */ +#endif /* GCSSPECIALQUERIES_SOGOCACHEOBJECT_H */ diff --git a/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.m b/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.m index 2e6376b15..ea6696d8d 100644 --- a/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.m +++ b/SoObjects/SOGo/GCSSpecialQueries+SOGoCacheObject.m @@ -1,8 +1,6 @@ -/* GCSSpecialQueries+OpenChange.m - this file is part of SOGo +/* GCSSpecialQueries+SOGoCacheObject.m - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,18 +20,18 @@ #import -#import "GCSSpecialQueries+OpenChange.h" +#import "GCSSpecialQueries+SOGoCacheObject.h" -@interface GCSPostgreSQLSpecialQueries (OpenChangeHelpers) +@interface GCSPostgreSQLSpecialQueries (SOGoObjectCache) @end -@interface GCSMySQLSpecialQueries (OpenChangeHelpers) +@interface GCSMySQLSpecialQueries (SOGoObjectCache) @end -@interface GCSOracleSpecialQueries (OpenChangeHelpers) +@interface GCSOracleSpecialQueries (SOGoObjectCache) @end -@implementation GCSSpecialQueries (OpenChangeHelpers) +@implementation GCSSpecialQueries (SOGoObjectCache) /* FIXME: c_parent_path should be indexed */ @@ -46,7 +44,7 @@ @end -@implementation GCSPostgreSQLSpecialQueries (OpenChangeHelpers) +@implementation GCSPostgreSQLSpecialQueries (SOGoObjectCache) - (NSString *) createOpenChangeFSTableWithName: (NSString *) tableName { @@ -66,7 +64,7 @@ @end -@implementation GCSMySQLSpecialQueries (OpenChangeHelpers) +@implementation GCSMySQLSpecialQueries (SOGoObjectCache) - (NSString *) createOpenChangeFSTableWithName: (NSString *) tableName { @@ -86,7 +84,7 @@ @end -@implementation GCSOracleSpecialQueries (OpenChangeHelpers) +@implementation GCSOracleSpecialQueries (SOGoObjectCache) - (NSString *) createOpenChangeFSTableWithName: (NSString *) tableName { diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index bf2948377..f1ee391bd 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -15,7 +15,14 @@ SOGo_HEADER_FILES = \ SOGoBuild.h \ SOGoProductLoader.h \ \ + BSONCodec.h \ + EOBitmaskQualifier.h \ + EOQualifier+SOGoCacheObject.h \ + GCSSpecialQueries+SOGoCacheObject.h \ SOGoCache.h \ + SOGoCacheGCSFolder.h \ + SOGoCacheGCSObject.h \ + SOGoCacheObject.h \ SOGoConstants.h \ SOGoObject.h \ SOGoContentObject.h \ @@ -80,7 +87,14 @@ SOGo_OBJC_FILES = \ SOGoBuild.m \ SOGoProductLoader.m \ \ + BSONCodec.m \ + EOBitmaskQualifier.m \ + EOQualifier+SOGoCacheObject.m \ + GCSSpecialQueries+SOGoCacheObject.m \ SOGoCache.m \ + SOGoCacheGCSFolder.m \ + SOGoCacheGCSObject.m \ + SOGoCacheObject.m \ SOGoConstants.m \ SOGoObject.m \ SOGoContentObject.m \ diff --git a/SoObjects/SOGo/SOGoCacheGCSFolder.h b/SoObjects/SOGo/SOGoCacheGCSFolder.h index 244e5a849..1b63ae683 100644 --- a/SoObjects/SOGo/SOGoCacheGCSFolder.h +++ b/SoObjects/SOGo/SOGoCacheGCSFolder.h @@ -1,8 +1,6 @@ -/* SOGoMAPIDBFolder.h - this file is part of SOGo +/* SOGoCacheGCSFolder.h - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +18,10 @@ * Boston, MA 02111-1307, USA. */ -#ifndef SOGOMAPIDBFOLDER_H -#define SOGOMAPIDBFOLDER_H +#ifndef SOGOCACHEGCSFOLDER_H +#define SOGOCACHEGCSFOLDER_H -#import "SOGoMAPIDBObject.h" +#import "SOGoCacheGCSObject.h" @class NSArray; @class NSMutableString; @@ -32,12 +30,10 @@ @class EOQualifier; -@class SOGoMAPIDBMessage; - -@interface SOGoMAPIDBFolder : SOGoMAPIDBObject +@interface SOGoCacheGCSFolder : SOGoCacheGCSObject { NSString *pathPrefix; /* for root folders */ - SOGoMAPIDBObject *aclMessage; + SOGoCacheGCSObject *aclMessage; } - (void) setPathPrefix: (NSString *) newPathPrefix; @@ -56,4 +52,4 @@ @end -#endif /* SOGOMAPIDBFOLDER_H */ +#endif /* SOGOCACHEGCSFOLDER_H */ diff --git a/SoObjects/SOGo/SOGoCacheGCSFolder.m b/SoObjects/SOGo/SOGoCacheGCSFolder.m index 41f5853b5..f8d25d381 100644 --- a/SoObjects/SOGo/SOGoCacheGCSFolder.m +++ b/SoObjects/SOGo/SOGoCacheGCSFolder.m @@ -1,8 +1,6 @@ -/* SOGoMAPIDBFolder.m - this file is part of SOGo +/* SOGoCacheGCSFolder.m - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,28 +36,27 @@ #import #import #import -#import "EOQualifier+MAPI.h" -#import "GCSSpecialQueries+OpenChange.h" -#import "SOGoMAPIDBMessage.h" +#import "EOQualifier+SOGoCacheObject.h" +#import "GCSSpecialQueries+SOGoCacheObject.h" -#import "SOGoMAPIDBFolder.h" +#import "SOGoCacheGCSFolder.h" #undef DEBUG -#include -#include -#include -#include -#include -#include -#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include -Class SOGoMAPIDBObjectK = Nil; +Class SOGoCacheGCSObjectK = Nil; -@implementation SOGoMAPIDBFolder +@implementation SOGoCacheGCSFolder + (void) initialize { - SOGoMAPIDBObjectK = [SOGoMAPIDBObject class]; + SOGoCacheGCSObjectK = [SOGoCacheGCSObject class]; } - (id) init @@ -77,7 +74,7 @@ Class SOGoMAPIDBObjectK = Nil; if ((self = [super initWithName: name inContainer: newContainer])) { objectType = MAPIFolderCacheObject; - aclMessage = [SOGoMAPIDBObject objectWithName: @"permissions" + aclMessage = [SOGoCacheGCSObject objectWithName: @"permissions" inContainer: self]; [aclMessage setObjectType: MAPIInternalCacheObject]; [aclMessage retain]; @@ -147,7 +144,7 @@ Class SOGoMAPIDBObjectK = Nil; NSArray *records; NSDictionary *record; NSUInteger childPathPrefixLen, count, max; - SOGoMAPIDBObject *currentChild; + SOGoCacheGCSObject *currentChild; /* query construction */ sql = [NSMutableString stringWithCapacity: 256]; @@ -181,7 +178,7 @@ Class SOGoMAPIDBObjectK = Nil; { if (qualifier) { - currentChild = [SOGoMAPIDBObject objectWithName: childKey + currentChild = [SOGoCacheGCSObject objectWithName: childKey inContainer: self]; [currentChild setupFromRecord: record]; if ([qualifier evaluateSOGoMAPIDBObject: currentChild]) @@ -361,7 +358,7 @@ Class SOGoMAPIDBObjectK = Nil; if ([[record objectForKey: @"c_type"] intValue] == MAPIFolderCacheObject) objectClass = isa; else - objectClass = SOGoMAPIDBObjectK; + objectClass = SOGoCacheGCSObjectK; object = [objectClass objectWithName: childName inContainer: self]; @@ -378,7 +375,7 @@ Class SOGoMAPIDBObjectK = Nil; { id object; - object = [SOGoMAPIDBFolder objectWithName: folderName + object = [SOGoCacheGCSFolder objectWithName: folderName inContainer: self]; [object reloadIfNeeded]; diff --git a/SoObjects/SOGo/SOGoCacheGCSObject.h b/SoObjects/SOGo/SOGoCacheGCSObject.h index a608da51a..cc7584198 100644 --- a/SoObjects/SOGo/SOGoCacheGCSObject.h +++ b/SoObjects/SOGo/SOGoCacheGCSObject.h @@ -1,8 +1,6 @@ -/* SOGoMAPIDBObject.h - this file is part of SOGo +/* SOGoCacheGCSObject.h - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +18,10 @@ * Boston, MA 02111-1307, USA. */ -#ifndef SOGOMAPIDBOBJECT_H -#define SOGOMAPIDBOBJECT_H +#ifndef SOGOCACHEGCSOBJECT_H +#define SOGOCACHEGCSOBJECT_H -#import "SOGoMAPIObject.h" +#import "SOGoCacheObject.h" @class NSArray; @class NSMutableDictionary; @@ -40,7 +38,7 @@ typedef enum { MAPIInternalCacheObject = 99 /* object = property list */ } SOGoCacheObjectType; -@interface SOGoMAPIDBObject : SOGoMAPIObject +@interface SOGoCacheGCSObject : SOGoCacheObject { NSURL *tableUrl; @@ -82,4 +80,4 @@ typedef enum { @end -#endif /* SOGOMAPIDBOBJECT_H */ +#endif /* SOGOCACHEGCSOBJECT_H */ diff --git a/SoObjects/SOGo/SOGoCacheGCSObject.m b/SoObjects/SOGo/SOGoCacheGCSObject.m index d137c7bc1..842e4c173 100644 --- a/SoObjects/SOGo/SOGoCacheGCSObject.m +++ b/SoObjects/SOGo/SOGoCacheGCSObject.m @@ -1,8 +1,6 @@ -/* SOGoMAPIDBObject.m - this file is part of SOGo +/* SOGoCacheGCSObject.m - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,16 +41,16 @@ #import #import -#import "GCSSpecialQueries+OpenChange.h" -#import "MAPIStoreTypes.h" -#import "SOGoMAPIDBFolder.h" +#import "GCSSpecialQueries+SOGoCacheObject.h" +//#import "MAPIStoreTypes.h" +#import "SOGoCacheGCSFolder.h" #import "BSONCodec.h" -#import "SOGoMAPIDBObject.h" +#import "SOGoCacheGCSObject.h" static EOAttribute *textColumn = nil; -@implementation SOGoMAPIDBObject +@implementation SOGoCacheGCSObject + (void) initialize { @@ -221,43 +219,6 @@ static EOAttribute *textColumn = nil; return deleted; } -- (Class) mapistoreMessageClass -{ - NSString *className, *mapiMsgClass; - - switch (objectType) - { - case MAPIMessageCacheObject: - mapiMsgClass = [properties - objectForKey: MAPIPropertyKey (PidTagMessageClass)]; - if (mapiMsgClass) - { - if ([mapiMsgClass isEqualToString: @"IPM.StickyNote"]) - className = @"MAPIStoreNotesMessage"; - else - className = @"MAPIStoreDBMessage"; - //[self logWithFormat: @"PidTagMessageClass = '%@', returning '%@'", - // mapiMsgClass, className]; - } - else - { - //[self warnWithFormat: @"PidTagMessageClass is not set, falling back" - // @" to 'MAPIStoreDBMessage'"]; - className = @"MAPIStoreDBMessage"; - } - break; - case MAPIFAICacheObject: - className = @"MAPIStoreFAIMessage"; - break; - default: - [NSException raise: @"MAPIStoreIOException" - format: @"message class should not be queried for objects" - @" of type '%d'", objectType]; - } - - return NSClassFromString (className); -} - /* actions */ - (void) setNameInContainer: (NSString *) newNameInContainer { diff --git a/SoObjects/SOGo/SOGoCacheObject.h b/SoObjects/SOGo/SOGoCacheObject.h index fbebaf641..0d0a78492 100644 --- a/SoObjects/SOGo/SOGoCacheObject.h +++ b/SoObjects/SOGo/SOGoCacheObject.h @@ -1,8 +1,6 @@ -/* SOGoMAPIObject.h - this file is part of SOGo +/* SOGoCacheObject.h - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,14 +18,14 @@ * Boston, MA 02111-1307, USA. */ -#ifndef SOGOMAPIOBJECT_H -#define SOGOMAPIOBJECT_H +#ifndef SOGOCACHEOBJECT_H +#define SOGOCACHEOBJECT_H #import @class NSMutableDictionary; -@interface SOGoMAPIObject : SOGoObject +@interface SOGoCacheObject : SOGoObject { BOOL isNew; NSMutableDictionary *properties; @@ -46,4 +44,4 @@ @end -#endif /* SOGOMAPIOBJECT_H */ +#endif /* SOGOCACHEOBJECT_H */ diff --git a/SoObjects/SOGo/SOGoCacheObject.m b/SoObjects/SOGo/SOGoCacheObject.m index 178202963..6842e148a 100644 --- a/SoObjects/SOGo/SOGoCacheObject.m +++ b/SoObjects/SOGo/SOGoCacheObject.m @@ -1,8 +1,6 @@ -/* SOGoMAPIObject.m - this file is part of SOGo +/* SOGoCacgeObject.m - this file is part of SOGo * - * Copyright (C) 2012 Inverse inc - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2012-2014 Inverse inc * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,9 +21,9 @@ #import #import -#import "SOGoMAPIObject.h" +#import "SOGoCacheObject.h" -@implementation SOGoMAPIObject +@implementation SOGoCacheObject - (id) init {