import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
/**
* Java Chat - A simple chatroom application - Chat Server Interface.
*
* This is the interface of methods implemented by the
* server class.
*
* @author Sean Handley
* @version November, 2006
*/
public interface IChatServer extends Remote
{
/**
* Check to see if a username exists on the server.
*
* @param username
* @return true if the user was found in the client collection, false otherwise
* @throws java.rmi.RemoteException
*/
public boolean checkUser(String username)
throws RemoteException;
/**
* Get the list of users currently on the server.
*
* @return List of clients currently in the collection
* @throws java.rmi.RemoteException
*/
public ArrayList<String> getUsers()
throws RemoteException;
/**
* Attempt to add a user's callback interface.
*
* @param cb
* @throws java.rmi.RemoteException
*/
public boolean addClient(ICallback cb)
throws RemoteException;
/**
* Remove a user's callback interface.
*
* @param cb
* @throws java.rmi.RemoteException
*/
public void removeClient(ICallback cb)
throws java.rmi.RemoteException;
/**
* Get the newest message in the collection.
*
* @return newest message
* @throws java.rmi.RemoteException
*/
public String getMessage()
throws RemoteException;
/**
* Add a new message to the collection.
*
* @param msg
* @throws java.rmi.RemoteException
*/
public void sendMessage(String msg)
throws RemoteException;
/**
* Announce that a new user has joined the server.
*
* @param username
* @throws java.rmi.RemoteException
*/
public void announce(String username)
throws RemoteException;
/**
* Announce that a user has changed their name.
*
* @param oldName
* @param newName
* @throws java.rmi.RemoteException
*/
public void announceNameChange(String oldName, String newName)
throws java.rmi.RemoteException;
/**
* Announce that a user has left the server.
*
* @param username
* @throws java.rmi.RemoteException
*/
public void leave(String username)
throws RemoteException;
}