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 Acquisition import aq_base
17
18 from Products.ZenRelations.RelSchema import *
19 from Products.ZenUtils.Utils import prepId
20
21 from Service import Service
22
37
39 """Windows Service Class
40 """
41 portal_type = meta_type = 'WinService'
42
43 acceptPause = False
44 acceptStop = False
45 pathName = ""
46 serviceType = ""
47 startMode = ""
48 startName = ""
49 collectors = ('zenwin',)
50
51 _properties = Service._properties + (
52 {'id': 'acceptPause', 'type':'boolean', 'mode':'w'},
53 {'id': 'acceptStop', 'type':'boolean', 'mode':'w'},
54 {'id': 'pathName', 'type':'string', 'mode':'w'},
55 {'id': 'serviceType', 'type':'string', 'mode':'w'},
56 {'id': 'startMode', 'type':'string', 'mode':'w'},
57 {'id': 'startName', 'type':'string', 'mode':'w'},
58 )
59
60 _relations = Service._relations + (
61 ("os", ToOne(ToManyCont, "Products.ZenModel.OperatingSystem", "winservices")),
62 )
63
64 factory_type_information = (
65 {
66 'immediate_view' : 'winServiceDetail',
67 'actions' :
68 (
69 { 'id' : 'status'
70 , 'name' : 'Status'
71 , 'action' : 'winServiceDetail'
72 , 'permissions' : (
73 Permissions.view, )
74 },
75 { 'id' : 'manage'
76 , 'name' : 'Administration'
77 , 'action' : 'winServiceManage'
78 , 'permissions' : ("Manage DMD",)
79 },
80 { 'id' : 'viewHistory'
81 , 'name' : 'Modifications'
82 , 'action' : 'viewHistory'
83 , 'permissions' : (
84 Permissions.view, )
85 },
86 )
87 },
88 )
89
90 security = ClassSecurityInfo()
91
92
94 """Return some text that describes this component. Default is name.
95 """
96 return "'%s' StartMode:%s StartName:%s" % (self.caption(),
97 self.startMode, self.startName)
98
99
101 """Return a dict like one set by zenwinmodeler for services.
102 """
103 return {'name': self.name, 'description': self.description }
104
105
118
119
121 """Return the windows caption for this service.
122 """
123 svccl = self.serviceclass()
124 if svccl: return svccl.description
125 return ""
126 primarySortKey = caption
127
128 security.declareProtected('Manage DMD', 'manage_editService')
129 - def manage_editService(self, id=None, description=None,
130 acceptPause=None, acceptStop=None,
131 pathName=None, serviceType=None,
132 startMode=None, startName=None,
133 monitor=False, severity=5,
134 REQUEST=None):
156
157 InitializeClass(WinService)
158