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

Source Code for Module ZenModel.OSComponent

  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  from Linkable import Linkable 
 15  from ManagedEntity import ManagedEntity 
 16  from DeviceComponent import DeviceComponent 
 17   
 18   
19 -class OSComponent(DeviceComponent, ManagedEntity, Linkable):
20 """ 21 Logical Operating System component like a Process, IpInterface, etc. 22 """ 23 isUserCreatedFlag = False 24 25 _relations = ManagedEntity._relations + Linkable._relations 26
27 - def setUserCreateFlag(self):
29
30 - def isUserCreated(self):
31 return self.isUserCreatedFlag
32
33 - def device(self):
34 """Return our device object for DeviceResultInt. 35 """ 36 os = self.os() 37 if os: return os.device()
38
39 - def manage_deleteComponent(self, REQUEST=None):
40 """ 41 Delete OSComponent 42 """ 43 url = None 44 if REQUEST is not None: 45 url = self.device().os.absolute_url() 46 self.getPrimaryParent()._delObject(self.id) 47 ''' 48 eventDict = { 49 'eventClass': Change_Remove, 50 'device': self.device().id, 51 'component': self.id or '', 52 'summary': 'Deleted by user: %s' % 'user', 53 'severity': Event.Info, 54 } 55 self.dmd.ZenEventManager.sendEvent(eventDict) 56 ''' 57 if REQUEST is not None: 58 REQUEST['RESPONSE'].redirect(url)
59
60 - def manage_updateComponent(self, datamap, REQUEST=None):
61 """ 62 Update OSComponent 63 """ 64 url = None 65 if REQUEST is not None: 66 url = self.device().os.absolute_url() 67 self.getPrimaryParent()._updateObject(self, datamap) 68 ''' 69 eventDict = { 70 'eventClass': Change_Set, 71 'device': self.device().id, 72 'component': self.id or '', 73 'summary': 'Updated by user: %s' % 'user', 74 'severity': Event.Info, 75 } 76 self.dmd.ZenEventManager.sendEvent(eventDict) 77 ''' 78 if REQUEST is not None: 79 REQUEST['RESPONSE'].redirect(url)
80
81 - def getEndpointName(self):
82 """ Implement the Linkable interface for 83 naming endpoints. See Linkable.py. 84 """ 85 return "%s/%s" % (self.device().getId(), self.id)
86
87 - def isInLocation(self, context):
88 """ Implement the Linkable interface for 89 checking Location. See Linkable.py. 90 """ 91 here = self.device().getLocationName() 92 return here.startswith(context.getLocationName())
93
94 - def getIconPath(self):
95 """ Override the device's zProperty and return 96 an icon based on the class name 97 """ 98 return "/zport/dmd/img/icons/%s.png" % self.meta_type.lower()
99
110