common.interfaces
Interface MSForMSInterface

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
Communication, SafeMSForMSInterface

public interface MSForMSInterface
extends java.rmi.Remote

This interface provides the methods that the object exported by a Message Server must provide to let another Message Server communicate with it.

Author:
Marco Cornolti and Alessandro Franchini

Method Summary
 void assignMovedUser(ManagedUser user)
          Assigns a user management (sending all its datas) to the message server.
 void forwardMessage(Message msg)
          Forwards a message from a Message Server to this one.
 User getManagedUserContact(User user)
          Gets a User IP address and TCP port to directely connect to its servlet.
 boolean inListOfUserContains(User listUser, User user)
          Checks whether or not a user (U1) accepts messages sent from another user (U2)
 

Method Detail

forwardMessage

void forwardMessage(Message msg)
                    throws java.rmi.RemoteException,
                           NotAllowedException,
                           UserNotManagedException,
                           GenericErrorException,
                           UserNotExistsException,
                           SystemErrorException
Forwards a message from a Message Server to this one.

Parameters:
msg - the message to forward.
Throws:
java.rmi.RemoteException - if a communication problem occurs.
NotAllowedException - if the recipint does not accept messages from the sender.
UserNotManagedException - id the recipient user is not assigned to this MS.
GenericErrorException - if a generic error occurred.
UserNotExistsException - if the user does not exist in the whole system.
SystemErrorException - if a system error occurred.

inListOfUserContains

boolean inListOfUserContains(User listUser,
                             User user)
                             throws java.rmi.RemoteException,
                                    UserNotManagedException
Checks whether or not a user (U1) accepts messages sent from another user (U2)

Parameters:
listUser - the receiver user (U1)
user - the sender user (U2)
Returns:
true if, and only if, listUser (U1) accepts messages from user (U2).
Throws:
java.rmi.RemoteException - if a communication problem occurred.
UserNotManagedException - if the listUser (U1) is not managed by the server.

assignMovedUser

void assignMovedUser(ManagedUser user)
                     throws java.rmi.RemoteException,
                            AssignationNotAcceptedException
Assigns a user management (sending all its datas) to the message server.

Parameters:
user - the user to assign.
Throws:
AssignationNotAcceptedException - if the assignation was not accepted.
java.rmi.RemoteException - if a communication problem occurred.

getManagedUserContact

User getManagedUserContact(User user)
                           throws java.rmi.RemoteException,
                                  UserNotManagedException
Gets a User IP address and TCP port to directely connect to its servlet. The User is managed by this MS.

Parameters:
user - the user whose connection datas is wanted. Only the nickname is considered.
Returns:
the user with the correctly obtained IP address and TCP port.
Throws:
java.rmi.RemoteException - if a communication problem occurs.
UserNotManagedException - if the user is not locally managed.