Class ACDP
- Author:
- Beat Hörmann
-
Method Summary
Modifier and TypeMethodDescriptionstatic final void
createDBFiles
(Path layoutFile) Creates the backing files of the WR database described by the layout contained in the specified layout file.static final void
deleteDBFiles
(Path layoutFile, boolean deleteLayoutFile) Deletes the backing files of the specified WR database and optionally deletes the layout file too, thus completely removing the database.static final boolean
Checks the integrity of the specified WR database by checking the integrity of the table data for each table of the database, and, provided that thefix
argument is set totrue
, makes an attempt to fix any detected integrity violations that have an automatic fix.
-
Method Details
-
verify
Checks the integrity of the specified WR database by checking the integrity of the table data for each table of the database, and, provided that thefix
argument is set totrue
, makes an attempt to fix any detected integrity violations that have an automatic fix.Each table is subjected to a series of tests each test checking a specific aspect of the table's integrity. If a test detects an integrity violation then this method returns
false
, and, provided that thereport
argument is set totrue
, sends a suitable message to the standard output stream. If thefix
argument is set totrue
then the test starts an attempt to fix the issue, provided that the test has an automatic fix.A test either completes or aborts. If a test aborts then some table data could not be verified.
A test completes successfully if and only if the test either did not detect an integrity violation or if the test was able to resolve a detected integrity violation.
If all tests for all tables in the database are successfully completed then this method returns
true
, and, provided that thereport
argument is set totrue
, sends one of the following messages to the standard output stream:Completed - No violations detected.
orCompleted - n violations detected, n fixed.
wheren
denotes the number of detected integrity violations.If you plan to invoke this method with the
fix
argument set totrue
then you may want to backup the database before executing this method. No changes are made to the database if thefix
argument is equal tofalse
.Note that this method fails if the database is not a WR database or if the database is currently open. In general, this method throws an exception if and only if the prerequisites for checking the integrity of the database are not met.
Note also that if the specified file does not contain a valid layout for a WR database then this method may throw an exception that is different from the listed exceptions.
- Parameters:
layoutFile
- The WR database layout file, not allowed to benull
.fix
- The information whether an attempt should be made to fix any detected integrity violations.report
- The information whether a result report should be sent to the standard output stream. If set totrue
then this method sends a result report to the standard output stream.- Returns:
- The boolean value
true
if and only if all tests successfully terminated, that is, none of the tests was aborted and no integrity violation was detected or thefix
argument is set totrue
and all detected integrity violations could be fixed. - Throws:
UnsupportedOperationException
- If the database is an RO database.NullPointerException
- IflayoutFile
isnull
.OverlappingFileLockException
- If the WR database is currently open.CreationException
- If the database can't be opened due to any other reason.
-
createDBFiles
public static final void createDBFiles(Path layoutFile) throws NullPointerException, IOFailureException Creates the backing files of the WR database described by the layout contained in the specified layout file.If the specified file does not contain a valid layout for a WR database then this method may throw an exception that is different from the listed exceptions.
- Parameters:
layoutFile
- The WR database layout file, not allowed to benull
.- Throws:
NullPointerException
- IflayoutFile
isnull
.IOFailureException
- If the layout file does not exist or if at least one of the backing files already exists or if another I/O error occurs.
-
deleteDBFiles
public static final void deleteDBFiles(Path layoutFile, boolean deleteLayoutFile) throws UnsupportedOperationException, NullPointerException, OverlappingFileLockException, CreationException, IOFailureException Deletes the backing files of the specified WR database and optionally deletes the layout file too, thus completely removing the database.This method fails if the database is not a WR database or if the database is currently open.
If the specified file does not contain a valid layout for a WR database then this method may throw an exception that is different from the listed exceptions.
Note that emptying the database can be achieved by executing
ACDP.deleteDBFiles(layoutFile, false); ACDP.createDBFiles(layoutFile);
wherelayoutFile
denotes the path to the layout file of the WR database (file name included).- Parameters:
layoutFile
- The WR database layout file, not allowed to benull
.deleteLayoutFile
- The information whether the specified layout file should be deleted or not. If set totrue
then this method deletes the specified layout file.- Throws:
UnsupportedOperationException
- If the database is an RO database.NullPointerException
- IflayoutFile
isnull
.OverlappingFileLockException
- If the WR database is currently open.CreationException
- If the database can't be opened due to any other reason.IOFailureException
- If the layout file does not exist or if at least one of the backing files does not exist or if another I/O error occurs.
-