import java.rmi.*; /** * Remote Interface for the chat server for ex6 */ public interface ChatInterface extends Remote { /** * Method to find out what message to poll * @return the next (expected) message-id * @exception RemoteException if the remote invocation fails. */ public int getMessId() throws RemoteException; /** * Method to join a chat * @param username your username string for chat * @return the next (expected) message-id, -1 if not success * @exception RemoteException if the remote invocation fails. */ public int join(String username) throws RemoteException; /** * Poll for a new message * @param messageid the message id requested * @return A string containing the username and the message, NULL * if no such message is available. Username of the message sender * is the first word (space separated) of the message. * @exception RemoteException if the remote invocation fails. */ public String pollMessage(int messageid) throws RemoteException; /** * Post a new message * @param username sender's username * @param message the message * @return the message id * @exception RemoteException if the remote invocation fails. */ public int postMessage(String username, String message) throws RemoteException; /** * Disconnect a chat (actually, we could have done without this) * @param username your username * @exception RemoteException if the remote invocation fails. */ public void disconnect(String username) throws RemoteException; } // interface ChatInterface