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

# Source Code for Package Products.ZenRelations

     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  __doc__="""__init__
    14
    15  Initialize the RelationshipManager Product
    16
    17  $Id: __init__.py,v 1.9 2002/12/06 14:25:57 edahl Exp $"""
    18
    19  __version__ = "$Revision: 1.9 $"[11:-2]
    20
    21  import logging
    22
    23  from RelationshipManager import RelationshipManager, addRelationshipManager, \
    24                                  manage_addRelationshipManager
    25  from ToOneRelationship import ToOneRelationship, addToOneRelationship, \
    26                                  manage_addToOneRelationship
    27  from ToManyRelationship import ToManyRelationship, addToManyRelationship, \
    28                                  manage_addToManyRelationship
    29  from ToManyContRelationship import ToManyContRelationship, \
    30                                  addToManyContRelationship, \
    31                                  manage_addToManyContRelationship
    32  from Products.ZenRelations.ZenPropertyManager import setDescriptors
    33
    34  log = logging.getLogger("zen.ZenRelations")
    35
    36 -def initialize(registrar):
    37      registrar.registerClass(
    38          RelationshipManager,
    39          constructors = (addRelationshipManager, manage_addRelationshipManager))
    40      registrar.registerBaseClass(RelationshipManager)
    41      registrar.registerClass(
    42          ToOneRelationship,
    43          constructors = (addToOneRelationship, manage_addToOneRelationship),
    44          icon = 'www/ToOneRelationship_icon.gif')
    45      registrar.registerClass(
    46          ToManyRelationship,
    47          constructors = (addToManyRelationship, manage_addToManyRelationship),
    48          icon = 'www/ToManyRelationship_icon.gif')
    49      registrar.registerClass(
    50          ToManyContRelationship,
    51          constructors = (addToManyContRelationship,
    52                          manage_addToManyContRelationship),
    53          icon = 'www/ToManyContRelationship_icon.gif')
    54      app = registrar._ProductContext__app
    55      try:
    56          zport = app.zport
    57          dmd = zport.dmd
    58          setDescriptors(dmd.propertyTransformers)
    59      except Exception, e:
    60          args = (e.__class__.__name__, e)
    61          log.error("Unable to set property descriptors: %s: %s", *args)
    62