org.gswing.framework
Class DatabaseManager

java.lang.Object
  extended by org.gswing.framework.DatabaseManager
All Implemented Interfaces:
IDatabaseManagement

public class DatabaseManager
extends Object
implements IDatabaseManagement

Manages the connection to the database in the GUI framework.


Constructor Summary
DatabaseManager(IPropertyManagement propManager)
          Default constructor.
 
Method Summary
 void closeDbConnection()
          Shutdown database connection.
 boolean createDbConnection(String protocol, String databaseName, String userName, String password)
          Create a new connection to the database.
 void deRegister(IDatabaseListener listener)
          De-register with the database manager for update database notification messages.
 IDbReadAccess getReadAccess()
          Get a read access to the database.
 IDbWriteAccess getWriteAccess()
          Get a write access to the database.
 boolean hasBeenInitialised()
          Has this database been initialised?
 boolean isCurrentlyConnected()
          Is the manager currently connected to the database?
 void register(IDatabaseListener listener)
          Register with the database manager for update database notification messages.
 void updateConnectionStatus()
          Inform all connected components of current connection status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseManager

public DatabaseManager(IPropertyManagement propManager)
Default constructor.

Method Detail

createDbConnection

public boolean createDbConnection(String protocol,
                                  String databaseName,
                                  String userName,
                                  String password)
Description copied from interface: IDatabaseManagement
Create a new connection to the database.

Specified by:
createDbConnection in interface IDatabaseManagement
Parameters:
protocol - The JDBC protocol.
databaseName - The database name.
userName - The database user name.
password - The password for the database.
Returns:
True if a successful connection was created.

closeDbConnection

public void closeDbConnection()
Description copied from interface: IDatabaseManagement
Shutdown database connection.

Specified by:
closeDbConnection in interface IDatabaseManagement

register

public void register(IDatabaseListener listener)
Description copied from interface: IDatabaseManagement
Register with the database manager for update database notification messages.

Specified by:
register in interface IDatabaseManagement
Parameters:
listener - The db listener.

deRegister

public void deRegister(IDatabaseListener listener)
Description copied from interface: IDatabaseManagement
De-register with the database manager for update database notification messages.

Specified by:
deRegister in interface IDatabaseManagement
Parameters:
listener - The db listener.

getReadAccess

public IDbReadAccess getReadAccess()
Description copied from interface: IDatabaseManagement
Get a read access to the database.

Specified by:
getReadAccess in interface IDatabaseManagement
Returns:
The read access db object.

getWriteAccess

public IDbWriteAccess getWriteAccess()
Description copied from interface: IDatabaseManagement
Get a write access to the database.

Specified by:
getWriteAccess in interface IDatabaseManagement
Returns:
Write access to the database.

isCurrentlyConnected

public boolean isCurrentlyConnected()
Description copied from interface: IDatabaseManagement
Is the manager currently connected to the database?

Specified by:
isCurrentlyConnected in interface IDatabaseManagement
Returns:
connection status.

hasBeenInitialised

public boolean hasBeenInitialised()
Description copied from interface: IDatabaseManagement
Has this database been initialised?

Specified by:
hasBeenInitialised in interface IDatabaseManagement
Returns:
True if the database has been initialised.

updateConnectionStatus

public void updateConnectionStatus()
Inform all connected components of current connection status.

Specified by:
updateConnectionStatus in interface IDatabaseManagement


Copyright © 2008. All Rights Reserved.