public void saveXml(XmlFile inFile, User inUser, Lock lock) throws OpenEditException {

    // Lock lock = getLockManager().lock("system", inFile.getPath(), null ); //this will retry 10
    // times then timeout and throw an exception

    Page page = getPageManager().getPage(inFile.getPath(), false);

    ContentItem tmp = getPageManager().getRepository().getStub(inFile.getPath() + ".tmp.xml");
    tmp.setMakeVersion(false);
    getXmlUtil().saveXml(inFile.getRoot(), tmp.getOutputStream(), page.getCharacterEncoding());

    ContentItem xmlcontent = getPageManager().getRepository().getStub(inFile.getPath());
    xmlcontent.setMakeVersion(false);
    getPageManager()
        .getRepository()
        .remove(xmlcontent); // might be a little faster to remove it first
    getPageManager().getRepository().move(tmp, xmlcontent);
    getPageManager().firePageModified(page);

    xmlcontent = getPageManager().getRepository().getStub(inFile.getPath());
    inFile.setLastModified(xmlcontent.getLastModified());
    inFile.setExist(true);
    // log.info("Save " + inFile.getPath());

  }
  public void saveXml(XmlFile inFile, User inUser) throws OpenEditException {

    Lock lock =
        getLockManager()
            .lock(
                "system",
                inFile.getPath(),
                null); // this will retry 10 times then timeout and throw an exception
    try {
      saveXml(inFile, inUser, lock);
      // log.info("Save " + inFile.getPath());
    } finally {

      getLockManager().release("system", lock);
    }
  }
 public void deleteXmlFile(XmlFile inSettings) throws OpenEditException {
   Page page = getPageManager().getPage(inSettings.getPath(), true);
   page.getContentItem().setMakeVersion(false);
   getPageManager().removePage(page);
 }