クラス org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable

すべてのメンバ一覧

説明

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

Keep it mind that ArrayList and HashMap are not synchronized...

作者:
Emmanuel Cecchet

Sara Bouchenak

バージョン:
1.0

CacheDatabaseTable.java51 行で定義されています。

Public メソッド

 CacheDatabaseTable (DatabaseTable databaseTable)
String getName ()
void addColumn (CacheDatabaseColumn column)
void mergeColumns (CacheDatabaseTable t) throws SQLException
ArrayList getColumns ()
CacheDatabaseColumn getColumn (String columnName)
boolean equals (Object other)
synchronized void addCacheEntry (CacheEntry ce)
void addPkCacheEntry (String pk, CacheEntry ce)
ResultCacheEntry getPkResultCacheEntry (String pk)
void removePkResultCacheEntry (Object pk)
void invalidateAll ()
synchronized void invalidateAllExceptPk ()
String getInformation (boolean longFormat)

Private 変数

String name
ArrayList columns
ArrayList cacheEntries
HashMap pkCacheEntries


コンストラクタとデストラクタ

org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.CacheDatabaseTable DatabaseTable  databaseTable  ) 
 

Creates a new CacheDatabaseTable instance.

引数:
databaseTable the database table to cache
CacheDatabaseTable.java63 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.cacheEntries, org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns, org.objectweb.cjdbc.common.sql.schema.DatabaseTable.getColumns(), org.objectweb.cjdbc.common.sql.schema.DatabaseTable.getName(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.name, と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries.

00064 { 00065 // Clone the name and the columns 00066 name = databaseTable.getName(); 00067 ArrayList origColumns = databaseTable.getColumns(); 00068 int size = origColumns.size(); 00069 columns = new ArrayList(size); 00070 for (int i = 0; i < size; i++) 00071 columns.add(new CacheDatabaseColumn(((DatabaseColumn) origColumns.get(i)) 00072 .getName())); 00073 00074 // Create an empty cache 00075 cacheEntries = new ArrayList(); 00076 pkCacheEntries = new HashMap(); 00077 }


メソッド

synchronized void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addCacheEntry CacheEntry  ce  ) 
 

Adds a CacheEntry object whose consistency depends on this table.

引数:
ce a CacheEntry value
CacheDatabaseTable.java187 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.cacheEntries.

参照元 org.objectweb.cjdbc.controller.cache.result.ResultCacheTable.processAddToCache(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache(), と org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn.processAddToCache().

00188 { 00189 cacheEntries.add(ce); 00190 }

void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addColumn CacheDatabaseColumn  column  ) 
 

Adds a CacheDatabaseColumn object to this table.

Warning! The underlying ArrayList is not synchronized.

引数:
column a CacheDatabaseColumn value
CacheDatabaseTable.java96 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns.

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.mergeColumns().

00097 { 00098 columns.add(column); 00099 }

void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addPkCacheEntry String  pk,
CacheEntry  ce
 

Adds a CacheEntry object associated to a pk entry.

引数:
pk the pk entry
ce a CacheEntry value
CacheDatabaseTable.java198 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries.

参照元 org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache().

00199 { 00200 synchronized (pkCacheEntries) 00201 { 00202 pkCacheEntries.put(pk, ce); 00203 } 00204 }

boolean org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals Object  other  ) 
 

Two CacheDatabaseColumn are equals if they have the same name and the same columns.

引数:
other the object to compare with
戻り値:
true if the objects are the same
CacheDatabaseTable.java172 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns, org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumns(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getName(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.name.

00173 { 00174 if (!(other instanceof CacheDatabaseTable)) 00175 return false; 00176 00177 CacheDatabaseTable t = (CacheDatabaseTable) other; 00178 return t.getName().equals(name) && t.getColumns().equals(columns); 00179 }

CacheDatabaseColumn org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumn String  columnName  ) 
 

Returns the CacheDatabaseColumn object matching the given column name or null if not found.

引数:
columnName column name to look for
戻り値:
a CacheDatabaseColumn value or null
CacheDatabaseTable.java154 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns, と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.getName().

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.mergeColumns(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn.processAddToCache(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify(), と org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn.processWriteNotify().

00155 { 00156 for (Iterator i = columns.iterator(); i.hasNext();) 00157 { 00158 CacheDatabaseColumn c = (CacheDatabaseColumn) i.next(); 00159 if (columnName.compareToIgnoreCase(c.getName()) == 0) 00160 return c; 00161 } 00162 return null; 00163 }

ArrayList org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumns  ) 
 

Returns a list of CacheDatabaseColumn objects describing the columns of this table.

Warning! The underlying ArrayList is not synchronized.

戻り値:
an ArrayList of CacheDatabaseColumn
CacheDatabaseTable.java142 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns.

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache(), と org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn.processAddToCache().

00143 { 00144 return columns; 00145 }

String org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getInformation boolean  longFormat  ) 
 

Returns information about the database table and its columns.

引数:
longFormat true for a long format, false for a short summary
戻り値:
String
CacheDatabaseTable.java279 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns, org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.getInformation(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.name.

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getInformation().

00280 { 00281 String result = "Table " + name + ": "; 00282 int size = columns.size(); 00283 for (int i = 0; i < size; i++) 00284 { 00285 CacheDatabaseColumn c = (CacheDatabaseColumn) columns.get(i); 00286 if (longFormat) 00287 result += "\n"; 00288 result += c.getInformation(); 00289 if (!longFormat && (i < size - 1)) 00290 result += ","; 00291 } 00292 return result; 00293 }

String org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getName  ) 
 

Gets the name of the table.

戻り値:
the table name
CacheDatabaseTable.java84 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.name.

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.hasTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.mergeSchema(), と org.objectweb.cjdbc.controller.cache.result.ResultCache.setDatabaseSchema().

00085 { 00086 return name; 00087 }

ResultCacheEntry org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getPkResultCacheEntry String  pk  ) 
 

Gets a CacheEntry object associated to a pk entry.

引数:
pk the pk entry
戻り値:
the corresponding cache entry if any or null if nothing is found
CacheDatabaseTable.java212 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries.

参照元 org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.isUpdateNecessary(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache(), と org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify().

00213 { 00214 if (pk == null) 00215 return null; 00216 synchronized (pkCacheEntries) 00217 { 00218 return (ResultCacheEntry) pkCacheEntries.get(pk); 00219 } 00220 }

void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll  ) 
 

Invalidates all cache entries of every column of this table. This does also affect the entries based on pk values. CacheDatabaseTable.java240 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.cacheEntries, org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns, と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries.

参照元 org.objectweb.cjdbc.controller.cache.result.ResultCacheTable.processWriteNotify(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn.processWriteNotify(), org.objectweb.cjdbc.controller.cache.result.ResultCache.setDatabaseSchema(), と org.objectweb.cjdbc.controller.cache.result.ResultCache.writeNotify().

00241 { 00242 synchronized (this) 00243 { 00244 for (Iterator i = cacheEntries.iterator(); i.hasNext();) 00245 ((ResultCacheEntry) i.next()).invalidate(); 00246 cacheEntries.clear(); 00247 00248 for (int i = 0; i < columns.size(); i++) 00249 ((CacheDatabaseColumn) columns.get(i)).invalidateAll(); 00250 } 00251 synchronized (pkCacheEntries) 00252 { // All pk cache entries have been invalidated as a side effect by the 00253 // above loop. 00254 pkCacheEntries.clear(); 00255 } 00256 }

synchronized void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAllExceptPk  ) 
 

Invalidates all cache entries of every column of this table. This does not affect the entries based on pk values. CacheDatabaseTable.java262 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.cacheEntries, org.objectweb.cjdbc.common.sql.AbstractRequest.getCacheAbility(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getRequest(), と org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.invalidate().

00263 { 00264 for (Iterator i = cacheEntries.iterator(); i.hasNext();) 00265 { 00266 ResultCacheEntry qce = (ResultCacheEntry) i.next(); 00267 if (qce.getRequest().getCacheAbility() != RequestType.UNIQUE_CACHEABLE) 00268 qce.invalidate(); 00269 } 00270 cacheEntries.clear(); 00271 }

void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.mergeColumns CacheDatabaseTable  t  )  throws 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.

引数:
t the table to merge
例外:
SQLException if the schemas conflict
CacheDatabaseTable.java109 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addColumn(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.equals(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumn(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.getName().

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.mergeSchema().

00110 { 00111 if (t == null) 00112 return; 00113 00114 ArrayList otherColumns = t.getColumns(); 00115 if (otherColumns == null) 00116 return; 00117 00118 int size = otherColumns.size(); 00119 for (int i = 0; i < size; i++) 00120 { 00121 CacheDatabaseColumn c = (CacheDatabaseColumn) otherColumns.get(i); 00122 CacheDatabaseColumn original = getColumn(c.getName()); 00123 if (original == null) 00124 addColumn(c); 00125 else 00126 { 00127 if (!original.equals(c)) 00128 throw new SQLException("Column " + c.getName() 00129 + " definition mismatch."); 00130 } 00131 } 00132 }

void org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.removePkResultCacheEntry Object  pk  ) 
 

Remove a CacheEntry object associated to a pk entry.

引数:
pk the pk entry
CacheDatabaseTable.java227 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.invalidate(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries.

参照元 org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify().

00228 { 00229 synchronized (pkCacheEntries) 00230 { 00231 ResultCacheEntry rce = (ResultCacheEntry) pkCacheEntries.remove(pk); 00232 rce.invalidate(); 00233 } 00234 }


変数

ArrayList org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.cacheEntries [private]
 

CacheDatabaseTable.java55 行で定義されています。

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addCacheEntry(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.CacheDatabaseTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAllExceptPk().

ArrayList org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.columns [private]
 

CacheDatabaseTable.java54 行で定義されています。

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addColumn(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.CacheDatabaseTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumn(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumns(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getInformation(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll().

String org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.name [private]
 

CacheDatabaseTable.java53 行で定義されています。

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.CacheDatabaseTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getInformation(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getName().

HashMap org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.pkCacheEntries [private]
 

CacheDatabaseTable.java56 行で定義されています。

参照元 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addPkCacheEntry(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.CacheDatabaseTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getPkResultCacheEntry(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll(), と org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.removePkResultCacheEntry().


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:39 2004に生成されました。 doxygen 1.3.8