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 as published by
     8  # 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              { 'id'          : 'viewHistory'
    67              , 'name'        : 'Modifications'
    68              , 'action'      : 'viewHistory'
    69              , 'permissions' : (ZEN_VIEW_MODIFICATIONS,)
    70              },
    71              ),
    72          },)
    73
    74      security = ClassSecurityInfo()
    75
    76
    77 -    def manage_editServiceClass(self, name="", monitor=False,
    78          serviceKeys="", port=0, description="", monitoredStartModes=[],
    79          REQUEST=None):
    80          """
    81          Edit a WinServiceClass.
    82          """
    83          if self.monitoredStartModes != monitoredStartModes:
    84              self.monitoredStartModes = monitoredStartModes
    85              for inst in self.instances():
    86                  inst._p_changed = True
    87
    88          return super(WinServiceClass, self).manage_editServiceClass(
    89              name, monitor, serviceKeys, port, description, REQUEST)
    90
    91
    92  InitializeClass(WinServiceClass)
    93