org.rhq.plugins.apache.util
Class HttpdAddressUtility.Address

java.lang.Object
  extended by org.rhq.plugins.apache.util.HttpdAddressUtility.Address
Enclosing class:
HttpdAddressUtility

public static class HttpdAddressUtility.Address
extends Object


Field Summary
static String DEFAULT_HOST
           
 String host
           
static int NO_PORT_SPECIFIED_VALUE
           
 int port
           
static int PORT_WILDCARD_VALUE
           
 String scheme
           
static String WILDCARD
           
 
Constructor Summary
HttpdAddressUtility.Address(String host, int port)
           
HttpdAddressUtility.Address(String scheme, String host, int port)
           
 
Method Summary
 boolean equals(Object other)
           
 int hashCode()
           
 boolean isHostDefault()
           
 boolean isHostWildcard()
           
 boolean isPortDefined()
           
 boolean isPortWildcard()
           
 boolean matches(HttpdAddressUtility.Address other, boolean matchSchemes)
          This differs from equals in the way that it considers wildcard values: wildcard host matches any host default host matches default host wildcard port matches any port undefined port matches undefined port The addresses match if both address and port match.
static HttpdAddressUtility.Address parse(String address)
          A simple parser of the provided address into host and port sections.
static HttpdAddressUtility.Address parse(String address, String defaultScheme)
          Parses given address into an Address object and assigns a default scheme if none is present in the address itself.
 String toString()
           
 String toString(boolean includeScheme, boolean interpretWildcardPort)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

host

public String host

port

public int port

scheme

public String scheme

WILDCARD

public static final String WILDCARD
See Also:
Constant Field Values

DEFAULT_HOST

public static final String DEFAULT_HOST
See Also:
Constant Field Values

PORT_WILDCARD_VALUE

public static final int PORT_WILDCARD_VALUE
See Also:
Constant Field Values

NO_PORT_SPECIFIED_VALUE

public static final int NO_PORT_SPECIFIED_VALUE
See Also:
Constant Field Values
Constructor Detail

HttpdAddressUtility.Address

public HttpdAddressUtility.Address(String host,
                                   int port)

HttpdAddressUtility.Address

public HttpdAddressUtility.Address(String scheme,
                                   String host,
                                   int port)
Method Detail

parse

public static HttpdAddressUtility.Address parse(String address)
A simple parser of the provided address into host and port sections.

This is equivalent to calling parse(String, String) with the default scheme "http".

Parameters:
address - the address to parse
Returns:
an instance of Address with host and port set accordingly

parse

public static HttpdAddressUtility.Address parse(String address,
                                                String defaultScheme)
Parses given address into an Address object and assigns a default scheme if none is present in the address itself.

Parameters:
address - the address to parse
defaultScheme - the default scheme to apply or null if no scheme is required by default
Returns:
the parsed address

isPortWildcard

public boolean isPortWildcard()

isPortDefined

public boolean isPortDefined()

isHostWildcard

public boolean isHostWildcard()

isHostDefault

public boolean isHostDefault()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

matches

public boolean matches(HttpdAddressUtility.Address other,
                       boolean matchSchemes)
This differs from equals in the way that it considers wildcard values: The addresses match if both address and port match.

Parameters:
other - the address to match
whether - to match the scheme as well
Returns:
true if the addresses match according to the rules described above, false otherwise

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(boolean includeScheme,
                       boolean interpretWildcardPort)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.