banking
Class DatabaseImpl

java.lang.Object
  extended bybanking.DatabaseImpl
All Implemented Interfaces:
Database

public class DatabaseImpl
extends java.lang.Object
implements Database

A simple banking DatabaseImpl class.

Version:
1.0 - 13/01/2004
Author:
Sara Bouchenak

Field Summary
private  java.lang.String password
          The database admin password.
private  java.lang.String url
          The database URL.
private  java.lang.String user
          The database admin name.
 
Constructor Summary
DatabaseImpl(java.lang.String url, java.lang.String user, java.lang.String password)
          Constructs a DatabaseImpl with a given URL and user name/password.
 
Method Summary
 float query(int accountNumber)
          Queries the database to return the balance of an account given its number.
 void update(int accountNumber, float amount)
          Updates the database to set the new amount of an account balance given its number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

private java.lang.String url
The database URL.


user

private java.lang.String user
The database admin name.


password

private java.lang.String password
The database admin password.

Constructor Detail

DatabaseImpl

public DatabaseImpl(java.lang.String url,
                    java.lang.String user,
                    java.lang.String password)
Constructs a DatabaseImpl with a given URL and user name/password.

Parameters:
url - The database URL
user - The database user name
password - The database user password
Method Detail

query

public float query(int accountNumber)
            throws InconsistentDatabaseException
Queries the database to return the balance of an account given its number.

Specified by:
query in interface Database
Returns:
The account number.
Throws:
InconsistentDatabaseException - if a problem occurs when querying the database.

update

public void update(int accountNumber,
                   float amount)
            throws InconsistentDatabaseException
Updates the database to set the new amount of an account balance given its number.

Specified by:
update in interface Database
Parameters:
amount - The balance to be set
Throws:
InconsistentDatabaseException - if a problem occurs when updating the database.


University Grenoble 1 (France) - Department of Computer Science
Master M1 - Adaptable Middleware - AOP / AspectJ.