Brooklyn

brooklyn.util
[Java] Class NetworkUtils

java.lang.Object
  brooklyn.util.NetworkUtils

public class NetworkUtils

Field Summary
static int MAX_PORT_NUMBER

static int MIN_PORT_NUMBER

 
Method Summary
static int checkPortValid(java.lang.Integer port, java.lang.String errorMessage)

static void checkPortsValid(java.util.Map ports)

static java.lang.String getAddressOfUnresolvableHostname()

returns null in a sane DNS environment, but if DNS provides a bogus address for made-up hostnames, this returns that address

static boolean isPortAvailable(int port)

static boolean isPortAvailable(java.net.InetAddress localAddress, int port)

static boolean isPortValid(java.lang.Integer port)

static boolean isPrivateSubnet(java.net.InetAddress address)

return true if the IP (v4 only currently) address indicates a private subnet address, not exposed on the public internet

static java.net.InetAddress resolve(java.lang.String hostname)

resolves the given hostname to an IP address, returning null if unresolvable or if the resolution is bogus (eg 169.* subnet or a "catch-all" IP resolution supplied by some miscreant DNS services)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

MAX_PORT_NUMBER

public static final int MAX_PORT_NUMBER


MIN_PORT_NUMBER

public static final int MIN_PORT_NUMBER


 
Method Detail

checkPortValid

public static int checkPortValid(java.lang.Integer port, java.lang.String errorMessage)


checkPortsValid

public static void checkPortsValid(@SuppressWarnings("rawtypes") java.util.Map ports)


getAddressOfUnresolvableHostname

public static java.lang.String getAddressOfUnresolvableHostname()
returns null in a sane DNS environment, but if DNS provides a bogus address for made-up hostnames, this returns that address


isPortAvailable

public static boolean isPortAvailable(int port)


isPortAvailable

public static boolean isPortAvailable(java.net.InetAddress localAddress, int port)


isPortValid

public static boolean isPortValid(java.lang.Integer port)


isPrivateSubnet

public static boolean isPrivateSubnet(java.net.InetAddress address)
return true if the IP (v4 only currently) address indicates a private subnet address, not exposed on the public internet


resolve

public static java.net.InetAddress resolve(java.lang.String hostname)
resolves the given hostname to an IP address, returning null if unresolvable or if the resolution is bogus (eg 169.* subnet or a "catch-all" IP resolution supplied by some miscreant DNS services)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.