def _getEndpResolveFn(shell, connectionIp):
    dnsResolver = netutils.createDnsResolverByShell(shell, connectionIp)
    # get function that accepts only address for IPs resolving
    resolveAddress = F(sap_webdisp_discoverer.resolveAddress,
                       dnsResolver.resolveIpsByHostname, (connectionIp, ), _x)
    # get function that accepts only endpoint for address resolving
    return F(SF(sap_discoverer.resolveEndpointAddress), resolveAddress, _x)
def _getEndpResolveFn(shell, connectionIp):
    dnsResolver = netutils.createDnsResolverByShell(shell, connectionIp)
    # get function that accepts only address for IPs resolving
    resolveAddress = F(sap_webdisp_discoverer.resolveAddress,
        dnsResolver.resolveIpsByHostname, (connectionIp, ), _x
    )
    # get function that accepts only endpoint for address resolving
    return F(SF(sap_discoverer.resolveEndpointAddress), resolveAddress, _x)
 def process(self, context):
     application = context.application
     osh = application.getOsh()
     shell = context.client
     fs = file_system.createFileSystem(shell)
     ip = application.getConnectionIp()
     dns_resolver = jee_discoverer.DnsResolverDecorator(
                             netutils.createDnsResolverByShell(shell), ip)
     process = application.getMainProcesses()[0]
     cmd_line = process.commandLine
     server_runtime = jboss_discoverer.createServerRuntime(cmd_line, ip)
     home_dir = server_runtime.findHomeDirPath()
     config = server_runtime.extractOptionValue('--server-config')
     layout = jboss_discoverer.StandaloneModeLayout(fs, home_dir, config)
     loadDtd = 0
     server_config_parser = jboss_discoverer.ServerConfigParserV7(loadDtd)
     standalone_config_path = layout.getStandaloneConfigPath()
     standalone_config_file = layout.getFileContent(standalone_config_path)
     content = standalone_config_file.content
     standalone_config_with_expressions = (
                 server_config_parser.parseStandaloneServerConfig(content))
     server_properties = jboss_discoverer.SystemProperties()
     properties_from_cmd_line = server_runtime.findJbossProperties()
     server_properties.update(properties_from_cmd_line)
     config_props = standalone_config_with_expressions.getSystemProperties()
     server_properties.update(config_props)
     standalone_config = server_config_parser.resolveStandaloneServerConfig(
                      standalone_config_with_expressions, server_properties)
     server_name = standalone_config.getServerName()
     if not server_name:
         try:
             server_name = dns_resolver.resolveHostnamesByIp(ip)[0]
         except netutils.ResolveException:
             server_name = 'Default'
     if server_name is not None:
         osh.setAttribute('j2eeserver_servername', server_name)
         #TODO: replace to jee.ServerTopologyBuilder._composeFullName
         osh.setAttribute('j2eeserver_fullname', server_name)
         modeling.setJ2eeServerAdminDomain(osh, server_name)
     modeling.setAppServerType(osh)
 def process(self, context):
     application = context.application
     osh = application.getOsh()
     shell = context.client
     fs = file_system.createFileSystem(shell)
     ip = application.getConnectionIp()
     dns_resolver = jee_discoverer.DnsResolverDecorator(
         netutils.createDnsResolverByShell(shell), ip)
     process = application.getMainProcesses()[0]
     cmd_line = process.commandLine
     server_runtime = jboss_discoverer.createServerRuntime(cmd_line, ip)
     home_dir = server_runtime.findHomeDirPath()
     config = server_runtime.extractOptionValue('--server-config')
     layout = jboss_discoverer.StandaloneModeLayout(fs, home_dir, config)
     loadDtd = 0
     server_config_parser = jboss_discoverer.ServerConfigParserV7(loadDtd)
     standalone_config_path = layout.getStandaloneConfigPath()
     standalone_config_file = layout.getFileContent(standalone_config_path)
     content = standalone_config_file.content
     standalone_config_with_expressions = (
         server_config_parser.parseStandaloneServerConfig(content))
     server_properties = jboss_discoverer.SystemProperties()
     properties_from_cmd_line = server_runtime.findJbossProperties()
     server_properties.update(properties_from_cmd_line)
     config_props = standalone_config_with_expressions.getSystemProperties()
     server_properties.update(config_props)
     standalone_config = server_config_parser.resolveStandaloneServerConfig(
         standalone_config_with_expressions, server_properties)
     server_name = standalone_config.getServerName()
     if not server_name:
         try:
             server_name = dns_resolver.resolveHostnamesByIp(ip)[0]
         except netutils.ResolveException:
             server_name = 'Default'
     if server_name is not None:
         osh.setAttribute('j2eeserver_servername', server_name)
         #TODO: replace to jee.ServerTopologyBuilder._composeFullName
         osh.setAttribute('j2eeserver_fullname', server_name)
         modeling.setJ2eeServerAdminDomain(osh, server_name)
     modeling.setAppServerType(osh)
        # 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:
        #     -Dweblogic.RootDirectory=c:\mydir
        #     -Dweblogic.ConfigFile=myfile.xml

        # prepare DNS resolver used in every discoverer.
        # Should be weblogic-specific resolver to resolve ${host.name} or "*"
        destinationIp = client.getIpAddress()
        dnsResolver = jee_discoverer.DnsResolverDecorator(
                            netutils.createDnsResolverByShell(shell), destinationIp
        )
        # create reporters and builders for weblogic topology
        globalSettings = GeneralSettingsConfigFile.getInstance()
        loadExternalDtd = globalSettings.getPropertyBooleanValue('loadExternalDtd', 0)
        reporterCreator = jee_discoverer.createTopologyReporterFactory(
                                                    weblogic.ServerTopologyBuilder(),
                                                    dnsResolver)

        for rootDirPath, processes in processesByRootDirPath.items():
            if not rootDirPath:
                continue
            try:
                try:
                    logger.debug("Discover topology for the domain in %s" % rootDirPath)
                    domainLayout = weblogic_discoverer.createDomainLayout(fs, rootDirPath)
Exemple #6
0
        # 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:
        #     -Dweblogic.RootDirectory=c:\mydir
        #     -Dweblogic.ConfigFile=myfile.xml

        # prepare DNS resolver used in every discoverer.
        # Should be weblogic-specific resolver to resolve ${host.name} or "*"
        destinationIp = client.getIpAddress()
        dnsResolver = jee_discoverer.DnsResolverDecorator(
            netutils.createDnsResolverByShell(shell), destinationIp)
        # create reporters and builders for weblogic topology
        globalSettings = GeneralSettingsConfigFile.getInstance()
        loadExternalDtd = globalSettings.getPropertyBooleanValue(
            'loadExternalDtd', 0)
        reporterCreator = jee_discoverer.createTopologyReporterFactory(
            weblogic.ServerTopologyBuilder(), dnsResolver)

        for rootDirPath, processes in processesByRootDirPath.items():
            if not rootDirPath:
                continue
            try:
                try:
                    logger.debug("Discover topology for the domain in %s" %
                                 rootDirPath)
                    domainLayout = weblogic_discoverer.createDomainLayout(