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