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

# Source Code for Module Products.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 or (at your
     8  # option) any later version as published by 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):
    25          self.remoteType = remoteType
    26          self.remoteClass = remoteClass
    27          self.remoteName = 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