Package Products ::
Package ZenModel
|
|
1
2
3
4
5
6
7
8
9
10
11 __doc__="""__init__
12
13 Initialize the Confmon Product
14
15 Products must follow the following standard
16 The name of the module (file) and the name of the product class inside
17 the file must be the same.
18
19 If there is a ZMI add screen it must be called "add" + class name (ie addDevice)and it must be defined at the module level.
20
21 the class factory must be a function at the module level called
22 manage_add + class name (ie manage_addDevice)
23
24 If there is an icon for the product it should be called class name + _icon.gif
25 """
26
27 import os
28 import logging
29 log = logging.getLogger("zenmodel")
30
31 if 0:
32 __path__ = None
33
34 from Products.CMFCore.DirectoryView import registerDirectory
35
36 confmon_globals = globals()
37
38 productNames = (
39 'AdministrativeRole',
40 'AdministrativeRoleable',
41 'AreaGraphPoint',
42 'BasicDataSource',
43 'BasicDeviceLoader',
44 'BatchDeviceLoader',
45 'BuiltInDS',
46 'CPU',
47 'CdefGraphPoint',
48 'CiscoLoader',
49 'Classifier',
50 'ClassifierEntry',
51 'Collection',
52 'CollectionItem',
53 'Commandable',
54 'CommentGraphPoint',
55 'ComplexGraphPoint',
56 'ConfigurationError',
57 'ConfmonPropManager',
58 'CustomDeviceReportClass',
59 'DataPointGraphPoint',
60 'DataRoot',
61 'DefGraphPoint',
62 'Device',
63 'DeviceClass',
64 'DeviceComponent',
65 'DeviceGroup',
66 'DeviceHW',
67 'DeviceManagerBase',
68 'DeviceOrganizer',
69 'DeviceReport',
70 'DeviceReportClass',
71 'DeviceResultInt',
72 'DmdBuilder',
73 'EventView',
74 'Exceptions',
75 'ExpansionCard',
76 'Fan',
77 'FileSystem',
78 'GprintGraphPoint',
79 'GraphDefinition',
80 'GraphGroup',
81 'GraphPoint',
82 'GraphReport',
83 'GraphReportClass',
84 'GraphReportElement',
85 'HWComponent',
86 'HardDisk',
87 'Hardware',
88 'HardwareClass',
89 'HruleGraphPoint',
90 'IpAddress',
91 'IpInterface',
92 'IpNetwork',
93 'IpRouteEntry',
94 'IpService',
95 'IpServiceClass',
96 'IpServiceLoader',
97 'LineGraphPoint',
98 'Link',
99 'LinkManager',
100 'Linkable',
101 'Location',
102 'Lockable',
103 'MEProduct',
104 'MaintenanceWindow',
105 'MaintenanceWindowable',
106 'ManagedEntity',
107 'Manufacturer',
108 'ManufacturerRoot',
109 'MibBase',
110 'MibModule',
111 'MibNode',
112 'MibNotification',
113 'MibOrganizer',
114 'MinMaxThreshold',
115 'Monitor',
116 'MonitorClass',
117 'MultiGraphReport',
118 'MultiGraphReportClass',
119 'OSComponent',
120 'OSProcess',
121 'OSProcessClass',
122 'OSProcessOrganizer',
123 'OperatingSystem',
124 'Organizer',
125 'PerformanceConf',
126 'PingDataSource',
127 'PowerSupply',
128 'PrintGraphPoint',
129 'ProductClass',
130 'RRDDataPoint',
131 'RRDDataSource',
132 'RRDGraph',
133 'RRDTemplate',
134 'RRDThreshold',
135 'RRDView',
136 'Report',
137 'ReportClass',
138 'Service',
139 'ServiceClass',
140 'ServiceOrganizer',
141 'ShiftGraphPoint',
142 'SiteError',
143 'Software',
144 'SoftwareClass',
145 'StatusColor',
146 'System',
147 'TemperatureSensor',
148 'TemplateContainer',
149 'ThresholdClass',
150 'ThresholdGraphPoint',
151 'ThresholdInstance',
152 'TickGraphPoint',
153 'UserCommand',
154 'UserSettings',
155 'VdefGraphPoint',
156 'VruleGraphPoint',
157 'WinService',
158 'XmlDataLoader',
159 'ZDeviceLoader',
160 'ZVersion',
161 'ZenDate',
162 'ZenMenu',
163 'ZenMenuItem',
164 'ZenMenuable',
165 'ZenModelBase',
166 'ZenModelItem',
167 'ZenModelRM',
168 'ZenPack',
169 'ZenPackLoader',
170 'ZenPackManager',
171 'ZenPackPersistence',
172 'ZenPackable',
173 'ZenPacker',
174 'ZenStatus',
175 'ZenossInfo',
176 'ZenossSecurity',
177 'ZentinelPortal',
178 )
179
180
181 registerDirectory('skins', globals())
182 registerDirectory('help', globals())
183
184
185 confmonModules = []
191
192
194 contentClasses = ()
195 contentConstructors = ()
196
197 registrar.registerHelp()
198 registrar.registerHelpTitle('Zentinel Portal Help')
199
200 if not confmonModules: loadConfmonModules()
201
202 for module in confmonModules:
203 args = []
204 kwargs = {}
205 className = module.__name__.split('.')[-1]
206 addDtmlName = "add%s" % className
207 factoryName = "manage_add%s" % className
208 iconName = "www/%s_icon.gif" % className
209 confclass = getattr(module, className, None)
210
211 if not confclass: continue
212 args.append(confclass)
213 constructors = []
214 addDtml = getattr(module, addDtmlName, None)
215 if addDtml: constructors.append(addDtml)
216 factory = getattr(module, factoryName, None)
217 if factory: constructors.append(factory)
218 if not constructors: continue
219 kwargs['constructors'] = constructors
220 kwargs['permission'] = "Add DMD Objects"
221 if os.path.exists(os.path.join(__path__[0], iconName)):
222 kwargs['icon'] = iconName
223 log.debug("Register Class=%s",className)
224 log.debug("kwargs=%s", constructors)
225 apply(registrar.registerClass, args, kwargs)
226