candy.server
Class MemberRegistry

java.lang.Object
  |
  +--candy.server.MemberRegistry

public class MemberRegistry
extends java.lang.Object

Data structure used to keep list of team members and their status

Author:
Jeremy Mullendore

Field Summary
 java.util.Vector masterTable
          The masterTable stores all the MemRegObject's registered on the system.
 MemberTable mTable
          The mTable stores member who are currently logged onto the system.
 ServerApp myserver
          A reference to the ServerApp who owns me; so that I can read/write to and from the JavaSpace
 
Constructor Summary
MemberRegistry(ServerApp server)
          empty constructor for this object
 
Method Summary
 java.lang.String addUser(Member m)
          adds new member to registry
 java.lang.String addUser(Member m, byte[] passwd)
           
 boolean checkUser(java.lang.String ID, byte[] password)
          checks if member is in registry
 Member getMemberObject(java.lang.String ID)
           
 candy.core.packet.MemberStatusResponsePacket login(candy.core.packet.LoginPacket lgn)
          Handle a login procedure.
 candy.core.packet.MemberStatusResponsePacket logout(candy.core.packet.LogoutPacket lgt)
           
 void notifyAdd(Member mem)
          Adds the Member object to the Member table and then writes the MemberTable into the space
 void notifyRem(Member mem)
          Removess the Member object from the MemberTable and then writes the MemberTable into the space
 java.lang.String removeUser(java.lang.String ID)
          removes member from registry
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myserver

public ServerApp myserver
A reference to the ServerApp who owns me; so that I can read/write to and from the JavaSpace

masterTable

public java.util.Vector masterTable
The masterTable stores all the MemRegObject's registered on the system.

mTable

public MemberTable mTable
The mTable stores member who are currently logged onto the system. The mTable is used to notify all client's of all member's currently logged onto the system
Constructor Detail

MemberRegistry

public MemberRegistry(ServerApp server)
empty constructor for this object
Method Detail

checkUser

public boolean checkUser(java.lang.String ID,
                         byte[] password)
checks if member is in registry
Parameters:
ID - (String)identification of member

getMemberObject

public Member getMemberObject(java.lang.String ID)

login

public candy.core.packet.MemberStatusResponsePacket login(candy.core.packet.LoginPacket lgn)
Handle a login procedure. Here, we are given a LoginPacket. We check its contents against those in the MemberRegistry If it is a proper login, we add the member object to mTable and insert the newly updated mTable into the JavaSpace And we return the proper result.
Parameters:
lgn - LoginPacket containing the information for the login

logout

public candy.core.packet.MemberStatusResponsePacket logout(candy.core.packet.LogoutPacket lgt)

notifyAdd

public void notifyAdd(Member mem)
Adds the Member object to the Member table and then writes the MemberTable into the space
Parameters:
mem - the Member object of the member that has just logged on

notifyRem

public void notifyRem(Member mem)
Removess the Member object from the MemberTable and then writes the MemberTable into the space
Parameters:
mem - the Member object of the member that has just logged on

addUser

public java.lang.String addUser(Member m)
adds new member to registry
Parameters:
m - new Member to be added

addUser

public java.lang.String addUser(Member m,
                                byte[] passwd)

removeUser

public java.lang.String removeUser(java.lang.String ID)
removes member from registry
Parameters:
ID - screen name of Member to be removed