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 or (at your
      8  # option) any later version as published by 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              )
     79           },
     80          )
     81
     82      security = ClassSecurityInfo()
     83
     84 -    def __init__(self, id, serviceKeys=(), description="", port=0):
     85          ServiceClass.__init__(self, id, serviceKeys, description)
     86          self._updateProperty('port', port)
     87
     88
     89      security.declareProtected('Manage DMD', 'manage_editServiceClass')
     90 -    def manage_editServiceClass(self, name="", monitor=False, serviceKeys="",
     91                                 port=0, description="", sendString="",
     92                                 expectRegex="", REQUEST=None):
     93          """
     94          Edit a ProductClass from a web page.
     95          """
     96          self.sendString = sendString
     97          self.expectRegex = expectRegex
     98          return super(IpServiceClass,self).manage_editServiceClass(
     99                                  name, monitor, serviceKeys,
    100                                  port, description, REQUEST=REQUEST)
    101
    102
    103
    104  InitializeClass(IpServiceClass)
    105