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

# Source Code for Module Products.ZenModel.WinServiceClass

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2010, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  from Globals import InitializeClass
    12  from AccessControl import ClassSecurityInfo
    13
    14  from Products.ZenModel.ZenossSecurity import *
    15  from Products.ZenModel.ServiceClass import ServiceClass
    16
    17
    18  STARTMODE_AUTO = 'Auto'
    19  STARTMODE_MANUAL = 'Manual'
    20  STARTMODE_DISABLED = 'Disabled'
    21  STARTMODE_NOTINSTALLED = 'Not Installed'
    22
    23
    24 -class WinServiceClass(ServiceClass):
    25      """
    26      Extends ServiceClass to add properties specific to Windows services.
    27      """
    28
    29      monitoredStartModes = [STARTMODE_AUTO]
    30
    31      _properties = ServiceClass._properties + (
    32          {'id': 'monitoredStartModes', 'type':'lines', 'mode':'rw'},
    33          )
    34
    35      factory_type_information = ({
    36          'id'             : 'WinServiceClass',
    37          'meta_type'      : 'WinServiceClass',
    38          'icon'           : 'WinServiceClass.gif',
    39          'product'        : 'ZenModel',
    40          'factory'        : 'manage_addWinServiceClass',
    41          'immediate_view' : 'winServiceClassStatus',
    42          'actions': (
    43              { 'id'          : 'status'
    44              , 'name'        : 'Status'
    45              , 'action'      : 'winServiceClassStatus'
    46              , 'permissions' : (ZEN_VIEW,),
    47              },
    48              { 'id'          : 'edit'
    49              , 'name'        : 'Edit'
    50              , 'action'      : 'winServiceClassEdit'
    51              , 'permissions' : (ZEN_MANAGE_DMD,),
    52              },
    53              { 'id'          : 'manage'
    54              , 'name'        : 'Administration'
    55              , 'action'      : 'serviceClassManage'
    56              , 'permissions' : (ZEN_MANAGE_DMD,)
    57              },
    58              { 'id'          : 'zproperties'
    59              , 'name'        : 'Configuration Properties'
    60              , 'action'      : 'zPropertyEdit'
    61              , 'permissions' : (ZEN_CHANGE_DEVICE,)
    62              },
    63              ),
    64          },)
    65
    66      security = ClassSecurityInfo()
    67
    68
    69 -    def manage_editServiceClass(self, name="", monitor=False,
    70          serviceKeys="", port=0, description="", monitoredStartModes=[],
    71          REQUEST=None):
    72          """
    73          Edit a WinServiceClass.
    74          """
    75          if self.monitoredStartModes != monitoredStartModes:
    76              self.monitoredStartModes = monitoredStartModes
    77              for inst in self.instances():
    78                  inst._p_changed = True
    79
    80          return super(WinServiceClass, self).manage_editServiceClass(
    81              name, monitor, serviceKeys, port, description, REQUEST)
    82
    83
    84  InitializeClass(WinServiceClass)
    85