Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 101 lines (80 sloc) 2.332 kb
0c33d97 @jonasf73 First import
authored
1 //
2 // DUServiceInterface.m
3 // DNSUpdate2
4 //
5 // Created by Julien Jalon on Mon Feb 11 2002.
6 // Copyright (c) 2001-2003 Julien Jalon. All rights reserved.
7 //
8
9 #import "DUServiceInterface.h"
10
11 NSMutableDictionary *_Interfaces=nil;
12
13 @implementation DUServiceInterface
14
15 + (void)registerServiceInterface:(DUServiceInterface *)theInterface {
16 [DUServiceInterface serviceInterfaces];
17 [_Interfaces setObject:theInterface forKey:[theInterface getServiceName]];
18 NSLog(@"Registering service %@",[theInterface getServiceName]);
19 }
20
21 + (NSDictionary *)serviceInterfaces {
22 if(_Interfaces==nil) {
23 _Interfaces=[[NSMutableDictionary alloc] initWithCapacity:1];
24 }
25 return _Interfaces;
26 }
27
28 + (DUServiceInterface *)getServiceInterfaceFor:(NSString *)theName {
29 return [_Interfaces objectForKey:theName];
30 }
31
32 + (void)registerService
33 {
34 [DUServiceInterface registerServiceInterface:[[[self alloc] init] autorelease]];
35 }
36
37 - init {
38 duServiceUserView=nil;
39 duServiceHostView=nil;
40 return [super init];
41 }
42
43 - (NSString *)getServiceName {
44 return nil; // Must be implemented by subclass
45 }
46
47 - (void)_loadInterface {
48 NSLog(@"Loading interface for %@",[self getServiceName]);
49 [NSBundle loadNibNamed:[self getServiceName] owner:self];
50 duServiceUserView=[duServiceUserView contentView];
51 duServiceHostView=[duServiceHostView contentView];
52 [[duServiceUserView retain] removeFromSuperview];
53 [[duServiceHostView retain] removeFromSuperview];
54 }
55
56 - (NSView *)serviceUserView {
57 if(!duServiceUserView) {
58 [self _loadInterface];
59 }
60 return duServiceUserView;
61 }
62
63 - (NSView *)serviceHostView {
64 if(!duServiceHostView) {
65 [self _loadInterface];
66 }
67 return duServiceHostView;
68 }
69
70 - (void)dealloc {
71 [duServiceHostView release];
72 [duServiceUserView release];
73 [super dealloc];
74 }
75
76 - (void)validateUser:(DUUser *)theUser {
77 // Must be implemented by subclass
78 }
79
80 - (void)validateHost:(DUHost *)theHost {
81 // Must be implemented by subclass
82 }
83
84 - (void)prepareHostViewForHost:(DUHost *)DUHost {
85 // Must be implemented by subclass
86 }
87
88 - (void)prepareUserViewForUser:(DUUser *)DUUser {
89 // Must be implemented by subclass
90 }
91
92 - (void)clearHostView {
93 // Must be implemented by subclass
94 }
95
96 - (void)clearUserView {
97 // Must be implemented by subclass
98 }
99
100 @end
Something went wrong with that request. Please try again.