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
Modifier and TypeClassDescriptionstatic interface
static interface
static class
static class
static class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The number of updates that will typically be done before the changes are committed.static final String
The joins used for the business tree.static final String
The joins used for the business tree.static final String
The joins used for the business tree.static final String
The where clauses that accompany the joins.static final String
The where clauses that accompany the joins.static final String
The where clauses that accompany the joins.static final String
The where clauses that accompany the joins.static final String
The where clauses that accompany the joins.static final int
The number of rows statements that should typically be used per update/insert/delete batch. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
This is available, but recommend registering viaServiceLoader
.static int
This is available, but recommend registering viaServiceLoader
.static void
checkInvalidator
(DatabaseConnection conn, RequestSource source, String action) static int
convertClientTableIdToDbTableId
(DatabaseAccess db, AoservProtocol.Version version, int clientTableId) Converts a specific AoservProtocol version table ID to the number used in the database storage.static int
convertDbTableIdToClientTableId
(DatabaseAccess db, AoservProtocol.Version version, int tableId) static Table.TableId
convertFromClientTableId
(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 int
convertToClientTableId
(DatabaseAccess db, RequestSource source, Table.TableId tableId) Converts a local (Master AoservProtocol) table ID to a client-version matched table ID.static int
getCachedRowCount
(DatabaseConnection conn, RequestSource source, Table.TableId tableId) static void
getObject
(DatabaseConnection conn, RequestSource source, StreamableInput in, StreamableOutput out, Table.TableId tableId) Gets one object from a table.static void
getOldTable
(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, String tableName) Gets an old table given its table name.static IntList
getOperatingSystemVersions
(DatabaseConnection conn, RequestSource source) static int
getRowCount
(DatabaseConnection conn, RequestSource source, Table.TableId tableId) Gets the number of accessible rows in a table.static void
getTable
(DatabaseConnection conn, RequestSource source, StreamableOutput out, boolean provideProgress, Table.TableId tableId) Gets an entire table.static String
getTableName
(DatabaseAccess db, Table.TableId tableId) Gets the table name, with schema prefixed.static String
getTableNameForDbTableId
(DatabaseAccess db, Integer dbTableId) Gets the table name, with schema prefixed.static void
invalidate
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Table.TableId tableId, int host) static void
invalidateTable
(Table.TableId tableId) static boolean
isInvalidator
(DatabaseConnection conn, RequestSource source) static void
start()
-
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:
IOException
SQLException
-
getCachedRowCount
public static int getCachedRowCount(DatabaseConnection conn, RequestSource source, Table.TableId tableId) throws IOException, SQLException - Throws:
IOException
SQLException
-
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:
IOException
SQLException
-
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:
IOException
SQLException
-
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:
IOException
SQLException
-
invalidate
public static void invalidate(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Table.TableId tableId, int host) throws SQLException, IOException - Throws:
SQLException
IOException
-
checkInvalidator
public static void checkInvalidator(DatabaseConnection conn, RequestSource source, String action) throws IOException, SQLException - Throws:
IOException
SQLException
-
isInvalidator
public static boolean isInvalidator(DatabaseConnection conn, RequestSource source) throws IOException, SQLException - Throws:
IOException
SQLException
-
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:
IOException
SQLException
- 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
id
used in the database or-1
if unknown - Throws:
IOException
SQLException
-
convertDbTableIdToClientTableId
public static int convertDbTableIdToClientTableId(DatabaseAccess db, AoservProtocol.Version version, int tableId) throws IOException, SQLException - Throws:
IOException
SQLException
-
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.TableId
ornull
if no match. - Throws:
IOException
SQLException
-
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:
IOException
SQLException
-
invalidateTable
-
getOperatingSystemVersions
public static IntList getOperatingSystemVersions(DatabaseConnection conn, RequestSource source) throws IOException, SQLException - Throws:
IOException
SQLException
-