1
2
3
4
5
6
7
8
9
10
11
12
13
14 from Globals import InitializeClass
15 from AccessControl import ClassSecurityInfo, Permissions
16 from Products.ZenModel.ZenossSecurity import *
17
18 from Products.ZenRelations.RelSchema import *
19 from Products.ZenUtils.Utils import prepId
20 from Products.ZenWidgets import messaging
21
22 from Service import Service
23
38
39
41 """Windows Service Class
42 """
43 portal_type = meta_type = 'WinService'
44
45 acceptPause = False
46 acceptStop = False
47 pathName = ""
48 serviceType = ""
49 startMode = ""
50 startName = ""
51 collectors = ('zenwin',)
52
53 _properties = Service._properties + (
54 {'id': 'acceptPause', 'type':'boolean', 'mode':'w'},
55 {'id': 'acceptStop', 'type':'boolean', 'mode':'w'},
56 {'id': 'pathName', 'type':'string', 'mode':'w'},
57 {'id': 'serviceType', 'type':'string', 'mode':'w'},
58 {'id': 'startMode', 'type':'string', 'mode':'w'},
59 {'id': 'startName', 'type':'string', 'mode':'w'},
60 )
61
62 _relations = Service._relations + (
63 ("os", ToOne(ToManyCont, "Products.ZenModel.OperatingSystem", "winservices")),
64 )
65
66 factory_type_information = (
67 {
68 'immediate_view' : 'winServiceDetail',
69 'actions' :
70 (
71 { 'id' : 'status'
72 , 'name' : 'Status'
73 , 'action' : 'winServiceDetail'
74 , 'permissions' : (
75 Permissions.view, )
76 },
77 { 'id' : 'events'
78 , 'name' : 'Events'
79 , 'action' : 'viewEvents'
80 , 'permissions' : (ZEN_VIEW, )
81 },
82 { 'id' : 'manage'
83 , 'name' : 'Administration'
84 , 'action' : 'winServiceManage'
85 , 'permissions' : ("Manage DMD",)
86 },
87 { 'id' : 'viewHistory'
88 , 'name' : 'Modifications'
89 , 'action' : 'viewHistory'
90 , 'permissions' : (ZEN_VIEW_MODIFICATIONS,)
91 },
92 )
93 },
94 )
95
96 security = ClassSecurityInfo()
97
98
100 """Return some text that describes this component. Default is name.
101 """
102 return "'%s' StartMode:%s StartName:%s" % (self.caption(),
103 self.startMode, self.startName)
104
112
114 """Return a dict like one set by zenwinmodeler for services.
115 """
116 desc = self.description
117 if not desc:
118 svccl = self.serviceclass()
119 if svccl: desc = svccl.description
120 return {'name': self.name(), 'description': desc }
121
122
133
134
136 """Return the windows caption for this service.
137 """
138 svccl = self.serviceclass()
139 if svccl: return svccl.description
140 return ""
141 primarySortKey = caption
142
143 security.declareProtected('Manage DMD', 'manage_editService')
144 - def manage_editService(self, id=None, description=None,
145 acceptPause=None, acceptStop=None,
146 pathName=None, serviceType=None,
147 startMode=None, startName=None,
148 monitor=False, severity=5,
149 REQUEST=None):
174
175 InitializeClass(WinService)
176