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