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