Example #1
0
    def entry_points(self, entry_points):
        self.depth += 1
        for entry_point_proxy in entry_points:
            entry_point = self.index_by_tagname['entry-point-list'][entry_point_proxy]
            self.detail(fmt('<div class="level{0}">', self.depth))
            self.detail('<div class="dialog">')
            self.detail(fmt('<h2><a name="{0!q}">Entry Point</a></h2>', entry_point.getAttribute('id')))
            info = self.get_basic_info(entry_point, 'name', 'class', 'description', 'filter')
            self.show_basic_info(info)
            nname = fill(info['name'])
            if nname not in self.node_keywords:
                javaclass = info['class']
                self.node_keywords[nname] = {
                    'shape': 'ellipse',
                    'fillcolor': fillcolor[4],
                    'tooltip': javaclass,
                    'URL': '#' + entry_point.getAttribute('id'),
                    }
##                self.digraph.node(nname, **self.node_keywords[nname])
                self.detail('</div>')
                self.operations(entry_point, [{
                    'id': getText(element.childNodes),
                    'from': element.getAttribute('from'),
                    'to': element.getAttribute('to'),
                    } for element in entry_point.getElementsByTagName('operation-list')])
                self.actions(entry_point, [{
                    'id': getText(element.childNodes),
                    'from': element.getAttribute('from'),
                    'to': element.getAttribute('to'),
                    } for element in entry_point.getElementsByTagName('action-list')])
                self.detail('</div>')
        self.depth -= 1
Example #2
0
    def operations(self, predecessor, operations):
        self.depth += 1
        pname = fill(getText(predecessor.getElementsByTagName('name')[0].childNodes))
        for operation_proxy in operations:
            id = operation_proxy['id']
            from_port = operation_proxy['from']
            to_port = operation_proxy['to']
            operation = self.index_by_tagname['operation-list'][id]
            info = self.get_basic_info(operation, 'name', 'class', 'description')
            nname = fill(info['name'])
            if nname not in self.node_keywords:
                javaclass = info['class']
                if not javaclass.startswith('com.'):
                    shape, fllclr = 'rectangle', 1
                elif javaclass.startswith('com.watch4net.alerting.operation.comparator.'):
                    shape, fllclr = 'diamond', 5
                else:
                    shape, fllclr = 'rectangle', 2
                self.node_keywords[nname] = {
                    'shape': shape,
                    'fillcolor': fillcolor[fllclr],
                    'tooltip': javaclass,
                    'URL': '#' + operation.getAttribute('id'),
                    }
##                self.digraph.node(nname, **self.node_keywords[nname])

                self.detail(fmt('<div class="level{0}">', self.depth))
                self.detail('<div class="dialog">')
                self.detail(fmt('<h2><a name="{0!q}">Operation</a></h2>', operation.getAttribute('id')))
                self.show_basic_info(info)
                self.param_table(operation)
                self.detail('</div>')
                self.operations(operation, [{
                    'id': getText(element.childNodes),
                    'from': element.getAttribute('from'),
                    'to': element.getAttribute('to'),
                    } for element in operation.getElementsByTagName('operation-list')])
                self.actions(operation, [{
                    'id': getText(element.childNodes),
                    'from': element.getAttribute('from'),
                    'to': element.getAttribute('to'),
                    } for element in operation.getElementsByTagName('action-list')])
                self.detail('</div>')

            edge = (pname, from_port, nname, to_port)
            if edge not in self.edge_keywords:
##                self.digraph.edge(pname, nname)
                self.edge_keywords[edge] = {}
        self.depth -= 1
Example #3
0
    def do_internal_operation_list(self, operations):
        self.depth += 1
        for operation in operations:
            info = self.get_basic_info(operation, 'name', 'class', 'description')
            pname = operation.getAttribute('id')
            nname = fill(info['name'])
            if nname not in self.node_keywords:
                javaclass = info['class']
                if not javaclass.startswith('com.'):
                    shape, fllclr = 'rectangle', 1
                elif javaclass.startswith('com.watch4net.alerting.operation.comparator.'):
                    shape, fllclr = 'diamond', 5
                else:
                    shape, fllclr = 'rectangle', 2
                self.node_keywords[pname] = {
                    'label': nname,
                    'shape': shape,
                    'fillcolor': fillcolor[fllclr],
                    'tooltip': javaclass,
                    'URL': '#' + operation.getAttribute('id'),
                    }

                self.detail(fmt('<div class="level{0}">', self.depth))
                self.detail('<div class="dialog">')
                self.detail(fmt('<h2><a name="{0!q}">Operation</a></h2>', pname))
                self.show_basic_info(info)
                self.param_table(operation)
##                self.operations(operation, [{
##                    'id': getText(element.childNodes),
##                    'from': element.getAttribute('from'),
##                    'to': element.getAttribute('to'),
##                    } for element in operation.getElementsByTagName('operation-list')])
                for element in operation.getElementsByTagName('operation-list'):
                    edge = (pname, element.getAttribute('from'), getText(element.childNodes), element.getAttribute('to'))
                    if edge not in self.edge_keywords:
                        self.edge_keywords[edge] = {}
##                self.actions(operation, [{
##                    'id': getText(element.childNodes),
##                    'from': element.getAttribute('from'),
##                    'to': element.getAttribute('to'),
##                    } for element in operation.getElementsByTagName('action-list')])
                for element in operation.getElementsByTagName('action-list'):
                    edge = (pname, element.getAttribute('from'), getText(element.childNodes), element.getAttribute('to'))
                    if edge not in self.edge_keywords:
                        self.edge_keywords[edge] = {}
                self.detail('</div>')
                self.detail('</div>')
        self.depth -= 1
Example #4
0
    def actions(self, predecessor, actions):
        self.depth += 1
        pname = fill(getText(predecessor.getElementsByTagName('name')[0].childNodes))
        for action_proxy in actions:
            id = action_proxy['id']
            from_port = action_proxy['from']
            to_port = action_proxy['to']
            action = self.index_by_tagname['action-list'][id]
            info = self.get_basic_info(action, 'name', 'class', 'description')

            nname = fill(info['name'])
            if nname not in self.node_keywords:
                javaclass = info['class']
                self.node_keywords[nname] = {
                    'shape': 'ellipse',
                    'fillcolor': fillcolor[3],
                    'tooltip': javaclass,
                    'URL': '#' + action.getAttribute('id'),
                    }

                self.detail(fmt('<div class="level{0}">', self.depth))
                self.detail('<div class="dialog">')
                self.detail(fmt('<h2><a name="{0!q}">Action</a></h2>', action.getAttribute('id')))
                self.show_basic_info(info)
                self.param_table(action)
                self.detail('</div>')
                self.detail('</div>')

            edge = (pname, from_port, nname, to_port)
            if edge not in self.edge_keywords:
                self.edge_keywords[edge] = {}
        self.depth -= 1
Example #5
0
    def do_internal_action_list(self, actions):
        self.depth += 1
        for action in actions:
            info = self.get_basic_info(action, 'name', 'class', 'description')
            pname = action.getAttribute('id')
            nname = fill(info['name'])
            if nname not in self.node_keywords:
                javaclass = info['class']
                self.node_keywords[pname] = {
                    'label': nname,
                    'shape': 'ellipse',
                    'fillcolor': fillcolor[3],
                    'tooltip': javaclass,
                    'URL': '#' + action.getAttribute('id'),
                    }

                self.detail(fmt('<div class="level{0}">', self.depth))
                self.detail('<div class="dialog">')
                self.detail(fmt('<h2><a name="{0!q}">Action</a></h2>', pname))
                self.show_basic_info(info)
                self.param_table(action)
                for element in action.getElementsByTagName('action-list'):
                    edge = (pname, element.getAttribute('from'), getText(element.childNodes), element.getAttribute('to'))
                    if edge not in self.edge_keywords:
                        self.edge_keywords[edge] = {}
                self.detail('</div>')
                self.detail('</div>')
        self.depth -= 1
Example #6
0
 def get_basic_info(self, node, *tagNames):
     info = { '': tagNames }  # a bit of a hack
     for tagName in tagNames:
         child = node.getElementsByTagName(tagName)
         text = getText(child[0].childNodes) if child else ''
         info[tagName] = text
         if tagName == 'class':
             self.jclasses.add(text)
     return info
Example #7
0
 def param_table(self, node, bgcolor='#F7F7FF'):
     try:
         detail = self.detail
     except:
         detail = self.html
     detail(fmt('<table bgcolor="{0!q}">', bgcolor))
     detail('<colgroup><col width=20%><col width=75%></colgroup>')
     detail('<thead><tr><th colspan="2">Parameters</th></tr></thead>')
     detail('<tbody>')
     for param in node.getElementsByTagName('param-list'):
         name = param.getAttribute('name')
         text = getText(param.childNodes)
         detail(fmt('<tr><td class="level{2}">{0!q}</td><td>{1!q}</td></tr>', name, text, self.depth))
     detail('</tbody>')
     detail('</table>')
Example #8
0
 def do_definition_list(self, definitions):
     self.html('<hr>')
     try:
         info = important_basic_information['definition-list']
     except KeyError:
         return
     self.html(fmt('<h1>{0!q}</h1>', info.title))
     seen = set()
     for definition in definitions:
         self.unique_name = definition.getAttribute(info.keyAttr)
         if not info.filter(definition):
             continue
         if self.unique_name in seen:
             continue
         self.depth = 0
         self.debug = self.unique_name == '...'
         seen.add(self.unique_name)
         self.html(fmt('<h2><a name="{0!q}">{0!q}</a></h2>', self.unique_name))
         self.prepare()
         self.entry_points([
             getText(element.childNodes)
             for element in definition.getElementsByTagName('entry-point-list')])
         self.cleanup()