def getAvalableVersions(self, Framework, ip, port): '@types: Framework, str, str -> list(str)' version = self.checkVersion(Framework, ip, port) if version == None: return JMXAgent.getAvailableVersions(self.getJ2eeServerType()) else: return [version]
def jmxConnect(credentialId, ip, Framework, platform): safe_int = lambda s: (s.isdigit() and (int(s), ) or (s, ))[0] versionsStr = JMXAgent.getAvailableVersions(platform) versionsInt = [tuple(map(safe_int, x.split('.'))) for x in versionsStr] # reverse sort versionsInt.sort(lambda a, b: cmp(b, a)) messagesLines = [] for versionInt in versionsInt: versionStr = '.'.join(map(str, versionInt)) properties = java.util.Properties() properties.setProperty(AgentConstants.VERSION_PROPERTY, versionStr) properties.setProperty('credentialsId', credentialId) properties.setProperty('ip_address', ip) status = False try: Framework.createClient(properties) except (java.lang.Exception, Exception), e: logger.debugException('Failed to create client') message = str(e) else: status = True if status: break else: messagesLines.append('Tried version %s: %s' % (versionStr, message))
def getAvailableVersions(platformName): return JMXAgent.getAvailableVersions(platformName)