org.jtheque.core.managers.file
Interface IFileManager

All Superinterfaces:
ActivableManager, IManager
All Known Implementing Classes:
FileManager

public interface IFileManager
extends ActivableManager

A FileManager specification.

Author:
Baptiste Wicht

Nested Class Summary
static class IFileManager.JTDVersion
          JTD File versions.
static class IFileManager.XmlBackupVersion
          XML Backup versions.
 
Field Summary
static int CONTENT
           
static long JTCATEGORYSEPARATOR
           
static long JTINTERNSEPARATOR
           
static java.lang.String JTKEY
           
static int NOCONTENT
           
static java.lang.String UTFNULL
           
 
Method Summary
 void backup(FileType format, java.io.File file)
          Backup to a File with a specific format.
 java.lang.String formatUTFToRead(java.lang.String utf)
          Format an UTF string after read it in a file to get the good value.
 java.lang.String formatUTFToWrite(java.lang.String utf)
          Format an UTF string before insert it in a file to be sure that it isn't empty.
 java.util.List<BackupReader> getBackupReaders(FileType format)
          Return all the backupers of a specific format.
 boolean isBackupPossible(FileType type)
          Indicate if the backup is possible for the specified file type.
 boolean isRestorePossible(FileType type)
          Indicate if the restore is possible for the specified file type.
 void registerBackupReader(FileType format, BackupReader reader)
          Register a new BackupReader.
 void registerBackupWriter(FileType format, BackupWriter writer)
          Register a new BackupWriter.
 void restore(FileType format, java.io.File file)
          Restore the data from a File with a specific format.
 void unregisterBackupReader(FileType format, BackupReader reader)
          Unregister a BackupReader.
 void unregisterBackupWriter(FileType format, BackupWriter writer)
          Unregister a BackupWriter.
 
Methods inherited from interface org.jtheque.core.managers.ActivableManager
isEnabled, setEnabled
 
Methods inherited from interface org.jtheque.core.managers.IManager
close, init, preInit
 

Field Detail

JTCATEGORYSEPARATOR

static final long JTCATEGORYSEPARATOR
See Also:
Constant Field Values

JTINTERNSEPARATOR

static final long JTINTERNSEPARATOR
See Also:
Constant Field Values

CONTENT

static final int CONTENT
See Also:
Constant Field Values

NOCONTENT

static final int NOCONTENT
See Also:
Constant Field Values

UTFNULL

static final java.lang.String UTFNULL
See Also:
Constant Field Values

JTKEY

static final java.lang.String JTKEY
See Also:
Constant Field Values
Method Detail

formatUTFToWrite

java.lang.String formatUTFToWrite(java.lang.String utf)
Format an UTF string before insert it in a file to be sure that it isn't empty.

Parameters:
utf - The UTF string.
Returns:
The UTF String if it isn't empty or UTFNULL.

formatUTFToRead

java.lang.String formatUTFToRead(java.lang.String utf)
Format an UTF string after read it in a file to get the good value.

Parameters:
utf - The UTF string.
Returns:
The UTF String if it isn't empty or UTFNULL.

backup

void backup(FileType format,
            java.io.File file)
            throws org.jtheque.utils.io.FileException
Backup to a File with a specific format.

Parameters:
format - The format of the backup.
file - The file to backup to.
Throws:
org.jtheque.utils.io.FileException - Thrown when an error occurs during the backup process.

restore

void restore(FileType format,
             java.io.File file)
             throws org.jtheque.utils.io.FileException
Restore the data from a File with a specific format.

Parameters:
format - The format of the backup.
file - The file to restore from.
Throws:
org.jtheque.utils.io.FileException - Thrown when an error occurs during the restore process.

registerBackupWriter

void registerBackupWriter(FileType format,
                          BackupWriter writer)
Register a new BackupWriter.

Parameters:
format - The format the BackupWriter manage.
writer - The writer to register.

registerBackupReader

void registerBackupReader(FileType format,
                          BackupReader reader)
Register a new BackupReader.

Parameters:
format - The format the BackupReader manage.
reader - The reader to register.

unregisterBackupWriter

void unregisterBackupWriter(FileType format,
                            BackupWriter writer)
Unregister a BackupWriter.

Parameters:
format - The format the BackupWriter manage.
writer - The writer to unregister.

unregisterBackupReader

void unregisterBackupReader(FileType format,
                            BackupReader reader)
Unregister a BackupReader.

Parameters:
format - The format the BackupReader manage.
reader - The reader to unregister.

getBackupReaders

java.util.List<BackupReader> getBackupReaders(FileType format)
Return all the backupers of a specific format.

Parameters:
format - The format.
Returns:
All the BackupReader.

isBackupPossible

boolean isBackupPossible(FileType type)
Indicate if the backup is possible for the specified file type.

Parameters:
type - The file type to test.
Returns:
true if the backup is possible with this file type else false.

isRestorePossible

boolean isRestorePossible(FileType type)
Indicate if the restore is possible for the specified file type.

Parameters:
type - The file type to test.
Returns:
true if the restore is possible with this file type else false.


Copyright © 2009 JTheque. All Rights Reserved.