com.quadrique.jbuildingblocks.gui
Class JbbUsers

java.lang.Object
  extended by com.quadrique.jbuildingblocks.gui.JbbUsers

public class JbbUsers
extends Object

This class handles the list of all the users that can be associated to an application. It is typically used in a server side application where multiple clients can connect at any given time. It provides common services including validation of a given user name/password against the current list of users, persistence of the list in an xml flat file (e.g. "users.xml"), add/remove/modify services against th current list...

Author:
Hervé Rivere

Constructor Summary
JbbUsers()
          Constructor
 
Method Summary
 void addUser(JbbUser zUser)
          to add a user
static JbbUsers getInstance()
          This method returns the global instance of the Users class.
 void initialize(String zUsersFileName)
          Open the users file
 boolean isAdministrator(String zUserName, String zUserPwd)
           
 boolean isValidUser(String zUserName, String zUserPwd)
           
 void modifyUser(JbbUser zUser)
          to modify the password and/or type a given user
 void removeUser(JbbUser zUser)
          to remove a user form the list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbUsers

public JbbUsers()
Constructor

Method Detail

getInstance

public static final JbbUsers getInstance()
This method returns the global instance of the Users class. If there has been already one instantiation, the same instance is returned so that it can be shared across the application. A typical usage would be: Users.getInstance().getXxxx() or Users lConfig = Users.getInstance();

Returns:
the global instance of the Users class

initialize

public void initialize(String zUsersFileName)
                throws Exception
Open the users file

Parameters:
zUsersFileName - the full users file name
Throws:
Exception - if an error occurs

isValidUser

public boolean isValidUser(String zUserName,
                           String zUserPwd)
Returns:
true if the user is a valid

isAdministrator

public boolean isAdministrator(String zUserName,
                               String zUserPwd)
Returns:
true if the user is an administrator

addUser

public void addUser(JbbUser zUser)
             throws Exception
to add a user

Parameters:
zUser - a user
Throws:
Exception - if an error occurs

modifyUser

public void modifyUser(JbbUser zUser)
                throws Exception
to modify the password and/or type a given user

Parameters:
zUser -
Throws:
Exception

removeUser

public void removeUser(JbbUser zUser)
                throws Exception
to remove a user form the list

Parameters:
zUser -
Throws:
Exception


Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.