| org.apache.lenya.ac.impl.AbstractItem org.apache.lenya.ac.impl.AbstractGroupable org.apache.lenya.ac.impl.AbstractIPRange
All known Subclasses: org.apache.lenya.ac.file.FileIPRange,
AbstractIPRange | abstract public class AbstractIPRange extends AbstractGroupable implements IPRange(Code) | |
A range of IP addresses, expressed by a network address and a subnet mask.
Note: this class does not enforce that the network address and the subnet mask have the same size
(i.e. either both IPv4 or both IPv6 addresses). If the the network address and subnet mask have
different sizes, the range does not contain any hosts, that is
AbstractIPRange.contains(Machine) will
always return false .
|
Method Summary | |
public boolean | contains(Machine machine) Checks if this IP range contains a certain machine.
Note: if the network address and the subnet mask of this IP range have different sizes (i.e.
one is IPv4 and one is IPv6), this method will always return false , no matter
what machine has been specified!
Further, if the machine address and the IP range (i.e. | public void | delete() | public File | getConfigurationDirectory() Returns the configuration directory. | public InetAddress | getNetworkAddress() Returns the network address. | public InetAddress | getSubnetMask() Returns the subnet mask. | public static boolean | isValidSubnet(InetAddress networkAddress, InetAddress subnetMask) Checks if a network address / subnet mask combination describes a valid subnet.
Parameters: networkAddress - The network address. Parameters: subnetMask - The subnet mask. | abstract public void | save() | protected void | setConfigurationDirectory(File _configurationDirectory) | public void | setNetworkAddress(String address) Sets the network address. | public void | setNetworkAddress(byte[] address) Sets the network address. | public void | setSubnetMask(String mask) Sets the subnet mask. | public void | setSubnetMask(byte[] mask) Sets the subnet mask.
Only valid subnet masks are accepted, for which the binary representation is a sequence of
1-bits followed by a sequence of 0-bits. |
AbstractIPRange | public AbstractIPRange(ItemManager itemManager, Logger logger)(Code) | | Ctor.
Initializes the the IP range with the local host (127.0.0.1/24 for IPv4, ::1/128 for IPv6).
Parameters: itemManager - The item manager. Parameters: logger - The logger. |
AbstractIPRange | public AbstractIPRange(ItemManager itemManager, Logger logger, String id)(Code) | | Ctor.
Parameters: itemManager - The item manager. Parameters: logger - The logger. Parameters: id - The IP range ID. |
contains | public boolean contains(Machine machine)(Code) | | Checks if this IP range contains a certain machine.
Note: if the network address and the subnet mask of this IP range have different sizes (i.e.
one is IPv4 and one is IPv6), this method will always return false , no matter
what machine has been specified!
Further, if the machine address and the IP range (i.e. network address and subnet mask) have
different sizes, the method will return false . (In other words: an IPv4 range
never contains an IPv6 address and the other way round.)
Note that the above can lead to confusion. For example the local subnet in IPv4 (
127.0.0.0/8 ) will not contain the localhost in IPv6 (
::1 ), and the localhost in IPv4 (127.0.0.1 ) will not
be contained in the local subnet in IPv6 (::1/128 ).
Parameters: machine - the machine to check for a boolean value See Also: InetAddressUtil.contains |
getConfigurationDirectory | public File getConfigurationDirectory()(Code) | | Returns the configuration directory.
A file object. |
getNetworkAddress | public InetAddress getNetworkAddress()(Code) | | Returns the network address.
an InetAddress representing the network address |
getSubnetMask | public InetAddress getSubnetMask()(Code) | | Returns the subnet mask.
An InetAddress value. |
isValidSubnet | public static boolean isValidSubnet(InetAddress networkAddress, InetAddress subnetMask)(Code) | | Checks if a network address / subnet mask combination describes a valid subnet.
Parameters: networkAddress - The network address. Parameters: subnetMask - The subnet mask. A boolean value. |
setConfigurationDirectory | protected void setConfigurationDirectory(File _configurationDirectory)(Code) | | |
setNetworkAddress | public void setNetworkAddress(String address) throws AccessControlException(Code) | | Sets the network address. This method accepts numeric IPv4 addresses like
"129.168.0.32" , numeric IPv6 addresses like
"1080::8:800:200C:417A" as well as hostnames (if DNS resolution is available)
like "localhost" or "www.apache.com" .
Parameters: address - a String like "192.168.0.32" ,"::1" , ... throws: AccessControlException - when the conversion of the String to anInetAddress failed See Also: AbstractIPRange.setNetworkAddress(byte[]) |
setNetworkAddress | public void setNetworkAddress(byte[] address) throws AccessControlException(Code) | | Sets the network address. The method accepts numeric IPv4 addresses (specified by byte arrays
of length 4) or IPv6 addresses (specified by byte arrays of length 16).
Parameters: address - a byte array of the length 4 or 16 throws: AccessControlException - when the conversion of the byte array to an InetAddressfailed. See Also: AbstractIPRange.setNetworkAddress(String) |
setSubnetMask | public void setSubnetMask(byte[] mask) throws AccessControlException(Code) | | Sets the subnet mask.
Only valid subnet masks are accepted, for which the binary representation is a sequence of
1-bits followed by a sequence of 0-bits. For example { 255, 128, 0, 0 } is
valid while { 255, 128, 0, 1 } is not.
Parameters: mask - A byte array of the length 4. throws: AccessControlException - when the conversion of the byte array to an InetAddressfailed. See Also: AbstractIPRange.setSubnetMask(String) |
|
|