Package com.aoindustries.aoserv.client
Class GlobalTable<K,V extends GlobalObject<K,V>>
java.lang.Object
com.aoindustries.aoserv.client.AoservTable<K,V>
com.aoindustries.aoserv.client.GlobalTable<K,V>
- Direct Known Subclasses:
BackupRetentionTable,GlobalTableDomainNameKey,GlobalTableIntegerKey,GlobalTablePosixPathKey,GlobalTableStringKey
A
GlobalTable is shared between all users.
The data is cached so that subsequent lookups need not
access the server.- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.aoindustries.aoserv.client.AoservTable
AoservTable.OrderBy -
Field Summary
Fields inherited from class com.aoindustries.aoserv.client.AoservTable
ASCENDING, connector, DESCENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cache, freeing up memory.final intGets the number of accessible rows in the table or-1if the table is not yet loaded.getIndexedRows(int col, Object value) Gets the rows in a more efficient, indexed manner.getRows()Gets the list of all accessible rows.Gets a modifiable copy of the rows, which may then be manipulated, such as for sorting.protected final VgetUniqueRowImpl(int col, Object value) Gets a row given a unique column value.final booleanisLoaded()Checks if the table is loaded.Methods inherited from class com.aoindustries.aoserv.client.AoservTable
addProgressListener, addTableListener, addTableListener, addTableLoadListener, get, getCachedRowCount, getConnector, getDefaultOrderBy, getDefaultOrderBySqlExpressions, getIndexedRows, getMap, getNewObject, getObject, getObjects, getObjects, getObjects, getObjectsNoProgress, getObjectsNoProgress, getSize, getSortAlgorithm, getTableId, getTableName, getTableSchema, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, handleCommand, hasAnyTableListener, hasTableListener, isEmpty, iterator, printTable, removeProgressListener, removeTableListener, removeTableLoadListener, size, sortIfNeeded, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GlobalTable
-
-
Method Details
-
getGlobalRowCount
public final int getGlobalRowCount()Gets the number of accessible rows in the table or-1if the table is not yet loaded. -
getIndexedRows
Description copied from class:AoservTableGets the rows in a more efficient, indexed manner.Implementation Note:
This default implementation simply throws UnsupportedOperationException.- Overrides:
getIndexedRowsin classAoservTable<K,V extends GlobalObject<K, V>> - Throws:
IOExceptionSQLException
-
getUniqueRowImpl
Description copied from class:AoservTableGets a row given a unique column value.- Specified by:
getUniqueRowImplin classAoservTable<K,V extends GlobalObject<K, V>> - Parameters:
col- the column index to searchvalue- whennull, no row is matched, even if there is a single row with a uniquelynullvalue- Throws:
SQLExceptionIOException
-
getRows
Description copied from class:AoservTableGets the list of all accessible rows.- Specified by:
getRowsin interfaceTable<K>- Overrides:
getRowsin classAoservTable<K,V extends GlobalObject<K, V>> - Returns:
- a
Listcontaining all of the rows - Throws:
IOException- if unable to access the serverSQLException- if unable to access the database- See Also:
-
getRowsCopy
Description copied from class:AoservTableGets a modifiable copy of the rows, which may then be manipulated, such as for sorting.This gives the table implementation a way to create a defensive copy most efficient to its underlying storage mechanism.
Note: It is best to use
AoservTable.getSortAlgorithm()when sorting rows, as the choice of sorting can be very important when objects are pulled from non-heap source like filesystem-based objects. It is very easy for the sort itself to end up pulling all objects into heap.- Specified by:
getRowsCopyin classAoservTable<K,V extends GlobalObject<K, V>> - Throws:
IOExceptionSQLException- See Also:
-
isLoaded
public final boolean isLoaded()Description copied from class:AoservTableChecks if the table is loaded. A table is considered loaded when accessing any part of it will be done entirely locally, avoiding any network traffic.- Overrides:
isLoadedin classAoservTable<K,V extends GlobalObject<K, V>>
-
clearCache
public void clearCache()Description copied from class:AoservTableClears the cache, freeing up memory. The data will be reloaded upon next use.- Overrides:
clearCachein classAoservTable<K,V extends GlobalObject<K, V>>
-
