Example #1
0
  public void deployElement(Element e, String fileName, boolean encrypt, boolean isTransient)
      throws ISOException, IOException, GeneralSecurityException {
    e = ((Element) e.clone());

    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
    Document doc = new Document();
    doc.setRootElement(e);
    File qbean = new File(deployDir, fileName);
    if (isTransient) {
      e.setAttribute("instance", getInstanceId().toString());
      qbean.deleteOnExit();
    }
    FileWriter writer = new FileWriter(qbean);
    if (encrypt) doc = encrypt(doc);
    out.output(doc, writer);
    writer.close();
  }