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

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

public class AppData
extends java.lang.Object

A class for holding application data structures.

Version:
$Id: AppData.java,v 1.15 2002/11/29 13:50:29 mpoeschl Exp $
Author:
John McNally,
Field Summary
private  java.lang.String basePropsFilePath
          The base of the path to the properties file, including trailing slash.
private  java.lang.String databaseType
          The type for our databases.
private  java.util.List dbList
          The list of databases for this application.
private  java.util.Map idiosyncrasyTable
          The table of idiosyncrasies for various database types.
(package private)  boolean isInitialized
           
private  java.lang.String name
          Name of the database.
 
Constructor Summary
AppData(java.lang.String databaseType, java.lang.String basePropsFilePath)
          Creates a new instance for the specified database type.
 
Method Summary
 Database addDatabase(org.xml.sax.Attributes attrib)
          An utility method to add a new database from an xml attribute.
 void addDatabase(Database db)
          Add a database to the list and sets the AppData property to this AppData
private  void doFinalInitialization()
           
 Database getDatabase()
          Get database object.
 Database getDatabase(java.lang.String name)
          Return the database with the specified name.
 Database[] getDatabases()
          Return an array of all databases
protected  java.util.Properties getIdiosyncrasies(java.lang.String databaseType)
          Each database has its own list of idiosyncrasies which can be configured by editting its db.props file.
 java.lang.String getName()
          Get the name of the database.
 java.lang.String getShortName()
          Get the short name of the database (without the '-schema' postfix).
 boolean hasMultipleDatabases()
          Returns whether this application has multiple databases.
 void setName(java.lang.String name)
          Set the name of the database.
 java.lang.String toString()
          Creats a string representation of this AppData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dbList

private java.util.List dbList
The list of databases for this application.


idiosyncrasyTable

private java.util.Map idiosyncrasyTable
The table of idiosyncrasies for various database types.


databaseType

private java.lang.String databaseType
The type for our databases.


basePropsFilePath

private java.lang.String basePropsFilePath
The base of the path to the properties file, including trailing slash.


name

private java.lang.String name
Name of the database. Only one database definition is allowed in one XML descriptor.


isInitialized

boolean isInitialized
Constructor Detail

AppData

public AppData(java.lang.String databaseType,
               java.lang.String basePropsFilePath)
Creates a new instance for the specified database type.

Parameters:
databaseType - The default type for any databases added to this application model.
basePropsFilePath - The base of the path to the properties file, including trailing slash.
Method Detail

getIdiosyncrasies

protected java.util.Properties getIdiosyncrasies(java.lang.String databaseType)
                                          throws EngineException
Each database has its own list of idiosyncrasies which can be configured by editting its db.props file.

Parameters:
databaseType - The type of database to retrieve the properties of.
Returns:
The idiosyncrasies of databaseType.
Throws:
EngineException - Couldn't locate properties file.

setName

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

Parameters:
name - of the database.

getName

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

Returns:
String name

getShortName

public java.lang.String getShortName()
Get the short name of the database (without the '-schema' postfix).

Returns:
String name

getDatabase

public Database getDatabase()
Get database object.

Returns:
Database database

getDatabases

public Database[] getDatabases()
Return an array of all databases

Returns:
Array of Database objects

hasMultipleDatabases

public boolean hasMultipleDatabases()
Returns whether this application has multiple databases.

Returns:
true if the application has multiple databases

getDatabase

public Database getDatabase(java.lang.String name)
Return the database with the specified name.

Parameters:
name - database name
Returns:
A Database object. If it does not exist it returns null

addDatabase

public Database addDatabase(org.xml.sax.Attributes attrib)
An utility method to add a new database from an xml attribute.

Parameters:
attrib - the xml attributes
Returns:
the database

addDatabase

public void addDatabase(Database db)
Add a database to the list and sets the AppData property to this AppData

Parameters:
db - the database to add

doFinalInitialization

private void doFinalInitialization()

toString

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

Returns:
representation in xml format


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