org.apache.torque.engine.database.model
Class Database

java.lang.Object
  extended byorg.apache.torque.engine.database.model.Database

public class Database
extends java.lang.Object

A class for holding application data structures.

Version:
$Id: Database.java,v 1.17.2.1 2003/05/27 18:06:45 mpoeschl Exp $
Author:
John McNally, Daniel Rall,
Field Summary
private  java.lang.String baseClass
           
private  java.lang.String basePeer
           
private  java.lang.String databaseType
           
private  AppData dbParent
           
private  java.lang.String defaultIdMethod
           
private  java.lang.String defaultJavaNamingMethod
           
private  java.lang.String defaultJavaType
           
private  boolean heavyIndexing
           
private  java.lang.String name
           
private  java.lang.String pkg
           
private  java.util.List tableList
           
private  java.util.Hashtable tablesByJavaName
           
private  java.util.Hashtable tablesByName
           
 
Constructor Summary
Database()
          Creates a new instance with unset attributes.
 
Method Summary
 Table addTable(org.xml.sax.Attributes attrib)
          An utility method to add a new table from an xml attribute.
 void addTable(Table tbl)
          Add a table to the list and sets the Database property to this Database
 void doFinalInitialization()
           
 AppData getAppData()
          Get the parent of the table
 java.lang.String getBaseClass()
          Get the value of baseClass.
 java.lang.String getBasePeer()
          Get the value of basePeer.
protected  java.lang.String getDatabaseType()
           
 java.lang.String getDefaultIdMethod()
          Get the value of defaultIdMethod.
 java.lang.String getDefaultJavaNamingMethod()
          Get the value of defaultJavaNamingMethod which specifies the method for converting schema names for table and column to Java names.
 java.lang.String getDefaultJavaType()
          Get type to use in Java sources (primitive || object)
 java.lang.String getName()
          Get the name of the Database
 java.lang.String getPackage()
          Get the value of package.
protected  java.lang.String getProperty(java.lang.String name)
          Returns the value of the named property from this database's db.props file.
 Table getTable(java.lang.String name)
          Return the table with the specified name.
 Table getTableByJavaName(java.lang.String javaName)
          Return the table with the specified javaName.
 Table[] getTables()
          Return an array of all tables
 boolean isHeavyIndexing()
          Get the value of heavyIndexing.
 void loadFromXML(org.xml.sax.Attributes attrib)
          Load the database object from an xml tag.
 boolean requiresIdTable()
          Determines if this database will be using the IDMethod.ID_BROKER to create ids for torque OM objects.
 void setAppData(AppData parent)
          Set the parent of the database
 void setBaseClass(java.lang.String v)
          Set the value of baseClass.
 void setBasePeer(java.lang.String v)
          Set the value of basePeer.
 void setDatabaseType(java.lang.String databaseType)
           
 void setDefaultIdMethod(java.lang.String v)
          Set the value of defaultIdMethod.
 void setDefaultJavaNamingMethod(java.lang.String v)
          Set the value of defaultJavaNamingMethod.
 void setHeavyIndexing(boolean v)
          Set the value of heavyIndexing.
 void setName(java.lang.String name)
          Set the name of the Database
 void setPackage(java.lang.String v)
          Set the value of package.
 java.lang.String toString()
          Creats a string representation of this Database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

databaseType

private java.lang.String databaseType

tableList

private java.util.List tableList

name

private java.lang.String name

pkg

private java.lang.String pkg

baseClass

private java.lang.String baseClass

basePeer

private java.lang.String basePeer

defaultIdMethod

private java.lang.String defaultIdMethod

defaultJavaType

private java.lang.String defaultJavaType

defaultJavaNamingMethod

private java.lang.String defaultJavaNamingMethod

dbParent

private AppData dbParent

tablesByName

private java.util.Hashtable tablesByName

tablesByJavaName

private java.util.Hashtable tablesByJavaName

heavyIndexing

private boolean heavyIndexing
Constructor Detail

Database

public Database()
Creates a new instance with unset attributes.

Method Detail

loadFromXML

public void loadFromXML(org.xml.sax.Attributes attrib)
Load the database object from an xml tag.


getName

public java.lang.String getName()
Get the name of the Database


setName

public void setName(java.lang.String name)
Set the name of the Database


getPackage

public java.lang.String getPackage()
Get the value of package.

Returns:
value of package.

setPackage

public void setPackage(java.lang.String v)
Set the value of package.

Parameters:
v - Value to assign to package.

getBaseClass

public java.lang.String getBaseClass()
Get the value of baseClass.

Returns:
value of baseClass.

setBaseClass

public void setBaseClass(java.lang.String v)
Set the value of baseClass.

Parameters:
v - Value to assign to baseClass.

getBasePeer

public java.lang.String getBasePeer()
Get the value of basePeer.

Returns:
value of basePeer.

setBasePeer

public void setBasePeer(java.lang.String v)
Set the value of basePeer.

Parameters:
v - Value to assign to basePeer.

getDefaultIdMethod

public java.lang.String getDefaultIdMethod()
Get the value of defaultIdMethod.

Returns:
value of defaultIdMethod.

setDefaultIdMethod

public void setDefaultIdMethod(java.lang.String v)
Set the value of defaultIdMethod.

Parameters:
v - Value to assign to defaultIdMethod.

getDefaultJavaType

public java.lang.String getDefaultJavaType()
Get type to use in Java sources (primitive || object)


getDefaultJavaNamingMethod

public java.lang.String getDefaultJavaNamingMethod()
Get the value of defaultJavaNamingMethod which specifies the method for converting schema names for table and column to Java names.

Returns:
The default naming conversion used by this database.

setDefaultJavaNamingMethod

public void setDefaultJavaNamingMethod(java.lang.String v)
Set the value of defaultJavaNamingMethod.

Parameters:
v - The default naming conversion for this database to use.

isHeavyIndexing

public boolean isHeavyIndexing()
Get the value of heavyIndexing.

Returns:
value of heavyIndexing.

setHeavyIndexing

public void setHeavyIndexing(boolean v)
Set the value of heavyIndexing.

Parameters:
v - Value to assign to heavyIndexing.

getTables

public Table[] getTables()
Return an array of all tables


getTable

public Table getTable(java.lang.String name)
Return the table with the specified name.

Returns:
A Table object. If it does not exist it returns null

getTableByJavaName

public Table getTableByJavaName(java.lang.String javaName)
Return the table with the specified javaName.

Returns:
A Table object. If it does not exist it returns null

addTable

public Table addTable(org.xml.sax.Attributes attrib)
An utility method to add a new table from an xml attribute.


addTable

public void addTable(Table tbl)
Add a table to the list and sets the Database property to this Database


setAppData

public void setAppData(AppData parent)
Set the parent of the database


getAppData

public AppData getAppData()
Get the parent of the table


getDatabaseType

protected java.lang.String getDatabaseType()

setDatabaseType

public void setDatabaseType(java.lang.String databaseType)

getProperty

protected java.lang.String getProperty(java.lang.String name)
                                throws EngineException
Returns the value of the named property from this database's db.props file.

Parameters:
name - The name of the property to retrieve the value of.
Returns:
The value of the specified property.
Throws:
EngineException - Couldn't access properties.

requiresIdTable

public boolean requiresIdTable()
Determines if this database will be using the IDMethod.ID_BROKER to create ids for torque OM objects.

Returns:
true if there is at least one table in this database that uses the IDMethod.ID_BROKER method of generating ids. returns false otherwise.

doFinalInitialization

public void doFinalInitialization()

toString

public java.lang.String toString()
Creats a string representation of this Database. The representation is given in xml format.



Copyright © 1999-2003 Apache Software Foundation. All Rights Reserved.