|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opentox.database.InHouseDB
public final class InHouseDB
This is a class to manage access to the database behind the services. This
class adopts the Singleton Design Pattern (see
this
article for details ). Only one object of this class can be created! The access point
pf this class is INSTANCE
and is the only object that can be created.
The contructor of InHouseDB is private and cannot be accessed from other classes and
what is more, InHouseDB cannot be subclassed. The interface
IDataBaseAccess
provides
an API for classes used to access certain tables of the database such as the Models' and
the Users' ones.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.opentox.interfaces.IDataBaseAccess |
---|
IDataBaseAccess.CreateTable, IDataBaseAccess.Registration, IDataBaseAccess.Removal |
Field Summary | |
---|---|
protected static java.sql.Connection |
connection
Static Connection to the databse. |
private static java.lang.String |
DB_PASSWORD
|
private static java.lang.String |
DB_USER
|
static InHouseDB |
INSTANCE
Thread-safe instantiation of the database through a final instance of it. |
private static InHouseDB |
instanceOfThis
|
Fields inherited from interface org.opentox.interfaces.IDataBaseAccess |
---|
DATABASENAME, DB_URL, DRIVER |
Constructor Summary | |
---|---|
private |
InHouseDB()
Database Constructor. |
Method Summary | |
---|---|
void |
close()
|
private static void |
createDataBase()
If the database does not exist, it is created. |
private void |
getConnection()
Establishes a connection to the database. |
private static InHouseDB |
getInstance()
|
private void |
loadDriver()
Loads the Driver that is used to establish a new connection. |
private void |
loadTables()
Load the tables in the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String DB_USER
private static final java.lang.String DB_PASSWORD
protected static java.sql.Connection connection
private static InHouseDB instanceOfThis
public static final InHouseDB INSTANCE
Constructor Detail |
---|
private InHouseDB()
Method Detail |
---|
private static InHouseDB getInstance()
private void loadDriver()
private void getConnection()
private void loadTables()
private static void createDataBase()
public void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |