Package Products :: Package ZenModel :: Module Linkable |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.Linkable

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  from Products.CMFCore.utils import getToolByName
    12
    13 -class Linkable:
    14      """ A mixin allowing an object to be the
    15          endpoint of a Link object.
    16      """
    17
    18 -    def _getLinkCatalog(self):
    19          try:
    20              return getToolByName(self.dmd.ZenLinkManager, self.link_catalog)
    21          except AttributeError:
    22              return None
    23
    24 -    def index_links(self):
    25          cat = self._getLinkCatalog()
    26          if cat is not None:
    27              cat.catalog_object(self, self.getPrimaryId())
    28
    29 -    def unindex_links(self):
    30          cat = self._getLinkCatalog()
    31          if cat is not None:
    32              cat.uncatalog_object(self.getPrimaryId())
    33
    34
    35 -class Layer2Linkable(Linkable):
    36
    37      link_catalog = "layer2_catalog"
    38
    39 -    def deviceId(self): raise NotImplementedError
    40 -    def interfaceId(self): raise NotImplementedError
    41 -    def macaddress(self): raise NotImplementedError
    42 -    def lanId(self): raise NotImplementedError
    43
    44
    45 -class Layer3Linkable(Linkable):
    46
    47      link_catalog = "layer3_catalog"
    48
    49 -    def deviceId(self): raise NotImplementedError
    50 -    def ipAddressId(self): raise NotImplementedError
    51 -    def networkId(self): raise NotImplementedError
    52 -    def interfaceId(self): raise NotImplementedError
    53