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

Source Code for Module Products.ZenModel.WinServiceClass

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2010, 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 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  from Globals import InitializeClass 
15  from AccessControl import ClassSecurityInfo 
16   
17  from Products.ZenModel.ZenossSecurity import * 
18  from Products.ZenModel.ServiceClass import ServiceClass 
19   
20   
21  STARTMODE_AUTO = 'Auto' 
22  STARTMODE_MANUAL = 'Manual' 
23  STARTMODE_DISABLED = 'Disabled' 
24  STARTMODE_NOTINSTALLED = 'Not Installed' 
25   
26   
27 -class WinServiceClass(ServiceClass):
28 """ 29 Extends ServiceClass to add properties specific to Windows services. 30 """ 31 32 monitoredStartModes = [STARTMODE_AUTO] 33 34 _properties = ServiceClass._properties + ( 35 {'id': 'monitoredStartModes', 'type':'lines', 'mode':'rw'}, 36 ) 37 38 factory_type_information = ({ 39 'id' : 'WinServiceClass', 40 'meta_type' : 'WinServiceClass', 41 'icon' : 'WinServiceClass.gif', 42 'product' : 'ZenModel', 43 'factory' : 'manage_addWinServiceClass', 44 'immediate_view' : 'winServiceClassStatus', 45 'actions': ( 46 { 'id' : 'status' 47 , 'name' : 'Status' 48 , 'action' : 'winServiceClassStatus' 49 , 'permissions' : (ZEN_VIEW,), 50 }, 51 { 'id' : 'edit' 52 , 'name' : 'Edit' 53 , 'action' : 'winServiceClassEdit' 54 , 'permissions' : (ZEN_MANAGE_DMD,), 55 }, 56 { 'id' : 'manage' 57 , 'name' : 'Administration' 58 , 'action' : 'serviceClassManage' 59 , 'permissions' : (ZEN_MANAGE_DMD,) 60 }, 61 { 'id' : 'zproperties' 62 , 'name' : 'Configuration Properties' 63 , 'action' : 'zPropertyEdit' 64 , 'permissions' : (ZEN_CHANGE_DEVICE,) 65 }, 66 ), 67 },) 68 69 security = ClassSecurityInfo() 70 71
72 - def manage_editServiceClass(self, name="", monitor=False, 73 serviceKeys="", port=0, description="", monitoredStartModes=[], 74 REQUEST=None):
75 """ 76 Edit a WinServiceClass. 77 """ 78 if self.monitoredStartModes != monitoredStartModes: 79 self.monitoredStartModes = monitoredStartModes 80 for inst in self.instances(): 81 inst._p_changed = True 82 83 return super(WinServiceClass, self).manage_editServiceClass( 84 name, monitor, serviceKeys, port, description, REQUEST)
85 86 87 InitializeClass(WinServiceClass) 88