]> err.no Git - scalable-opengroupware.org/blob - OGoContentStore/ocs_ls.m
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@66 d1b88da0-ebda-0310-925b-ed51d8...
[scalable-opengroupware.org] / OGoContentStore / ocs_ls.m
1 // $Id$
2
3 #include <OGoContentStore/OCSFolderManager.h>
4 #include "common.h"
5
6 @interface Tool : NSObject
7 {
8   OCSFolderManager *folderManager;
9 }
10
11 + (int)run;
12
13 @end
14
15 @implementation Tool
16
17 - (id)init {
18   if ((self = [super init])) {
19     self->folderManager = [[OCSFolderManager defaultFolderManager] retain];
20   }
21   return self;
22 }
23 - (void)dealloc {
24   [self->folderManager release];
25   [super dealloc];
26 }
27
28 /* operation */
29
30 - (int)run {
31   [self logWithFormat:@"manager: %@", self->folderManager];
32
33   if (![self->folderManager canConnect]) {
34     [self logWithFormat:@"cannot connect folder-info database!"];
35     return 1;
36   }
37   
38   return 0;
39 }
40 + (int)run {
41   return [(Tool *)[[[self alloc] init] autorelease] run];
42 }
43
44 @end /* Tool */
45
46 int main(int argc, char **argv, char **env) {
47   NSAutoreleasePool *pool;
48   int rc;
49
50   pool = [[NSAutoreleasePool alloc] init];
51 #if LIB_FOUNDATION_LIBRARY  
52   [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
53 #endif
54
55   rc = [Tool run];
56   
57   [pool release];
58   return rc;
59 }