pl.kernelpanic.dbmonster.schema
Class Schema

java.lang.Object
  extended bypl.kernelpanic.dbmonster.schema.Schema
All Implemented Interfaces:
Comparable

public class Schema
extends Object
implements Comparable

Schema represents the look of the database, it is complete database structure including tables, primary keys, columns and generators.

Version:
$Id: Schema.html,v 1.1 2007/06/21 08:38:14 sbahloul Exp $
Author:
Piotr Maj <piotr.maj@kernelpanic.pl>

Constructor Summary
Schema()
           
 
Method Summary
 void addTable(Table table)
          Adds a table to the schema.
 int compareTo(Object o)
           
 Table findTable(String tableName)
          Returns a table of given name.
 void generate()
          Generates the schema.
 String getHome()
          Returns the directory where the schema is located.
 String getName()
          Returns the name of the schema.
 List getTables()
          Returns tables.
 void initialize(DBMonsterContext ctx)
          Initializes the schema.
 void removeTable(Table t)
          Removes the table.
 void reset()
          Resets the schema.
 void setHome(String dir)
          Sets the home directory of the schema.
 void setName(String s)
          Sets the name of the schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema()
Method Detail

addTable

public void addTable(Table table)
              throws SchemaException
Adds a table to the schema.

Parameters:
table - a table to add.
Throws:
SchemaException - if a schema error occures

getName

public String getName()
Returns the name of the schema.

Returns:
the name of the schema.

setName

public void setName(String s)
Sets the name of the schema.

Parameters:
s - the name of the schema.

initialize

public void initialize(DBMonsterContext ctx)
                throws Exception
Initializes the schema.

Parameters:
ctx - dbmonster context.
Throws:
Exception - if initialization fails

generate

public void generate()
              throws Exception
Generates the schema.

Throws:
Exception - if this schema could not be generated

getHome

public String getHome()
Returns the directory where the schema is located.

Returns:
schema home directory

setHome

public void setHome(String dir)
Sets the home directory of the schema.

Parameters:
dir - the home directory of schema.

findTable

public Table findTable(String tableName)
Returns a table of given name.

Parameters:
tableName - the name of the table
Returns:
the table

getTables

public List getTables()
Returns tables.

Returns:
list of tables;

removeTable

public void removeTable(Table t)
Removes the table.

Parameters:
t - table to remove

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

reset

public void reset()
Resets the schema.



Copyright © 2003-2005 .:. kernelpanic.pl .:.. All Rights Reserved.