messageServerP
Interface BackupperInterface

All Known Implementing Classes:
FileBackupper

public interface BackupperInterface

An interface that represents a backupper for a Gossip Message Server. A backupper is a unit that can save and restore any working data of the server, that is the managed users.

Author:
Marco Cornolti

Method Summary
 void backupUser(ManagedUser usr)
          Backups a new user adding it to the backup.
 void backupWholeData(java.util.List<ManagedUser> mUsers)
          Backups the whole data given as arguments.
 void removeBackuppedUser(ManagedUser usr)
          Removes a user from the backup.
 int restoreData(java.util.List<ManagedUser> restoredUsers)
           
 void updateUser(ManagedUser newUserStatus)
          Replaces the status of a user in the backup or adds the user if it is not backupped.
 

Method Detail

backupWholeData

void backupWholeData(java.util.List<ManagedUser> mUsers)
                     throws java.io.IOException
Backups the whole data given as arguments.

Parameters:
mUsers - the managed users to backup list.
Throws:
java.io.IOException - if a problem occurred while writing the backup.

restoreData

int restoreData(java.util.List<ManagedUser> restoredUsers)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException,
                       java.lang.IllegalArgumentException
Parameters:
restoredUsers - an empty list where restored users will be stored.
Returns:
the number of restored users.
Throws:
java.io.IOException - if a problem occurred while reading the backup.
java.lang.ClassNotFoundException - if the read object class is not recognized.
java.lang.IllegalArgumentException - if the list given as argument is not empty or is null.

updateUser

void updateUser(ManagedUser newUserStatus)
                throws java.io.IOException
Replaces the status of a user in the backup or adds the user if it is not backupped.

Parameters:
newUserStatus - the new user status.
Throws:
java.io.IOException - if a problem occurred while reading or writing the backup (broken data, incorrect version).

backupUser

void backupUser(ManagedUser usr)
                throws java.io.IOException
Backups a new user adding it to the backup.

Parameters:
usr - the user to backup
Throws:
java.io.IOException - if the user addition failed (broken old backup, not enought space left, ...).

removeBackuppedUser

void removeBackuppedUser(ManagedUser usr)
                         throws java.io.IOException
Removes a user from the backup.

Parameters:
usr - the user to delete (only the nickname is considered).
Throws:
java.io.IOException - if the user deletion failed (user was not present, i/o error, ...)