filled out PresenceServiceImpl.java, added Makefile
git-svn-id: svn://anubis/gvsu@139 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
5c35389192
commit
4642c73779
6
cs656/lab2/src/Makefile
Normal file
6
cs656/lab2/src/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
all:
|
||||
javac *.java
|
||||
|
||||
clean:
|
||||
-rm -f *.class *~
|
@ -1,9 +1,13 @@
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.rmi.server.UnicastRemoteObject;
|
||||
|
||||
public class PresenceServiceImpl implements PresenceService
|
||||
{
|
||||
private HashMap<String, RegistrationInfo> myRegisteredUsers;
|
||||
|
||||
public PresenceServiceImpl()
|
||||
{
|
||||
super();
|
||||
@ -11,20 +15,23 @@ public class PresenceServiceImpl implements PresenceService
|
||||
|
||||
public void register(RegistrationInfo reg)
|
||||
{
|
||||
if (!myRegisteredUsers.containsKey(reg.getUserName()))
|
||||
myRegisteredUsers.put(reg.getUserName(), reg);
|
||||
}
|
||||
|
||||
public void unregister(String userName)
|
||||
{
|
||||
myRegisteredUsers.remove(userName);
|
||||
}
|
||||
|
||||
public RegistrationInfo lookup(String name)
|
||||
{
|
||||
return null;
|
||||
return myRegisteredUsers.get(name);
|
||||
}
|
||||
|
||||
public RegistrationInfo[] listRegisteredUsers()
|
||||
{
|
||||
return null;
|
||||
return myRegisteredUsers.values().toArray(new RegistrationInfo[0]);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user