def AddInfo(grph, node, entity_ids_arr): ac2File = entity_ids_arr[0] ac2App = entity_ids_arr[1] appNode = AC2_application.MakeUri(ac2File, ac2App) # Should be the other way around but not nice to display. grph.add((node, AC2.propComp2App, appNode))
def DisplayComponentDependencies(grph, ac2File, ac2App, ac2Comp): configNode = AC2_configuration.MakeUri(ac2File) appNode = AC2_application.MakeUri(ac2File, ac2App) compNode = AC2_component.MakeUri(ac2File, ac2App, ac2Comp) dom = AC2_configuration.GetDom(ac2File) # TODO: PROBLEME, ON DEVRAIT ALLER CHERCHER LES SOUS-NODES AU LIEU DE TOUT REPARCOURIR !!!!!!!!!!! for elt_apps in dom.getElementsByTagName('apps'): sys.stderr.write("Founds apps\n") # TODO: ERROR: SHOULD FOCUS ON ONE APP ONLY. for elt_app in elt_apps.getElementsByTagName('app'): attr_app_name = elt_app.getAttributeNode('name').value sys.stderr.write("attr_app_name=%s\n" % attr_app_name) if attr_app_name != ac2App: continue AC2_application.DecorateAppWithXml(grph, appNode, elt_app) for elt_component in elt_app.getElementsByTagName('component'): attr_component_name = elt_component.getAttributeNode( 'name').value sys.stderr.write("attr_component_name=%s\n" % attr_component_name) if attr_component_name == ac2Comp: AC2_component.DecorateComponentWithXml( grph, compNode, elt_component) fatherFound = False for elt_father in elt_component.getElementsByTagName( 'father'): # There should be one parent only. attr_father_name = elt_father.firstChild.nodeValue sys.stderr.write("attr_father_name=%s\n" % attr_father_name) nodeFather = ComponentNameToNode( ac2File, attr_app_name, attr_father_name) grph.add((nodeFather, AC2.propParent, compNode)) fatherFound = True if fatherFound: # grph.add( ( appNode, AC2.propComp2App, nodeFather ) ) grph.add((nodeFather, AC2.propComp2App, appNode)) grph.add((nodeFather, AC2.propParent, compNode)) else: # grph.add( ( appNode, AC2.propComp2App, compNode ) ) grph.add((compNode, AC2.propComp2App, appNode)) break return
def DisplayComponentsTree(grph, configName, ac2App): dom = AC2_configuration.GetDom(configName) configNode = AC2_configuration.MakeUri(configName) # TODO: PROBLEME, ON DEVRAIT ALLER CHERCHER LES SOUS-NODES AU LIEU DE TOUT REPARCOURIR !!!!!!!!!!! for elt_apps in dom.getElementsByTagName('apps'): # There should be one only. sys.stderr.write("Founds apps\n") for elt_app in elt_apps.getElementsByTagName('app'): attr_name = elt_app.getAttributeNode('name').value sys.stderr.write("attr_name=%s\n" % attr_name) if attr_name != ac2App: continue appNode = AC2_application.MakeUri(configName, attr_name) AC2_application.DecorateAppWithXml(grph, appNode, elt_app) for elt_component in elt_app.getElementsByTagName('component'): attr_component_name = elt_component.getAttributeNode( 'name').value nodeComponent = ComponentNameToNode(configName, attr_name, attr_component_name) sys.stderr.write("attr_component_name=%s\n" % attr_component_name) AC2_component.DecorateComponentWithXml(grph, nodeComponent, elt_component) fatherFound = False for elt_father in elt_component.getElementsByTagName('father'): attr_father_name = elt_father.firstChild.nodeValue sys.stderr.write("attr_father_name=%s\n" % attr_father_name) nodeFather = ComponentNameToNode(configName, attr_name, attr_father_name) grph.add((nodeFather, AC2.propParent, nodeComponent)) fatherFound = True if not fatherFound: grph.add((appNode, AC2.propParent, nodeComponent))
def DispApp(grph, configNode, configName): dom = AC2_configuration.GetDom(configName) for elt_app in dom.getElementsByTagName('app'): attr_name = elt_app.getAttributeNode('name').value attr_version = elt_app.getAttributeNode('version').value attr_notifref = elt_app.getAttributeNode('notifref').value attr_cronref = elt_app.getAttributeNode('cronref').value nodeApp = AC2_application.MakeUri(configName, attr_name) grph.add((nodeApp, lib_common.MakeProp("version"), lib_common.NodeLiteral(attr_version))) grph.add((nodeApp, lib_common.MakeProp("notifref"), lib_common.NodeLiteral(attr_notifref))) grph.add((nodeApp, lib_common.MakeProp("cronref"), lib_common.NodeLiteral(attr_cronref))) grph.add((configNode, lib_common.MakeProp("AC2 application"), nodeApp)) return
def DisplayComponentDependencies(grph, ac2File, ac2App, ac2Comp): configNode = AC2_configuration.MakeUri(ac2File) appNode = AC2_application.MakeUri(ac2File, ac2App) compNode = AC2_component.MakeUri(ac2File, ac2App, ac2Comp) dom = AC2_configuration.GetDom(ac2File) # TODO: PROBLEME, ON DEVRAIT ALLER CHERCHER LES SOUS-NODES AU LIEU DE TOUT REPARCOURIR !!!!!!!!!!! for elt_apps in dom.getElementsByTagName('apps'): sys.stderr.write("Founds apps\n") # TODO: ERROR: SHOULD FOCUS ON ONE APP ONLY. for elt_app in elt_apps.getElementsByTagName('app'): attr_app_name = elt_app.getAttributeNode('name').value sys.stderr.write("attr_app_name=%s\n" % attr_app_name) if attr_app_name != ac2App: continue AC2_application.DecorateAppWithXml(grph, appNode, elt_app) #attr_version = elt_app.getAttributeNode('version').value #grph.add( ( appNode, lib_common.MakeProp("Version"), lib_common.NodeLiteral( attr_version ) ) ) #attr_notifref = elt_app.getAttributeNode('notifref').value #grph.add( ( appNode, lib_common.MakeProp("Notifref"), lib_common.NodeLiteral( attr_notifref ) ) ) #attr_cronref = elt_app.getAttributeNode('cronref').value #grph.add( ( appNode, lib_common.MakeProp("Cronref"), lib_common.NodeLiteral( attr_cronref ) ) ) #appParent = None #appChildren = [] for elt_component in elt_app.getElementsByTagName('component'): attr_component_name = elt_component.getAttributeNode( 'name').value sys.stderr.write("attr_component_name=%s\n" % attr_component_name) if attr_component_name == ac2Comp: attr_component_description = elt_component.getAttributeNode( 'description') if attr_component_description: grph.add((compNode, pc.property_information, lib_common.NodeLiteral( attr_component_description.value))) attr_component_group = elt_component.getAttributeNode( 'group') if attr_component_group: grph.add((compNode, lib_common.MakeProp("Group"), lib_common.NodeLiteral( attr_component_group.value))) attr_component_type = elt_component.getAttributeNode( 'type') if attr_component_type: grph.add((compNode, lib_common.MakeProp("Type"), lib_common.NodeLiteral( attr_component_type.value))) nodeFather = None for elt_father in elt_component.getElementsByTagName( 'father'): # There should be one parent only. attr_father_name = elt_father.firstChild.nodeValue sys.stderr.write("attr_father_name=%s\n" % attr_father_name) nodeFather = ComponentNameToNode( ac2File, attr_app_name, attr_father_name) grph.add((nodeFather, AC2.propParent, compNode)) grph.add((appNode, AC2.propComp2App, nodeFather)) if not nodeFather: grph.add((appNode, AC2.propComp2App, compNode)) else: currCompNode = ComponentNameToNode(ac2File, attr_app_name, attr_component_name) for elt_father in elt_component.getElementsByTagName( 'father'): # There should be one parent only. attr_father_name = elt_father.firstChild.nodeValue if attr_father_name == ac2Comp: sys.stderr.write("ac2Comp attr_father_name=%s\n" % attr_father_name) nodeChild = ComponentNameToNode( ac2File, attr_app_name, attr_father_name) grph.add((compNode, AC2.propParent, currCompNode)) return