We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

AttributeDescriptionRequired
fromfileThe source file containing the original configuration.No. Patching destinations can also be updated by manual definition using nested <entry> elements. If specified, fromfile must exist.
tofileThe file to patch to.

Exactly one of these is required.

Similar to the Ant copy task, fromfile can be used with tofile or todir. Nested <fileset> elements can be used with todir, but not with tofile, since the use of <fileset> implies a bulk patching operation. Neither tofile nor todir have to exist, but an error will occur if they cannot be created, or if create is set to false.

todirThe directory to patch to.
targetfileAn alternative file to write the patched configuration to.No. When specified, tofile itself is not modified. Cannot be used when nested <fileset>s are specified (since it makes no sense).
preservelastmodifiedGive the new configuration file(s) the same last-modified time as the original source file(s).No; defaults to false.
overwriteAllow existing destination files to be overwritten.No; defaults to falsetrue. If If overwrite and create are both set to false, an error occurs.
createAllow destination files to be created where they don't already exist.No; defaults to true. If overwrite and create are both set to false, an error occurs.
cleanupDeletes original configuration file(s) after new patched file(s) is/are successfully written. If any destination or target file could not be processed or written for any reason, the original file is never deleted, even if this is set to true.No; defaults to false.
failonerrorIf false, the listener will try to continue processing remaining actions even when errors in reading, processing, or writing files occur. Instead of immediately failing, a warning message is written to the log.No; defaults to true.
enablemultiplemappingsIf true the task will process to all the mappings for a given source path. If false the task will only process the first file or directory. This attribute is only relevant if there is a mapper subelement.No; defaults to false.
conditionSpecifies the name of an IzPack installer condition that must be fulfilled before the configuration is executed.No.
keepOldKeys (ini4j)Whether to generally preserve entries with the same name (but not necessarily the same value) from the source configuration file, if they can be found.

If keepOldKeys="true" and the entry occurs in the old configuration and also in the new configuration, the new configuration entry is left and the value is set according to keepOldValues. Otherwise, if the configuration entry found in an old configuration is not found in a new configuration, the old configuration entry and value is merged into the new configuration. Manual <entry> definitions will override the old value of a preserved key entry.
No; defaults to true.
keepOldValues (ini4j)Whether to preserve the values of equal entries from an old configuration, if they can be found.

Set false to overwrite old configuration values by default with the new ones, regardless whether they have been already set in an old configuration. Values from an old configuration can only be preserved, if the appropriate entries exist in an old configuration. Manual <entry> definitions will override the old value of a key entry even when keepOldValues is true. 
No; defaults to true.
escape (ini4j)Whether to parse the following sequences as escape characters (and write them accordingly to the target file) when they appear in a parsed configuration file:
  • \\ (escape character)
  • \t (tab)
  • \n (new line)
  • \f (form feed for printers)
  • \b (backspace)
  • \r (line feed)
No; defaults to true.
escapeNewLine (ini4j)When true, lines are concatenated as far as the last character before the line break backslash ('\'). In this case the trailing line break is omitted, interpreting several lines ending on '\' as a single "long" line.No; defaults to true.
headerComment (ini4j)Allows header comments in the file. If this is true, the comment before the first entry is treated as the global header comment for the whole file, not logically assigning this comment to the first option itself. The header comment might be internally overwritten separately, and is separated using a newlineNo; defaults to false.
emptyLines (ini4j)Preserves empty lines. If false, empty lines in configuration files are discarded when saving the file.No; defaults to true.
operator (ini4j)

Set this option to override the default operator key-value assignment operator.

When a file is parsed, the first occurrence of the = or : character is respected as being the operator between a key and its value; but the target file is always saved using = with a leading and trailing space character, i.e. " = ". This works fine for 'standard' Windows INI files. This attribute overrides the operator to use when writing  non-standard target files, e.g. for preserving : as the operator, or to explicitly set the string "=" (i.e. no leading/trailing whitespaces).

No; defaults to " = ". A string of one or more character is acceptable.
resolveExpressions (ini4j)Whether ini4j expressions should be resolved when a configuration is being patched. This is not the same as substituting IzPack variables, but resolves references to configuration entries in the same configuration file. See [ini4j] - Expression handling. 

...

The same principle applies to an assignment or calculation operation (i.e. =+-), so that a specific value (or values) could be replaced or modified. Where a match is found in this case, the matched value(s) are replaced/modified by the specified default value for the <entry>. Where no matching key is found, the specified value (or default, when specified) is inserted into the property file. In this way, the 'normal' set, increment, and decrement operations can be performed as expected. See the Examples section for sample config.

Parameters 

AttributeDescriptionRequired
keyThe property key to deal with. If this ends with a dot ., the key is automatically assumed to be an auto-numbered value, e.g. key = "key." would match a collection of keys "key.0", "key.1", etc. The operation below would apply on each of those keys.Yes.
value

The new value to set the property key to.
OR:
A match string to lookup a property with the specified key by its value, and thus select it for modification (see Lookup-by-value).

Yes, if operation="set" and default is not specified; optional otherwise.

Defaults to "1" for numeric data types, and to "" for the string type (i.e. the empty string), only for increment/decrement operations. 

default

A fallback value to set the property key to if no other definition can be found, i.e. if parameter value is not specified, or if the key is not already defined in the property file.
OR:
The new value for the target property/properties when using the lookup-by-value feature. 

Yes, if operation="set" and value is not specified; optional otherwise. When dataType="date", the keyword "now" is allowed.

Where no previous value is defined, defaults to "now" for the date type, and to "0" for the int type, only for increment/decrement operations. 

dataTypeInstructs that entry values be treated as a certain data type during processing. Support currently exists for treating a property value as a date or an integer, instead of as a plain string. Can be used with the pattern parameter to define string parsing and output formatting, and/or with the operation parameter to perform basic calculations.No; defaults to "string". Can also be set to "int" or "date".
operation

Overrides global patching behavior for specific entries, or allows basic calculations for numeric data types (i.e. int and date). When this attribute is omitted, the specified entry will be set to the specified value or default

Entries can be removed from the property file by specifying operation="remove". The entry is removed even if keepOldValues is true. Using operation="keep" preserves the original value of a key when using a fromfile, even if keepOldKeys is false. These operations are valid for all data types, and the parameters value/default do not have to be set. Where value is specified, only keys with matching values are subject to the operation (see Lookup-by-value).

Specifying operation="+" performs an increment operation on numeric data types, or an append operation on the string type. For numeric types, a decrement operation can also be performed, where the value is deducted from the original value of a key (or the specified default, where no original value exists). Use parameter unit to define the scope of increment/decrement on the date type.

No; defaults to "=". Valid values for all data types are "=" (set), "+" (increment/append), "remove", "keep". For numeric data types, the value "-" (decrement) is also valid.
lookupType

The lookup type to use when it is intended that the key/value property (or properties) should be selected for modification according to their value. The match string should be specified in the value parameter, and (for set, increment, and delete operations) the new value should be specified in the default parameter.

Supported lookup types are plain string comparison (case-sensitive) and Java-style regular expression.

No; defaults to "plain". Valid values are "plain""regexp".
unitDefines the date component to modify when dataType="date" and operation is "+" or "-".

No; defaults to "day". Can only be specified when dataType="date". Valid values are "millisecond", "second", "minute", "hour", "day", "week", "month""year".

patternFor numeric data types, a string formatting pattern can be specified using conventional Java formatting placeholders. This defines both the input parsing and output formatting pattern for this entry. See javadoc for DecimalFormat (applies to int) and SimpleDateFormat (applies to date).

No. The default pattern for date is "yyyy/MM/dd HH:mm".

...