common.interfaces
Interface MSForBSInterface

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

public interface MSForBSInterface
extends java.rmi.Remote

This interface represents the method that a Gossip Message Server must provide to let a Bootstrap work.

Author:
Marco Cornolti and Alessandro Franchini

Method Summary
 void assign(java.lang.String MSPw, User user, java.lang.String userPw)
          Assigns a new user to the message server.
 void blockAssignation(java.lang.String MSPw, boolean status)
          Puts the MS in the 'blocked' or 'unblocked' status, depending on the boolean status given by argument.
 void deleteUserAdmin(User nick, java.lang.String MSpw)
          Deletes a user.
 Statistics getStatistics(java.lang.String globalpw)
          Returns the statistics of the message server.
 java.util.Vector<User> getUsersList(java.lang.String globalpw)
          Returns the list of users managed by the Message Server.
 void moveUser(java.lang.String MSPw, User user, MessageServer ms)
          Moves a user assignation from the message server to the specified one.
 void shutdown(java.lang.String MSPw)
          Shuts down the MS server.
 boolean testPassword(java.lang.String pw)
          Tests a message server administration password.
 void testPresence()
          Tests the presence of a Message Server
 

Method Detail

testPresence

void testPresence()
                  throws java.rmi.RemoteException
Tests the presence of a Message Server

Throws:
java.rmi.RemoteException - if the server could not be reached.

deleteUserAdmin

void deleteUserAdmin(User nick,
                     java.lang.String MSpw)
                     throws java.rmi.RemoteException,
                            WrongPasswordException,
                            BlockedException,
                            UserNotManagedException
Deletes a user. This method is invoked by the global administrator.

Parameters:
nick - the user to delete.
MSpw - the Message Server administration password.
Throws:
java.rmi.RemoteException - if a communication problem with the server occurred.
WrongPasswordException - if the password is not right.
BlockedException - if the MS is currently blocked.
UserNotManagedException - if the specified user is not managed by the Message server.

blockAssignation

void blockAssignation(java.lang.String MSPw,
                      boolean status)
                      throws java.rmi.RemoteException,
                             WrongPasswordException
Puts the MS in the 'blocked' or 'unblocked' status, depending on the boolean status given by argument. If the MS is blocked, no new assignations are accepted. The MS must be put in bloked status when their users have to be transferred to another MS before shutting down.

Parameters:
MSPw - the MS administration password.
status - true if the status must be set to 'blocked', false if the status must be set to 'unblocked'.
Throws:
java.rmi.RemoteException - if a communication problem occurs.
WrongPasswordException - if the password is wrong.

moveUser

void moveUser(java.lang.String MSPw,
              User user,
              MessageServer ms)
              throws java.rmi.RemoteException,
                     WrongPasswordException,
                     UserNotManagedException,
                     AssignationNotAcceptedException,
                     GenericErrorException
Moves a user assignation from the message server to the specified one.

Parameters:
MSPw - the message server password.
user - the user to move.
ms - the message server to move the user to.
Throws:
java.rmi.RemoteException - if a communication problem occurs.
WrongPasswordException - id the MS admin password is wrong.
UserNotManagedException - if the user is not managed by this MS (or does not exists).
AssignationNotAcceptedException - if the MS the user was wanted to be moved to refused the assignation (i.e. is blocked).
GenericErrorException - if a communication problem with the second MS occurred.

getStatistics

Statistics getStatistics(java.lang.String globalpw)
                         throws java.rmi.RemoteException,
                                WrongPasswordException
Returns the statistics of the message server.

Parameters:
globalpw - the MS password
Returns:
an object containing the statistics of the message server.
Throws:
java.rmi.RemoteException - if a communcation problem occurs.
WrongPasswordException - if the administration password is wrong.

shutdown

void shutdown(java.lang.String MSPw)
              throws java.rmi.RemoteException,
                     WrongPasswordException,
                     UsersStillPresentException,
                     BlockedException
Shuts down the MS server. Must be invoked when no users are managed by the MS and the MS is blocked.

Parameters:
MSPw - the Message Server password.
Throws:
java.rmi.RemoteException - if there was a communication error or the MS was correctly shutdown.
WrongPasswordException - if the password is wrong.
UsersStillPresentException - if the Message Server still manages some users.
BlockedException - if the Message Server is not blocked.

assign

void assign(java.lang.String MSPw,
            User user,
            java.lang.String userPw)
            throws java.rmi.RemoteException,
                   BlockedException,
                   WrongPasswordException
Assigns a new user to the message server.

Parameters:
MSPw - the MS password.
user - the user to add
userPw - the user password
Throws:
BlockedException - if the server is blocked and does not accept new users.
WrongPasswordException - if the Message Server Password is wrong.
java.rmi.RemoteException - if a communication problem occurs.

getUsersList

java.util.Vector<User> getUsersList(java.lang.String globalpw)
                                    throws java.rmi.RemoteException,
                                           WrongPasswordException
Returns the list of users managed by the Message Server. (Used only for debug purposals?)

Parameters:
globalpw - the MS password
Returns:
a vector containing the managed users or null if the password is wrong.
Throws:
WrongPasswordException - if the password is wrong.
java.rmi.RemoteException - if a communication problem occurs.

testPassword

boolean testPassword(java.lang.String pw)
                     throws java.rmi.RemoteException
Tests a message server administration password.

Parameters:
pw - the password to check
Returns:
true if the password is right, false otherwise.
Throws:
java.rmi.RemoteException