1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""Classifier
15
16 Organizes classifier subclasses to perform high level classification of
17 a device. Subclasses know how to collect information from a device
18 and look in their indexes for a ClassifierEntry about the device.
19
20 $Id: Classifier.py,v 1.4 2004/03/26 23:58:44 edahl Exp $"""
21
22 __version__ = "$Revision: 1.4 $"[11:-2]
23
24 from AccessControl import ClassSecurityInfo
25 from Globals import InitializeClass
26 from AccessControl import Permissions as permissions
27 from Products.ZenModel.ZenossSecurity import *
28 from OFS.OrderedFolder import OrderedFolder
29
30 from ZenModelItem import ZenModelItem
31
38
39
40
42
43 meta_type = 'Classifier'
44
45
46 factory_type_information = (
47 {
48 'id' : 'Classifier',
49 'meta_type' : 'Classifier',
50 'description' : """Class to manage product information""",
51 'icon' : 'Classifier_icon.gif',
52 'product' : 'ZenModel',
53 'factory' : 'manage_addClassifier',
54 'immediate_view' : 'manageClassifiers',
55 'actions' :
56 (
57 { 'id' : 'overview'
58 , 'name' : 'Overview'
59 , 'action' : 'manageClassifiers'
60 , 'permissions' : (
61 permissions.view, )
62 },
63 )
64 },
65 )
66
67 security = ClassSecurityInfo()
68
70 self.id = id
71 self.title = title
72 self.curClassifierEntryId = 0
73
74
76 """kick off device classification against all classifiers
77 will walk down a tree of classifiers until the most specific
78 is found. Top level classifiers can jump into the tree
79 where lower level classifiers will then take over the process
80 """
81 classifierEntry = None
82 for classifier in self.getClassifierValues():
83 classifierEntry = classifier.getClassifierEntry(
84 deviceName, loginInfo,log)
85 if classifierEntry: break
86 return classifierEntry
87
88
91
92
94 """return a list of availible classifiers for entry popup"""
95 return self.objectIds()
96
97
99 cid = self.curClassifierEntryId
100 self.curClassifierEntryId += 1
101 return "ClassifierEntry-" + str(cid)
102
103
104 InitializeClass(Classifier)
105