Class InetAddressMatchInterfaceCriteria
- java.lang.Object
-
- org.jboss.as.controller.interfaces.AbstractInterfaceCriteria
-
- org.jboss.as.controller.interfaces.InetAddressMatchInterfaceCriteria
-
- All Implemented Interfaces:
Serializable
,Comparable<InterfaceCriteria>
,InterfaceCriteria
public class InetAddressMatchInterfaceCriteria extends AbstractInterfaceCriteria
InterfaceCriteria
that tests whether a given address is matches the specified address.- Author:
- Brian Stansberry
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InetAddressMatchInterfaceCriteria(String address)
Creates a new InetAddressMatchInterfaceCriteriaInetAddressMatchInterfaceCriteria(InetAddress address)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(InterfaceCriteria o)
boolean
equals(Object o)
Map<NetworkInterface,Set<InetAddress>>
getAcceptableAddresses(Map<NetworkInterface,Set<InetAddress>> candidates)
Gets which of the available network interfaces and addresses are acceptable for use.InetAddress
getAddress()
int
hashCode()
protected InetAddress
isAcceptable(NetworkInterface networkInterface, InetAddress address)
Gets whether the given network interface and address are acceptable for use.String
toString()
-
Methods inherited from class org.jboss.as.controller.interfaces.AbstractInterfaceCriteria
cloneCandidates
-
-
-
-
Constructor Detail
-
InetAddressMatchInterfaceCriteria
public InetAddressMatchInterfaceCriteria(InetAddress address)
-
InetAddressMatchInterfaceCriteria
public InetAddressMatchInterfaceCriteria(String address)
Creates a new InetAddressMatchInterfaceCriteria- Parameters:
address
- a valid String value to pass toInetAddress.getByName(String)
Cannot benull
- Throws:
IllegalArgumentException
- ifnetwork
isnull
-
-
Method Detail
-
getAddress
public InetAddress getAddress() throws UnknownHostException
- Throws:
UnknownHostException
-
getAcceptableAddresses
public Map<NetworkInterface,Set<InetAddress>> getAcceptableAddresses(Map<NetworkInterface,Set<InetAddress>> candidates) throws SocketException
Description copied from interface:InterfaceCriteria
Gets which of the available network interfaces and addresses are acceptable for use. Acceptance is indicated by including a network interface and the acceptable addresses associated with it in a map. The map may include more than one entry, and the set of addresses for any given entry may include more than one value. For those criteria which override the configured addresses (e.g.LoopbackAddressInterfaceCriteria
, the override address should be returned in the set associated with the relevant interface.- Specified by:
getAcceptableAddresses
in interfaceInterfaceCriteria
- Overrides:
getAcceptableAddresses
in classAbstractInterfaceCriteria
- Parameters:
candidates
- map of candidate interfaces and addresses. This map may include all known interfaces and addresses or the system, or a subset of them that were acceptable to other criteria.- Returns:
- map of accepted network interfaces to their acceptable addresses. Cannot return
null
; an empty map should be returned if no acceptable items are found. The set of addresses stored as values in the map should not benull
or empty; no key for an interface should be stored if no addresses are acceptable. A criteria that only cares about the network interface should return a map including all provided candidate addresses for that interface. - Throws:
SocketException
-
compareTo
public int compareTo(InterfaceCriteria o)
- Specified by:
compareTo
in interfaceComparable<InterfaceCriteria>
- Overrides:
compareTo
in classAbstractInterfaceCriteria
-
isAcceptable
protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException
Gets whether the given network interface and address are acceptable for use. Acceptance is indicated by returning the address which should be used for binding against the network interface; typically this is the givenaddress
parameter. For those criteria which override the configured address, the override address should be returned.- Specified by:
isAcceptable
in classAbstractInterfaceCriteria
- Parameters:
networkInterface
- the network interface. Cannot benull
address
- an address that is associated withnetworkInterface
. Cannot benull
- Returns:
getAddress()
if theaddress
is the same as the one returned bygetAddress()
.- Throws:
SocketException
- if evaluating the state ofnetworkInterface
results in one
-
-