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.4.2.2 2004/05/20 04:34:15 seade Exp $
Author:
John McNally,
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
 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
 

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()
                     throws EngineException
Get database object.

Returns:
Database database
Throws:
EngineException

getDatabases

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

Returns:
Array of Database objects
Throws:
EngineException

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)
                     throws EngineException
Return the database with the specified name.

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

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

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 © 2000-2007 Apache Software Foundation. All Rights Reserved.