Package ZenRelations :: Module RelSchema
[hide private]
[frames] | no frames]

Source Code for Module ZenRelations.RelSchema

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  __doc__="""$Id: ToManyRelationship.py,v 1.48 2003/11/12 22:05:48 edahl Exp $""" 
15   
16  __version__ = "$Revision: 1.48 $"[11:-2] 
17   
18   
19  RELMETATYPES = ( 
20      'ToOneRelationship', 'ToManyContRelationship', 'ToManyRelationship') 
21   
22 -class RelSchema:
23
24 - def __init__(self, remoteType, remoteClass, remoteName):
28
29 - def createRelation(self, name):
30 return self._relationClass(name)
31
32 - def checkType(self, relationship):
33 """Check that a relationship instance is of correct type""" 34 return isinstance(relationship, self._relationClass)
35 36
37 -class ToOne(RelSchema):
38 from ToOneRelationship import ToOneRelationship 39 _relationClass = ToOneRelationship
40
41 -class ToMany(RelSchema):
42 from ToManyRelationship import ToManyRelationship 43 _relationClass = ToManyRelationship
44
45 -class ToManyCont(RelSchema):
46 from ToManyContRelationship import ToManyContRelationship 47 _relationClass = ToManyContRelationship
48