Class AoservObject<K,T extends AoservObject<K,T>>
- All Implemented Interfaces:
Streamable
,StreamReadable
,StreamWritable
,Row
,AoservReadable
,AoservStreamable
,AoservWritable
- Direct Known Subclasses:
BackupReport
,BankTransaction
,CachedObject
,FileReplicationLog
,FilesystemCachedObject
,GlobalObject
,Process
,ServerStat
,SpamMessage
AoservObject
is the lowest level object
for all data in the system. Each AoservObject
belongs to a AoservTable
, and each table
contains AoservObject
s.- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Deprecated.Only required for implementation, do not use directly. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
compare
(int i1, int i2) Deprecated.This method moved toComparatorUtils.compare(int, int)
static int
compare
(long l1, long l2) Deprecated.This method moved toComparatorUtils.compare(long, long)
static int
compare
(short s1, short s2) Deprecated.This method moved toComparatorUtils.compare(short, short)
static <T extends Comparable<T>>
intcompare
(T obj1, T obj2) Compares two objects allowing for nulls, sorts non-null before null.static int
Deprecated.final int
compareTo
(AoservConnector conn, AoservObject<?, ?> other, SqlExpression[] sortExpressions, boolean[] sortOrders) final int
compareTo
(AoservConnector conn, Comparable<?> value, SqlExpression[] sortExpressions, boolean[] sortOrders) final int
compareTo
(AoservConnector conn, Object[] objects, SqlExpression[] sortExpressions, boolean[] sortOrders) boolean
protected static Account.Name
getAccountingCode
(AccountName accounting) null-safe accounting code conversion.final Object
getColumn
(int i) protected abstract Object
getColumnImpl
(int i) getColumns
(AoservConnector connector) final int
getColumns
(AoservConnector connector, List<Object> buff) protected static DomainLabel
getDomainLabel
(DomainLabel domainLabel) null-safe domain label conversion.protected static DomainLabels
getDomainLabels
(DomainLabels domainLabels) null-safe domain labels conversion.protected static DomainName
getDomainName
(DomainName domainName) null-safe domain name conversion.protected static <B> B
getDto
(DtoFactory<B> dtoFactory) null-safe getDto.protected static Email
null-safe email conversion.protected static User.Gecos
null-safe GECOS conversion.protected static Group.Name
getGroupId
(LinuxGroupName gid) null-safe group id conversion.protected static HashedKey
getHashedKey
(HashedKey hashedKey) null-safe hashed key conversion.protected static HashedPassword
getHashedPassword
(HashedPassword hashedPassword) null-safe hashed password conversion.protected static HostAddress
getHostname
(HostAddress hostname) null-safe hostname conversion.protected static InetAddress
getInetAddress
(InetAddress inetAddress) null-safe inet address conversion.abstract K
getKey()
protected static LinuxId
getLinuxId
(LinuxId lid) null-safe Linux id conversion.protected static User.Name
getLinuxUserName
(LinuxUserName linuxUserName) null-safe Linux user name conversion.protected static MacAddress
getMacAddress
(MacAddress macAddress) null-safe MAC address conversion.protected static Database.Name
getMysqlDatabaseName
(MysqlDatabaseName databaseName) null-safe MySQL database name conversion.protected static Server.Name
getMysqlServerName
(MysqlServerName serverName) null-safe MySQL server name conversion.protected static User.Name
getMysqlUserName
(MysqlUserName mysqlUserId) null-safe MySQL user name conversion.protected static Port
null-safe port conversion.protected static Database.Name
getPostgresDatabaseName
(PostgresDatabaseName databaseName) null-safe PostgreSQL database name conversion.protected static Server.Name
getPostgresServerName
(PostgresServerName serverName) null-safe PostgreSQL server name conversion.protected static User.Name
getPostgresUserId
(PostgresUserName postgresUserId) null-safe PostgreSQL user id conversion.abstract Table.TableId
final Table
getTableSchema
(AoservConnector connector) protected static Long
getTimeMillis
(Calendar datetime) null-safe conversion from Calendar to Long.protected static Long
getTimeMillis
(Date date) null-safe conversion from Date to Long.protected static PosixPath
getUnixPath
(PosixPath unixPath) null-safe Unix path conversion.protected static User.Name
null-safe user id conversion.int
hashCode()
abstract void
Initializes this object from the raw database contents.abstract void
read
(StreamableInput in, AoservProtocol.Version protocolVersion) final void
read
(StreamableInput in, String protocolVersion) Deprecated.This is maintained only for compatibility with theStreamable
interface.final String
toString()
toString()
implementation that is allowed to throw exceptions.abstract void
write
(StreamableOutput out, AoservProtocol.Version protocolVersion) final void
write
(StreamableOutput out, String protocolVersion) Deprecated.This is maintained only for compatibility with theStreamable
interface.
-
Field Details
-
USE_SQL_DATA
public static final boolean USE_SQL_DATAEnables the use ofSQLData
. This currently requires our forked PostgreSQL JDBC driver to function correctly. See Issue #641 for more details.- See Also:
-
USE_SQL_DATA_WRITE
public static final boolean USE_SQL_DATA_WRITEEnables the use ofSQLData
on writeObject. This currently requires our forked PostgreSQL JDBC driver to function correctly. See Pull request #1377 for more details.- See Also:
-
USE_ARRAY_OF_DOMAIN
public static final boolean USE_ARRAY_OF_DOMAINEnables the use of arrays of domains. This is currently not supported by PostgreSQL.- See Also:
-
-
Constructor Details
-
AoservObject
Deprecated.Only required for implementation, do not use directly.- See Also:
-
-
Method Details
-
compareIgnoreCaseConsistentWithEquals
Deprecated. -
compare
Deprecated.This method moved toComparatorUtils.compare(int, int)
-
compare
Deprecated.This method moved toComparatorUtils.compare(short, short)
-
compare
Deprecated.This method moved toComparatorUtils.compare(long, long)
-
compare
Compares two objects allowing for nulls, sorts non-null before null. -
compareTo
public final int compareTo(AoservConnector conn, AoservObject<?, ?> other, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
compareTo
public final int compareTo(AoservConnector conn, Comparable<?> value, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
compareTo
public final int compareTo(AoservConnector conn, Object[] objects, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
getDto
null-safe getDto. -
getAccountingCode
null-safe accounting code conversion.- Throws:
ValidationException
-
getDomainLabel
null-safe domain label conversion.- Throws:
ValidationException
-
getDomainLabels
null-safe domain labels conversion.- Throws:
ValidationException
-
getDomainName
null-safe domain name conversion.- Throws:
ValidationException
-
getEmail
null-safe email conversion.- Throws:
ValidationException
-
getGecos
null-safe GECOS conversion.- Throws:
ValidationException
-
getGroupId
null-safe group id conversion.- Throws:
ValidationException
-
getHashedKey
null-safe hashed key conversion.- Throws:
IllegalArgumentException
-
getHashedPassword
protected static HashedPassword getHashedPassword(HashedPassword hashedPassword) throws IllegalArgumentException null-safe hashed password conversion.- Throws:
IllegalArgumentException
-
getHostname
null-safe hostname conversion.- Throws:
ValidationException
-
getInetAddress
null-safe inet address conversion.- Throws:
ValidationException
-
getLinuxId
null-safe Linux id conversion.- Throws:
ValidationException
-
getLinuxUserName
null-safe Linux user name conversion.- Throws:
ValidationException
-
getMacAddress
null-safe MAC address conversion.- Throws:
ValidationException
-
getMysqlDatabaseName
protected static Database.Name getMysqlDatabaseName(MysqlDatabaseName databaseName) throws ValidationException null-safe MySQL database name conversion.- Throws:
ValidationException
-
getMysqlServerName
protected static Server.Name getMysqlServerName(MysqlServerName serverName) throws ValidationException null-safe MySQL server name conversion.- Throws:
ValidationException
-
getMysqlUserName
null-safe MySQL user name conversion.- Throws:
ValidationException
-
getPort
null-safe port conversion.- Throws:
ValidationException
-
getPostgresDatabaseName
protected static Database.Name getPostgresDatabaseName(PostgresDatabaseName databaseName) throws ValidationException null-safe PostgreSQL database name conversion.- Throws:
ValidationException
-
getPostgresServerName
protected static Server.Name getPostgresServerName(PostgresServerName serverName) throws ValidationException null-safe PostgreSQL server name conversion.- Throws:
ValidationException
-
getPostgresUserId
protected static User.Name getPostgresUserId(PostgresUserName postgresUserId) throws ValidationException null-safe PostgreSQL user id conversion.- Throws:
ValidationException
-
getTimeMillis
null-safe conversion from Date to Long. -
getTimeMillis
null-safe conversion from Calendar to Long. -
getUnixPath
null-safe Unix path conversion.- Throws:
ValidationException
-
getUserId
null-safe user id conversion.- Throws:
ValidationException
-
equals
Implementation Note:
This default implementation considers the object equal when it is the same class (viaObject.getClass()
and has equal keys (viagetKey()
). -
getColumn
-
getColumnImpl
- Throws:
IOException
SQLException
-
getColumns
- Throws:
IOException
SQLException
-
getColumns
public final int getColumns(AoservConnector connector, List<Object> buff) throws IOException, SQLException - Throws:
IOException
SQLException
-
getKey
-
getTableId
-
getTableSchema
- Throws:
IOException
SQLException
-
hashCode
public int hashCode()Implementation Note:
This default implementation callshashCode()
on the key (fromgetKey()
). -
init
Initializes this object from the raw database contents.- Parameters:
results
- theResultSet
containing the row to copy into this object- Throws:
SQLException
-
read
Deprecated.This is maintained only for compatibility with theStreamable
interface.- Specified by:
read
in interfaceAoservStreamable
- Specified by:
read
in interfaceStreamable
- Specified by:
read
in interfaceStreamReadable
- Throws:
IOException
- See Also:
-
read
public abstract void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException - Specified by:
read
in interfaceAoservReadable
- Specified by:
read
in interfaceAoservStreamable
- Throws:
IOException
-
toString
Implementation Note:
This default implementation callstoStringImpl()
, which is allowed to throw exceptions.- Overrides:
toString
in classObject
- Throws:
WrappedException
- whentoStringImpl()
throws an exception- See Also:
-
toStringImpl
toString()
implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callstoString()
on the key (fromgetKey()
). When the key isnull
, uses the default implementation fromObject.toString()
.- Throws:
IOException
SQLException
-
write
@Deprecated public final void write(StreamableOutput out, String protocolVersion) throws IOException Deprecated.This is maintained only for compatibility with theStreamable
interface.- Specified by:
write
in interfaceAoservStreamable
- Specified by:
write
in interfaceStreamable
- Specified by:
write
in interfaceStreamWritable
- Throws:
IOException
- See Also:
-
write
public abstract void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException - Specified by:
write
in interfaceAoservStreamable
- Specified by:
write
in interfaceAoservWritable
- Throws:
IOException
-