messageServerP
Class HumanListener

java.lang.Object
  extended by java.lang.Thread
      extended by messageServerP.HumanListener
All Implemented Interfaces:
java.lang.Runnable

public class HumanListener
extends java.lang.Thread

The human listener, a thread that waits the administration commands from the interface and performs the correspondent actions.

Author:
Marco Cornolti

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static HumanInterface currentInt
          The current human-user interface.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HumanListener()
           
 
Method Summary
private  void executeBackup(Command com)
          Executes a complete backup in the file given as argument, or in the main backupper if the argument was not given.
private  void executeChangeInterfaceToGui()
          NOT YET IMPLEMENTED: DOES NOTHING!
private  void executePrintLoadStatistics()
          Prints the load statistics.
private  void executePrintUserStatistics()
          Prints the user statistics.
protected static boolean executeShutdown()
          Shuts down the Message server if no users are assigned or returns false if there are assigned users.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentInt

public static HumanInterface currentInt
The current human-user interface. Automatically set to textual when the thread starts.

Constructor Detail

HumanListener

public HumanListener()
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

executeShutdown

protected static boolean executeShutdown()
Shuts down the Message server if no users are assigned or returns false if there are assigned users. If there are some assigned user, this method displays ad error message in the current interface, else (if shutting down) a notifying message is displayed.

Returns:
false if there are assigned users, does not return otherwise.

executePrintUserStatistics

private void executePrintUserStatistics()
Prints the user statistics.


executeChangeInterfaceToGui

private void executeChangeInterfaceToGui()
NOT YET IMPLEMENTED: DOES NOTHING! (should run the graphical interface)


executePrintLoadStatistics

private void executePrintLoadStatistics()
Prints the load statistics.


executeBackup

private void executeBackup(Command com)
Executes a complete backup in the file given as argument, or in the main backupper if the argument was not given.

Parameters:
com - the command obtained by the human interface (contains the backup filename)