butler.sql.metadata
Class Schema

java.lang.Object
  extended by butler.util.BaseGroovyObjectSupport
      extended by butler.sql.metadata.Schema
All Implemented Interfaces:
groovy.lang.GroovyObject
Direct Known Subclasses:
GeneratedSchema

public class Schema
extends butler.util.BaseGroovyObjectSupport

Database schema.

Author:
Fredrik Bertilsson
See Also:
Schema DTD

Constructor Summary
Schema(java.lang.String name, Catalog cat)
           
 
Method Summary
 void addRecordListener(RecordListener listener)
          Add record listener which will apply to all tables in this schema.
 void addTable(Table tab)
           
 Table createTable(java.lang.String name)
          Creates an empty table with the given name.
 boolean equals(java.lang.Object other)
           
 boolean equals(Schema other)
           
 java.lang.String getAlias()
           
 Catalog getCatalog()
          Returns the catalog to which this schema belongs.
 Datatype getDatatype(java.lang.String name)
           
 java.lang.String getName()
          Returns the name of the schema.
 java.lang.String getPath()
           
 java.lang.Object getProperty(java.lang.String property)
           
protected  java.util.Comparator getRecordComparator()
           
protected  java.util.Set getRecordListeners()
           
 java.lang.String getResourceBundleBaseName()
           
static Schema getSchema(org.dom4j.Element element)
           
 Table getTable(java.lang.String name)
          Returns the table with the given name.
 java.util.Iterator getTableNames()
          Returns the names of the tables in this schema.
 java.util.Map getTables()
          Returns the table with the given name.
 void loadTables()
          Loads all tables in this schema.
 void setAlias(java.lang.String alias)
           
 void setCatalog(Catalog cat)
          Sets the catalog to which this schema belongs.
 void setDescriptor(java.lang.String descriptor)
           
 void setDictionaryFile(java.lang.String filename)
           
 void setRecordComparator(java.util.Comparator comp)
           
 void setResourceBundleBaseName(java.lang.String name)
           
 void setUseName(boolean value)
          Sets if schema name should be used in table qualified name.
 void toXML(org.xml.sax.ContentHandler handler)
           
 void upgrade()
          Upgrades every table in this schema.
 boolean useName()
          Tells if schema name should be used in table qualified name.
 
Methods inherited from class butler.util.BaseGroovyObjectSupport
getMetaClass, invokeMethod, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema(java.lang.String name,
              Catalog cat)
Method Detail

getName

public java.lang.String getName()
                         throws java.lang.Exception
Returns the name of the schema.

Throws:
java.lang.Exception

getAlias

public java.lang.String getAlias()

setAlias

public void setAlias(java.lang.String alias)

getCatalog

public Catalog getCatalog()
                   throws java.lang.Exception
Returns the catalog to which this schema belongs.

Throws:
java.lang.Exception

setCatalog

public void setCatalog(Catalog cat)
Sets the catalog to which this schema belongs.


setDescriptor

public void setDescriptor(java.lang.String descriptor)
                   throws java.lang.Exception
Throws:
java.lang.Exception

getTables

public java.util.Map getTables()
Returns the table with the given name.


getTableNames

public java.util.Iterator getTableNames()
                                 throws java.lang.Exception
Returns the names of the tables in this schema.

Throws:
java.lang.Exception

getTable

public Table getTable(java.lang.String name)
               throws java.lang.Exception
Returns the table with the given name.

Throws:
java.lang.Exception

addTable

public void addTable(Table tab)
              throws java.lang.Exception
Throws:
java.lang.Exception

createTable

public Table createTable(java.lang.String name)
                  throws java.lang.Exception
Creates an empty table with the given name. But the table is not actually created before the create method on the table object is called.

Throws:
java.lang.Exception

loadTables

public void loadTables()
                throws java.lang.Exception
Loads all tables in this schema.

Throws:
java.lang.Exception

toXML

public void toXML(org.xml.sax.ContentHandler handler)
           throws java.lang.Exception
Throws:
java.lang.Exception

useName

public boolean useName()
Tells if schema name should be used in table qualified name.


setUseName

public void setUseName(boolean value)
Sets if schema name should be used in table qualified name.


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Schema other)

getSchema

public static Schema getSchema(org.dom4j.Element element)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getResourceBundleBaseName

public java.lang.String getResourceBundleBaseName()

setResourceBundleBaseName

public void setResourceBundleBaseName(java.lang.String name)

addRecordListener

public void addRecordListener(RecordListener listener)
Add record listener which will apply to all tables in this schema.


getRecordListeners

protected java.util.Set getRecordListeners()

getRecordComparator

protected java.util.Comparator getRecordComparator()

setRecordComparator

public void setRecordComparator(java.util.Comparator comp)

upgrade

public void upgrade()
             throws java.lang.Exception
Upgrades every table in this schema.

Throws:
java.lang.Exception

getPath

public java.lang.String getPath()

getDatatype

public Datatype getDatatype(java.lang.String name)

setDictionaryFile

public void setDictionaryFile(java.lang.String filename)

getProperty

public java.lang.Object getProperty(java.lang.String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class butler.util.BaseGroovyObjectSupport