- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<IpAddress>
-
- com.aoindustries.aoserv.client.net.IpAddress
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,SingleTableObject<Integer,IpAddress>
public final class IpAddress extends CachedObjectIntegerKey<IpAddress>
EachIPAddressrepresents a unique IPv4 address. Two of the IP addresses exist on every server,WILDCARD_IPandLOOPBACK_IP. Every other IP address is assigned to a specificServer. IP addresses may be assigned to a specificPackageand may have a monthly rate associated with them.- Author:
- AO Industries, Inc.
- See Also:
Host,Package,Bind,PrivateServer
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_DEVICE_namestatic StringCOLUMN_IP_ADDRESS_namestatic StringLOOPBACK_IPstatic StringWILDCARD_IP-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description IpAddress()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ObjectgetColumnImpl(int i)UnmodifiableTimestampgetCreated()Determines when thisIPAddresswas created.DevicegetDevice()intgetDevice_id()InetAddressgetExternalInetAddress()Gets the external IP address, if different than ip_address.DomainNamegetHostname()intgetId()InetAddressgetInetAddress()static IntegergetIntForIPAddress(String ipAddress)static StringgetIPAddressForInt(int i)IpAddressMonitoringgetMonitoring()List<Bind>getNetBinds()StringgetNetMask()PackagegetPackage()intgetPackage_id()Table.TableIDgetTableID()voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisAlias()booleanisAvailable()booleanisDhcp()booleanisOverflow()booleanisUsed()booleanisWildcard()Deprecated.Replace with getInetAddress().isUnspecified()voidmoveTo(Host server)voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidsetDHCPAddress(InetAddress ipAddress)voidsetHostname(DomainName hostname)Sets the hostname for thisIPAddress.voidsetPackage(Package pk)Sets thePackage.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode, toStringImpl
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
COLUMN_IP_ADDRESS_name
public static final String COLUMN_IP_ADDRESS_name
- See Also:
- Constant Field Values
-
COLUMN_DEVICE_name
public static final String COLUMN_DEVICE_name
- See Also:
- Constant Field Values
-
LOOPBACK_IP
public static final String LOOPBACK_IP
- See Also:
- Constant Field Values
-
WILDCARD_IP
public static final String WILDCARD_IP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getIntForIPAddress
public static Integer getIntForIPAddress(String ipAddress) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getIPAddressForInt
public static String getIPAddressForInt(int i)
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,IpAddress>
-
getId
public int getId()
-
getInetAddress
public InetAddress getInetAddress()
-
getDevice_id
public int getDevice_id()
-
getDevice
public Device getDevice() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
isAlias
public boolean isAlias()
-
getHostname
public DomainName getHostname()
-
getPackage_id
public int getPackage_id()
-
getPackage
public Package getPackage() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getCreated
public UnmodifiableTimestamp getCreated()
Determines when thisIPAddresswas created. The created time is reset when the address is allocated to a differentPackage, which allows the automated accounting to start the billing on the correct day of the month.
-
getNetBinds
public List<Bind> getNetBinds() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
isAvailable
public boolean isAvailable()
-
isOverflow
public boolean isOverflow()
-
isDhcp
public boolean isDhcp()
-
getExternalInetAddress
public InetAddress getExternalInetAddress()
Gets the external IP address, if different than ip_address.
-
getNetMask
public String getNetMask()
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,IpAddress>
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,IpAddress>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,IpAddress>- Throws:
IOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,IpAddress>- Throws:
IOException
-
isUsed
public boolean isUsed() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isWildcard
@Deprecated public boolean isWildcard()
Deprecated.Replace with getInetAddress().isUnspecified()
-
moveTo
public void moveTo(Host server) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setHostname
public void setHostname(DomainName hostname) throws IOException, SQLException
Sets the hostname for thisIPAddress.- Throws:
IOExceptionSQLException
-
setPackage
public void setPackage(Package pk) throws IOException, SQLException
Sets thePackage. The package may only be set if the IP Address is not used by other resources.- Throws:
IOExceptionSQLException
-
setDHCPAddress
public void setDHCPAddress(InetAddress ipAddress) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMonitoring
public IpAddressMonitoring getMonitoring() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
-