Esempio n. 1
0
def discoverResourcesInDomain(cell, cellLayout, fs, parser, reporterCreator,
                              sendResourcesVector):
    r'@types: Cell, CellLayout, FileSystem, DescriptorParser, ReporterCreator, (ObjectStateHolderVector ->) -> JndiNamedResourceManager'
    # ========================== RESOURCES DISCOVERY =======
    logger.info("START GRABBING RESOURCES")
    jndiNamedResourceManager = websphere_discoverer.JndiNamedResourceManager()
    # discover resources for cell
    discoverResources(cell, None, curry(asIs, cellLayout), parser,
                      reporterCreator, sendResourcesVector,
                      jndiNamedResourceManager.addDomainResource)

    # discover resources for clusters
    for cluster in cell.getClusters():
        discoverResources(cell, cluster,
                          curry(createClusterLayout, cluster, cellLayout, fs),
                          parser, reporterCreator, sendResourcesVector,
                          jndiNamedResourceManager.addClusterResource)
    # discover resources for nodes
    for node in cell.getNodes():
        discoverResources(cell, node,
                          curry(createNodeLayout, node, cellLayout, fs),
                          parser, reporterCreator, sendResourcesVector,
                          jndiNamedResourceManager.addNodeResource)
        # discover resources for server
        nodeLayout = websphere_discoverer.NodeLayout(
            cellLayout.composeNodeHomePath(node.getName()), fs)
        for server in node.getServers():
            discoverResources(
                cell, server, curry(createServerLayout, server, nodeLayout,
                                    fs), parser, reporterCreator,
                sendResourcesVector,
                jndiNamedResourceManager.addServerResource)
    return jndiNamedResourceManager
Esempio n. 2
0
 def parseCentralInstance(self, doc):
     'r@types:org.w3c.dom.Document -> JEEDiscovererByHTTP.CentralInstance'
     centralInstanceNode = self._evalToNode('/SAP_J2EE/CENTRAL_INSTANCE',
                           doc)
     if centralInstanceNode:
         buildInstanceSafely = fptools.safeFunc(fptools.curry(self._parseInstance,
                                                  fptools._,
                                                  self.CentralInstance))
         return buildInstanceSafely(centralInstanceNode)
Esempio n. 3
0
 def parseDialogInstances(self, doc):
     'r@types:org.w3c.dom.Document -> list(JEEDiscovererByHTTP.DialogInstance)'
     dialogInstanceNodes = self._evalToNodes('/SAP_J2EE/DIALOG_INSTANCE',
                                   doc)
     buildInstanceSafely = fptools.safeFunc(fptools.curry(self._parseInstance,
                                              fptools._,
                                              self.DialogInstance))
     res = map(buildInstanceSafely, dialogInstanceNodes)
     return filter(None, res)
Esempio n. 4
0
def discoverResourcesInDomain(cell, cellLayout, fs, parser, reporterCreator, sendResourcesVector):
    r'@types: Cell, CellLayout, FileSystem, DescriptorParser, ReporterCreator, (ObjectStateHolderVector ->) -> JndiNamedResourceManager'
    # ========================== RESOURCES DISCOVERY =======
    logger.info("START GRABBING RESOURCES")
    jndiNamedResourceManager = websphere_discoverer.JndiNamedResourceManager()
    # discover resources for cell
    discoverResources(
        cell, None, curry(asIs, cellLayout),
        parser, reporterCreator, sendResourcesVector,
        jndiNamedResourceManager.addDomainResource
    )

    # discover resources for clusters
    for cluster in cell.getClusters():
        discoverResources(
            cell, cluster,
            curry(createClusterLayout, cluster, cellLayout, fs),
            parser, reporterCreator, sendResourcesVector,
            jndiNamedResourceManager.addClusterResource
        )
    # discover resources for nodes
    for node in cell.getNodes():
        discoverResources(
            cell, node,
            curry(createNodeLayout, node, cellLayout, fs),
            parser, reporterCreator, sendResourcesVector,
            jndiNamedResourceManager.addNodeResource
        )
        # discover resources for server
        nodeLayout = websphere_discoverer.NodeLayout(
                        cellLayout.composeNodeHomePath(node.getName()), fs)
        for server in node.getServers():
            discoverResources(
                cell, server,
                curry(createServerLayout, server, nodeLayout, fs),
                parser, reporterCreator, sendResourcesVector,
                jndiNamedResourceManager.addServerResource
            )
    return jndiNamedResourceManager
Esempio n. 5
0
        Framework.sendObjects(jee_discoverer.discoverTnsnamesOra(hostId, client))

        # discover all processes
        runningProcesses = processDiscoverer.discoverAllProcesses()
        # make filtering for Weblogic processes
        serverProcesses = filter(isWeblogicAsProcess, runningProcesses)
        # obvious to terminate discovery job without weblogic processes running
        if not serverProcesses:
            logger.reportWarning("No Weblogic processes currently running")
            return ObjectStateHolderVector()
        # create catalog of processes by PID
        processByPid = applyMapping(processModule.Process.getPid, runningProcesses)

        # for each weblogic server process get root directory path
        getRootDirectoryPath = curry(getDomainRootDirPath,
                                     shell, fs, _, processByPid.get
        )
        rootDirectoryPaths = map(safeFunc(getRootDirectoryPath), serverProcesses)
        # group server processes by root directory path
        processesByRootDirPath = {}
        for process, path in zip(serverProcesses, rootDirectoryPaths):
            processesByRootDirPath.setdefault(path, []).append(process)
        debugGroups(processesByRootDirPath)

        # NEXT CASE IS NOT SUPPORTED (as property weblogic.ConfigFile
        #     removed starting from version 9
        # important to understand that some processes may specify alternative
        # path to the configuration
        #     -Dweblogic.ConfigFile=c:\mydir\myfile.xml
        # OR
        # Instead, use the following arguments:
Esempio n. 6
0
                        runtimes
            )
            debugGroupping(runtimesByConfigDirPath)

            # find out platform version for each runtime where several runtimes
            # may use the same binary installation placed in so called 'isntall root directory'
            # so to reduce FS calls for the same root directory we will group
            # runtimes by this path
            installRootDirPaths = applySet(
                    websphere_discoverer.ServerRuntime.findInstallRootDirPath,
                    runtimes
            )
            # for install root directory get platform version
            productInfoParser = websphere_discoverer.ProductInfoParser(loadExternalDtd)
            productInfoByInstallDirPath = applyReverseMapping(
                                   curry(determineVersion, _, productInfoParser, fs),
                                   installRootDirPaths)
            r'''2)'''
            for configDirPath, runtimes in runtimesByConfigDirPath.items():
                logger.info("=" * 30)
                logger.info("Profile %s"  % configDirPath )
                logger.info("Determine cell type (standalone|distributed)")
                # expected to see the same cell name for all runtimes in scope
                # of configDirPath
                runtimesByCellName = groupby(websphere_discoverer.ServerRuntime.getCellName,
                                             runtimes)
                debugGroupping(runtimesByCellName)
                if len(runtimesByCellName) > 1:
                    logger.warn("Configuration where more than one cell in one profile is not supported")
                    continue
                # parse cell configuration and get deployment type
Esempio n. 7
0
            runtimesByConfigDirPath = groupby(
                websphere_discoverer.ServerRuntime.getConfigDirPath, runtimes)
            debugGroupping(runtimesByConfigDirPath)

            # find out platform version for each runtime where several runtimes
            # may use the same binary installation placed in so called 'isntall root directory'
            # so to reduce FS calls for the same root directory we will group
            # runtimes by this path
            installRootDirPaths = applySet(
                websphere_discoverer.ServerRuntime.findInstallRootDirPath,
                runtimes)
            # for install root directory get platform version
            productInfoParser = websphere_discoverer.ProductInfoParser(
                loadExternalDtd)
            productInfoByInstallDirPath = applyReverseMapping(
                curry(determineVersion, _, productInfoParser, fs),
                installRootDirPaths)
            r'''2)'''
            for configDirPath, runtimes in runtimesByConfigDirPath.items():
                logger.info("=" * 30)
                logger.info("Profile %s" % configDirPath)
                logger.info("Determine cell type (standalone|distributed)")
                # expected to see the same cell name for all runtimes in scope
                # of configDirPath
                runtimesByCellName = groupby(
                    websphere_discoverer.ServerRuntime.getCellName, runtimes)
                debugGroupping(runtimesByCellName)
                if len(runtimesByCellName) > 1:
                    logger.warn(
                        "Configuration where more than one cell in one profile is not supported"
                    )
Esempio n. 8
0
            jee_discoverer.discoverTnsnamesOra(hostId, client))

        # discover all processes
        runningProcesses = processDiscoverer.discoverAllProcesses()
        # make filtering for Weblogic processes
        serverProcesses = filter(isWeblogicAsProcess, runningProcesses)
        # obvious to terminate discovery job without weblogic processes running
        if not serverProcesses:
            logger.reportWarning("No Weblogic processes currently running")
            return ObjectStateHolderVector()
        # create catalog of processes by PID
        processByPid = applyMapping(processModule.Process.getPid,
                                    runningProcesses)

        # for each weblogic server process get root directory path
        getRootDirectoryPath = curry(getDomainRootDirPath, shell, fs, _,
                                     processByPid.get)
        rootDirectoryPaths = map(safeFunc(getRootDirectoryPath),
                                 serverProcesses)
        # group server processes by root directory path
        processesByRootDirPath = {}
        for process, path in zip(serverProcesses, rootDirectoryPaths):
            processesByRootDirPath.setdefault(path, []).append(process)
        debugGroups(processesByRootDirPath)

        # NEXT CASE IS NOT SUPPORTED (as property weblogic.ConfigFile
        #     removed starting from version 9
        # important to understand that some processes may specify alternative
        # path to the configuration
        #     -Dweblogic.ConfigFile=c:\mydir\myfile.xml
        # OR
        # Instead, use the following arguments: