|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jsfcl.data.DataCache
Cache for row and column values that supports persisting the data behind
a UIData
component across HTTP requests, without
requiring that the underlying JDBC connection remain open. It also includes
mechanisms to detect which row and column values have been updated, in order
to support minimal database activity when synchronizing these changes to
the underlying database.
DataCache
declares itself to be Serializable
to conform to the J2EE platform requirement that session scope attributes
should be serializable on a distributable container. However, this will
only succeed if the actual cached column values are themselves
Serializable as well.
Nested Class Summary | |
class |
DataCache.Column
Column encapsulates the stored information
about a single "column" of data, typically corresponding to a column
from an individual row in an underlying relational database. |
class |
DataCache.Row
Row encapsulates the stored information
about a single "row" of data, typically corresponding to a row in
an underlying relational database. |
Constructor Summary | |
DataCache()
|
Method Summary | |
void |
add(int rowIndex,
DataCache.Row row)
Add a new row entry to the cache, replacing any existing cache entry for the same rowIndex value. |
void |
clear()
Clear any cached row and column data. |
void |
commit()
Commit the updated state of all cached rows. |
DataCache.Column |
createColumn(java.lang.String schemaName,
java.lang.String tableName,
java.lang.String columnName,
int sqlType,
java.lang.Class javaType,
java.lang.Object original)
Create and return a Column instance configured
with the specified parameters. |
DataCache.Column |
createColumn(java.lang.String schemaName,
java.lang.String tableName,
java.lang.String columnName,
int sqlType,
java.lang.Object original)
Create and return a Column instance configured
with the specified parameters. |
DataCache.Row |
createRow(DataCache.Column[] columns)
Create and return a Row instance configured
with the specified parameters. |
DataCache.Row |
get(int rowIndex)
Return the cached row associated with the specified row index, if any; otherwise, return null . |
java.util.Iterator |
iterator()
Return an Iterator over the row index values
(of type java.lang.Integer ) for which cached data
is present. |
void |
remove(int rowIndex)
Remove any row entry corresponding to the specified rowIndex . |
void |
reset()
Reset the updated state of all rows and columns in the cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataCache()
Method Detail |
public void add(int rowIndex, DataCache.Row row)
Add a new row entry to the cache, replacing any existing cache entry
for the same rowIndex
value.
rowIndex
- Row index this row corresponds torow
- DataCache.Row
to be addedpublic void clear()
Clear any cached row and column data.
public void commit()
Commit the updated state of all cached rows. After this method completes, the current values for all columns will appear to be original, any rows marked deleted will be removed, and no row will be considered updated.
public DataCache.Column createColumn(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, int sqlType, java.lang.Object original)
Create and return a Column
instance configured
with the specified parameters.
schemaName
- Schema name of the table containing this
column (if any)tableName
- Table name containing this column (if any)columnName
- Column name of this columnsqlType
- SQL type (from java.sql.Types)original
- Original value for this columnpublic DataCache.Column createColumn(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, int sqlType, java.lang.Class javaType, java.lang.Object original)
Create and return a Column
instance configured
with the specified parameters.
schemaName
- Schema name of the table containing this
column (if any)tableName
- Table name containing this column (if any)columnName
- Column name of this columnsqlType
- SQL type (from java.sql.Types)javaType
- Java type as would be returned by
Class.forName(ResultSetMetaData.getColumnClassName)original
- Original value for this columnpublic DataCache.Row createRow(DataCache.Column[] columns)
Create and return a Row
instance configured
with the specified parameters.
columns
- Column
instances for this rowpublic DataCache.Row get(int rowIndex)
Return the cached row associated with the specified row index,
if any; otherwise, return null
.
rowIndex
- Row index for which to retrieve a rowpublic java.util.Iterator iterator()
Return an Iterator
over the row index values
(of type java.lang.Integer
) for which cached data
is present.
public void remove(int rowIndex)
Remove any row entry corresponding to the specified
rowIndex
.
rowIndex
- Row index for which to remove any cached datapublic void reset()
Reset the updated state of all rows and columns in the cache.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |