|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmessageServerP.FileBackupper
public class FileBackupper
Field Summary | |
---|---|
private java.io.File |
bkFile
|
Constructor Summary | |
---|---|
FileBackupper(java.lang.String backupFilePath)
Creates a backupper that writes on a single file. |
Method Summary | |
---|---|
private void |
backupSingleData(ManagedUser usr,
boolean remove)
Adds or removes a single managed user from the backup. |
void |
backupUser(ManagedUser usr)
Backups a new user adding it to the backup. |
void |
backupWholeData(java.util.List<ManagedUser> users)
Backups the whole data given as arguments. |
java.lang.String |
getFilename()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.File bkFile
Constructor Detail |
---|
public FileBackupper(java.lang.String backupFilePath)
backupFilePath
- the backup file path.Method Detail |
---|
public java.lang.String getFilename()
public void backupWholeData(java.util.List<ManagedUser> users) throws java.io.IOException
BackupperInterface
backupWholeData
in interface BackupperInterface
users
- the managed users to backup list.
java.io.IOException
- if a problem occurred while writing the backup.private void backupSingleData(ManagedUser usr, boolean remove) throws java.io.IOException
usr
- the user to add or remove (in the latter case, only the nickname is considered).remove
- true if the user must be removed, false otherwise.
java.io.IOException
- if the file could not be modified or read.public void backupUser(ManagedUser usr) throws java.io.IOException
BackupperInterface
backupUser
in interface BackupperInterface
usr
- the user to backup
java.io.IOException
- if the user addition failed (broken old backup, not enought space left, ...).public void removeBackuppedUser(ManagedUser usr) throws java.io.IOException
BackupperInterface
removeBackuppedUser
in interface BackupperInterface
usr
- the user to delete (only the nickname is considered).
java.io.IOException
- if the user deletion failed (user was not present, i/o error, ...)public int restoreData(java.util.List<ManagedUser> restoredUsers) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.IllegalArgumentException
restoreData
in interface BackupperInterface
restoredUsers
- an empty list where restored users will be stored.
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.public void updateUser(ManagedUser newUserStatus) throws java.io.IOException
BackupperInterface
updateUser
in interface BackupperInterface
newUserStatus
- the new user status.
java.io.IOException
- if a problem occurred while reading or writing the backup (broken data, incorrect version).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |