示例#1
0
    def discover(self, document, appName):
        adapters = []

        # discoverer
        if document:
            logger.debug('Trying to find adapters for %s' % appName)
            xpath = self.getXPath()

            adapterNodeList = xpath.evaluate(r'/application/services/adapter',
                                             document, XPathConstants.NODESET)
            logger.debug('Found %s adapters' % adapterNodeList.getLength())
            if adapterNodeList:
                for adapterNum in xrange(adapterNodeList.getLength()):
                    adapterNode = adapterNodeList.item(adapterNum)
                    # For reconciliation we will use adapter name as application name,
                    # since from app signature we cannot get adapter name only application name and
                    # binding name
                    #adapterName = xpath.evaluate(r'@name', adapterNode, XPathConstants.STRING)
                    adapterName = appName
                    isEnabledStr = xpath.evaluate(r'enabled', adapterNode,
                                                  XPathConstants.STRING)
                    adapter = tibco.Adapter(adapterName,
                                            Boolean.valueOf(isEnabledStr))
                    tibco.each(adapter.addBinding,
                               self._getAdapterBindings(adapterNode))
                    adapters.append(adapter)

        return adapters
示例#2
0
    def discover(self, document, appName):
        adapters = []

        # discoverer
        if document:
            logger.debug('Trying to find adapters for %s' % appName)
            xpath = self.getXPath()

            adapterNodeList = xpath.evaluate(r'/application/services/adapter', document, XPathConstants.NODESET)
            logger.debug('Found %s adapters' % adapterNodeList.getLength())
            if adapterNodeList:
                for adapterNum in xrange(adapterNodeList.getLength()):
                    adapterNode = adapterNodeList.item(adapterNum)
                    # For reconciliation we will use adapter name as application name,
                    # since from app signature we cannot get adapter name only application name and
                    # binding name
                    #adapterName = xpath.evaluate(r'@name', adapterNode, XPathConstants.STRING)
                    adapterName = appName
                    isEnabledStr = xpath.evaluate(r'enabled', adapterNode, XPathConstants.STRING)
                    adapter = tibco.Adapter(adapterName, Boolean.valueOf(isEnabledStr))
                    tibco.each(adapter.addBinding, self._getAdapterBindings(adapterNode))
                    adapters.append(adapter)

        return adapters
示例#3
0
    def discover(self, domainName, traHome, tmpDir, cleanTemp = 1, discoverJmsTopology = Boolean.TRUE):
        r'@types: str, str, str, netutils.BaseDnsResolver, bool -> '
        ts = Date().getTime()
        ucmdbTmpDir = "/forUcmdb-%s" % ts
        applications = []

        # first check if tmpDir exists
        fs = self.getFileSystem()
        if fs.exists(tmpDir):
            logger.debug('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] %s directory exists' % tmpDir)
            tmpDir = fs.getFile(tmpDir)
            logger.debug('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] Permissions - %s, Path = %s' % (tmpDir.permissions(), tmpDir.path))
            # TODO check for permissions?
        else:
            logger.errorException('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] %s directory does not exist' % tmpDir)
            # TODO: raise exception or log
            return None

        # get the tra version
        appManageFileDir = "%sbin/" % traHome
        if fs.exists(appManageFileDir):
            appManageFile = fs.getFile("%sAppManage" % appManageFileDir)
            logger.debug('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] Found AppManage file path - %s' % appManageFile.path)

            # run the AppManage command for given domainName
            tempDomainDir = "%s%s/%s" % (tmpDir.path, ucmdbTmpDir, domainName)
            shell = self.getShell()
            shell.execCmd("mkdir -p %s" % tempDomainDir)
            if shell.getLastCmdReturnCode() == 0:
                logger.debug('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] Successfully created temp UCMDB directory: %s' % tempDomainDir)
                shell.execCmd("cd %s" % appManageFileDir)
                if shell.getLastCmdReturnCode() == 0:
                    buffer = shell.execCmd("pwd")
                    logger.debug('[' + __name__ + ':BusinessWorksApplicationDiscoverer.discover] Changed working directory to = %s' % buffer)

                    if self.__executeAppManage(tempDomainDir, domainName):
                        # let's get the applications now
                        appMap = self.__getAppConfigsMap(shell, tempDomainDir)
                        for (appName, xmlFile) in appMap.items():
                            #logger.debug("%s --> %s" % (fileName, xmlFile))
                            xmlFilePath = "%s/%s" % (tempDomainDir, xmlFile)
                            if fs.exists(xmlFilePath):

                                folder = self.getPathUtils().dirName(appName) or ""
                                name = self.getPathUtils().baseName(appName) or ""

                                if name:
                                    application = tibco.Application(name, folder)
                                    applications.append(application)
                                    xmlFile = fs.getFile(xmlFilePath, [FileAttrs.CONTENT])
                                    if shell.getLastCmdReturnCode() == 0:
                                        jmsDiscoverer = JmsDiscoverer()
                                        try:
                                            document = XmlParser().getDocument(xmlFile.content, namespaceAware = 0)
                                        except JException, je:
                                            logger.warnException("Failed to parse XML document. %s" % str(je))
                                        else:
                                            if discoverJmsTopology == Boolean.TRUE:
                                                tibco.each(application.addJmsServer, jmsDiscoverer.discoverJmsServer(document))
                                                tibco.each(application.addJmsQueue, jmsDiscoverer.discoverJmsQueues(document))
                                                tibco.each(application.addJmsTopic, jmsDiscoverer.discoverJmsTopics(document))
                                            tibco.each(application.addAdapter, self.__adapterDiscoverer.discover(document, name))
                                    else:
                                        logger.error('Failed to get content of %s' % xmlFilePath)
                        # remove temporary directory
                        logger.debug("Clean temp folder")
                        if cleanTemp:
                            try:
                                # fs.removeFiles(self.__createdFiles)
                                self.__removeTempUcmdbDirectory("%s%s" % (tmpDir.path, ucmdbTmpDir))
                            except Exception, ex:
                                logger.warnException(str(ex))
                                logger.reportWarning("Unable to delete temporary folder")
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()
    client = None
    hostOsh = None
    shell = None

    ## Destination data
    hostId = Framework.getDestinationAttribute('hostId') or None
    bwId = Framework.getDestinationAttribute('bwId') or None
    bwPath = Framework.getDestinationAttribute('bwPath') or None
    protocol = Framework.getDestinationAttribute('Protocol')
    ip_address = Framework.getDestinationAttribute('ip_address')
    tmpDirPath = Framework.getParameter('temp_directory') or '/tmp'
    isDiscoverJms = Framework.getParameter('discover_jms_topology') or "true"
    isDiscoverJms = Boolean.valueOf(isDiscoverJms)

    ## Container HOST OSH
    if hostId:
        hostOsh = modeling.createOshByCmdbIdString('node', hostId.strip())
        OSHVResult.add(hostOsh)
        logger.debug('[' + __name__ + ':DiscoveryMain] Got HOSTID <%s>' % hostId)

    ## Pre-discovered Business Works CI
    bwOsh = None
    if bwId:
        bwOsh = modeling.createOshByCmdbIdString('tibco_business_works', bwId.strip())
        logger.debug('[' + __name__ + ':DiscoveryMain] Got bwId <%s>' % bwId)
    else:
        errMsg = '[' + __name__ + ':DiscoveryMain] Invalid TibcoBusinessWorks CI ID received from server. This BW will not be processed'
        logger.error(errMsg)
        logger.reportError(errMsg)
        return OSHVResult


    if not tmpDirPath:
        errMsg = '[' + __name__ + ':DiscoveryMain] temp_directory parameter has not been set correctly. Discovery cannot continue until this parameter is set with a remote directory with write permissions.'
        logger.error(errMsg)
        logger.reportError(errMsg)
        return OSHVResult

    try:
        try:
            client = Framework.createClient()
            shell = shellutils.ShellFactory().createShell(client)
            credList = Framework.getAvailableProtocols(ip_address, tibco.TIBCO_PROTOCOL)
            logger.info("Found tibco credentials: %s" % len(credList))

            fs = tibco_discoverer.createFileSystem(shell)

            bw = tibco_discoverer.BusinessWorksDiscoverer().findBWVersionFromPath(bwPath)
            domains = tibco_discoverer.BusinessWorksDomainDiscoverer(shell, fs).discover(bwPath)
            traHomeDiscoverer = tibco_discoverer.TicboTraHomeDiscoverer(shell)
            traHomes = traHomeDiscoverer.discover()
            fallbackDnsResolver = tibco_discoverer.FallbackResolver([netutils.JavaDnsResolver(), netutils.DnsResolverByShell(shell)])
            dnsResolver = tibco_discoverer.CachedResolver(fallbackDnsResolver)

            if traHomes and bw:
                traPath = traHomes[0]
                for domain in domains:
                    logger.info("Visit %s" % domain)
                    try:
                        applications = None
                        # Check if we have any credential for TIBCO
                        if credList:
                            for credId in credList:
                                adminCommand = tibco_discoverer.AppManageAdminCommand(client, credId, "./")
                                adapterDiscoverer = tibco_discoverer.TibcoAdapterDiscoverer(dnsResolver)
                                appDiscoverer = tibco_discoverer.BusinessWorksApplicationDiscoverer(shell, fs, adminCommand, adapterDiscoverer)
                                applications = appDiscoverer.discover(domain.getName(), traPath, tmpDirPath, discoverJmsTopology=isDiscoverJms)
                            if applications:
                                tibco.each(domain.addApplication, applications)
                        else:
                            msg = errormessages.makeErrorMessage(tibco.TIBCO_PROTOCOL, pattern=errormessages.ERROR_NO_CREDENTIALS)
                            errobj = errorobject.createError(errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [ tibco.TIBCO_PROTOCOL ], msg)
                            logger.reportErrorObject(errobj)

                        bw.addDomain(domain)
                    except tibco_discoverer.TibcoDiscovererException, exc:
                        logger.debugException(str(exc))
                        errorobj = errorobject.createError(errorcodes.FAILED_RUNNING_DISCOVERY_WITH_CLIENT_TYPE, [ 'tibco', 'error: %s' % str(exc)], str(exc))
                        logger.reportErrorObject(errorobj)
        except:
            logger.debugException('')
            exInfo = logger.prepareJythonStackTrace('[' + __name__ + ':DiscoveryMain] Error connecting: ')
            errormessages.resolveAndReport(exInfo, protocol, Framework)
        else:
            # Reporting
            logger.debug("--- Start reporting ---")
            reporter = tibco.TopologyReporter(tibco.TopologyBuilder())
            bwOsh = reporter.reportBusinessWorks(bw, hostOsh, bwId)
            OSHVResult.add(bwOsh)
            endpointReporter = netutils.EndpointReporter(netutils.ServiceEndpointBuilder())

            for domain in domains:
                domainOsh = reporter.reportBusinessWorksDomain(domain)
                OSHVResult.add(domainOsh)
                OSHVResult.add(reporter.reportBWAndDomainLink(domainOsh, bwOsh))
                for app in domain.getApplications():
                    appOsh = reporter.reportBusinessWorksApp(app, bwOsh)
                    OSHVResult.add(appOsh)
                    if app.getJmsServers():
                        for jmsServer in app.getJmsServers():

                            # Trying to resolver host name
                            try:
                                ip = netutils.getLowestIp(dnsResolver.resolveIpsByHostname(jmsServer.hostname))
                                if ip:
                                    jmsServer.hostname = ip
                            except Exception, ex:
                                logger.debugException(str(ex))

                            if netutils.isValidIp(jmsServer.hostname) and not netutils.isLoopbackIp(jmsServer.hostname):
                                jmsHostOsh = modeling.createHostOSH(jmsServer.hostname)
                                emsServerOsh = reporter.reportEMSServer(tibco.EmsServer(), jmsHostOsh)
                                jmsServerOsh = reporter.reportJmsServer(jmsServer, emsServerOsh)
                                endpoint = netutils.createTcpEndpoint(jmsServer.hostname, jmsServer.getPort())
                                serviceOsh = endpointReporter.reportEndpoint(endpoint, jmsHostOsh)
                                linkOsh = reporter.reportEmsServerServiceAddressLink(emsServerOsh, serviceOsh)
                                OSHVResult.add(emsServerOsh)
                                OSHVResult.add(jmsHostOsh)
                                OSHVResult.add(jmsServerOsh)
                                OSHVResult.add(serviceOsh)
                                OSHVResult.add(linkOsh)
                                for jmsQueue in app.getJmsQueues():
                                    OSHVResult.addAll(reporter.reportJmsDestinationTopology(jmsQueue, jmsServerOsh, appOsh))
                                for jmsTopic in app.getJmsTopics():
                                    OSHVResult.addAll(reporter.reportJmsDestinationTopology(jmsTopic, jmsServerOsh, appOsh))
                    if app.getAdapters():
                        for adapter in app.getAdapters():
                            OSHVResult.addAll(reporter.reportAdapterTopology(adapter, appOsh))

    finally:
        if shell:
            ## Close shell connection
            shell.closeClient()

    return OSHVResult
示例#5
0
    def discover(self,
                 domainName,
                 traHome,
                 tmpDir,
                 cleanTemp=1,
                 discoverJmsTopology=Boolean.TRUE):
        r'@types: str, str, str, netutils.BaseDnsResolver, bool -> '
        ts = Date().getTime()
        ucmdbTmpDir = "/forUcmdb-%s" % ts
        applications = []

        # first check if tmpDir exists
        fs = self.getFileSystem()
        if fs.exists(tmpDir):
            logger.debug(
                '[' + __name__ +
                ':BusinessWorksApplicationDiscoverer.discover] %s directory exists'
                % tmpDir)
            tmpDir = fs.getFile(tmpDir)
            logger.debug(
                '[' + __name__ +
                ':BusinessWorksApplicationDiscoverer.discover] Permissions - %s, Path = %s'
                % (tmpDir.permissions(), tmpDir.path))
            # TODO check for permissions?
        else:
            logger.errorException(
                '[' + __name__ +
                ':BusinessWorksApplicationDiscoverer.discover] %s directory does not exist'
                % tmpDir)
            # TODO: raise exception or log
            return None

        # get the tra version
        appManageFileDir = "%sbin/" % traHome
        if fs.exists(appManageFileDir):
            appManageFile = fs.getFile("%sAppManage" % appManageFileDir)
            logger.debug(
                '[' + __name__ +
                ':BusinessWorksApplicationDiscoverer.discover] Found AppManage file path - %s'
                % appManageFile.path)

            # run the AppManage command for given domainName
            tempDomainDir = "%s%s/%s" % (tmpDir.path, ucmdbTmpDir, domainName)
            shell = self.getShell()
            shell.execCmd("mkdir -p %s" % tempDomainDir)
            if shell.getLastCmdReturnCode() == 0:
                logger.debug(
                    '[' + __name__ +
                    ':BusinessWorksApplicationDiscoverer.discover] Successfully created temp UCMDB directory: %s'
                    % tempDomainDir)
                shell.execCmd("cd %s" % appManageFileDir)
                if shell.getLastCmdReturnCode() == 0:
                    buffer = shell.execCmd("pwd")
                    logger.debug(
                        '[' + __name__ +
                        ':BusinessWorksApplicationDiscoverer.discover] Changed working directory to = %s'
                        % buffer)

                    if self.__executeAppManage(tempDomainDir, domainName):
                        # let's get the applications now
                        appMap = self.__getAppConfigsMap(shell, tempDomainDir)
                        for (appName, xmlFile) in appMap.items():
                            #logger.debug("%s --> %s" % (fileName, xmlFile))
                            xmlFilePath = "%s/%s" % (tempDomainDir, xmlFile)
                            if fs.exists(xmlFilePath):

                                folder = self.getPathUtils().dirName(
                                    appName) or ""
                                name = self.getPathUtils().baseName(
                                    appName) or ""

                                if name:
                                    application = tibco.Application(
                                        name, folder)
                                    applications.append(application)
                                    xmlFile = fs.getFile(
                                        xmlFilePath, [FileAttrs.CONTENT])
                                    if shell.getLastCmdReturnCode() == 0:
                                        jmsDiscoverer = JmsDiscoverer()
                                        try:
                                            document = XmlParser().getDocument(
                                                xmlFile.content,
                                                namespaceAware=0)
                                        except JException, je:
                                            logger.warnException(
                                                "Failed to parse XML document. %s"
                                                % str(je))
                                        else:
                                            if discoverJmsTopology == Boolean.TRUE:
                                                tibco.each(
                                                    application.addJmsServer,
                                                    jmsDiscoverer.
                                                    discoverJmsServer(
                                                        document))
                                                tibco.each(
                                                    application.addJmsQueue,
                                                    jmsDiscoverer.
                                                    discoverJmsQueues(
                                                        document))
                                                tibco.each(
                                                    application.addJmsTopic,
                                                    jmsDiscoverer.
                                                    discoverJmsTopics(
                                                        document))
                                            tibco.each(
                                                application.addAdapter,
                                                self.__adapterDiscoverer.
                                                discover(document, name))
                                    else:
                                        logger.error(
                                            'Failed to get content of %s' %
                                            xmlFilePath)
                        # remove temporary directory
                        logger.debug("Clean temp folder")
                        if cleanTemp:
                            try:
                                # fs.removeFiles(self.__createdFiles)
                                self.__removeTempUcmdbDirectory(
                                    "%s%s" % (tmpDir.path, ucmdbTmpDir))
                            except Exception, ex:
                                logger.warnException(str(ex))
                                logger.reportWarning(
                                    "Unable to delete temporary folder")
示例#6
0
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()
    client = None
    hostOsh = None
    shell = None

    ## Destination data
    hostId = Framework.getDestinationAttribute('hostId') or None
    bwId = Framework.getDestinationAttribute('bwId') or None
    bwPath = Framework.getDestinationAttribute('bwPath') or None
    protocol = Framework.getDestinationAttribute('Protocol')
    ip_address = Framework.getDestinationAttribute('ip_address')
    tmpDirPath = Framework.getParameter('temp_directory') or '/tmp'
    isDiscoverJms = Framework.getParameter('discover_jms_topology') or "true"
    isDiscoverJms = Boolean.valueOf(isDiscoverJms)

    ## Container HOST OSH
    if hostId:
        hostOsh = modeling.createOshByCmdbIdString('node', hostId.strip())
        OSHVResult.add(hostOsh)
        logger.debug('[' + __name__ +
                     ':DiscoveryMain] Got HOSTID <%s>' % hostId)

    ## Pre-discovered Business Works CI
    bwOsh = None
    if bwId:
        bwOsh = modeling.createOshByCmdbIdString('tibco_business_works',
                                                 bwId.strip())
        logger.debug('[' + __name__ + ':DiscoveryMain] Got bwId <%s>' % bwId)
    else:
        errMsg = '[' + __name__ + ':DiscoveryMain] Invalid TibcoBusinessWorks CI ID received from server. This BW will not be processed'
        logger.error(errMsg)
        logger.reportError(errMsg)
        return OSHVResult

    if not tmpDirPath:
        errMsg = '[' + __name__ + ':DiscoveryMain] temp_directory parameter has not been set correctly. Discovery cannot continue until this parameter is set with a remote directory with write permissions.'
        logger.error(errMsg)
        logger.reportError(errMsg)
        return OSHVResult

    try:
        try:
            client = Framework.createClient()
            shell = shellutils.ShellFactory().createShell(client)
            credList = Framework.getAvailableProtocols(ip_address,
                                                       tibco.TIBCO_PROTOCOL)
            logger.info("Found tibco credentials: %s" % len(credList))

            fs = tibco_discoverer.createFileSystem(shell)

            bw = tibco_discoverer.BusinessWorksDiscoverer(
            ).findBWVersionFromPath(bwPath)
            domains = tibco_discoverer.BusinessWorksDomainDiscoverer(
                shell, fs).discover(bwPath)
            traHomeDiscoverer = tibco_discoverer.TicboTraHomeDiscoverer(shell)
            traHomes = traHomeDiscoverer.discover()
            fallbackDnsResolver = tibco_discoverer.FallbackResolver([
                netutils.JavaDnsResolver(),
                netutils.DnsResolverByShell(shell)
            ])
            dnsResolver = tibco_discoverer.CachedResolver(fallbackDnsResolver)

            if traHomes and bw:
                traPath = traHomes[0]
                for domain in domains:
                    logger.info("Visit %s" % domain)
                    try:
                        applications = None
                        # Check if we have any credential for TIBCO
                        if credList:
                            for credId in credList:
                                adminCommand = tibco_discoverer.AppManageAdminCommand(
                                    client, credId, "./")
                                adapterDiscoverer = tibco_discoverer.TibcoAdapterDiscoverer(
                                    dnsResolver)
                                appDiscoverer = tibco_discoverer.BusinessWorksApplicationDiscoverer(
                                    shell, fs, adminCommand, adapterDiscoverer)
                                applications = appDiscoverer.discover(
                                    domain.getName(),
                                    traPath,
                                    tmpDirPath,
                                    discoverJmsTopology=isDiscoverJms)
                            if applications:
                                tibco.each(domain.addApplication, applications)
                        else:
                            msg = errormessages.makeErrorMessage(
                                tibco.TIBCO_PROTOCOL,
                                pattern=errormessages.ERROR_NO_CREDENTIALS)
                            errobj = errorobject.createError(
                                errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP,
                                [tibco.TIBCO_PROTOCOL], msg)
                            logger.reportErrorObject(errobj)

                        bw.addDomain(domain)
                    except tibco_discoverer.TibcoDiscovererException, exc:
                        logger.debugException(str(exc))
                        errorobj = errorobject.createError(
                            errorcodes.
                            FAILED_RUNNING_DISCOVERY_WITH_CLIENT_TYPE,
                            ['tibco', 'error: %s' % str(exc)], str(exc))
                        logger.reportErrorObject(errorobj)
        except:
            logger.debugException('')
            exInfo = logger.prepareJythonStackTrace(
                '[' + __name__ + ':DiscoveryMain] Error connecting: ')
            errormessages.resolveAndReport(exInfo, protocol, Framework)
        else:
            # Reporting
            logger.debug("--- Start reporting ---")
            reporter = tibco.TopologyReporter(tibco.TopologyBuilder())
            bwOsh = reporter.reportBusinessWorks(bw, hostOsh, bwId)
            OSHVResult.add(bwOsh)
            endpointReporter = netutils.EndpointReporter(
                netutils.ServiceEndpointBuilder())

            for domain in domains:
                domainOsh = reporter.reportBusinessWorksDomain(domain)
                OSHVResult.add(domainOsh)
                OSHVResult.add(reporter.reportBWAndDomainLink(
                    domainOsh, bwOsh))
                for app in domain.getApplications():
                    appOsh = reporter.reportBusinessWorksApp(app, bwOsh)
                    OSHVResult.add(appOsh)
                    if app.getJmsServers():
                        for jmsServer in app.getJmsServers():

                            # Trying to resolver host name
                            try:
                                ip = netutils.getLowestIp(
                                    dnsResolver.resolveIpsByHostname(
                                        jmsServer.hostname))
                                if ip:
                                    jmsServer.hostname = ip
                            except Exception, ex:
                                logger.debugException(str(ex))

                            if netutils.isValidIp(
                                    jmsServer.hostname
                            ) and not netutils.isLoopbackIp(
                                    jmsServer.hostname):
                                jmsHostOsh = modeling.createHostOSH(
                                    jmsServer.hostname)
                                emsServerOsh = reporter.reportEMSServer(
                                    tibco.EmsServer(), jmsHostOsh)
                                jmsServerOsh = reporter.reportJmsServer(
                                    jmsServer, emsServerOsh)
                                endpoint = netutils.createTcpEndpoint(
                                    jmsServer.hostname, jmsServer.getPort())
                                serviceOsh = endpointReporter.reportEndpoint(
                                    endpoint, jmsHostOsh)
                                linkOsh = reporter.reportEmsServerServiceAddressLink(
                                    emsServerOsh, serviceOsh)
                                OSHVResult.add(emsServerOsh)
                                OSHVResult.add(jmsHostOsh)
                                OSHVResult.add(jmsServerOsh)
                                OSHVResult.add(serviceOsh)
                                OSHVResult.add(linkOsh)
                                for jmsQueue in app.getJmsQueues():
                                    OSHVResult.addAll(
                                        reporter.reportJmsDestinationTopology(
                                            jmsQueue, jmsServerOsh, appOsh))
                                for jmsTopic in app.getJmsTopics():
                                    OSHVResult.addAll(
                                        reporter.reportJmsDestinationTopology(
                                            jmsTopic, jmsServerOsh, appOsh))
                    if app.getAdapters():
                        for adapter in app.getAdapters():
                            OSHVResult.addAll(
                                reporter.reportAdapterTopology(
                                    adapter, appOsh))

    finally:
        if shell:
            ## Close shell connection
            shell.closeClient()

    return OSHVResult