Package fr.dyade.aaa.util
Interface Repository
-
- All Known Implementing Classes:
DBRepository,FileRepository
public interface RepositoryThis interface defines a repository for serializable objects and bytes array. Note: Be careful the constructor must be public to allow newInstance from another package.- See Also:
NTransaction
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbackup(BackupFile backup)Backups the repository (may be unimplemented).voidclose()Closes the repository.voidcommit()Commits all changes to the repository.voiddelete(String dirName, String name)Deletes the corresponding objects in repository.intgetNbBadDeletedObjects()Returns the number of useless delete operation on repository.intgetNbDeletedObjects()Returns the number of delete operation on repository.intgetNbLoadedObjects()Returns the number of load operation from repository.intgetNbSavedObjects()Returns the number of save operation to repository.voidinit(Transaction transaction, File dir)Initializes the repository.String[]list(String prefix)Gets a list of persistent objects that name corresponds to prefix.byte[]load(String dirName, String name)Loads the byte array.voidsave(String dirName, String name, byte[] content)Save the corresponding bytes array.
-
-
-
Method Detail
-
init
void init(Transaction transaction, File dir) throws IOException
Initializes the repository.- Parameters:
transaction- the transaction object.dir- the directory.- Throws:
IOException- an error occurs.
-
list
String[] list(String prefix) throws IOException
Gets a list of persistent objects that name corresponds to prefix.- Parameters:
prefix- the prefix.- Returns:
- The list of corresponding names.
- Throws:
IOException- an error occurs.
-
save
void save(String dirName, String name, byte[] content) throws IOException
Save the corresponding bytes array.- Parameters:
dirName- the directory.name- the object name.content- the serialized object view.- Throws:
IOException- an error occurs.
-
load
byte[] load(String dirName, String name) throws IOException
Loads the byte array.- Parameters:
dirName- the directory.name- the object name.- Returns:
- the serialized object view.
- Throws:
IOException- an error occurs.
-
delete
void delete(String dirName, String name) throws IOException
Deletes the corresponding objects in repository.- Parameters:
dirName- the directory.name- the object name.- Throws:
IOException- an error occurs.
-
commit
void commit() throws IOExceptionCommits all changes to the repository.- Throws:
IOException- an error occurs.
-
backup
void backup(BackupFile backup) throws IOException
Backups the repository (may be unimplemented).- Parameters:
backup- The backup file.- Throws:
IOException
-
close
void close() throws IOExceptionCloses the repository.- Throws:
IOException- an error occurs.
-
getNbSavedObjects
int getNbSavedObjects()
Returns the number of save operation to repository.- Returns:
- The number of save operation to repository.
-
getNbDeletedObjects
int getNbDeletedObjects()
Returns the number of delete operation on repository.- Returns:
- The number of delete operation on repository.
-
getNbBadDeletedObjects
int getNbBadDeletedObjects()
Returns the number of useless delete operation on repository.- Returns:
- The number of useless delete operation on repository.
-
getNbLoadedObjects
int getNbLoadedObjects()
Returns the number of load operation from repository.- Returns:
- The number of load operation from repository.
-
-