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

Source Code for Module 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 port = 0 43 sendString = "" 44 expectRegex = "" 45 46 portal_type = meta_type = 'IpServiceClass' 47 48 _properties = ServiceClass._properties + ( 49 {'id':'port', 'type':'int', 'mode':'w'}, 50 {'id':'sendString', 'type':'string', 'mode':'w'}, 51 {'id':'expectRegex', 'type':'string', 'mode':'w'}, 52 ) 53 54 factory_type_information = ( 55 { 56 'immediate_view' : 'ipServiceClassStatus', 57 'actions' : 58 ( 59 { 'id' : 'status' 60 , 'name' : 'Status' 61 , 'action' : 'ipServiceClassStatus' 62 , 'permissions' : ( 63 Permissions.view, ) 64 }, 65 { 'id' : 'edit' 66 , 'name' : 'Edit' 67 , 'action' : 'ipServiceClassEdit' 68 , 'permissions' : ("Manage DMD", ) 69 }, 70 { 'id' : 'manage' 71 , 'name' : 'Administration' 72 , 'action' : 'ipServiceClassManage' 73 , 'permissions' : ("Manage DMD",) 74 }, 75 { 'id' : 'zproperties' 76 , 'name' : 'zProperties' 77 , 'action' : 'zPropertyEdit' 78 , 'permissions' : ("Change Device",) 79 }, 80 { 'id' : 'viewHistory' 81 , 'name' : 'Modifications' 82 , 'action' : 'viewHistory' 83 , 'permissions' : (ZEN_VIEW_MODIFICATIONS,) 84 }, 85 ) 86 }, 87 ) 88 89 security = ClassSecurityInfo() 90
91 - def __init__(self, id, serviceKeys=(), description="", port=0):
94 95 96 security.declareProtected('Manage DMD', 'manage_editServiceClass')
97 - def manage_editServiceClass(self, name="", monitor=False, serviceKeys="", 98 port=0, description="", sendString="", 99 expectRegex="", REQUEST=None):
100 """ 101 Edit a ProductClass from a web page. 102 """ 103 self.sendString = sendString 104 self.expectRegex = expectRegex 105 return super(IpServiceClass,self).manage_editServiceClass( 106 name, monitor, serviceKeys, 107 port, description, REQUEST=REQUEST)
108 109 110 111 InitializeClass(IpServiceClass) 112