Class Settings
 The settings of an ACDP WR database are stored in the layout file
 which is identical to the main file passed as first argument to
 the Database.open(java.nio.file.Path, int, boolean, acdp.design.ICipherFactory) and CustomDatabase.open(Path, int, boolean, ICipherFactory, int, CustomTable...) methods.
 The settings can also be obtained by a call to the Database.info()
 method, however, this requires the database to be opened and the settings
 can't be modified that way.
 On the other hand, the meaning of a particular setting may be better
 explained in the method descriptions of the Information.DatabaseInfo, Information.TableInfo, Information.WRStoreInfo and Information.ColumnInfo interfaces rather
 than in the method descriptions of this class.
 
 Editing the layout file manually or with the help of the Layout
 class carries the risk of corrupting the layout file and can even lead to
 data integrity being destroyed.
 This class allows you to safely modify some settings without corrupting the
 layout file and without the risk of harming data integrity.
 The modifications take effect as soon as the database is opened.
 
 Don't forget to invoke the save() method to save your modifications
 to the layout file.
 
You may want to apply method chaining like this:
 new Settings(Paths.get("layoutFile")).setVersion("7.0").setConsistencyNumber(4).save();
 
 The methods of this class assume that the layout file is such that the
 database can be opened without throwing an exception.
 
 Check the Refactor class in case you miss a method.
- Author:
- Beat Hörmann
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal StringReturns the cipher challenge, if any is specified in the layout.final String[]getColumnNames(String tableName) Returns the names of the columns of the specified table.final intReturns the consistency number.final StringgetFlDataFile(String tableName) Returns the path (including the file name) of the specified table's FL data file.final booleanIndicates whether "force write on commit" is turned on or off.final StringgetName()Returns the name of the database.final intgetNobsOutrowPtr(String tableName) Returns the number of bytes required for referencing any outrow data in the specified table.final intgetNobsRefCount(String tableName) Returns the number of bytes used by the reference counter in the header of a row in the specified table.final intgetNobsRowRef(String tableName) Returns the number of bytes required for referencing a row in the specified table.final StringReturns the path (including the file name) of the database's recorder file.final StringgetRefdTable(String tableName, String columnName) Returns the name of the table referenced by the specified column, provided that the column is ofRefTypeorArrayOfRefType.final String[]Returns the names of the tables in the database.final StringgetTypeDesc(String tableName, String columnName) Returns the type descriptor of the specified column.final StringgetTypeFactoryClassName(String tableName, String columnName) Returns the type factory class name of the specified column, if any is specified in the column layout.final StringgetTypeFactoryClasspath(String tableName, String columnName) Returns the extra classpath of the specified column's type factory, if any is specified in the column layout.final StringReturns the version of the database, if any is specified in the layout.final StringgetVlDataFile(String tableName) Returns the path (including the file name) of the specified table's VL data file, provided that the path is specified in the table layout.final Settingssave()Saves the settings.final SettingssetColumnName(String tableName, String columnName, String value) Sets the name of the specified column to the specified new value.final SettingssetConsistencyNumber(int value) Sets the consistency number to the specified value.final SettingssetFlDataFile(String tableName, String value) Sets the path (including the file name) of the specified table's FL data file to the specified value.final SettingssetForceWriteCommit(boolean value) Sets the value of the "force write on commit" database property.final SettingsSets the name of the database to the specified value.final SettingssetRecFile(String value) Sets the path (including the file name) of the database's recorder file to the specified value.final SettingssetTableName(String tableName, String value) Sets the name of the specified table to the specified new value.final SettingssetTypeFactoryClasspath(String tableName, String columnName, String value) Sets the extra classpath of the specified column's type factory to the specified value.final SettingssetVersion(String value) Sets the version of the database to the specified value.final SettingssetVlDataFile(String tableName, String value) Sets the path (including the file name) of the specified table's VL data file to the specified value, provided that the path is specified in the table layout.
- 
Constructor Details- 
SettingsCreates a database settings object based on the layout saved in the specified file.- Parameters:
- layoutFile- The layout file.
- Throws:
- NullPointerException- If- layoutFileis- null.
- IOFailureException- If the specified file does not exist or if another I/O error occurs.
 
 
- 
- 
Method Details- 
getNameReturns the name of the database.- Returns:
- The name of the database.
 
- 
setNameSets the name of the database to the specified value.- Parameters:
- value- The new name of the database, not allowed to be- nulland not allowed to be an empty string.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If- valueis- nullor an empty string.
 
- 
getVersionReturns the version of the database, if any is specified in the layout.- Returns:
- The version of the database or nullif this database has no version.
 
- 
setVersionSets the version of the database to the specified value.If the layout already contains a version number and the specified value is nullor an empty string then the version field is removed from the layout.- Parameters:
- value- The version of the database.
- Returns:
- This object.
 
- 
getConsistencyNumberpublic final int getConsistencyNumber()Returns the consistency number.- Returns:
- The consistency number.
 
- 
setConsistencyNumberSets the consistency number to the specified value.- Parameters:
- value- The new consistency number.
- Returns:
- This object.
 
- 
getCipherChallengeReturns the cipher challenge, if any is specified in the layout.- Returns:
- The cipher challenge, or nullif no cipher challenge is specified in the layout.
 
- 
getForceWriteCommitpublic final boolean getForceWriteCommit()Indicates whether "force write on commit" is turned on or off.Consult the chapter "Durability" of the Databaseinterface description to learn more about this database property.- Returns:
- The boolean value trueif and only if "force write on commit" is turned on.
 
- 
setForceWriteCommitSets the value of the "force write on commit" database property.Consult the chapter "Durability" of the Databaseinterface description to learn more about this database property.- Parameters:
- value- The new value of "force write on commit".
- Returns:
- This object.
 
- 
getRecFileReturns the path (including the file name) of the database's recorder file.- Returns:
- The path (including the file name) of the recorder file.
 
- 
setRecFileSets the path (including the file name) of the database's recorder file to the specified value.Note that this method does not check whether the specified value is a valid path and whether the recorder file actually exists. Opening the database will throw an exception if the specified value is not a valid path or if the recorder file does not exist. - Parameters:
- value- The new path (including the file name) of the recorder file, not allowed to be- nullor an empty string.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If- valueis- nullor an empty string.
 
- 
getTableNamesReturns the names of the tables in the database.The order of the returned array is identical to the order in which the tables appear in the layout. - Returns:
- The names of the database's table, never null.
 
- 
setTableNameSets the name of the specified table to the specified new value.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- value- The new name of the table, not allowed to be- nullor an empty string and not allowed to start with the number sign ('#') character.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with a name equal to the- tableNameargument or if the- valueargument starts with the number sign ('#') character or if a table with a name equal to the- valueargument already exists.
 
- 
getNobsRowRefReturns the number of bytes required for referencing a row in the specified table.See the description of the Setup Tool for further information about the nobsRowRef,nobsOutrowPtrandnobsRefCountproperties.This value can be changed by invoking the Refactor.nobsRowRef(java.nio.file.Path, java.lang.String, int)method.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The value of the nobsRowReftable property.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with such a name.
 
- 
getNobsOutrowPtrReturns the number of bytes required for referencing any outrow data in the specified table.See the description of the Setup Tool for further information about the nobsRowRef,nobsOutrowPtrandnobsRefCountproperties.This value can be changed by invoking the Refactor.nobsOutrowPtr(java.nio.file.Path, java.lang.String, int)method.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The value of the nobsOutrowPtrtable property. If the table has no such property then this value is zero.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with such a name.
 
- 
getNobsRefCountReturns the number of bytes used by the reference counter in the header of a row in the specified table.See the description of the Setup Tool for further information about the nobsRowRef,nobsOutrowPtrandnobsRefCountproperties.This value can be changed by invoking the Refactor.nobsRefCount(java.nio.file.Path, java.lang.String, int)method.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The value of the nobsRefCounttable property. If the table has no such property then this value is zero.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with such a name.
 
- 
getFlDataFileReturns the path (including the file name) of the specified table's FL data file.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The path (including the file name) of the FL data file.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with such a name.
 
- 
setFlDataFileSets the path (including the file name) of the specified table's FL data file to the specified value.Note that this method does not check whether the specified value is a valid path and whether the FL data file actually exists. Opening the database will throw an exception if the specified value is not a valid path or if the FL data file does not exist. - Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- value- The new path (including the file name) of the table's FL data file, not allowed to be- nullor an empty string.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name.
 
- 
getVlDataFileReturns the path (including the file name) of the specified table's VL data file, provided that the path is specified in the table layout.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The path (including the file name) of the VL data file or nullif no such path is specified in the table layout.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with the specified name.
 
- 
setVlDataFileSets the path (including the file name) of the specified table's VL data file to the specified value, provided that the path is specified in the table layout.Note that this method does not check whether the specified value is a valid path and whether the VL data file actually exists. Opening the database will throw an exception if the specified value is not a valid path or if the VL data file does not exist. - Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- value- The new path (including the file name) of the table's VL data file, not allowed to be- nullor an empty string.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table layout does not contain such a path.
 
- 
getColumnNamesReturns the names of the columns of the specified table.The order of the returned array is identical to the order in which the columns appear in the table layout. - Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- Returns:
- The names of the table's columns, never null.
- Throws:
- IllegalArgumentException- If- tableNameis- nullor an empty string or if the database has no table with such a name.
 
- 
setColumnNamepublic final Settings setColumnName(String tableName, String columnName, String value) throws IllegalArgumentException Sets the name of the specified column to the specified new value.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- value- The new name of the column, not allowed to be- nullor an empty string.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name or if the table already has a column with a name equal to the- valueargument.
 
- 
getTypeDescpublic final String getTypeDesc(String tableName, String columnName) throws IllegalArgumentException Returns the type descriptor of the specified column.Invoke the Refactor.modifyColumn(java.nio.file.Path, acdp.design.ICipherFactory, java.lang.String, java.lang.String, acdp.Column<T>, acdp.Table.ValueSwitcher<T>)method to change the type of a column.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- Returns:
- The column's type descriptor.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name.
 
- 
getTypeFactoryClassNamepublic final String getTypeFactoryClassName(String tableName, String columnName) throws IllegalArgumentException Returns the type factory class name of the specified column, if any is specified in the column layout.Invoke the Refactor.modifyColumn(java.nio.file.Path, acdp.design.ICipherFactory, java.lang.String, java.lang.String, acdp.Column<T>, acdp.Table.ValueSwitcher<T>)method to change the type of a column.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- Returns:
- The column's type factory class name or nullif no type factory class name is specified in the column layout.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name.
 
- 
getTypeFactoryClasspathpublic final String getTypeFactoryClasspath(String tableName, String columnName) throws IllegalArgumentException Returns the extra classpath of the specified column's type factory, if any is specified in the column layout.Invoke the Refactor.modifyColumn(java.nio.file.Path, acdp.design.ICipherFactory, java.lang.String, java.lang.String, acdp.Column<T>, acdp.Table.ValueSwitcher<T>)method to change the type of a column.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- Returns:
- The extra classpath of the column's type factory or nullif no extra type factory classpath is specified in the column layout.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name.
 
- 
setTypeFactoryClasspathpublic final Settings setTypeFactoryClasspath(String tableName, String columnName, String value) throws IllegalArgumentException Sets the extra classpath of the specified column's type factory to the specified value.If the column layout already contains an extra type factory classpath and the specified value is nullor an empty string then the extra type factory classpath is removed from the column layout.Note that this method does not check whether the specified value is a valid path and whether the path actually exists. Opening the database will throw an exception if the specified value is illegal. Invoke the Refactor.modifyColumn(java.nio.file.Path, acdp.design.ICipherFactory, java.lang.String, java.lang.String, acdp.Column<T>, acdp.Table.ValueSwitcher<T>)method to change the type of a column.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- value- The extra classpath of the column's type factory.
- Returns:
- This object.
- Throws:
- IllegalArgumentException- If- tableNameor- columnNameis- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name.
 
- 
getRefdTablepublic final String getRefdTable(String tableName, String columnName) throws IllegalArgumentException Returns the name of the table referenced by the specified column, provided that the column is ofRefTypeorArrayOfRefType.- Parameters:
- tableName- The name of the table, not allowed to be- nullor an empty string.
- columnName- The name of the column, not allowed to be- nullor an empty string.
- Returns:
- The name of the referenced table or nullif the column is neither ofRefTypenorArrayOfRefType.
- Throws:
- IllegalArgumentException- If one of the arguments is- nullor an empty string or if the database has no table with the specified name or if the table has no column with the specified name.
 
- 
saveSaves the settings.- Returns:
- This object.
- Throws:
- IOFailureException- If an I/O error occurs.
 
 
-