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

# Source Code for Module Products.ZenModel.IpServiceClass

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