servlet
Class AccessOperation

java.lang.Object
  extended by servlet.AccessOperation

public class AccessOperation
extends java.lang.Object

Provides a whole of methods which to communicate with the server.

Author:
Alessandro Franchini

Field Summary
private static BSForServletInterface boot
          The reference to the remote object of the bootstrap
private static MSForServletInterface msi
          The reference to the remote object of the message
 
Constructor Summary
AccessOperation()
           
 
Method Summary
static MessageServer askMsgServer(User user)
          Asks the assignation of a Message Server
private static void catchError(java.lang.String error)
          Visualizes a graphic interface with the error
static void changeStateUser(int form, User user)
          Changes the friendship's state with the user
static boolean contactUser(User user)
          Lets contact another user the first time
static java.util.Vector<Message> getMail(User user, java.lang.String pass, MessageServer ms)
          Downloads and deletes the messages received by the user
static User getUser(User user)
          Gets information about the requested user
static ContactList logMsg(User user, java.lang.String pass, MessageServer ms)
          This method finds the reference to the remote object of the message server, sets the State to true and downloads the Contacts List
static void logOff()
          Set the user's state to false.
static boolean register(User user, java.lang.String pass)
          This method is of use to the user's registration
static void sendMessage(Message mx)
          Sends a message to the message server
static boolean setConnBoot(java.net.InetAddress bootIa, int port)
          This method finds the reference to the remote object of the bootstrap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boot

private static BSForServletInterface boot
The reference to the remote object of the bootstrap


msi

private static MSForServletInterface msi
The reference to the remote object of the message

Constructor Detail

AccessOperation

public AccessOperation()
Method Detail

setConnBoot

public static boolean setConnBoot(java.net.InetAddress bootIa,
                                  int port)
This method finds the reference to the remote object of the bootstrap.

Parameters:
bootIa - the bootstrap's address
port - the bootstrap's port
Returns:
true if the object is found; else false.

register

public static boolean register(User user,
                               java.lang.String pass)
This method is of use to the user's registration

Parameters:
user - the user
pass - the user's pass
Returns:
true if the registration has been made; else false

askMsgServer

public static MessageServer askMsgServer(User user)
Asks the assignation of a Message Server

Parameters:
user - the user who to assign the Message Server to.
Returns:
The Message Server assigned

logMsg

public static ContactList logMsg(User user,
                                 java.lang.String pass,
                                 MessageServer ms)
This method finds the reference to the remote object of the message server, sets the State to true and downloads the Contacts List

Parameters:
user - the user
pass - the user's password
ms - the message server
Returns:
the contact list.

getMail

public static java.util.Vector<Message> getMail(User user,
                                                java.lang.String pass,
                                                MessageServer ms)
Downloads and deletes the messages received by the user

Parameters:
user - the user
pass - the user's password
ms - the message server
Returns:
the message received by the user

changeStateUser

public static void changeStateUser(int form,
                                   User user)
Changes the friendship's state with the user

Parameters:
form - 0 to unlock the contact; 1 to lock the contact
user - the user

logOff

public static void logOff()
Set the user's state to false.


sendMessage

public static void sendMessage(Message mx)
Sends a message to the message server

Parameters:
mx - the message server

getUser

public static User getUser(User user)
Gets information about the requested user

Parameters:
user - the user
Returns:
The user with all the information

contactUser

public static boolean contactUser(User user)
Lets contact another user the first time

Parameters:
user - the user
Returns:
true if the user is online; else false.

catchError

private static void catchError(java.lang.String error)
Visualizes a graphic interface with the error

Parameters:
error - the error