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

# Source Code for Module Products.ZenModel.IpServiceClass

      1  ###########################################################################
      2  #
      3  # This program is part of Zenoss Core, an open source monitoring platform.
      4  # Copyright (C) 2007, 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 DTMLFile
     15  from Globals import InitializeClass
     16
     17  from AccessControl import Permissions
     18  from AccessControl import ClassSecurityInfo
     19  from Products.ZenModel.ZenossSecurity import *
     20
     21  from Products.ZenRelations.RelSchema import *
     22
     23  from ServiceClass import ServiceClass
     24
     25
     26 -def manage_addIpServiceClass(context, id, REQUEST = None):
     27      """make a device"""
     28      ipsc = IpServiceClass(id)
     29      context._setObject(ipsc.id, ipsc)
     30      if REQUEST is not None:
     31          REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
     32      return ipsc.id
     33
     34
     35  addIpServiceClass = DTMLFile('dtml/addIpServiceClass',globals())
     36
     37 -class IpServiceClass(ServiceClass):
     38      """IpServiceClass object.
     39      """
     40      __pychecker__='no-override'
     41
     42      sendString = ""
     43      expectRegex = ""
     44
     45      portal_type = meta_type = 'IpServiceClass'
     46
     47      _properties = ServiceClass._properties + (
     48          {'id':'sendString', 'type':'string', 'mode':'w'},
     49          {'id':'expectRegex', 'type':'string', 'mode':'w'},
     50          )
     51
     52      factory_type_information = (
     53          {
     54              'immediate_view' : 'ipServiceClassStatus',
     55              'actions'        :
     56              (
     57                  { 'id'            : 'status'
     58                  , 'name'          : 'Status'
     59                  , 'action'        : 'ipServiceClassStatus'
     60                  , 'permissions'   : (
     61                    Permissions.view, )
     62                  },
     63                  { 'id'            : 'edit'
     64                  , 'name'          : 'Edit'
     65                  , 'action'        : 'ipServiceClassEdit'
     66                  , 'permissions'   : ("Manage DMD", )
     67                  },
     68                  { 'id'            : 'manage'
     69                  , 'name'          : 'Administration'
     70                  , 'action'        : 'ipServiceClassManage'
     71                  , 'permissions'   : ("Manage DMD",)
     72                  },
     73                  { 'id'            : 'zproperties'
     74                  , 'name'          : 'zProperties'
     75                  , 'action'        : 'zPropertyEdit'
     76                  , 'permissions'   : ("Change Device",)
     77                  },
     78                  { 'id'            : 'viewHistory'
     79                  , 'name'          : 'Modifications'
     80                  , 'action'        : 'viewHistory'
     81                  , 'permissions'   : (ZEN_VIEW_MODIFICATIONS,)
     82                  },
     83              )
     84           },
     85          )
     86
     87      security = ClassSecurityInfo()
     88
     89 -    def __init__(self, id, serviceKeys=(), description="", port=0):
     90          ServiceClass.__init__(self, id, serviceKeys, description)
     91          self._updateProperty('port', port)
     92
     93
     94      security.declareProtected('Manage DMD', 'manage_editServiceClass')
     95 -    def manage_editServiceClass(self, name="", monitor=False, serviceKeys="",
     96                                 port=0, description="", sendString="",
     97                                 expectRegex="", REQUEST=None):
     98          """
     99          Edit a ProductClass from a web page.
    100          """
    101          self.sendString = sendString
    102          self.expectRegex = expectRegex
    103          return super(IpServiceClass,self).manage_editServiceClass(
    104                                  name, monitor, serviceKeys,
    105                                  port, description, REQUEST=REQUEST)
    106
    107
    108
    109  InitializeClass(IpServiceClass)
    110