Class LegacyXmlExporter

java.lang.Object
legacyxml.LegacyXmlExporter

public final class LegacyXmlExporter extends Object
Rewrites a JMT XML file (any tool that stores classPath attributes: .jsimg, .jsimw, simulation input) between XmlFormats. Command line: java -cp jmt-legacy-xml.jar legacyxml.LegacyXmlExporter in.jsimg out.jsimg [version] where version defaults to 1.4.0.
  • Method Details

    • export

      public static void export(File in, File out, XmlFormat target) throws Exception
      Reads in (any format), writes out in target format.
      Throws:
      Exception
    • convert

      public static void convert(Document doc, XmlFormat target)
      Rewrites every classPath attribute of the document in place. For XmlFormat.V1_4_0 the jmtVersion root attribute is also removed (older schemas reject unknown attributes) and its value is kept in a leading comment.
    • convertClassName

      public static String convertClassName(String name, XmlFormat target)
      Maps one class name to the requested format; names it does not recognise (java.*, already converted) are returned as is.
    • legacyFileFor

      public static File legacyFileFor(File current)
      File the legacy copy of current is written to: model.jsimg becomes model.legacy.jsimg.
    • saveLegacyCopy

      public static File saveLegacyCopy(Document current, File currentFile)
      Writes the XmlFormat.V1_4_0 copy of a document that was just saved as currentFile. Works on a copy, so current keeps the current format. Never throws: the legacy copy is a courtesy and must not fail the real save.
      Returns:
      the legacy file, or null if it could not be written
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception