filled out PresenceServiceImpl.java, added Makefile

git-svn-id: svn://anubis/gvsu@139 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-09-13 20:48:52 +00:00
parent 5c35389192
commit 4642c73779
2 changed files with 15 additions and 2 deletions

6
cs656/lab2/src/Makefile Normal file
View File

@ -0,0 +1,6 @@
all:
javac *.java
clean:
-rm -f *.class *~

View File

@ -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)