Esempio n. 1
0
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 Main():

    cgiEnv = lib_common.CgiEnv()

    ac2File = cgiEnv.m_entity_id_dict["File"]

    sys.stderr.write("ac2File=%s\n" % (ac2File))

    grph = cgiEnv.GetGraph()

    configNode = AC2_configuration.MakeUri(ac2File)

    DispHosts(grph, configNode, ac2File)

    cgiEnv.OutCgiRdf()
Esempio n. 3
0
def Main():

    cgiEnv = lib_common.CgiEnv()

    ac2File = cgiEnv.m_entity_id_dict["File"]

    DEBUG("ac2File=%s", ac2File)

    grph = cgiEnv.GetGraph()

    configNode = AC2_configuration.MakeUri(ac2File)

    DispHosts(grph, configNode, ac2File)

    cgiEnv.OutCgiRdf()
Esempio n. 4
0
def Main():

    cgiEnv = lib_common.CgiEnv()

    ac2File = cgiEnv.m_entity_id_dict["File"]

    DEBUG("ac2File=%s", ac2File)

    grph = cgiEnv.GetGraph()

    configNode = AC2_configuration.MakeUri(ac2File)

    DisplayCronsTable(grph, configNode, ac2File)

    cgiEnv.OutCgiRdf("LAYOUT_RECT", [AC2.propTrigger, AC2.propComponents])
Esempio n. 5
0
def Main():

    cgiEnv = lib_common.CgiEnv()

    ac2File = cgiEnv.m_entity_id_dict["File"]

    DEBUG("ac2File=%s", ac2File)

    grph = cgiEnv.GetGraph()

    configNode = AC2_configuration.MakeUri(ac2File)

    DispApp(grph, configNode, ac2File)

    # cgiEnv.OutCgiRdf( "LAYOUT_RECT", [pc.property_argument] )
    cgiEnv.OutCgiRdf()
Esempio n. 6
0
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))
Esempio n. 7
0
def AddInfo(grph, node, entity_ids_arr):
    ac2File = entity_ids_arr[0]
    configNode = AC2_configuration.MakeUri(ac2File)
    propApp2Conf = lib_common.MakeProp("configuration")
    grph.add((configNode, propApp2Conf, node))
    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