2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "DSoDatabase.h"
25 #include "DSoAuthenticator.h"
28 // TODO: PG databases do have an owner!
29 // TODO: PG databases have an ACL
31 @implementation DSoDatabase
33 - (id)initWithHostName:(NSString *)_hostname port:(int)_port
34 databaseName:(NSString *)_dbname
36 if ((self = [super init])) {
37 self->hostName = [_hostname copy];
38 self->databaseName = [_dbname copy];
39 self->port = _port > 0 ? _port : 5432;
45 [self->databaseName release];
46 [self->hostName release];
52 - (NSString *)hostName {
53 return self->hostName;
59 - (NSString *)databaseName {
60 return self->databaseName;
63 // TODO: add baseURL generation
67 - (EOAdaptor *)adaptorInContext:(WOContext *)_ctx {
68 return [self adaptorForHostName:[self hostName] port:[self port]
69 databaseName:[self databaseName] inContext:_ctx];
74 - (id)authenticatorInContext:(id)_ctx {
75 return [DSoAuthenticator authenticatorWithHostName:[self hostName]
76 port:[self port] databaseName:[self databaseName]];
81 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
85 Note: acquire:NO - otherwise acquired stuff will override the stuff
88 if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
91 obj = [[DSoTable alloc] initWithName:_key inContainer:self];
92 return [obj autorelease];
95 @end /* DSoDatabase */