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 OFS.OrderedFolder import OrderedFolder
28
29 from ZenModelItem import ZenModelItem
30
37
38
39
41
42 meta_type = 'Classifier'
43
44
45 factory_type_information = (
46 {
47 'id' : 'Classifier',
48 'meta_type' : 'Classifier',
49 'description' : """Class to manage product information""",
50 'icon' : 'Classifier_icon.gif',
51 'product' : 'ZenModel',
52 'factory' : 'manage_addClassifier',
53 'immediate_view' : 'manageClassifiers',
54 'actions' :
55 (
56 { 'id' : 'overview'
57 , 'name' : 'Overview'
58 , 'action' : 'manageClassifiers'
59 , 'permissions' : (
60 permissions.view, )
61 },
62 { 'id' : 'viewHistory'
63 , 'name' : 'Modifications'
64 , 'action' : 'viewHistory'
65 , 'permissions' : (
66 permissions.view, )
67 },
68 )
69 },
70 )
71
72 security = ClassSecurityInfo()
73
75 self.id = id
76 self.title = title
77 self.curClassifierEntryId = 0
78
79
81 """kick off device classification against all classifiers
82 will walk down a tree of classifiers until the most specific
83 is found. Top level classifiers can jump into the tree
84 where lower level classifiers will then take over the process
85 """
86 classifierEntry = None
87 for classifier in self.getClassifierValues():
88 classifierEntry = classifier.getClassifierEntry(
89 deviceName, loginInfo,log)
90 if classifierEntry: break
91 return classifierEntry
92
93
96
97
99 """return a list of availible classifiers for entry popup"""
100 return self.objectIds()
101
102
104 cid = self.curClassifierEntryId
105 self.curClassifierEntryId += 1
106 return "ClassifierEntry-" + str(cid)
107
108
109 InitializeClass(Classifier)
110