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

# Source Code for Module Products.ZenModel.OSComponent

      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 ManagedEntity import ManagedEntity
     12  from DeviceComponent import DeviceComponent
     13  from Products.ZenRelations.RelSchema import ToMany
     14
     15
     16 -class OSComponent(DeviceComponent, ManagedEntity):
     17      """
     18      Logical Operating System component like a Process, IpInterface, etc.
     19      """
     20      isUserCreatedFlag = False
     21
     22      _relations = ManagedEntity._relations + (
     23          ("links", ToMany(ToMany, "Products.ZenModel.Link", "endpoints")),
     24      )
     25
     26 -    def setUserCreateFlag(self):
     27          """
     28          Sets self.isUserCreatedFlag to True.  This indicated that the
     29          component was created by a user rather than via modelling.
     30          """
     31          self.isUserCreatedFlag = True
     32
     33
     34 -    def isUserCreated(self):
     35          """
     36          Returns the value of isUserCreated.  See setUserCreatedFlag() above.
     37          """
     38          return self.isUserCreatedFlag
     39
     40
     41 -    def device(self):
     42          """
     43          Return our device object for DeviceResultInt.
     44          """
     45          os = self.os()
     46          if os: return os.device()
     47
     48
     49 -    def manage_deleteComponent(self, REQUEST=None):
     50          """
     51          Delete OSComponent
     52          """
     53          url = None
     54          if REQUEST is not None:
     55              url = self.device().os.absolute_url()
     56          self.getPrimaryParent()._delObject(self.id)
     57          '''
     58          eventDict = {
     59              'eventClass': Change_Remove,
     60              'device': self.device().id,
     61              'component': self.id or '',
     62              'summary': 'Deleted by user: %s' % 'user',
     63              'severity': Event.Info,
     64              }
     65          self.dmd.ZenEventManager.sendEvent(eventDict)
     66          '''
     67          if REQUEST is not None:
     68              REQUEST['RESPONSE'].redirect(url)
     69
     70
     71 -    def manage_updateComponent(self, datamap, REQUEST=None):
     72          """
     73          Update OSComponent
     74          """
     75          url = None
     76          if REQUEST is not None:
     77              url = self.device().os.absolute_url()
     78          self.getPrimaryParent()._updateObject(self, datamap)
     79          '''
     80          eventDict = {
     81              'eventClass': Change_Set,
     82              'device': self.device().id,
     83              'component': self.id or '',
     84              'summary': 'Updated by user: %s' % 'user',
     85              'severity': Event.Info,
     86              }
     87          self.dmd.ZenEventManager.sendEvent(eventDict)
     88          '''
     89          if REQUEST is not None:
     90              REQUEST['RESPONSE'].redirect(url)
     91
     92
     93 -    def getPrettyLink(self):
     94          """
     95          Gets a link to this object, plus an icon
     96          """
     97          template = ("<a href='%s' class='prettylink'>"
     98                      "<div class='device-icon-container'> "
     99                      "<img class='device-icon' src='%s'/> "
    100                      "</div>%s</a>")
    101          icon = self.getIconPath()
    102          href = self.getPrimaryUrlPath()
    103          name = self.titleOrId()
    104          return template % (href, icon, name)
    105