public final class DBRepository extends Object implements Repository
NTransaction
,
Repository
Modifier and Type | Field and Description |
---|---|
private int |
baddeleted |
(package private) Connection |
conn |
(package private) String |
connurl |
(package private) PreparedStatement |
deleteStmt |
(package private) File |
dir |
(package private) String |
driver |
(package private) PreparedStatement |
insertStmt |
private int |
nbdeleted |
private int |
nbloaded |
private int |
nbsaved |
(package private) PreparedStatement |
updateStmt |
Constructor and Description |
---|
DBRepository() |
Modifier and Type | Method and Description |
---|---|
void |
backup(BackupFile backup)
Backups the repository (may be unimplemented).
|
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.
|
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.
|
String driver
String connurl
File dir
private int nbsaved
private int nbdeleted
private int baddeleted
private int nbloaded
Connection conn
PreparedStatement insertStmt
PreparedStatement updateStmt
PreparedStatement deleteStmt
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
transaction
- the transaction object.dir
- the directory.IOException
- an error occurs.public String[] list(String prefix) throws IOException
list
in interface Repository
prefix
- the prefix.IOException
- an error occurs.public void save(String dirName, String name, byte[] content) throws IOException
save
in interface Repository
dirName
- the directory.name
- the object name.content
- the serialized object view.IOException
- an error occurs.public byte[] load(String dirName, String name) throws IOException
load
in interface Repository
dirName
- the directory.name
- the object name.IOException
- an error occurs.public void delete(String dirName, String name) throws IOException
delete
in interface Repository
dirName
- the directory.name
- the object name.IOException
- an error occurs.public void commit() throws IOException
commit
in interface Repository
IOException
- an error occurs.public void backup(BackupFile backup) throws IOException
Repository
backup
in interface Repository
backup
- The backup file.IOException
public void close() throws IOException
close
in interface Repository
IOException
- an error occurs.Copyright © 2023 ScalAgent D.T.. All rights reserved.