org.objectweb.cjdbc.controller.cache.result.schema
Class CacheDatabaseSchema

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema

public class CacheDatabaseSchema
extends java.lang.Object

A CacheDatabaseSchema describes all the tables and columns of a database and its associated cache entries.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
private  java.util.ArrayList tables
          Database tables.
 
Constructor Summary
CacheDatabaseSchema(DatabaseSchema dbs)
          Creates a new CacheDatabaseSchema instance by cloning an existing DatabaseSchema.
 
Method Summary
 void addTable(CacheDatabaseTable table)
          Adds a CacheDatabaseTable describing a table of the database.
 boolean equals(java.lang.Object other)
          Two CacheDatabaseSchema are equals if they have the same tables.
 java.lang.String getInformation(boolean longFormat)
          Returns information about the database schema.
 CacheDatabaseTable getTable(java.lang.String tableName)
          Returns the CacheDatabaseTable object matching the given table name or null if not found.
 java.util.ArrayList getTables()
          Returns an ArrayList of CacheDatabaseTable objects describing the database.
 boolean hasTable(java.lang.String tableName)
          Returns true if the given TableName is found in this schema.
 void mergeSchema(CacheDatabaseSchema databaseSchema)
          Merge the given schema with the current one.
 void removeTable(CacheDatabaseTable table)
          Removes a CacheDatabaseTable describing a table of the database.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tables

private java.util.ArrayList tables
Database tables.

Constructor Detail

CacheDatabaseSchema

public CacheDatabaseSchema(DatabaseSchema dbs)
Creates a new CacheDatabaseSchema instance by cloning an existing DatabaseSchema.

Parameters:
dbs - the DatabaseSchema to clone
Method Detail

addTable

public void addTable(CacheDatabaseTable table)
Adds a CacheDatabaseTable describing a table of the database.

Parameters:
table - the table to add

removeTable

public void removeTable(CacheDatabaseTable table)
Removes a CacheDatabaseTable describing a table of the database.

Parameters:
table - the table to remove

mergeSchema

public void mergeSchema(CacheDatabaseSchema databaseSchema)
                 throws java.sql.SQLException
Merge the given schema with the current one. All missing tables or columns are added if no conflict is detected. An exception is thrown if the given schema definition conflicts with the current one.

Parameters:
databaseSchema - the schema to merge
Throws:
java.sql.SQLException - if the schemas conflict

getTables

public java.util.ArrayList getTables()
Returns an ArrayList of CacheDatabaseTable objects describing the database.

Returns:
an ArrayList of CacheDatabaseTable

getTable

public CacheDatabaseTable getTable(java.lang.String tableName)
Returns the CacheDatabaseTable object matching the given table name or null if not found.

Parameters:
tableName - the table name to look for
Returns:
a CacheDatabaseTable value or null

hasTable

public boolean hasTable(java.lang.String tableName)
Returns true if the given TableName is found in this schema.

Parameters:
tableName - the name of the table you are looking for
Returns:
true if the table has been found

equals

public boolean equals(java.lang.Object other)
Two CacheDatabaseSchema are equals if they have the same tables.

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

getInformation

public java.lang.String getInformation(boolean longFormat)
Returns information about the database schema.

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


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