userManager.dbManager
Class DBManager

java.lang.Object
  extended by userManager.dbManager.DBManager
All Implemented Interfaces:
DBManagerInterface

public class DBManager
extends Object
implements DBManagerInterface

DBManagerInterface.java - communicates with user class to authenticate a given user. Additionally it provides operations to manage a user object for CON-ECT system.

Author:
:Nirmal Chhugani(CS-410 Software Engineering)

Field Summary
 Active active
           
 
Method Summary
 String getFirstName(String username)
          Method will retreive firstname of the user from the database.
 int getId(String username)
          Method will retreive unique system id of the user from the database.
static DBManager getInstance()
          Method will return existing DBManager class.
 String getLastName(String username)
          Method will retreive lastname of the user from the database.
 int getStatus(String username)
          Method will retreive status of the user with the given username.
static void print()
           
 void setFirstName(String username)
           
 void setLastName(String username)
           
 void setPassword(int id, String password)
           
 void setStatus(String username, int stat)
          Method will set the current online status of the user to the database.
 boolean validateUser(String username, String pwd)
          This method will validate if user's existance in the database by searching the given username and matching it with the password.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

public Active active
Method Detail

getInstance

public static DBManager getInstance()
Method will return existing DBManager class. If no DBManager class exists, it will call the constructor, creates an instance and returns it to caller.

Returns:
DBManager will return instance of the DBManager class.

validateUser

public boolean validateUser(String username,
                            String pwd)
This method will validate if user's existance in the database by searching the given username and matching it with the password.

Specified by:
validateUser in interface DBManagerInterface
Parameters:
username - username to be searched in the database
password - password to be matched with username
Returns:
boolean true if user exists, else false

setFirstName

public void setFirstName(String username)

setLastName

public void setLastName(String username)

setPassword

public void setPassword(int id,
                        String password)

setStatus

public void setStatus(String username,
                      int stat)
Description copied from interface: DBManagerInterface
Method will set the current online status of the user to the database.

Specified by:
setStatus in interface DBManagerInterface
Parameters:
username - username of students whose status will be set

getFirstName

public String getFirstName(String username)
Description copied from interface: DBManagerInterface
Method will retreive firstname of the user from the database.

Specified by:
getFirstName in interface DBManagerInterface
Parameters:
username - of user whose firstname is looked for
Returns:
String firstname of the user.

getLastName

public String getLastName(String username)
Description copied from interface: DBManagerInterface
Method will retreive lastname of the user from the database.

Specified by:
getLastName in interface DBManagerInterface
Parameters:
username - of user whose lastname is looked for
Returns:
String lastname of the user.

getId

public int getId(String username)
Description copied from interface: DBManagerInterface
Method will retreive unique system id of the user from the database.

Specified by:
getId in interface DBManagerInterface
Parameters:
username - of user whose lastname is looked for
Returns:
String lastname of the user.

getStatus

public int getStatus(String username)
Description copied from interface: DBManagerInterface
Method will retreive status of the user with the given username.

Specified by:
getStatus in interface DBManagerInterface
Parameters:
username - username of user whose status is returned
Returns:
int status of username 1-online 0-offline

print

public static void print()