private long persist(File f, ObjectName name) { long deployed = f.lastModified(); try { Element e = (Element) server.getAttribute(name, "Persist"); if (e != null) { XMLOutputter out = new XMLOutputter(Format.getPrettyFormat()); Document doc = new Document(); e.detach(); doc.setRootElement(e); File tmp = new File(f.getAbsolutePath() + ".tmp"); FileWriter writer = new FileWriter(tmp); out.output(doc, writer); writer.close(); f.delete(); tmp.renameTo(f); deployed = f.lastModified(); } } catch (Exception ex) { log.warn("persist", ex); } return deployed; }
private void deleteFile(File f, String iuuid) { f.delete(); getLog() .info(String.format("Deleted transient descriptor %s (%s)", f.getAbsolutePath(), iuuid)); }