]> err.no Git - sope/blob - sope-core/EOControl/EODataSource.m
map Java-like class names
[sope] / sope-core / EOControl / EODataSource.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE 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
9   later version.
10
11   SOPE 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.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #include <EOControl/EODataSource.h>
23 #include <EOControl/EOClassDescription.h>
24 #include "common.h"
25
26 @implementation EODataSource
27
28 + (int)version {
29   return 1;
30 }
31
32 /* reflection */
33
34 - (EOClassDescription *)classDescriptionForObjects {
35   return nil;
36 }
37
38 /* master-detail */
39
40 - (EODataSource *)dataSourceQualifiedByKey:(NSString *)_relKey {
41   [NSException raise:@"NSInvalidArgumentException"
42                format:@"datasource %@ can't return a ds qualified by key '%@'",
43                  self, _relKey];
44   return nil;
45 }
46
47 - (void)qualifyWithRelationshipKey:(NSString *)_relKey ofObject:(id)_object {
48   [NSException raise:@"NSInvalidArgumentException"
49                format:@"datasource %@ can't qualify by key '%@' of object %@",
50                  self, _relKey, _object];
51 }
52
53 /* operations */
54
55 - (NSArray *)fetchObjects {
56   return nil;
57 }
58 - (NSEnumerator *)fetchEnumerator {
59   return [[self fetchObjects] objectEnumerator];
60 }
61
62 - (void)deleteObject:(id)_object {
63   [NSException raise:@"NSInvalidArgumentException"
64                format:@"datasource %@ can't delete object %@",
65                  self, _object];
66 }
67
68 - (void)insertObject:(id)_object {
69   [NSException raise:@"NSInvalidArgumentException"
70                format:@"datasource %@ can't insert object %@",
71                  self, _object];
72 }
73
74 - (id)createObject {
75   EOClassDescription *cd;
76   
77   if ((cd = [self classDescriptionForObjects]) == nil)
78     return nil;
79   
80   return [cd createInstanceWithEditingContext:nil globalID:nil zone:NULL];
81 }
82
83 @end /* EODataSource */