org.objectweb.cjdbc.controller.scheduler.schema
Class SchedulerDatabaseSchema

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

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

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

Version:
1.0
Author:
Emmanuel Cecchet
See Also:
Serialized Form

Field Summary
private  TransactionExclusiveLock lock
           
private  java.util.ArrayList tables
          ArrayList of SchedulerDatabaseTable.
 
Constructor Summary
SchedulerDatabaseSchema(DatabaseSchema schema)
          Creates a new SchedulerDatabaseSchema instance by cloning an existing DatabaseSchema.
 
Method Summary
 void addTable(SchedulerDatabaseTable table)
          Adds a SchedulerDatabaseTable describing a table of the database.
 boolean equals(java.lang.Object other)
          Two SchedulerDatabaseSchema are equals if they have the same tables.
 java.lang.String getInformation(boolean longFormat)
          Returns information about the database schema.
 TransactionExclusiveLock getLock()
          Returns the lock for this table.
 SchedulerDatabaseTable getTable(java.lang.String tableName)
          Returns the SchedulerDatabaseTable object matching the given table name or null if not found.
 java.util.ArrayList getTables()
          Returns an ArrayList of SchedulerDatabaseTable objects describing the database.
 boolean hasTable(java.lang.String tableName)
          Returns true if the given TableName is found in this schema.
 void mergeSchema(SchedulerDatabaseSchema databaseSchema)
          Merge the given schema with the current one.
 void removeTable(SchedulerDatabaseTable table)
          Removes a SchedulerDatabaseTable 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
ArrayList of SchedulerDatabaseTable.


lock

private TransactionExclusiveLock lock
Constructor Detail

SchedulerDatabaseSchema

public SchedulerDatabaseSchema(DatabaseSchema schema)
Creates a new SchedulerDatabaseSchema instance by cloning an existing DatabaseSchema.

Parameters:
schema - the database schema to clone
Method Detail

addTable

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

Parameters:
table - the table to add

removeTable

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

Parameters:
table - the table to remove

mergeSchema

public void mergeSchema(SchedulerDatabaseSchema databaseSchema)
Merge the given schema with the current one. All missing tables 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

getTables

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

Returns:
an ArrayList of SchedulerDatabaseTable

getTable

public SchedulerDatabaseTable getTable(java.lang.String tableName)
Returns the SchedulerDatabaseTable object matching the given table name or null if not found. Matching is case insensitive.

Parameters:
tableName - the table name to look for
Returns:
a SchedulerDatabaseTable 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

getLock

public TransactionExclusiveLock getLock()
Returns the lock for this table.

Returns:
a TransactionExclusiveLock instance
See Also:
TransactionExclusiveLock

equals

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

Parameters:
other - the object to compare with
Returns:
true if the 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.