org.apache.lenya.ac
Class Machine

java.lang.Object
  extended by org.apache.lenya.ac.Machine
All Implemented Interfaces:
java.io.Serializable, Accreditable, Identifiable

public class Machine
extends java.lang.Object
implements Identifiable, java.io.Serializable

A machine (representing an IP address).

Version:
$Id: Machine.java 473861 2006-11-12 03:51:14Z gregor $
See Also:
Serialized Form

Constructor Summary
Machine(java.lang.String ip)
          Creates a new machine object.
 
Method Summary
 void addIPRange(IPRange range)
          Adds an IP range to this machine.
 boolean equals(java.lang.Object otherObject)
           
 Accreditable[] getAccreditables()
          Returns the set of accreditables of this accreditable.
 java.net.InetAddress getAddress()
          Returns the IP address.
static java.net.InetAddress getAddress(java.lang.String string)
          Deprecated. This method is unnecessary and does not work for IPv6. Use InetAddress.getByName(string) instead!
 java.lang.String getIp()
          Returns the IP address.
 IPRange[] getIPRanges()
          Returns the IP ranges this machine belongs to.
 int hashCode()
           
 void setAddress(java.net.InetAddress _address)
          Sets the IP address.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Machine

public Machine(java.lang.String ip)
        throws AccessControlException
Creates a new machine object. 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:
ip - a String like "192.168.0.32", "::1", ... .
Throws:
AccessControlException - when the conversion of the String to an InetAddress failed
Method Detail

equals

public boolean equals(java.lang.Object otherObject)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getAccreditables

public Accreditable[] getAccreditables()
Description copied from interface: Accreditable
Returns the set of accreditables of this accreditable. The set contains the accreditable itself and all collections it belongs to.

Specified by:
getAccreditables in interface Accreditable
Returns:
An array of accreditables.
See Also:
Accreditable.getAccreditables()

getIp

public java.lang.String getIp()
Returns the IP address.

Returns:
The IP address.

getAddress

public static java.net.InetAddress getAddress(java.lang.String string)
                                       throws AccessControlException
Deprecated. This method is unnecessary and does not work for IPv6. Use InetAddress.getByName(string) instead!

Converts a string to an IP addres.

Parameters:
string - The IP address, represented by a string.
Returns:
An InetAddress object.
Throws:
AccessControlException - when something went wrong.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getAddress

public java.net.InetAddress getAddress()
Returns the IP address.

Returns:
An IP address.

setAddress

public void setAddress(java.net.InetAddress _address)
Sets the IP address.

Parameters:
_address - An IP address.

addIPRange

public void addIPRange(IPRange range)
Adds an IP range to this machine.

Parameters:
range - An IP range this machine belongs to.

getIPRanges

public IPRange[] getIPRanges()
Returns the IP ranges this machine belongs to.

Returns:
An array of IP ranges.


Copyright 1999-2006 Apache Software Foundation. All Rights Reserved.