com.googlecode.jdbw.metadata
Class Schema

java.lang.Object
  extended by com.googlecode.jdbw.metadata.Schema
All Implemented Interfaces:
Comparable<Schema>

public class Schema
extends Object
implements Comparable<Schema>

In database terminology, especially in the JDBC world, a Schema is a middle level organizational container. Owner by a Catalog, a Schema will be the owner of tables, system tables, stored procedures, function and views. A catalog may contain one or more schemas, but it's not uncommon among database servers to provide only one per catalog by default (you have to create more yourself), normally called PUBLIC.

Author:
Martin Berglund

Constructor Summary
Schema(MetaDataResolver metaDataResolver, Catalog catalog, String name)
           
 
Method Summary
 int compareTo(Schema o)
           
 boolean equals(Object obj)
           
 Catalog getCatalog()
           
 String getName()
           
 List<StoredProcedure> getStoredProcedures()
           
 Table getTable(String tableName)
          Creates and returns a Table object for a particular table.
 Map<String,Table> getTableMap()
           
 List<Table> getTables()
           
 List<View> getViews()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Schema

public Schema(MetaDataResolver metaDataResolver,
              Catalog catalog,
              String name)
Method Detail

getCatalog

public Catalog getCatalog()
Returns:
Catalog owning this schema

getName

public String getName()
Returns:
Name of the schema

getTables

public List<Table> getTables()
                      throws SQLException
Returns:
List of all tables in this schema
Throws:
SQLException - If an error occurred while reading the list of tables

getTableMap

public Map<String,Table> getTableMap()
                              throws SQLException
Returns:
Map (table name to Table object) of all tables in this schema
Throws:
SQLException - If an error occurred while reading the list of tables

getTable

public Table getTable(String tableName)
               throws SQLException
Creates and returns a Table object for a particular table.

Parameters:
tableName - Name of the table to get the Table object for
Returns:
Table representing the table or null if there was no table in the schema with this name
Throws:
SQLException - If an error occurred while reading the list of tables

getViews

public List<View> getViews()
                    throws SQLException
Returns:
List of all views in this schema
Throws:
SQLException - If an error occurred while reading the list of views

getStoredProcedures

public List<StoredProcedure> getStoredProcedures()
                                          throws SQLException
Returns:
List of all stored procedures in this schema
Throws:
SQLException - If an error occurred while reading the list of stored procedures

compareTo

public int compareTo(Schema o)
Specified by:
compareTo in interface Comparable<Schema>

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.