Package acdp.tools

Class ROToWR

java.lang.Object
acdp.tools.ROToWR

public final class ROToWR extends Object
Given an RO database and an optional layout file that is "compatible" with the RO database, this class creates a WR database based on the layout file and copies the content of the RO database to the newly created WR database. If no layout file is provided then the layout of the WR database will be derived from the layout of the RO database, with some fields set to estimated values.
Author:
Beat Hörmann
  • Method Details

    • run

      public static final void run(Path roDbFilePath, Path wrDbDirPath, Path layoutFile, ICipherFactory cf) throws NullPointerException, IOFailureException, CreationException
      Creates a WR database and copies all rows from all tables of the specified RO database to the newly created WR database. The newly created WR datastore is stored in the directory with a path equal to the wrDbDirPath argument and has a layout file with a name equal to "layout". If the layoutFile argument is not null then the WR database is created according to the layout saved in the layout file. Otherwise, the WR database layout will be derived from the RO database layout, with some fields set to estimated values ​​that you may want to adjust later. (See the corresponding subsection in the description of the Setup Tool.)

      Note that existing references to rows of a particular table of the RO database are valid in the created WR database.

      If the specified layout file does not contain a valid layout for a WR database or does not reflect the structure of the RO database then this method may throw an exception that is different from the listed exceptions.

      Parameters:
      roDbFilePath - The path of the RO database file; not allowed to be null.
      wrDbDirPath - The directory where to store the resulting WR database; not allowed to be null and must exist. The directory is not allowed to contain a file with a name equal to "layout" nor any files with names equal to the names of any backing files of the WR database to be created. The directory will be created if it does not exist.
      layoutFile - The layout file of the WR database to be created or null. This is typically the layout file of the WR database used to create the RO database. If the layout file is contained in the directory pointed to by the wrDbDirPath argument and its name is equal to "layout" then this layout file will be the layout file of the WR database to be created. If the value is null then the layout will be derived from the layout of the RO database. See the method description for more information.
      cf - The cipher factory or null. The cipher factory is used for reading the RO database as well as for writing the WR database.
      Throws:
      NullPointerException - If roDbFilePath or wrDbDirPath are null.
      IOFailureException - If the directory pointed to by the wrDbDirPath argument already contains a file with the name "layout" which is not equal to the specified layout file or if at least one of the backing files of the WR database to be created already exists or if another I/O error occurs.
      CreationException - If the RO database can't be opened due to any reason including the content of the roDbFilePath file not being an RO database or problems regarding encryption.