2004-06-30 Helge Hess <helge.hess@opengroupware.org>
+ * GNUmakefile (libOGoContentStore_HEADER_FILES_INSTALL_DIR): install
+ headers in OGoContentStore
+
* GNUmakefile.preamble (ocs_ls_TOOL_LIBS): added static dependencies
for OSX
LIBRARY_NAME = libOGoContentStore
TOOL_NAME = ocs_ls ocs_mkdir ocs_cat
+libOGoContentStore_HEADER_FILES_DIR = .
+libOGoContentStore_HEADER_FILES_INSTALL_DIR = /OGoContentStore
+
libOGoContentStore_HEADER_FILES += \
NSURL+OCS.h \
EOAdaptorChannel+OCS.h \
/* name lookup */
+- (BOOL)isValidAppointmentName:(NSString *)_key {
+ if ([_key length] == 0)
+ return NO;
+
+ return YES;
+}
+
+- (id)appointmentWithName:(NSString *)_key inContext:(id)_ctx {
+ static Class aptClass = Nil;
+ id apt;
+
+ if (aptClass == Nil)
+ aptClass = NSClassFromString(@"SOGoAppointmentObject");
+ if (aptClass == Nil) {
+ [self logWithFormat:@"ERROR: missing SOGoAppointmentObject class!"];
+ return nil;
+ }
+
+ apt = [[aptClass alloc] initWithName:_key inContainer:self];
+ return [apt autorelease];
+}
+
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
id obj;
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
return obj;
-
- [self logWithFormat:@"CHECK KEY: %@", _key];
+
+ if ([self isValidAppointmentName:_key])
+ return [self appointmentWithName:_key inContext:_ctx];
/* return 404 to stop acquisition */
return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
#include <SOGo/SOGoObject.h>
+@class NSString;
+
@interface SOGoContentObject : SOGoObject
{
NSString *ocsPath;
- (void)setOCSPath:(NSString *)_path;
- (NSString *)ocsPath;
+- (NSString *)ocsPathOfContainer;
+
+- (OCSFolder *)ocsFolder;
+
@end
#endif /* __SOGo_SOGoContentObject_H__ */
ASSIGNCOPY(self->ocsPath, _path);
}
+
- (NSString *)ocsPath {
+ if (self->ocsPath == nil) {
+ NSString *p;
+
+ if ((p = [self ocsPathOfContainer]) != nil) {
+ if (![p hasSuffix:@"/"]) p = [p stringByAppendingString:@"/"];
+ p = [p stringByAppendingString:[self nameInContainer]];
+ self->ocsPath = [p copy];
+ }
+ }
return self->ocsPath;
}
+- (NSString *)ocsPathOfContainer {
+ if (![[self container] respondsToSelector:@selector(ocsPath)])
+ return nil;
+
+ return [[self container] ocsPath];
+}
+
+- (OCSFolder *)ocsFolder {
+ if (![[self container] respondsToSelector:@selector(ocsFolder)])
+ return nil;
+
+ return [[self container] ocsFolder];
+}
+
/* description */
- (void)appendAttributesToDescription:(NSMutableString *)_ms {
#include <SOGo/SOGoObject.h>
+@class OCSFolder;
+
@interface SOGoFolder : SOGoObject
{
NSString *ocsPath;
- (void)setOCSPath:(NSString *)_Path;
- (NSString *)ocsPath;
+- (OCSFolder *)ocsFolder;
+
@end
#endif /* __SOGo_SOGoFolder_H__ */
#include "SOGoFolder.h"
#include "common.h"
+#include <OGoContentStore/OCSFolderManager.h>
+#include <OGoContentStore/OCSFolder.h>
@implementation SOGoFolder
- (void)dealloc {
- [self->ocsPath release];
+ [self->ocsFolder release];
+ [self->ocsPath release];
[super dealloc];
}
return self->ocsPath;
}
+- (OCSFolderManager *)folderManager {
+ return [OCSFolderManager defaultFolderManager];
+}
+- (OCSFolder *)ocsFolder {
+ if (self->ocsFolder != nil)
+ return [self->ocsFolder isNotNull] ? self->ocsFolder : nil;
+
+ self->ocsFolder =
+ [[[self folderManager] folderAtPath:[self ocsPath]] retain];
+ return self->ocsFolder;
+}
+
/* description */
- (void)appendAttributesToDescription:(NSMutableString *)_ms {
if (calClass == Nil)
calClass = NSClassFromString(@"SOGoAppointmentFolder");
if (calClass == Nil) {
- [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder!"];
+ [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder class!"];
return nil;
}