fr.dyade.aaa.util
Interface Repository

All Known Implementing Classes:
DBRepository, FileRepository, MySqlDBRepository

public interface Repository

This 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
 void close()
          Closes the repository.
 void commit()
          Commits all changes to the repository.
 void delete(java.lang.String dirName, java.lang.String name)
          Deletes the corresponding objects in repository.
 int getNbBadDeletedObjects()
          Returns the number of useless delete operation on repository.
 int getNbDeletedObjects()
          Returns the number of delete operation on repository.
 int getNbLoadedObjects()
          Returns the number of load operation from repository.
 int getNbSavedObjects()
          Returns the number of save operation to repository.
 void init(java.io.File dir)
          Initializes the repository.
 java.lang.String[] list(java.lang.String prefix)
          Gets a list of persistent objects that name corresponds to prefix.
 byte[] load(java.lang.String dirName, java.lang.String name)
          Loads the byte array.
 void save(java.lang.String dirName, java.lang.String name, byte[] content)
          Save the corresponding bytes array.
 

Method Detail

init

void init(java.io.File dir)
          throws java.io.IOException
Initializes the repository.

Throws:
java.io.IOException

list

java.lang.String[] list(java.lang.String prefix)
                        throws java.io.IOException
Gets a list of persistent objects that name corresponds to prefix.

Returns:
The list of corresponding names.
Throws:
java.io.IOException

save

void save(java.lang.String dirName,
          java.lang.String name,
          byte[] content)
          throws java.io.IOException
Save the corresponding bytes array.

Throws:
java.io.IOException

load

byte[] load(java.lang.String dirName,
            java.lang.String name)
            throws java.io.IOException
Loads the byte array.

Returns:
The loaded bytes array.
Throws:
java.io.IOException

delete

void delete(java.lang.String dirName,
            java.lang.String name)
            throws java.io.IOException
Deletes the corresponding objects in repository.

Throws:
java.io.IOException

commit

void commit()
            throws java.io.IOException
Commits all changes to the repository.

Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Closes the repository.

Throws:
java.io.IOException

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.


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.