java.lang.Object
com.aoindustries.aoserv.master.TableHandler
The
TableHandler handles all the accesses to the AOServ tables.- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of updates that will typically be done before the changes are committed.static final StringThe joins used for the business tree.static final StringThe joins used for the business tree.static final StringThe joins used for the business tree.static final StringThe where clauses that accompany the joins.static final StringThe where clauses that accompany the joins.static final StringThe where clauses that accompany the joins.static final StringThe where clauses that accompany the joins.static final StringThe where clauses that accompany the joins.static final intThe number of rows statements that should typically be used per update/insert/delete batch. -
Method Summary
Modifier and TypeMethodDescriptionstatic intThis is available, but recommend registering viaServiceLoader.static intThis is available, but recommend registering viaServiceLoader.static voidcheckInvalidator(DatabaseConnection conn, RequestSource source, String action) static intconvertClientTableIdToDbTableId(DatabaseAccess db, AoservProtocol.Version version, int clientTableId) Converts a specific AoservProtocol version table ID to the number used in the database storage.static intconvertDbTableIdToClientTableId(DatabaseAccess db, AoservProtocol.Version version, int tableId) static Table.TableIdconvertFromClientTableId(DatabaseConnection conn, RequestSource source, int clientTableId) Converts the client's AoservProtocol-version-specific table ID to the version used by the master's AoservProtocol version.static intconvertToClientTableId(DatabaseAccess db, RequestSource source, Table.TableId tableId) Converts a local (Master AoservProtocol) table ID to a client-version matched table ID.static intgetCachedRowCount(DatabaseConnection conn, RequestSource source, Table.TableId tableId) static voidgetObject(DatabaseConnection conn, RequestSource source, StreamableInput in, StreamableOutput out, Table.TableId tableId) Gets one object from a table.static voidgetOldTable(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, String tableName) Gets an old table given its table name.static IntListgetOperatingSystemVersions(DatabaseConnection conn, RequestSource source) static intgetRowCount(DatabaseConnection conn, RequestSource source, Table.TableId tableId) Gets the number of accessible rows in a table.static voidgetTable(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, Table.TableId tableId) Gets an entire table.static StringgetTableName(DatabaseAccess db, Table.TableId tableId) Gets the table name, with schema prefixed.static StringgetTableNameForDbTableId(DatabaseAccess db, Integer dbTableId) Gets the table name, with schema prefixed.static voidinvalidate(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Table.TableId tableId, int host) static voidinvalidateTable(Table.TableId tableId) static booleanisInvalidator(DatabaseConnection conn, RequestSource source) static voidstart()
-
Field Details
-
UPDATE_BATCH_SIZE
public static final int UPDATE_BATCH_SIZEThe number of rows statements that should typically be used per update/insert/delete batch.- See Also:
-
BATCH_COMMIT_INTERVAL
public static final int BATCH_COMMIT_INTERVALThe number of updates that will typically be done before the changes are committed.- See Also:
-
BU1_PARENTS_JOIN
The joins used for the business tree.- See Also:
-
BU1_PARENTS_JOIN_NO_COMMA
The joins used for the business tree.- See Also:
-
BU2_PARENTS_JOIN
The joins used for the business tree.- See Also:
-
PK_BU1_PARENTS_WHERE
The where clauses that accompany the joins.- See Also:
-
PK1_BU1_PARENTS_OR_WHERE
The where clauses that accompany the joins.- See Also:
-
PK1_BU1_PARENTS_WHERE
The where clauses that accompany the joins.- See Also:
-
PK3_BU2_PARENTS_OR_WHERE
The where clauses that accompany the joins.- See Also:
-
PK3_BU2_PARENTS_WHERE
The where clauses that accompany the joins.- See Also:
-
-
Method Details
-
start
public static void start() -
addGetObjectHandler
This is available, but recommend registering viaServiceLoader. -
getObject
public static void getObject(DatabaseConnection conn, RequestSource source, StreamableInput in, StreamableOutput out, Table.TableId tableId) throws IOException, SQLException Gets one object from a table.- Throws:
IOExceptionSQLException
-
getCachedRowCount
public static int getCachedRowCount(DatabaseConnection conn, RequestSource source, Table.TableId tableId) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getRowCount
public static int getRowCount(DatabaseConnection conn, RequestSource source, Table.TableId tableId) throws IOException, SQLException Gets the number of accessible rows in a table.- Throws:
IOExceptionSQLException
-
addGetTableHandler
This is available, but recommend registering viaServiceLoader. -
getTable
public static void getTable(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, Table.TableId tableId) throws IOException, SQLException Gets an entire table.- Throws:
IOExceptionSQLException
-
getOldTable
public static void getOldTable(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, String tableName) throws IOException, SQLException Gets an old table given its table name. This is used for backwards compatibility to provide data for tables that no longer exist.- Throws:
IOExceptionSQLException
-
invalidate
public static void invalidate(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Table.TableId tableId, int host) throws SQLException, IOException - Throws:
SQLExceptionIOException
-
checkInvalidator
public static void checkInvalidator(DatabaseConnection conn, RequestSource source, String action) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
isInvalidator
public static boolean isInvalidator(DatabaseConnection conn, RequestSource source) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getTableNameForDbTableId
public static String getTableNameForDbTableId(DatabaseAccess db, Integer dbTableId) throws SQLException Gets the table name, with schema prefixed.- Throws:
SQLException- See Also:
-
getTableName
public static String getTableName(DatabaseAccess db, Table.TableId tableId) throws IOException, SQLException Gets the table name, with schema prefixed.- Throws:
IOExceptionSQLException- See Also:
-
convertClientTableIdToDbTableId
public static int convertClientTableIdToDbTableId(DatabaseAccess db, AoservProtocol.Version version, int clientTableId) throws IOException, SQLException Converts a specific AoservProtocol version table ID to the number used in the database storage.- Returns:
- the
idused in the database or-1if unknown - Throws:
IOExceptionSQLException
-
convertDbTableIdToClientTableId
public static int convertDbTableIdToClientTableId(DatabaseAccess db, AoservProtocol.Version version, int tableId) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
convertFromClientTableId
public static Table.TableId convertFromClientTableId(DatabaseConnection conn, RequestSource source, int clientTableId) throws IOException, SQLException Converts the client's AoservProtocol-version-specific table ID to the version used by the master's AoservProtocol version.- Returns:
- The
Table.TableIdornullif no match. - Throws:
IOExceptionSQLException
-
convertToClientTableId
public static int convertToClientTableId(DatabaseAccess db, RequestSource source, Table.TableId tableId) throws IOException, SQLException Converts a local (Master AoservProtocol) table ID to a client-version matched table ID.- Throws:
IOExceptionSQLException
-
invalidateTable
-
getOperatingSystemVersions
public static IntList getOperatingSystemVersions(DatabaseConnection conn, RequestSource source) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
