XML handling by Deploy
The deploy program needs to create a settings file in the xml
fileformat for each application.
The creation of these files involves manipulating xml
datastructures, creating new xml
instances based on previous ones and saving the result to a file.
The XMLTree
class (under dk.netarkivet.common.utils
) did not support this functionality, and it would require a major structural change in the class to meet our demands.
A new class (dk.netarkivet.deploy.XmlStructure
) was therefore implemented to meet our requirements for handling the xml
datastructure.
This class uses the com.dom4j
structure for handling the xml
datastructure.
The dk.netarkivet.deploy.XmlStructure
class has the ability to inherit and overwrite, which is used in the deploy configuration structure.
The abilty to inherit is implemented as creating a new instance identical to a current instance, thus inheritance can only occur during creation of a new instance of this class.
The overwrite function merges the current !XmlStructure with a new tree.
This means that the leafs which are present in both new tree and the current one, the value in the current leaf will be overwritten by the leaf on the new tree.
Branches which only exists in the new tree will be appended to the current tree.
The branches in both trees are then recursively overwritten
Â