/** * Edits the container's configuration so that the file's XML element specified by the XPath * parameter contains the given XML attributes * * Uses {@link XmlReplacement} instances to add XML attributes to the specified XML node without * actively updating the original XML file. * * This function is used to edit the system properties that need to be placed in the server.xml * file. Adding these replacement XML pieces to the container's configuration allows the * configuration to modify the server.xml file only when creating the standalone container * configuration. This means that the server.xml file located in the installation's 'conf' folder * remains static, which resolves possible concurrency issues that might arise if more than one * container is modifying the server.xml file. * * @param file The path to the XML file that will be edited * @param XPath The path within XML file that leads to the node that should be changed * @param attributes The attributes to add to the node */ private void writePropertiesToConfig(StandaloneLocalConfiguration config, String file, String XPath, HashMap<String, String> attributes) { for (String key : attributes.keySet()) { XmlReplacement property = new XmlReplacement(); property.setFile(file); property.setXpathExpression(XPath); property.setAttributeName(key); property.setValue(attributes.get(key)); config.addXmlReplacement(property); } }