/* Copyright (C) 2004 SKYRIX Software AG This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. OGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with OGo; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id: DSoHost.m 38 2004-06-16 12:45:03Z helge $ #include "DSoHost.h" #include "DSoAuthenticator.h" #include "DSoDatabaseManager.h" #include "DSoUserManager.h" #include "common.h" @implementation DSoHost + (id)dHostWithName:(NSString *)_key port:(int)_port { return [[[self alloc] initWithHostName:_key port:_port] autorelease]; } - (id)initWithHostName:(NSString *)_key port:(int)_port { if ((self = [super init])) { self->hostName = [_key copy]; self->port = _port > 0 ? _port : 5432; } return self; } - (void)dealloc { [self->hostName release]; [super dealloc]; } /* accessors */ - (NSString *)hostName { return self->hostName; } - (int)port { return self->port; } /* support */ - (EOAdaptor *)adaptorInContext:(WOContext *)_ctx { return [self adaptorForHostName:[self hostName] port:[self port] databaseName:nil inContext:_ctx]; } /* authentication */ - (id)authenticatorInContext:(id)_ctx { return [DSoAuthenticator authenticatorWithHostName:[self hostName] port:[self port]]; } /* names */ - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { /* We only need to deal with two fix keys here :-) */ if ([_key isEqualToString:@"Databases"]) return [[[DSoDatabaseManager alloc] initWithContainer:self] autorelease]; if ([_key isEqualToString:@"Users"]) return [[[DSoUserManager alloc] initWithContainer:self] autorelease]; return [super lookupName:_key inContext:_ctx acquire:_flag]; } @end /* DSoHost */