/** * @param chkKeys List of String objects with the shas * @param targetFile target file * @return true if write was successful */ public static boolean writeRequestFile( final FileRequestFileContent content, final File targetFile) { final Document doc = XMLTools.createDomDocument(); if (doc == null) { logger.severe("Error - writeRequestFile: factory could'nt create XML Document."); return false; } final Element rootElement = doc.createElement(TAG_FrostFileRequestFile); doc.appendChild(rootElement); final Element timeStampElement = doc.createElement(TAG_timestamp); final Text timeStampText = doc.createTextNode(Long.toString(content.getTimestamp())); timeStampElement.appendChild(timeStampText); rootElement.appendChild(timeStampElement); final Element rootChkElement = doc.createElement(TAG_shaList); rootElement.appendChild(rootChkElement); for (final String chkKey : content.getShaStrings()) { final Element nameElement = doc.createElement(TAG_sha); final Text text = doc.createTextNode(chkKey); nameElement.appendChild(text); rootChkElement.appendChild(nameElement); } boolean writeOK = false; try { writeOK = XMLTools.writeXmlFile(doc, targetFile); } catch (final Throwable t) { logger.log(Level.SEVERE, "Exception in writeRequestFile/writeXmlFile", t); } return writeOK; }