public final class FileRepository extends Object implements Repository
NTransaction
,
Repository
Modifier and Type | Field and Description |
---|---|
private int |
baddeleted
The number of useless delete operation on repository.
|
(package private) File |
dir |
private String |
mode |
private int |
nbdeleted
The number of delete operation on repository.
|
private int |
nbloaded
The number of load operation from repository.
|
private int |
nbsaved
The number of save operation to repository.
|
private boolean |
syncOnWrite |
private boolean |
useFileOutputStream
Boolean value to force the use of FileOutputStream rather than
RandomAccessFile.
|
Constructor and Description |
---|
FileRepository() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the repository.
|
void |
commit()
Commits all changes to the repository.
|
void |
delete(String dirName,
String name)
Deletes the corresponding objects in repository.
|
private void |
deleteDir(File dir)
Delete the specified directory if it is empty.
|
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(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.
|
void |
save(String dirName,
String name,
byte[] content)
Save the corresponding bytes array.
|
File dir
private int nbsaved
private int nbdeleted
private int baddeleted
private int nbloaded
private boolean useFileOutputStream
This property can be fixed only from java
launching
command, or through System.property method.
private boolean syncOnWrite
private String mode
public int getNbSavedObjects()
getNbSavedObjects
in interface Repository
public int getNbDeletedObjects()
getNbDeletedObjects
in interface Repository
public int getNbBadDeletedObjects()
getNbBadDeletedObjects
in interface Repository
public int getNbLoadedObjects()
getNbLoadedObjects
in interface Repository
public void init(Transaction transaction, File dir) throws IOException
init
in interface Repository
IOException
public String[] list(String prefix) throws IOException
list
in interface Repository
IOException
public void save(String dirName, String name, byte[] content) throws IOException
save
in interface Repository
IOException
public byte[] load(String dirName, String name) throws IOException
load
in interface Repository
IOException
public void delete(String dirName, String name) throws IOException
delete
in interface Repository
IOException
private final void deleteDir(File dir)
public void commit() throws IOException
commit
in interface Repository
IOException
public void close() throws IOException
close
in interface Repository
IOException
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.