bootstrapP
Class Communication

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by bootstrapP.Communication
All Implemented Interfaces:
BSForMSInterface, BSForServletInterface, java.io.Serializable, java.rmi.Remote

public class Communication
extends java.rmi.server.UnicastRemoteObject
implements BSForMSInterface, BSForServletInterface, java.io.Serializable

The class that contains the methods needed for communicating with other servers and servlets.

Author:
Marco Cornolti
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected Communication()
          The constructor.
 
Method Summary
 void deleteUser(User user, java.lang.String pw)
          Deletes an account of a user (this method is used by the user itself).
 MessageServer getMS(User user)
          Returns the message server of a user given by argument.
 void register(java.lang.String nickCase, java.lang.String pw)
          Creates an account for a new user.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Communication

protected Communication()
                 throws java.rmi.RemoteException
The constructor.

Throws:
java.rmi.RemoteException - if a remote exception occurred.
Method Detail

getMS

public MessageServer getMS(User user)
                    throws UserNotExistsException
Description copied from interface: BSForMSInterface
Returns the message server of a user given by argument.

Specified by:
getMS in interface BSForMSInterface
Specified by:
getMS in interface BSForServletInterface
Parameters:
user - the user (only the nickname is considered).
Returns:
the user's message server.
Throws:
UserNotExistsException - if the user does not exist.

register

public void register(java.lang.String nickCase,
                     java.lang.String pw)
              throws GenericErrorException,
                     AssignationNotAcceptedException
Description copied from interface: BSForServletInterface
Creates an account for a new user.

Specified by:
register in interface BSForServletInterface
Parameters:
nickCase - The new user nickname (case insensitive).
pw - The new user password.
Throws:
GenericErrorException - if there are no message server available for the assignation.
AssignationNotAcceptedException

deleteUser

public void deleteUser(User user,
                       java.lang.String pw)
                throws UserNotExistsException,
                       WrongPasswordException,
                       GenericErrorException,
                       BlockedException
Description copied from interface: BSForServletInterface
Deletes an account of a user (this method is used by the user itself).

Specified by:
deleteUser in interface BSForServletInterface
Parameters:
user - the user to delete
pw - the user's password
Throws:
UserNotExistsException - if the user nickname does not exist.
WrongPasswordException - if the user password is not right.
GenericErrorException - if some error occurred and the user was not deleted (i.e. MS not reachable).
BlockedException - if the user is currently blocked by the administrator.