protected String marshallAdvisory(final DataStructure ds, String transformation) {

    StringWriter buffer = new StringWriter();
    HierarchicalStreamWriter out;
    if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
      out = new JettisonMappedXmlDriver().createWriter(buffer);
    } else {
      out = new PrettyPrintWriter(buffer);
    }

    XStream xstream = getXStream();
    xstream.setMode(XStream.NO_REFERENCES);
    xstream.aliasPackage("", "org.apache.activemq.command");
    xstream.marshal(ds, out);
    return buffer.toString();
  }
 /**
  * Return an Advisory message as a JSON formatted string
  *
  * @param ds the DataStructure instance that is being marshaled.
  * @return the JSON marshaled form of the given DataStructure instance.
  */
 protected String marshallAdvisory(final DataStructure ds) {
   XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
   xstream.setMode(XStream.NO_REFERENCES);
   xstream.aliasPackage("", "org.apache.activemq.command");
   return xstream.toXML(ds);
 }