1
2
3
4
5
6
7
8
9
10
11
12
13 __doc__="""__init__
14
15 Initialize the Confmon Product
16
17 Products must follow the following standard
18 The name of the module (file) and the name of the product class inside
19 the file must be the same.
20
21 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.
22
23 the class factory must be a function at the module level called
24 manage_add + class name (ie manage_addDevice)
25
26 If there is an icon for the product it should be called class name + _icon.gif
27
28 $Id: __init__.py,v 1.50 2004/04/06 02:19:04 edahl Exp $"""
29
30 __version__ = "$Revision: 1.50 $"[11:-2]
31
32 import os
33 import logging
34 log = logging.getLogger("zen")
35
36 if 0:
37 __path__ = None
38
39 from AccessControl import ModuleSecurityInfo
40
41 from Products.CMFCore.DirectoryView import registerDirectory
42
43 confmon_globals = globals()
44
45 productNames = (
46 "Collection",
47 "CollectionItem",
48 "Classifier",
49 "ClassifierEntry",
50 "CPU",
51 "DataRoot",
52 "Device",
53 "DeviceClass",
54 "DeviceGroup",
55 "DeviceHW",
56 "DeviceReport",
57 "ExpansionCard",
58 "MultiGraphReport",
59 'MultiGraphReportClass',
60 "FileSystem",
61 "GraphGroup",
62 "GraphReport",
63 "GraphReportElement",
64 "HardDisk",
65 "Hardware",
66 "HardwareClass",
67 "IpAddress",
68 "IpInterface",
69 "IpNetwork",
70 "IpRouteEntry",
71 "IpService",
72 "IpServiceClass",
73 "Location",
74 "Manufacturer",
75 "ManufacturerRoot",
76 "MEProduct",
77 "MibModule",
78 "MibNode",
79 "MibNotification",
80 "MibOrganizer",
81 "MonitorClass",
82 "OperatingSystem",
83 "OSProcess",
84 "OSProcessClass",
85 "OSProcessOrganizer",
86 "ProductClass",
87 "Report",
88 "ReportClass",
89 "RRDDataSource",
90 "RRDDataPoint",
91 "RRDGraph",
92 "RRDTemplate",
93 "GraphDefinition",
94 "GraphPoint",
95 "DataPointGraphPoint",
96 "ThresholdGraphPoint",
97 "DefGraphPoint",
98 "CdefGraphPoint",
99 "VdefGraphPoint",
100 "PrintGraphPoint",
101 "GprintGraphPoint",
102 "CommentGraphPoint",
103 "HruleGraphPoint",
104 "VruleGraphPoint",
105 "LineGraphPoint",
106 "AreaGraphPoint",
107 "TickGraphPoint",
108 "ShiftGraphPoint",
109 "RRDThreshold",
110 "ServiceClass",
111 "ServiceOrganizer",
112 "Software",
113 "SoftwareClass",
114 "StatusMonitorConf",
115 "System",
116 "UserSettings",
117 "WinService",
118 "ZDeviceLoader",
119 "ZentinelPortal",
120 "ZenossInfo",
121 )
122
123
124 registerDirectory('skins', globals())
125 registerDirectory('help', globals())
126
127
128 confmonModules = []
134
135
137 contentClasses = ()
138 contentConstructors = ()
139
140 registrar.registerHelp()
141 registrar.registerHelpTitle('Zentinel Portal Help')
142
143 if not confmonModules: loadConfmonModules()
144
145 for module in confmonModules:
146 args = []
147 kwargs = {}
148 className = module.__name__.split('.')[-1]
149 addDtmlName = "add%s" % className
150 factoryName = "manage_add%s" % className
151 iconName = "www/%s_icon.gif" % className
152 confclass = getattr(module, className, None)
153
154 if not confclass: continue
155 args.append(confclass)
156 constructors = []
157 addDtml = getattr(module, addDtmlName, None)
158 if addDtml: constructors.append(addDtml)
159 factory = getattr(module, factoryName, None)
160 if factory: constructors.append(factory)
161 if not constructors: continue
162 kwargs['constructors'] = constructors
163 kwargs['permission'] = "Add DMD Objects"
164 if os.path.exists(os.path.join(__path__[0], iconName)):
165 kwargs['icon'] = iconName
166 log.debug("Register Class=%s",className)
167 log.debug("kwargs=%s", constructors)
168 apply(registrar.registerClass, args, kwargs)
169