bootstrapP
Class TextualInterfaceIt

java.lang.Object
  extended by bootstrapP.TextualInterfaceIt
All Implemented Interfaces:
HumanInterface

public class TextualInterfaceIt
extends java.lang.Object
implements HumanInterface

The human textual interface in italian.

Author:
Marco Cornolti

Field Summary
(package private) static java.io.BufferedReader in
           
(package private) static java.io.PrintStream out
           
 
Constructor Summary
TextualInterfaceIt()
           
 
Method Summary
 void destroy()
          Called when the interface must be terminated.
 Command getCommand()
          Gets the next command to execute from the interface.
 void initialize()
          Initialize the interface.
private  void printError(java.lang.String err)
          Stampa i messaggi di gravi errori di sistema locali.
private  void printHelp()
          Stampa l'elenco dei comandi disponibili.
private  void printMessage(java.lang.String msg)
          Stampa i messaggi di normale interazione.
private  void printWarning(java.lang.String war)
          Stampa i messaggi di particolare rilevanza come errori degli utenti, errori del sistema globale e password sbagliate.
 void showBackupDone()
          Called when the main backupper ends.
 void showBackupFailed()
          Called when a backupper unit failed to backup.
 void showBackupFileStart(java.lang.String filename)
          Called when a file backupper starts.
 void showBackupStart()
          Called when a backupper unit starts.
 void showCouldNotBackupMS(java.lang.String hostname, int RMIport, int UDPport)
          Called when a backup problem occurred and a MS could not be saved.
 void showCouldNotBackupUser(java.lang.String nickname)
          Called when a backup problem occurred and a User could not be saved.
 void showCouldNotContactMS(java.lang.String hostname, int udpPort, int rmiPort)
          Called when a Message Server could not be contacted.
 void showCouldNotRemoveBackuppedMS(java.lang.String hostName, int RMIport, int UDPport)
          Called when a backup problem occurred and a MS could not be removed.
 void showCouldNotRemoveBackuppedUser(java.lang.String nick)
          Called when a backup problem occurred and a User could not be removed.
 void showCouldNotShutdownUnblockedMS(int id1)
          Called when a MS cannot shutdown because it is not blocked.
 void showGlobalMSStats(int mss, long minFreeMem, int minFreeMemI, java.lang.String minMemCanonicalHostName, long maxFreeMem, int maxFreeMemI, java.lang.String maxMemCanonicalHostName, int minManUsers, int minManUsersI, java.lang.String minUsersCanonicalHostName, int maxManUsers, int maxManUsersI, java.lang.String maxUsersCanonicalHostName, long fwMsgs, long onlineUsers, long queuedMsgs)
          Called when some global statistics must be shown.
 void showIllegalArgument(java.lang.String hostname, int UDPport, int RMIport)
          Called when some given data are not right.
 void showMSAdded(java.lang.String canonicalHostName, int udpPort, int rmiPort)
          Called when a MS is added.
 void showMSAlreadyInseted()
          Called when the admin tried to add an already added message server.
 void showMSBlocked(int id1)
          Called when a MS is blocked.
 void showMSCommunicationProblem(int id1)
          Called when a communication problem with a MS occurred.
 void showMSGenericError(int msId)
          Called when a generic error occurred in the message server.
 void showMSNotRemoved(int id1)
          Called when a MS cannot be removed.
 void showMSRemoved(int id1)
          Called when a MS has been removed.
 void showMSShutdownDone(int id1)
          Called when a MS Shutdown is done correctly.
 void showMSShutdownFailedUsersPresent(int id)
          Called when a MS cannot shutdown because some users are still assigned to it.
 void showMSUnblocked(int id1)
          Called when a MS is not blocked.
 void showMSUnknown(java.lang.String hostAddress, int port)
          Called when an udp packet from an unknown Message server is received.
 void showMSUserNotAccepted(int id, java.lang.String nick)
          Called when a MS does not accept a user assignation.
 void showReceivedLoad(java.lang.String hostname, int freeMem, int fwdMess)
          Called when a MS load is received.
 void showReceivedLoadFailed()
          Called when a load could not be received.
 void showSingleMSStats(int i, java.lang.String canonicalHostName, int RMIport, int UDPport, int cacheEntries, long freeMem, long load, int forwardedMessagesMinute, int forwardedMessagesHour, int forwardedMessages24Hours, int forwardedMessages144Hours, int managedUsers, int onlineManagedUsers, int queuedMessageNumber)
          Called when a single server statistics must be shown.
 void showStatistics(long upTime, int usersNumber, int MSnumber)
          Called when some statistics has to be shown.
 void showTestPresenceDone(int id1)
          Called when a presence test for a MS is done correctly.
 void showTestPresenceFailed(int id1)
          Called when a presence test for a MS failed.
 void showUDPProblem()
          Called when an UDP problem occurred.
 void showUserDeleted(java.lang.String nick)
          Called when a user was successfully deleted.
 void showUserList(int id1, java.lang.String userStr)
          Shows a list of users managed by a message server.
 void showUserMoved(java.lang.String nick)
          Called when a user has been successfully moved.
 void showUserMoveSameDest(java.lang.String nick)
          Called when somebody is trying to move a user from a server to its server.
 void showUserNotDeleted(java.lang.String nick)
          Called when a user could not be deleted.
 void showUserNotExists(java.lang.String nick)
          Called when a user does not exist.
 void showUserNotManaged(int managerMSi, java.lang.String user)
          Called when a user is not managed by a Message server.
 void showUserNotMoved(java.lang.String nick)
          Called when a user could not be moved.
private  void showWrongCommandName()
          Stampa un messaggio se il nome di un comando e' errato.
 void showWrongMSId(int id1)
          Called when a MS id is not correct.
 void showWrongMSPassword(int id1)
          Called when a Message server password is wrong.
 void showWrongMSPassword(java.lang.String host, int udpPort, int rmiPort)
          Called when a Message server password is wrong.
private  void showWrongParametersFormat()
          Stampa un messaggio se la sintassi di un comando non e' corretta.
private  void showWrongParametersNumber()
          Stampa un messaggio se il numero di parametri immessi per un comando e' errata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

static java.io.BufferedReader in

out

static java.io.PrintStream out
Constructor Detail

TextualInterfaceIt

public TextualInterfaceIt()
Method Detail

initialize

public void initialize()
Description copied from interface: HumanInterface
Initialize the interface.

Specified by:
initialize in interface HumanInterface

getCommand

public Command getCommand()
Description copied from interface: HumanInterface
Gets the next command to execute from the interface.

Specified by:
getCommand in interface HumanInterface
Returns:
the command to execute.

showWrongCommandName

private void showWrongCommandName()
Stampa un messaggio se il nome di un comando e' errato.


showWrongParametersFormat

private void showWrongParametersFormat()
Stampa un messaggio se la sintassi di un comando non e' corretta.


showWrongParametersNumber

private void showWrongParametersNumber()
Stampa un messaggio se il numero di parametri immessi per un comando e' errata.


printHelp

private void printHelp()
Stampa l'elenco dei comandi disponibili.


printMessage

private void printMessage(java.lang.String msg)
Stampa i messaggi di normale interazione.

Parameters:
msg - il messaggio da stampare.

printWarning

private void printWarning(java.lang.String war)
Stampa i messaggi di particolare rilevanza come errori degli utenti, errori del sistema globale e password sbagliate.

Parameters:
war - il messaggio da stampare.

printError

private void printError(java.lang.String err)
Stampa i messaggi di gravi errori di sistema locali.

Parameters:
err - il messaggio da stampare

destroy

public void destroy()
Description copied from interface: HumanInterface
Called when the interface must be terminated.

Specified by:
destroy in interface HumanInterface

showMSNotRemoved

public void showMSNotRemoved(int id1)
Description copied from interface: HumanInterface
Called when a MS cannot be removed.

Specified by:
showMSNotRemoved in interface HumanInterface
Parameters:
id1 - the id of the MS that could not be removed.

showMSRemoved

public void showMSRemoved(int id1)
Description copied from interface: HumanInterface
Called when a MS has been removed.

Specified by:
showMSRemoved in interface HumanInterface
Parameters:
id1 - the id of the removed message server.

showReceivedLoad

public void showReceivedLoad(java.lang.String hostname,
                             int freeMem,
                             int fwdMess)
Description copied from interface: HumanInterface
Called when a MS load is received.

Specified by:
showReceivedLoad in interface HumanInterface
Parameters:
hostname - the sender hostname.
freeMem - the free memory.
fwdMess - the forwarded messages.

showUserDeleted

public void showUserDeleted(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a user was successfully deleted.

Specified by:
showUserDeleted in interface HumanInterface
Parameters:
nick - the user nickname

showUserMoved

public void showUserMoved(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a user has been successfully moved.

Specified by:
showUserMoved in interface HumanInterface
Parameters:
nick - the user nickname.

showUserNotDeleted

public void showUserNotDeleted(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a user could not be deleted.

Specified by:
showUserNotDeleted in interface HumanInterface
Parameters:
nick - the user nickname

showUserNotExists

public void showUserNotExists(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a user does not exist.

Specified by:
showUserNotExists in interface HumanInterface
Parameters:
nick - the user nickname

showUserNotMoved

public void showUserNotMoved(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a user could not be moved.

Specified by:
showUserNotMoved in interface HumanInterface
Parameters:
nick - the user nickname.

showCouldNotContactMS

public void showCouldNotContactMS(java.lang.String hostname,
                                  int udpPort,
                                  int rmiPort)
Description copied from interface: HumanInterface
Called when a Message Server could not be contacted.

Specified by:
showCouldNotContactMS in interface HumanInterface
Parameters:
hostname - the MS hostname.
udpPort - the MS UDP port.
rmiPort - the MS RMI port.

showUDPProblem

public void showUDPProblem()
Description copied from interface: HumanInterface
Called when an UDP problem occurred.

Specified by:
showUDPProblem in interface HumanInterface

showGlobalMSStats

public void showGlobalMSStats(int mss,
                              long minFreeMem,
                              int minFreeMemI,
                              java.lang.String minMemCanonicalHostName,
                              long maxFreeMem,
                              int maxFreeMemI,
                              java.lang.String maxMemCanonicalHostName,
                              int minManUsers,
                              int minManUsersI,
                              java.lang.String minUsersCanonicalHostName,
                              int maxManUsers,
                              int maxManUsersI,
                              java.lang.String maxUsersCanonicalHostName,
                              long fwMsgs,
                              long onlineUsers,
                              long queuedMsgs)
Description copied from interface: HumanInterface
Called when some global statistics must be shown.

Specified by:
showGlobalMSStats in interface HumanInterface
Parameters:
mss - total number of Message Servers.
minFreeMem - the minimum free memory in a single server.
minFreeMemI - the id of the server with the minimum free memory.
minMemCanonicalHostName - the hostname of the server with the minimum free memory.
maxFreeMem - the maximum free memory in a single server.
maxFreeMemI - the id of the server with the maximum free memory.
maxMemCanonicalHostName - the hostname of the server with the maximum free memory.
minManUsers - the minimum managed users in a single server.
minManUsersI - the id of the server with the minimum managed users.
minUsersCanonicalHostName - the hostname of the server with the minimum managed users.
maxManUsers - the maximum managed users in a single server.
maxManUsersI - the id of the server with the maximum managed users.
maxUsersCanonicalHostName - the hostname of the server with the maximum managed users.
fwMsgs - the totally forwarded messages.
onlineUsers - the estimate online users.
queuedMsgs - the number of messages stored in the message servers queues.

showSingleMSStats

public void showSingleMSStats(int i,
                              java.lang.String canonicalHostName,
                              int RMIport,
                              int UDPport,
                              int cacheEntries,
                              long freeMem,
                              long load,
                              int forwardedMessagesMinute,
                              int forwardedMessagesHour,
                              int forwardedMessages24Hours,
                              int forwardedMessages144Hours,
                              int managedUsers,
                              int onlineManagedUsers,
                              int queuedMessageNumber)
Description copied from interface: HumanInterface
Called when a single server statistics must be shown.

Specified by:
showSingleMSStats in interface HumanInterface
Parameters:
i - the server id.
canonicalHostName - the server hostname.
RMIport - the server RMI port.
UDPport - the server UDP port.
cacheEntries - the cache entries.
freeMem - the free memory.
load - the load.
forwardedMessagesMinute - the number of messages forwarded in the last minute.
forwardedMessagesHour - the number of messages forwarded in the last hour.
forwardedMessages24Hours - the number of messages forwarded in the last day.
forwardedMessages144Hours - the number of messages forwarded in the last week.
managedUsers - the number of managed users.
onlineManagedUsers - the number of online managed users.
queuedMessageNumber - the number of queued messages.

showStatistics

public void showStatistics(long upTime,
                           int usersNumber,
                           int MSnumber)
Description copied from interface: HumanInterface
Called when some statistics has to be shown.

Specified by:
showStatistics in interface HumanInterface
Parameters:
upTime - the local server uptime.
usersNumber - the number of currently registered users.
MSnumber - the number of registered message servers.

showReceivedLoadFailed

public void showReceivedLoadFailed()
Description copied from interface: HumanInterface
Called when a load could not be received.

Specified by:
showReceivedLoadFailed in interface HumanInterface

showMSAdded

public void showMSAdded(java.lang.String canonicalHostName,
                        int udpPort,
                        int rmiPort)
Description copied from interface: HumanInterface
Called when a MS is added.

Specified by:
showMSAdded in interface HumanInterface
Parameters:
canonicalHostName - the ms hostname.
udpPort - the UDP port.
rmiPort - the RMI port.

showWrongMSPassword

public void showWrongMSPassword(java.lang.String host,
                                int udpPort,
                                int rmiPort)
Description copied from interface: HumanInterface
Called when a Message server password is wrong.

Specified by:
showWrongMSPassword in interface HumanInterface
Parameters:
host - the MS hostname.
udpPort - the MS UDP port.
rmiPort - the MS RMI port.

showMSBlocked

public void showMSBlocked(int id1)
Description copied from interface: HumanInterface
Called when a MS is blocked.

Specified by:
showMSBlocked in interface HumanInterface
Parameters:
id1 - the MS id.

showCouldNotShutdownUnblockedMS

public void showCouldNotShutdownUnblockedMS(int id1)
Description copied from interface: HumanInterface
Called when a MS cannot shutdown because it is not blocked.

Specified by:
showCouldNotShutdownUnblockedMS in interface HumanInterface
Parameters:
id1 - the ms id.

showMSCommunicationProblem

public void showMSCommunicationProblem(int id1)
Description copied from interface: HumanInterface
Called when a communication problem with a MS occurred.

Specified by:
showMSCommunicationProblem in interface HumanInterface
Parameters:
id1 - the MS id.

showMSShutdownDone

public void showMSShutdownDone(int id1)
Description copied from interface: HumanInterface
Called when a MS Shutdown is done correctly.

Specified by:
showMSShutdownDone in interface HumanInterface
Parameters:
id1 - the MS id

showTestPresenceDone

public void showTestPresenceDone(int id1)
Description copied from interface: HumanInterface
Called when a presence test for a MS is done correctly.

Specified by:
showTestPresenceDone in interface HumanInterface
Parameters:
id1 - the MS id

showTestPresenceFailed

public void showTestPresenceFailed(int id1)
Description copied from interface: HumanInterface
Called when a presence test for a MS failed.

Specified by:
showTestPresenceFailed in interface HumanInterface
Parameters:
id1 - the MS id

showUserList

public void showUserList(int id1,
                         java.lang.String userStr)
Description copied from interface: HumanInterface
Shows a list of users managed by a message server.

Specified by:
showUserList in interface HumanInterface
Parameters:
id1 - the ms id.
userStr - the users string representation.

showWrongMSId

public void showWrongMSId(int id1)
Description copied from interface: HumanInterface
Called when a MS id is not correct.

Specified by:
showWrongMSId in interface HumanInterface
Parameters:
id1 - the wrong id.

showWrongMSPassword

public void showWrongMSPassword(int id1)
Description copied from interface: HumanInterface
Called when a Message server password is wrong.

Specified by:
showWrongMSPassword in interface HumanInterface
Parameters:
id1 - the MS id.

showMSUnblocked

public void showMSUnblocked(int id1)
Description copied from interface: HumanInterface
Called when a MS is not blocked.

Specified by:
showMSUnblocked in interface HumanInterface
Parameters:
id1 - the MS id.

showMSUnknown

public void showMSUnknown(java.lang.String hostAddress,
                          int port)
Description copied from interface: HumanInterface
Called when an udp packet from an unknown Message server is received.

Specified by:
showMSUnknown in interface HumanInterface
Parameters:
hostAddress - the sender hostname.
port - the sender UDP port.

showUserNotManaged

public void showUserNotManaged(int managerMSi,
                               java.lang.String user)
Description copied from interface: HumanInterface
Called when a user is not managed by a Message server.

Specified by:
showUserNotManaged in interface HumanInterface
Parameters:
managerMSi - the MS id.
user - the user nickname.

showMSGenericError

public void showMSGenericError(int msId)
Description copied from interface: HumanInterface
Called when a generic error occurred in the message server.

Specified by:
showMSGenericError in interface HumanInterface
Parameters:
msId - the message server ID.

showMSShutdownFailedUsersPresent

public void showMSShutdownFailedUsersPresent(int id)
Description copied from interface: HumanInterface
Called when a MS cannot shutdown because some users are still assigned to it.

Specified by:
showMSShutdownFailedUsersPresent in interface HumanInterface
Parameters:
id - the ms id.

showMSUserNotAccepted

public void showMSUserNotAccepted(int id,
                                  java.lang.String nick)
Description copied from interface: HumanInterface
Called when a MS does not accept a user assignation.

Specified by:
showMSUserNotAccepted in interface HumanInterface
Parameters:
id - the MS id.
nick - the user nickname.

showIllegalArgument

public void showIllegalArgument(java.lang.String hostname,
                                int UDPport,
                                int RMIport)
Description copied from interface: HumanInterface
Called when some given data are not right.

Specified by:
showIllegalArgument in interface HumanInterface
Parameters:
hostname - the given hostname.
UDPport - the given RMI port.
RMIport - the given UDP port.

showCouldNotBackupMS

public void showCouldNotBackupMS(java.lang.String hostname,
                                 int RMIport,
                                 int UDPport)
Description copied from interface: HumanInterface
Called when a backup problem occurred and a MS could not be saved.

Specified by:
showCouldNotBackupMS in interface HumanInterface
Parameters:
hostname - the MS hostname.
RMIport - the MS RMI port.
UDPport - the Ms UDP port.

showCouldNotBackupUser

public void showCouldNotBackupUser(java.lang.String nickname)
Description copied from interface: HumanInterface
Called when a backup problem occurred and a User could not be saved.

Specified by:
showCouldNotBackupUser in interface HumanInterface
Parameters:
nickname - the user nickname.

showCouldNotRemoveBackuppedMS

public void showCouldNotRemoveBackuppedMS(java.lang.String hostName,
                                          int RMIport,
                                          int UDPport)
Description copied from interface: HumanInterface
Called when a backup problem occurred and a MS could not be removed.

Specified by:
showCouldNotRemoveBackuppedMS in interface HumanInterface
Parameters:
hostName - the MS hostname
RMIport - the MS RMI port.
UDPport - the MS UDP port.

showCouldNotRemoveBackuppedUser

public void showCouldNotRemoveBackuppedUser(java.lang.String nick)
Description copied from interface: HumanInterface
Called when a backup problem occurred and a User could not be removed.

Specified by:
showCouldNotRemoveBackuppedUser in interface HumanInterface
Parameters:
nick - the user nickname.

showBackupDone

public void showBackupDone()
Description copied from interface: HumanInterface
Called when the main backupper ends.

Specified by:
showBackupDone in interface HumanInterface

showBackupFileStart

public void showBackupFileStart(java.lang.String filename)
Description copied from interface: HumanInterface
Called when a file backupper starts.

Specified by:
showBackupFileStart in interface HumanInterface
Parameters:
filename - the name of the file the main backupper is working on.

showBackupStart

public void showBackupStart()
Description copied from interface: HumanInterface
Called when a backupper unit starts.

Specified by:
showBackupStart in interface HumanInterface

showBackupFailed

public void showBackupFailed()
Description copied from interface: HumanInterface
Called when a backupper unit failed to backup.

Specified by:
showBackupFailed in interface HumanInterface

showUserMoveSameDest

public void showUserMoveSameDest(java.lang.String nick)
Description copied from interface: HumanInterface
Called when somebody is trying to move a user from a server to its server.

Specified by:
showUserMoveSameDest in interface HumanInterface
Parameters:
nick - the user nickname.

showMSAlreadyInseted

public void showMSAlreadyInseted()
Description copied from interface: HumanInterface
Called when the admin tried to add an already added message server.

Specified by:
showMSAlreadyInseted in interface HumanInterface