com.ibm.wbi.util
Class DatabaseFactory

java.lang.Object
  |
  +--com.ibm.wbi.util.DatabaseFactory

public class DatabaseFactory
extends java.lang.Object

An abstract factory, one per application,that encapsulates knowledge about what kind of databases are being used with this running version of the application. Any class that needs to open a database asks this class for a reference to it. Depending on how it was created, the factory will return either an IniDatabase, which is stored in the local file system, or an OrionR2Database, which uses Orion APIs to store information. The abstract factory defaults to using IniDatabases. To switch to a different type, some class, such as the root servlet or application, should call the setDatabaseType() method to switch it.


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright information.
static int LOCAL_DATABASE
          Indicator of database type, and defined values.
static int ORION_DATABASE
           
protected static com.ibm.wbi.ras.RASDirector ras
          An abstract RASDirector class.
 
Constructor Summary
DatabaseFactory()
           
 
Method Summary
static void clearCache()
          To be used possibly at servlet initialiation or destruction time.
static Database getDatabase(java.lang.String dbName, int type)
          Used to acquire the database instance of the appropriate type corresponding to a given name and type.
static void setDatabaseType(int type)
           
static void setHomeKey(java.lang.String s)
          Home key is the key to used with Sys.properties to acquire the root directory of the application.
static void setRASDirector(com.ibm.wbi.ras.RASDirector inras)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
IBM copyright information.

LOCAL_DATABASE

public static final int LOCAL_DATABASE
Indicator of database type, and defined values. The default database type is LOCAL_DATABASE, which can be overridden when the application is started.

ORION_DATABASE

public static final int ORION_DATABASE

ras

protected static com.ibm.wbi.ras.RASDirector ras
An abstract RASDirector class. The calling application needs to set the value for this variable if it chooses to integrate database log and trace messages with its own (recommended). TBD: Have this object create its own RASDirector if either it or one of the database classes needs to make a RAS call before the application sets this value -- This is a place where errors will be made.

Setting the ras variable here makes it accessible to all objects in the package.

Constructor Detail

DatabaseFactory

public DatabaseFactory()
Method Detail

setRASDirector

public static void setRASDirector(com.ibm.wbi.ras.RASDirector inras)

setDatabaseType

public static void setDatabaseType(int type)

setHomeKey

public static void setHomeKey(java.lang.String s)
Home key is the key to used with Sys.properties to acquire the root directory of the application. This is particularly needed by IniDatabase.

getDatabase

public static Database getDatabase(java.lang.String dbName,
                                   int type)
Used to acquire the database instance of the appropriate type corresponding to a given name and type.

clearCache

public static void clearCache()
To be used possibly at servlet initialiation or destruction time.