org.objectweb.cjdbc.controller.cache.schema
Class CacheDatabaseTable

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.cache.schema.CacheDatabaseTable
All Implemented Interfaces:
java.io.Serializable

public class CacheDatabaseTable
extends java.lang.Object
implements java.io.Serializable

A CacheDatabaseTable represents a database table and its associated cache entries. It has an array of CacheDatabaseColumn objects.

Keep it mind that ArrayList is not synchronized...

Version:
1.0
Author:
Emmanuel Cecchet, Sara Bouchenak
See Also:
Serialized Form

Field Summary
private  java.util.ArrayList cacheEntries
           
private  java.util.ArrayList columns
           
private  java.lang.String name
           
 
Constructor Summary
CacheDatabaseTable(DatabaseTable databaseTable)
          Creates a new CacheDatabaseTable instance.
 
Method Summary
 void addColumn(CacheDatabaseColumn column)
          Adds a CacheDatabaseColumn object to this table.
 void addQueryCacheEntry(QueryCacheEntry ce)
          Adds a CacheEntry object whose consistency depends on this table.
 boolean equals(java.lang.Object other)
          Two CacheDatabaseColumn are equals if they have the same name and the same columns.
 CacheDatabaseColumn getColumn(java.lang.String columnName)
          Returns the CacheDatabaseColumn object matching the given column name or null if not found.
 java.util.ArrayList getColumns()
          Returns a list of CacheDatabaseColumn objects describing the columns of this table.
 java.lang.String getInformation(boolean longFormat)
          Returns information about the database table and its columns.
 java.lang.String getName()
          Gets the name of the table.
 void invalidateAll()
          Invalidates all cache entries of every column of this table.
 void mergeColumns(CacheDatabaseTable t)
          Merge the given table's columns with the current table.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name

columns

private java.util.ArrayList columns

cacheEntries

private java.util.ArrayList cacheEntries
Constructor Detail

CacheDatabaseTable

public CacheDatabaseTable(DatabaseTable databaseTable)
Creates a new CacheDatabaseTable instance.

Parameters:
databaseTable - the database table to cache
Method Detail

getName

public java.lang.String getName()
Gets the name of the table.

Returns:
the table name

addColumn

public void addColumn(CacheDatabaseColumn column)
Adds a CacheDatabaseColumn object to this table.

Warning! The underlying ArrayList is not synchronized.

Parameters:
column - a CacheDatabaseColumn value

mergeColumns

public void mergeColumns(CacheDatabaseTable t)
                  throws java.sql.SQLException
Merge the given table's columns with the current table. All missing columns are added if no conflict is detected. An exception is thrown if the given table columns conflicts with the current one.

Parameters:
t - the table to merge
Throws:
java.sql.SQLException - if the schemas conflict

getColumns

public java.util.ArrayList getColumns()
Returns a list of CacheDatabaseColumn objects describing the columns of this table.

Warning! The underlying ArrayList is not synchronized.

Returns:
an ArrayList of CacheDatabaseColumn

getColumn

public CacheDatabaseColumn getColumn(java.lang.String columnName)
Returns the CacheDatabaseColumn object matching the given column name or null if not found.

Parameters:
columnName - column name to look for
Returns:
a CacheDatabaseColumn value or null

equals

public boolean equals(java.lang.Object other)
Two CacheDatabaseColumn are equals if they have the same name and the same columns.

Parameters:
other - the object to compare with
Returns:
true if the objects are the same

addQueryCacheEntry

public void addQueryCacheEntry(QueryCacheEntry ce)
Adds a CacheEntry object whose consistency depends on this table.

Parameters:
ce - a CacheEntry value

invalidateAll

public void invalidateAll()
Invalidates all cache entries of every column of this table.


getInformation

public java.lang.String getInformation(boolean longFormat)
Returns information about the database table and its columns.

Parameters:
longFormat - true for a long format, false for a short summary
Returns:
String


Copyright © 2002, 2003 - ObjectWeb Consortium - All Rights Reserved.