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
105
107 """Return a dict like one set by zenwinmodeler for services.
108 """
109 desc = self.description
110 if not desc:
111 svccl = self.serviceclass()
112 if svccl: desc = svccl.description
113 return {'name': self.name(), 'description': desc }
114
115
126
127
129 """Return the windows caption for this service.
130 """
131 svccl = self.serviceclass()
132 if svccl: return svccl.description
133 return ""
134 primarySortKey = caption
135
136 security.declareProtected('Manage DMD', 'manage_editService')
137 - def manage_editService(self, id=None, description=None,
138 acceptPause=None, acceptStop=None,
139 pathName=None, serviceType=None,
140 startMode=None, startName=None,
141 monitor=False, severity=5,
142 REQUEST=None):
167
168 InitializeClass(WinService)
169