You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2022/08/11 20:52:43 UTC

[GitHub] [daffodil-vscode] michael-hoke opened a new pull request, #253: Daffodil vscode tdml

michael-hoke opened a new pull request, #253:
URL: https://github.com/apache/daffodil-vscode/pull/253

   Closes #168 #169 #170 #171 #172 #173 
   
   There is an issue with the installed .vsix file currently. To receive updates to the backend scala server, a Run DFDL operation must be performed. I'm not sure if it has to be deleted as well. This location varies based on OS. On Linux, the path is ~/.local.share/daffodil-dap. If I find why this is in time, I'll try to fit the fix into the PR. Otherwise, I'll create an issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r970745700


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   > would only see this if they cloned the repo and were using VS Code
   
   How does that work? I don't see anything that only shows this menu for extension developers?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1081821514


##########
build.sbt:
##########
@@ -91,3 +95,85 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project

Review Comment:
   Question: I'm not sure if this needs to be a separate sbt project. Was there a particular reason why it was done this way?
   
   I can see if locally I can move this stuff into the core project.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1080711262


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   The .vscode/launch.json file is used to define runnable programs within the current VS Code project. It doesn't necessarily have anything to do with extension development or not. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien merged pull request #253: Daffodil VsCode TDML

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien merged PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963831051


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   What does this actually launch? What is DAPodil?



##########
bindings.xjb:
##########
@@ -0,0 +1,58 @@
+<jxb:bindings version="2.1"

Review Comment:
   This needs a license header.
   
   Also, is this generated? Can this just be created as part of the build process?



##########
bindings.xjb:
##########
@@ -0,0 +1,58 @@
+<jxb:bindings version="2.1"
+          xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <jxb:globalBindings>
+        <jxb:serializable uid="1" />
+    </jxb:globalBindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part3_model.xsd" version="1.0">
+        <jxb:bindings node="//xs:attributeGroup[@name='SetVariableAG']/xs:attribute[@name='value']">
+            <jxb:property name="ValueAttribute"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='simpleType']">
+            <jxb:class name="simpleTypeClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='group']">
+            <jxb:class name="groupClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='choice']">
+            <jxb:class name="choiceClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='sequence']">
+            <jxb:class name="sequenceClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='element']">
+            <jxb:class name="elementClass"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part2_attributes.xsd" version="1.0">
+        <jxb:bindings node="//xs:attributeGroup[@name='BaseAGQualified']/xs:attribute[@name='ref']">
+            <jxb:property name="RefAttribute"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part1_simpletypes.xsd" version="1.0">
+        <jxb:bindings node="//xs:simpleType[@name='ByteOrderEnum']">
+            <jxb:typesafeEnumClass name="ByteOrderEnumType"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:simpleType[@name='BitOrderEnum']">
+            <jxb:typesafeEnumClass name="BitOrderEnumType"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/dafext.xsd" version="1.0">
+        <jxb:bindings node="//xs:attribute[@name='parseUnparsePolicy']">
+            <jxb:property name="ParseUnparsePolicyExt"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+            <jxb:typesafeEnumClass name="PropertyNameTypeExt"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:complexType[@name='PropertyType']">
+            <jxb:class name="PropertyTypeClass"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/dfdlx.xsd" version="1.0">
+        <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+            <jxb:typesafeEnumClass name="PropertyNameTypeX"/>
+        </jxb:bindings>
+    </jxb:bindings>
+</jxb:bindings>

Review Comment:
   What is the decision point for what bindings get included? There seems to be very small subset of everything defined in the schemas?



##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   Is adding all these paths manually really the expected usage of this? This seems incredibly fragile and hard to maintain, especially with the verisions in the. Isn't any version change going to break this? Does the sbt xjc plugin not handle all of this?



##########
project/Rat.scala:
##########
@@ -34,7 +34,9 @@ object Rat {
     file("images/daffodil.ico"),
     // yarn and rpm generated files
     file("yarn.lock"),
-    file("package-lock.json")
+    file("package-lock.json"),
+    // JAXB Bindings files
+    file("bindings.xjb")

Review Comment:
   If a file can have a license, it should have one. An xjb file is just XML and so can have a license. This should be removed from the Rat excludes.



##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator)
+    ).mkString(java.io.File.pathSeparator),
+    Compile / xjc / sources := Seq(file("resources/xsd")),

Review Comment:
   Should these files be in the `server/sbtXjc` subproject? Though, maybe I'm not sure what the sbtXjc subproject is for? That directory doesn't actually exist?



##########
resources/xsd/xml.xsd:
##########
@@ -0,0 +1,155 @@
+<?xml version='1.0'?>
+<!--
+  Copyright © 2018 World Wide Web Consortium, (Massachusetts
+  Institute of Technology, European Research Consortium for Informatics and
+  Mathematics, Keio University, Beihang). All Rights Reserved. This work is
+  distributed under the W3C® Software License [1] in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+  [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+-->

Review Comment:
   Many of these files you've copied have different licenses. If they are going to be copied like this (which I hope there is an alternative), then you need to update the LICENSE/NOTICE files accordingly.



##########
server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala:
##########
@@ -176,71 +180,333 @@ object Parse {
         case class File(path: Path) extends InfosetOutput
       }
 
+      sealed trait TDMLConfig extends LaunchArgs
+      object TDMLConfig {
+        case class Generate(
+            schemaPath: Path,
+            dataPath: Path,
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+
+        case class Append(
+            schemaPath: Path,
+            dataPath: Path,
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+
+        case class Execute(
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+      }
+
       def parse(arguments: JsonObject): EitherNel[String, LaunchArgs] =
+        // Determine, based on the presence of the tdmlConfig object in the launch config, whether
+        //   this is a "normal" DFDL operation or if we should attempt to parse the values from
+        //   the tdmlConfig object.
+        Option(arguments.getAsJsonObject("tdmlConfig")) match {
+          case None             => parseManual(arguments)
+          case Some(tdmlConfig) => parseTDML(arguments, tdmlConfig)
+        }
+
+      // Parse a launch config that has been found to not have a tdmlConfig object
+      def parseManual(arguments: JsonObject): EitherNel[String, LaunchArgs] =
         (
-          Option(arguments.getAsJsonPrimitive("program"))
-            .toRight("missing 'program' field from launch request")
-            .flatMap(path =>
-              Either
-                .catchNonFatal(Paths.get(path.getAsString))
-                .leftMap(t => s"'program' field from launch request is not a valid path: $t")
-                .ensureOr(path => s"program file at $path doesn't exist")(_.toFile().exists())
-            )
-            .toEitherNel,
-          Option(arguments.getAsJsonPrimitive("data"))
-            .toRight("missing 'data' field from launch request")
-            .flatMap(path =>
-              Either
-                .catchNonFatal(Paths.get(path.getAsString))
-                .leftMap(t => s"'data' field from launch request is not a valid path: $t")
-                .ensureOr(path => s"data file at $path doesn't exist")(_.toFile().exists())
-            )
-            .toEitherNel,
-          Option(arguments.getAsJsonPrimitive("stopOnEntry"))
-            .map(_.getAsBoolean())
-            .getOrElse(true)
-            .asRight[String]
-            .toEitherNel,
-          Option(arguments.getAsJsonObject("infosetOutput")) match {
+          parseProgram(arguments),
+          parseData(arguments),
+          parseStopOnEntry(arguments),
+          parseInfosetOutput(arguments)
+        ).parMapN(LaunchArgs.Manual.apply)
+    }
+
+    // Parse a tdmlConfig object from the launch config
+    //
+    // tdmlConfig: {
+    //   action: '',
+    //   name: '',
+    //   description: '',
+    //   path: ''
+    // }
+    //
+    // The action field is parsed first.
+    // If it is a valid action ('generate' | 'append' | 'execute'), create a LaunchArgs object of the appropriate type
+    // If it is 'none' or missing, create a LaunchArgs.Manual object. This will ignore any other fields in the tdmlConfig object.
+    //
+    // arguments:  Launch config
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDML(arguments: JsonObject, tdmlConfig: JsonObject): EitherNel[String, LaunchArgs] =
+      Option(tdmlConfig.getAsJsonPrimitive("action")) match {
+        case None =>
+          (
+            parseProgram(arguments),
+            parseData(arguments),
+            parseStopOnEntry(arguments),
+            parseInfosetOutput(arguments)
+          ).parMapN(LaunchArgs.Manual.apply)
+        case Some(action) =>
+          action.getAsString() match {
+            case "generate" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments, true),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Generate.apply)
+            case "append" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments, true),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Append.apply)
+            case "execute" =>
+              (
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Execute.apply)
+            case "none" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments)
+              ).parMapN(LaunchArgs.Manual.apply)
+            case invalidType =>
+              Left(
+                s"invalid 'tdmlConfig.action': '$invalidType', must be 'none', 'generate', 'append', or 'execute'"
+              ).toEitherNel
+          }
+      }
+
+    // Parse the program field from the launch config
+    // Returns an error if the program field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments: Launch config
+    def parseProgram(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("program"))
+        .toRight("missing 'program' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString))
+            .leftMap(t => s"'program' field from launch request is not a valid path: $t")
+            .ensureOr(path => s"program file at $path doesn't exist")(_.toFile().exists())
+        )
+        .toEitherNel
+
+    // Parse the data field from the launch config
+    // Returns an error if the data field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments: Launch config
+    def parseData(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("data"))
+        .toRight("missing 'data' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString))
+            .leftMap(t => s"'data' field from launch request is not a valid path: $t")
+            .ensureOr(path => s"data file at $path doesn't exist")(_.toFile().exists())
+        )
+        .toEitherNel
+
+    // Parse the stopOnEntry field from the launch config
+    // Defaults to true
+    //
+    // arguments: Launch config
+    def parseStopOnEntry(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("stopOnEntry"))
+        .map(_.getAsBoolean())
+        .getOrElse(true)
+        .asRight[String]
+        .toEitherNel
+
+    // Parse the infosetOutput object from the launch config
+    //
+    // infosetOutput: {
+    //   type: '',
+    //   path: ''
+    // }
+    //
+    // Type must be 'none' | 'console' | 'file'
+    // If type is 'file', there must be a 'path' field that contains a valid path
+    //   for the resulting infoset to be written to
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments:   Launch config
+    // requireFile: Whether or not the type field must be set to file. This is a requirement
+    //              for the TDML generate operation. Returns an error if this boolean
+    //              is set to True, and the type field is set to a value other than file
+    def parseInfosetOutput(arguments: JsonObject, requireFile: Boolean = false) =
+      Option(arguments.getAsJsonObject("infosetOutput")) match {
+        case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
+        case Some(infosetOutput) =>
+          Option(infosetOutput.getAsJsonPrimitive("type")) match {
             case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-            case Some(infosetOutput) =>
-              Option(infosetOutput.getAsJsonPrimitive("type")) match {
-                case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-                case Some(typ) =>
-                  typ.getAsString() match {
-                    case "none"    => Right(LaunchArgs.InfosetOutput.None).toEitherNel
-                    case "console" => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-                    case "file" =>
-                      Option(infosetOutput.getAsJsonPrimitive("path"))
-                        .toRight("missing 'infosetOutput.path' field from launch request")
-                        .flatMap(path =>
-                          Either
-                            .catchNonFatal(LaunchArgs.InfosetOutput.File(Paths.get(path.getAsString)))
-                            .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
-                            .ensureOr(file => s"can't write to infoset output file at ${file.path}") { f =>
-                              val file = f.path.toFile
-                              file.canWrite || (!file.exists && file.getParentFile.canWrite)
-                            }
-                        )
-                        .toEitherNel
-                    case invalidType =>
-                      Left(
-                        s"invalid 'infosetOutput.type': '$invalidType', must be 'none', 'console', or 'file'"
-                      ).toEitherNel
-                  }
+            case Some(typ) =>
+              typ.getAsString() match {
+                case "none" =>
+                  if (requireFile)
+                    Left("'type' field in 'infosetOutput' must be set to 'file'").toEitherNel
+                  else
+                    Right(LaunchArgs.InfosetOutput.None).toEitherNel
+                case "console" =>
+                  if (requireFile)
+                    Left("'type' field in 'infosetOutput' must be set to 'file'").toEitherNel
+                  else
+                    Right(LaunchArgs.InfosetOutput.Console).toEitherNel
+                case "file" =>
+                  Option(infosetOutput.getAsJsonPrimitive("path"))
+                    .toRight("missing 'infosetOutput.path' field from launch request")
+                    .flatMap(path =>
+                      Either
+                        .catchNonFatal(LaunchArgs.InfosetOutput.File(Paths.get(path.getAsString)))
+                        .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
+                        .ensureOr(file => s"can't write to infoset output file at ${file.path}") { f =>
+                          val file = f.path.toFile
+                          // If an empty string is passed in, it will be set to the workspace directory by default
+                          // This is inside the Java code, so we have to make sure that the TDML file we
+                          //   are working with is not a directory
+                          !file.isDirectory() && (file.canWrite || (!file.exists && file.getParentFile.canWrite))
+                        }
+                    )
+                    .toEitherNel
+                case invalidType =>
+                  Left(
+                    s"invalid 'infosetOutput.type': '$invalidType', must be 'none', 'console', or 'file'"
+                  ).toEitherNel
               }
           }
-        ).parMapN(LaunchArgs.apply)
-    }
+      }
+
+    // The following functions granularly parse the tdmlConfig object from the launch config
+    //
+    // tdmlConfig: {
+    //   action: '',
+    //   name: '',
+    //   description: '',
+    //   path: ''
+    // }
+    //
+    // The action field is parsed elsewhere. If these functions are hit, a valid action
+    //   other than 'none' was found.
+
+    // Parse the  name field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an empty string
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLName(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("name"))
+        .toRight("missing 'tdmlConfig.name' field from launch request")
+        .map(_.getAsString())
+        .flatMap(name => Either.cond(name.length() > 0, name, "'name' field from 'tdmlConfig' object cannot be empty"))
+        .toEitherNel
+
+    // Parse the description field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an empty string
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLDescription(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("description"))
+        .toRight("missing 'tdmlConfig.description' field from launch request")
+        .map(_.getAsString())
+        .flatMap(description =>
+          Either
+            .cond(description.length() > 0, description, "'description' field from 'tdmlConfig' object cannot be empty")
+        )
+        .toEitherNel
+
+    // Parse the path field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLPath(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("path"))
+        .toRight("missing 'tdmlConfig.path' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString).toFile().getAbsolutePath())
+            .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
+            .ensureOr(file => s"can't write to infoset output file at ${file}") { f =>
+              val file = Paths.get(f).toFile()
+              // If an empty string is passed in, it will be set to the workspace directory by default
+              // This is inside the Java code, so we have to make sure that the TDML file we
+              //   are working with is not a directory
+              !file.isDirectory() && (file.canWrite || (!file.exists && file.getParentFile.canWrite))
+            }
+        )
+        .toEitherNel

Review Comment:
   I'm a little concerned that this duplicates a decent amount of logic from the daffodil tdml library. And there's a lot of non trivial code in the TDML library that isn't implemented that we definitely don't want to reimplement. For example, input data can be defined in binary, hex, or characters, and even more complicates like bitOrder, replaceDFDLEntitites, etc. And this is just the data portion. There's a lot of complexity to TDML files that I would hate to have duplicated.



##########
resources/xsd/DFDL_part3_model.xsd:
##########
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   I assume all these files in `resources/xsd` have just been copied and unmodified from Daffodil? Can they instead be pulled out of the the daffodil-lib dependency?
   
   Otherwise these files may start to drift from the ones in Daffodil when we make changes and we'll have to remember (and most likely forget) to keep things updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1255381817

   Couldn't figure out how to get Windows/Mac to build. Linux is the only OS that builds right now. As best as I can tell, the reason that it isn't building lies with the extraction itself. I checked the permissions of the server/sbtXjc directory on Windows, and those seemed okay to me. Even after I changed them to include every available option, it still wouldn't build. The permissions on the jar in the ~/.ivy/cache folder looked okay as well. Other than the IO.unzip extraction that is currently being used, I also made an attempt using Java's ZipFile class. This did not change the output of the build.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1330882773

   That's what I'm working on now. I'm just not sure on the extent right now. I need to talk to Davin to figure out what needs to be done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] NolanMatt commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
NolanMatt commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329426094

   Trying to pick this up while working on Windows since its a problem, and when I attempt to build, I get an error saying
   
    error while decoding C:\Users\nolanm\Documents\GitHub\daffodil-vscode\server\sbtXjc\resources\xsd\org\apache\daffodil\xsd\xml.xsd with UTF-8: C:\Users\
   nolanm\Documents\GitHub\daffodil-vscode\server\sbtXjc\resources\xsd\org\apache\daffodil\xsd\xml.xsd (The system cannot find the path specified)←[0m←[0J
   
   This happens for every xsd file because the directory doesn't exist.  After server/sbtXjc/resources/xsd the directory structure is flat and none of org/apache/daffodil/xsd exist.  Is this whats happening on windows with other people as well?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963955123


##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   I'm not thrilled with this either, but I don't know another way of doing it. This is here because the sbt-xjc plugin invokes java from the command line, and it needs to find the libraries downloaded as dependencies during the build somehow. These lines are adding the required jars to the classpath.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963955551


##########
resources/xsd/DFDL_part3_model.xsd:
##########
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   Yes, that's where they came from. I will give that a shot.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963974390


##########
server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala:
##########
@@ -176,71 +180,333 @@ object Parse {
         case class File(path: Path) extends InfosetOutput
       }
 
+      sealed trait TDMLConfig extends LaunchArgs
+      object TDMLConfig {
+        case class Generate(
+            schemaPath: Path,
+            dataPath: Path,
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+
+        case class Append(
+            schemaPath: Path,
+            dataPath: Path,
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+
+        case class Execute(
+            stopOnEntry: Boolean,
+            infosetOutput: LaunchArgs.InfosetOutput,
+            name: String,
+            description: String,
+            path: String
+        ) extends TDMLConfig
+      }
+
       def parse(arguments: JsonObject): EitherNel[String, LaunchArgs] =
+        // Determine, based on the presence of the tdmlConfig object in the launch config, whether
+        //   this is a "normal" DFDL operation or if we should attempt to parse the values from
+        //   the tdmlConfig object.
+        Option(arguments.getAsJsonObject("tdmlConfig")) match {
+          case None             => parseManual(arguments)
+          case Some(tdmlConfig) => parseTDML(arguments, tdmlConfig)
+        }
+
+      // Parse a launch config that has been found to not have a tdmlConfig object
+      def parseManual(arguments: JsonObject): EitherNel[String, LaunchArgs] =
         (
-          Option(arguments.getAsJsonPrimitive("program"))
-            .toRight("missing 'program' field from launch request")
-            .flatMap(path =>
-              Either
-                .catchNonFatal(Paths.get(path.getAsString))
-                .leftMap(t => s"'program' field from launch request is not a valid path: $t")
-                .ensureOr(path => s"program file at $path doesn't exist")(_.toFile().exists())
-            )
-            .toEitherNel,
-          Option(arguments.getAsJsonPrimitive("data"))
-            .toRight("missing 'data' field from launch request")
-            .flatMap(path =>
-              Either
-                .catchNonFatal(Paths.get(path.getAsString))
-                .leftMap(t => s"'data' field from launch request is not a valid path: $t")
-                .ensureOr(path => s"data file at $path doesn't exist")(_.toFile().exists())
-            )
-            .toEitherNel,
-          Option(arguments.getAsJsonPrimitive("stopOnEntry"))
-            .map(_.getAsBoolean())
-            .getOrElse(true)
-            .asRight[String]
-            .toEitherNel,
-          Option(arguments.getAsJsonObject("infosetOutput")) match {
+          parseProgram(arguments),
+          parseData(arguments),
+          parseStopOnEntry(arguments),
+          parseInfosetOutput(arguments)
+        ).parMapN(LaunchArgs.Manual.apply)
+    }
+
+    // Parse a tdmlConfig object from the launch config
+    //
+    // tdmlConfig: {
+    //   action: '',
+    //   name: '',
+    //   description: '',
+    //   path: ''
+    // }
+    //
+    // The action field is parsed first.
+    // If it is a valid action ('generate' | 'append' | 'execute'), create a LaunchArgs object of the appropriate type
+    // If it is 'none' or missing, create a LaunchArgs.Manual object. This will ignore any other fields in the tdmlConfig object.
+    //
+    // arguments:  Launch config
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDML(arguments: JsonObject, tdmlConfig: JsonObject): EitherNel[String, LaunchArgs] =
+      Option(tdmlConfig.getAsJsonPrimitive("action")) match {
+        case None =>
+          (
+            parseProgram(arguments),
+            parseData(arguments),
+            parseStopOnEntry(arguments),
+            parseInfosetOutput(arguments)
+          ).parMapN(LaunchArgs.Manual.apply)
+        case Some(action) =>
+          action.getAsString() match {
+            case "generate" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments, true),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Generate.apply)
+            case "append" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments, true),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Append.apply)
+            case "execute" =>
+              (
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments),
+                parseTDMLName(tdmlConfig),
+                parseTDMLDescription(tdmlConfig),
+                parseTDMLPath(tdmlConfig)
+              ).parMapN(LaunchArgs.TDMLConfig.Execute.apply)
+            case "none" =>
+              (
+                parseProgram(arguments),
+                parseData(arguments),
+                parseStopOnEntry(arguments),
+                parseInfosetOutput(arguments)
+              ).parMapN(LaunchArgs.Manual.apply)
+            case invalidType =>
+              Left(
+                s"invalid 'tdmlConfig.action': '$invalidType', must be 'none', 'generate', 'append', or 'execute'"
+              ).toEitherNel
+          }
+      }
+
+    // Parse the program field from the launch config
+    // Returns an error if the program field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments: Launch config
+    def parseProgram(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("program"))
+        .toRight("missing 'program' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString))
+            .leftMap(t => s"'program' field from launch request is not a valid path: $t")
+            .ensureOr(path => s"program file at $path doesn't exist")(_.toFile().exists())
+        )
+        .toEitherNel
+
+    // Parse the data field from the launch config
+    // Returns an error if the data field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments: Launch config
+    def parseData(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("data"))
+        .toRight("missing 'data' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString))
+            .leftMap(t => s"'data' field from launch request is not a valid path: $t")
+            .ensureOr(path => s"data file at $path doesn't exist")(_.toFile().exists())
+        )
+        .toEitherNel
+
+    // Parse the stopOnEntry field from the launch config
+    // Defaults to true
+    //
+    // arguments: Launch config
+    def parseStopOnEntry(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("stopOnEntry"))
+        .map(_.getAsBoolean())
+        .getOrElse(true)
+        .asRight[String]
+        .toEitherNel
+
+    // Parse the infosetOutput object from the launch config
+    //
+    // infosetOutput: {
+    //   type: '',
+    //   path: ''
+    // }
+    //
+    // Type must be 'none' | 'console' | 'file'
+    // If type is 'file', there must be a 'path' field that contains a valid path
+    //   for the resulting infoset to be written to
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // arguments:   Launch config
+    // requireFile: Whether or not the type field must be set to file. This is a requirement
+    //              for the TDML generate operation. Returns an error if this boolean
+    //              is set to True, and the type field is set to a value other than file
+    def parseInfosetOutput(arguments: JsonObject, requireFile: Boolean = false) =
+      Option(arguments.getAsJsonObject("infosetOutput")) match {
+        case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
+        case Some(infosetOutput) =>
+          Option(infosetOutput.getAsJsonPrimitive("type")) match {
             case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-            case Some(infosetOutput) =>
-              Option(infosetOutput.getAsJsonPrimitive("type")) match {
-                case None => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-                case Some(typ) =>
-                  typ.getAsString() match {
-                    case "none"    => Right(LaunchArgs.InfosetOutput.None).toEitherNel
-                    case "console" => Right(LaunchArgs.InfosetOutput.Console).toEitherNel
-                    case "file" =>
-                      Option(infosetOutput.getAsJsonPrimitive("path"))
-                        .toRight("missing 'infosetOutput.path' field from launch request")
-                        .flatMap(path =>
-                          Either
-                            .catchNonFatal(LaunchArgs.InfosetOutput.File(Paths.get(path.getAsString)))
-                            .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
-                            .ensureOr(file => s"can't write to infoset output file at ${file.path}") { f =>
-                              val file = f.path.toFile
-                              file.canWrite || (!file.exists && file.getParentFile.canWrite)
-                            }
-                        )
-                        .toEitherNel
-                    case invalidType =>
-                      Left(
-                        s"invalid 'infosetOutput.type': '$invalidType', must be 'none', 'console', or 'file'"
-                      ).toEitherNel
-                  }
+            case Some(typ) =>
+              typ.getAsString() match {
+                case "none" =>
+                  if (requireFile)
+                    Left("'type' field in 'infosetOutput' must be set to 'file'").toEitherNel
+                  else
+                    Right(LaunchArgs.InfosetOutput.None).toEitherNel
+                case "console" =>
+                  if (requireFile)
+                    Left("'type' field in 'infosetOutput' must be set to 'file'").toEitherNel
+                  else
+                    Right(LaunchArgs.InfosetOutput.Console).toEitherNel
+                case "file" =>
+                  Option(infosetOutput.getAsJsonPrimitive("path"))
+                    .toRight("missing 'infosetOutput.path' field from launch request")
+                    .flatMap(path =>
+                      Either
+                        .catchNonFatal(LaunchArgs.InfosetOutput.File(Paths.get(path.getAsString)))
+                        .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
+                        .ensureOr(file => s"can't write to infoset output file at ${file.path}") { f =>
+                          val file = f.path.toFile
+                          // If an empty string is passed in, it will be set to the workspace directory by default
+                          // This is inside the Java code, so we have to make sure that the TDML file we
+                          //   are working with is not a directory
+                          !file.isDirectory() && (file.canWrite || (!file.exists && file.getParentFile.canWrite))
+                        }
+                    )
+                    .toEitherNel
+                case invalidType =>
+                  Left(
+                    s"invalid 'infosetOutput.type': '$invalidType', must be 'none', 'console', or 'file'"
+                  ).toEitherNel
               }
           }
-        ).parMapN(LaunchArgs.apply)
-    }
+      }
+
+    // The following functions granularly parse the tdmlConfig object from the launch config
+    //
+    // tdmlConfig: {
+    //   action: '',
+    //   name: '',
+    //   description: '',
+    //   path: ''
+    // }
+    //
+    // The action field is parsed elsewhere. If these functions are hit, a valid action
+    //   other than 'none' was found.
+
+    // Parse the  name field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an empty string
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLName(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("name"))
+        .toRight("missing 'tdmlConfig.name' field from launch request")
+        .map(_.getAsString())
+        .flatMap(name => Either.cond(name.length() > 0, name, "'name' field from 'tdmlConfig' object cannot be empty"))
+        .toEitherNel
+
+    // Parse the description field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an empty string
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLDescription(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("description"))
+        .toRight("missing 'tdmlConfig.description' field from launch request")
+        .map(_.getAsString())
+        .flatMap(description =>
+          Either
+            .cond(description.length() > 0, description, "'description' field from 'tdmlConfig' object cannot be empty")
+        )
+        .toEitherNel
+
+    // Parse the path field from the tdmlConfig object from the launch config
+    // Returns an error if the field is missing or is an invalid path
+    // A case where the user expects a new directory to be created is not a valid path
+    //   eg. /path/to/<existing>/<non-existing>/file.tdml
+    //
+    // tdmlConfig: tdmlConfig object from the launch config
+    def parseTDMLPath(tdmlConfig: JsonObject) =
+      Option(tdmlConfig.getAsJsonPrimitive("path"))
+        .toRight("missing 'tdmlConfig.path' field from launch request")
+        .flatMap(path =>
+          Either
+            .catchNonFatal(Paths.get(path.getAsString).toFile().getAbsolutePath())
+            .leftMap(t => s"'infosetOutput.path' field from launch request is not a valid path: $t")
+            .ensureOr(file => s"can't write to infoset output file at ${file}") { f =>
+              val file = Paths.get(f).toFile()
+              // If an empty string is passed in, it will be set to the workspace directory by default
+              // This is inside the Java code, so we have to make sure that the TDML file we
+              //   are working with is not a directory
+              !file.isDirectory() && (file.canWrite || (!file.exists && file.getParentFile.canWrite))
+            }
+        )
+        .toEitherNel

Review Comment:
   The intent of this feature was just to implement very basic TDML test cases into the extension. I agree that the code should not be duplicated. I'm hoping that someone will be willing to come along to refactor this to reference the TDML code in the main daffodil repo (either directly, or refactor it into a separate library), but that seemed out of scope for this implementation.
   
   The main use case for this feature as it exists now is for a user of the extension to use the 'Generate TDML' command to create a TDML file that can be added to a DFDL schema and an input file, and sent to the user list for debugging purposes. Then, someone should be able to take those files and execute the test case from the TDML file to get the same execution as the original poster.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on pull request #253: Daffodil vscode tdml

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1460694351

   I get this error when activating the Launch Config Wizard via the "gear" icon next to the open file tabs:
   
   ```
   2023-03-08 10:46:41.855 [error] SyntaxError: Unexpected token } in JSON at position 790
   	at JSON.parse (<anonymous>)
   	at LaunchWizard.getWebViewContent (/Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11760:29)
   	at /Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11689:43
   	at Generator.next (<anonymous>)
   	at /Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11562:71
   	at new Promise (<anonymous>)
   	at __awaiter (/Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11558:12)
   	at createWizard (/Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11686:12)
   	at Object.<anonymous> (/Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11575:19)
   	at Generator.next (<anonymous>)
   	at /Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11562:71
   	at new Promise (<anonymous>)
   	at __awaiter (/Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11558:12)
   	at /Users/arosien/nteligen/daffodil-vscode/dist/ext/extension.js:11574:87
   	at l.h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:96:108784)
   	at l.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:96:109688)
   	at c.N (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:11223)
   	at c.M (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:10941)
   	at c.H (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:10034)
   	at c.G (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:9015)
   	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:7803
   	at f.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
   	at g.deliver (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2066)
   	at h.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1704)
   	at p.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14907)
   	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:122:16556
   	at f.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
   	at g.deliver (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2066)
   	at h.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1704)
   	at p.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14907)
   	at MessagePortMain.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:122:14682)
   	at MessagePortMain.emit (node:events:526:28)
   	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:5:364)
   	at Object.callbackTrampoline (node:internal/async_hooks:130:17) launch.config {"value":"asf.apache-daffodil-vscode","c":"asf.apache-daffodil-vscode"}
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1131302573


##########
.vscode/launch.json:
##########
@@ -18,6 +18,30 @@
 {
 	"version": "0.2.0",
 	"configurations": [
+		{

Review Comment:
   I don't think this should be in the launch config.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1082039738


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDMLWrapper.scala:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Path
+import java.nio.file.Paths
+
+object TDMLWrapper {

Review Comment:
   Suggestion: I think these should be moved to the `TDML` companion object since they are just overloads of existing methods.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] Shanedell commented on a diff in pull request #253: Daffodil vscode tdml

Posted by "Shanedell (via GitHub)" <gi...@apache.org>.
Shanedell commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1085632072


##########
src/tests/data/png.dfdl.xsd:
##########
@@ -0,0 +1,764 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   As I have learned from @stevedlawrence , do not add this file into the repo. Its license is not compatible with ALv2 I believe. You will instead want to make a custom schema for testing, something similar to what we have in `main`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r970746735


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   Ah, maybe I just had to look up, is this part of the "Extension" configuration? Is that only enabled by developers somehow?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955334206


##########
build.sbt:
##########
@@ -46,7 +47,8 @@ lazy val commonSettings =
     // remove the -Xcheckinit option added by the sbt tpoletcat plugin. This
     // option leads to non-reproducible builds
     scalacOptions --= Seq("-Xcheckinit"),
-    startYear := Some(2021)
+    startYear := Some(2021),
+    Compile / managedResourceDirectories += baseDirectory.value / "server" / "sbtXjc" / "target" / "scala-2.12" / "src_managed_cxf" / "org" / "apache" / "daffodil" / "tdml"

Review Comment:
   ```suggestion
   ```
   
   This line isn't needed; the generated sources are automatically added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329632647

   Can you check the hash?? If it's d37932a577, that's mildly concerning that it would be working on your local machine but not on the git runners... Maybe the remaining issue is in the runner rather than the build.sbt? I feel like this is probably unlikely, though.
   
   Can you check the following directory - ./server/sbtXjc/target/scala-2.12/src_managed_cxf/org/apache/daffodil/tdml
   
   That should contain the Java files compiled from the xjc plugin. I've got ~150 generated files in that directory.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1080711501


##########
.vscode/launch.json:
##########
@@ -44,6 +61,15 @@
 				"${workspaceFolder}/out/tests/**/*.js",
 			],
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   ```suggestion
   			"name": "Daffodil Debug Server",
   ```



##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   ```suggestion
   			"name": "Daffodil Debug Server",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1083127579


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDML.scala:
##########
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Paths
+import javax.xml.bind.JAXBContext
+import javax.xml.bind.JAXBElement
+import javax.xml.bind.Marshaller
+import javax.xml.namespace.QName
+import javax.xml.bind.annotation.XmlType
+
+object TDML {
+  // Create a ParserTestCaseType object that can be put into a TestSuite
+  // These types are generated when JAXB is executed on the TDML schema
+  //
+  // The format of the new ParserTestCase is as follows:
+  //
+  // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" description="$tdmlDescription" roundTrip="onePass">
+  //   <tdml:document>
+  //     <tdml:documentPart type="file">$dataPath</tdml:documentPart>
+  //   <tdml:document>
+  //   <tdml:infoset>
+  //     <tdml:dfdlInfoset type="file">$infosetPath</tdml:dfdlInfoset>
+  //   </tdml:infoset>
+  // </tdml:parserTestCase>
+  //
+  // infosetPath:     Path to the infoset
+  // dataPath:        Path to the data file
+  // schemaPath:      Path to the DFDL Schema
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  //
+  // Returns the ParserTestCase object created with the applied paths
+  def createTestCase(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String
+  ): ParserTestCaseType = {
+    val factory = new ObjectFactory()
+
+    val dfdlInfoset = factory.createDfdlInfosetType()
+    dfdlInfoset.setType("file")
+    dfdlInfoset.getContent().add(infosetPath)
+
+    val infoset = factory.createInfosetType()
+    infoset.setDfdlInfoset(dfdlInfoset)
+
+    val docPart = factory.createDocumentPartType()
+    docPart.setType(DocumentPartTypeEnum.FILE)
+    docPart.setValue(dataPath)
+
+    // These lines are necessary because there is no @XmlRootElement annotation on the DocumentPartType class in JAXB
+    // Ideally, we would want to have JAXB add the annotation - probably with the bindings.xjb file. The only way I found
+    //   that did that required an external plugin just to add the annotation (https://github.com/highsource/jaxb2-annotate-plugin).
+    // We are getting the namespace from the JAXB class so that we don't have to hard-code it here
+    // Unfortunately, it seems like hard-coding the class name isn't an easy thing to avoid. There is a name in the XmlType
+    //   annotation, but it is documentPartType instead of documentPart. We would need to remove the Type from this anyway.
+    val tdmlNamespacePrefix = classOf[DocumentPartType].getAnnotation(classOf[XmlType]).namespace()
+    val docPartElement = new JAXBElement[DocumentPartType](
+      new QName(tdmlNamespacePrefix, "documentPart"),
+      classOf[DocumentPartType],
+      docPart
+    )
+
+    val doc = factory.createDocumentType()
+    doc.getContent().add(docPartElement)
+
+    val testCase = factory.createParserTestCaseType()
+    testCase.setName(tdmlName)
+    testCase.setRoot("file")
+    testCase.setModel(schemaPath)
+    testCase.setDescription(tdmlDescription)
+    testCase.setRoundTrip(RoundTripType.ONE_PASS)
+    testCase.getTutorialOrDocumentOrInfoset().add(doc)
+    testCase.getTutorialOrDocumentOrInfoset().add(infoset)
+
+    return testCase
+  }
+
+  // Generate a new TDML file.
+  // There is a suiteName attribute in the root element (TestSuite) of the document. This is set to $tdmlName
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  //
+  // There is a suiteName attribute in the root element of the document. This is set to tdmlName
+  def generate(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+    val factory = new ObjectFactory()
+
+    val testSuite = factory.createTestSuite()
+    testSuite.setSuiteName(tdmlName)
+    testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Append a new test case to an existing TDML file.
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  def append(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Find the parameters needed to execute a DFDL parse based on the given TDML Parameters
+  //
+  // tdmlName:        Test case name to run
+  // tdmlDescription: Description of test case to run
+  // tdmlPath:        File path of TDML file to extract test case from
+  //
+  // Returns a tuple containing the following (Path to DFDL Schema, Path to Data File)
+  // All paths returned could be either relative or absolute - it depends on what exists in the TDML file
+  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): (String, String) = {
+    val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent()
+
+    val testCaseList = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+      .getTutorialOrParserTestCaseOrDefineSchema()
+
+    testCaseList.forEach { tc =>

Review Comment:
   This isn't Scala.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1231810509

   Should the version be incremented as a part of this PR - going from 1.1.0 to 1.1.1? If version 1.1.0 of the extension has already been used on a PC and this branch is installed and run, the Scala backend won't be re-downloaded and updated, and the old, existing backend will be used. This results in the TDML commands showing up in the frontend, but no TDML code will actually be executed in the Scala backend.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1213389283

   Also, it looks like a "daffodil-vscode-tdml" branch was pushed to the asf repo. Was that intentional? If not, we should delete that and only look at this PR from a fork.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r969854108


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   Suggestion: let's rename the launch entry here to be something like "Daffodil DAP Server" to be a clear description of what it does. The name of the mainClass shouldn't matter too much.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r969978713


##########
bindings.xjb:
##########
@@ -0,0 +1,58 @@
+<jxb:bindings version="2.1"

Review Comment:
   ALv2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955315188


##########
project/plugins.sbt:
##########
@@ -21,3 +21,6 @@ addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.22")
 addSbtPlugin("org.musigma" % "sbt-rat" % "0.7.0")
 addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
 addSbtPlugin("com.github.battermann" % "sbt-json" % "0.5.0")
+addSbtPlugin("org.scala-sbt.plugins" % "sbt-xjc" % "0.10")
+
+// resolvers += "Java Net" at "http://download.java.net/maven/2/"

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r969978225


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   What about "Daffodil Debug Server"? I'm not sure if most people will know what a "DAP" server is. Also, if it's only for extension developers, maybe it should be hidden behind an "advanced settings" option or something?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963990673


##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   I also would expect it to handle this automatically, but it was throwing ClassNotFoundExceptions before I added all of this. Maybe there is some extra configuration needed, but nothing jumps out at me from their documentation.
   
   @arosien is there a smarter way to have the java process recognize/find the jars?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963998114


##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   It looks like sbt-xjc is already adding jars to the classpath:
   
   https://github.com/sbt/sbt-xjc/blob/master/src/main/scala/com/github/retronym/sbtxjc/SbtXjcPlugin.scala#L96
   
   I do see references to Ivy in that file, it's possible it doesn't work with Coursier? You might try settting `useCoursier := false`, in your sbt configs? We do that for daffodil because something doesn't work with coursier.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] NolanMatt commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
NolanMatt commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1330871700

   @michael-hoke Davin mentioned next step is to hook the feature into the test suite.  It seems like that's what you ended up doing yesterday.  Am I right in thinking that or is that still to be done?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1080711501


##########
.vscode/launch.json:
##########
@@ -44,6 +61,15 @@
 				"${workspaceFolder}/out/tests/**/*.js",
 			],
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   ```suggestion
   			"name": "Daffodil Debug Server",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] Shanedell commented on a diff in pull request #253: Daffodil VsCode TDML

Posted by "Shanedell (via GitHub)" <gi...@apache.org>.
Shanedell commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1134777112


##########
package.json:
##########
@@ -35,7 +35,7 @@
     "package-setup": "node -e \"require('./build/scripts/package.ts').setup()\"",
     "package-create": "node -e \"require('./build/scripts/package.ts').create()\"",
     "pretest": "yarn compile && yarn webpack",
-    "test": "node ./out/tests/runTest.js",
+    "test": "node ./out/tests/runTest.js && sbt test",

Review Comment:
   ```suggestion
       "test": "sbt test && node ./out/tests/runTest.js",
   ```
   
   This is the only small thing I had. I believe we want `sbt test` first since some of the node tests depend on the debugger so if it fails an sbt test we should not try to run the node ones.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] NolanMatt commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
NolanMatt commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329645559

   $ git log
   commit d37932a577a08c092891b3b8b1c99b31932f14b5 (HEAD -> pr/253, github-desktop-michael-hoke/daffodil-vscode-tdml)
   Author: Michael Hoke <mi...@nteligen.com>
   Date:   Mon Nov 28 13:16:44 2022 -0500
   
   nolanm@EVC-D4269 MINGW64 ~/Documents/GitHub/daffodil-vscode/server/sbtXjc/target/scala-2.12/src_managed_cxf/org/apache/daffodil/tdml (pr/253)
   $ ls | grep java | wc -l
   150
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329877359

   I think we're almost there. I had it building successfully in CI before rebasing on the current apache:main. It looks like the tests that were added to main need to be updated - doesn't look like it should be that much of an issue.
   
   Thanks again @NolanMatt for checking the Windows build.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1213565228

   It has already been rebased (as of yesterday) on top of main. Not sure why Git says it can't be rebased... 
   
   If there is another branch out there, I am unaware of it, and it should be removed. The only branch I worked off of was the one in my fork. It looks like there are a lot of duplicate commits in there - I'll see if I can remove them before squashing - maybe that will fix the rebase issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1083127916


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDML.scala:
##########
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Paths
+import javax.xml.bind.JAXBContext
+import javax.xml.bind.JAXBElement
+import javax.xml.bind.Marshaller
+import javax.xml.namespace.QName
+import javax.xml.bind.annotation.XmlType
+
+object TDML {
+  // Create a ParserTestCaseType object that can be put into a TestSuite
+  // These types are generated when JAXB is executed on the TDML schema
+  //
+  // The format of the new ParserTestCase is as follows:
+  //
+  // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" description="$tdmlDescription" roundTrip="onePass">
+  //   <tdml:document>
+  //     <tdml:documentPart type="file">$dataPath</tdml:documentPart>
+  //   <tdml:document>
+  //   <tdml:infoset>
+  //     <tdml:dfdlInfoset type="file">$infosetPath</tdml:dfdlInfoset>
+  //   </tdml:infoset>
+  // </tdml:parserTestCase>
+  //
+  // infosetPath:     Path to the infoset
+  // dataPath:        Path to the data file
+  // schemaPath:      Path to the DFDL Schema
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  //
+  // Returns the ParserTestCase object created with the applied paths
+  def createTestCase(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String
+  ): ParserTestCaseType = {
+    val factory = new ObjectFactory()
+
+    val dfdlInfoset = factory.createDfdlInfosetType()
+    dfdlInfoset.setType("file")
+    dfdlInfoset.getContent().add(infosetPath)
+
+    val infoset = factory.createInfosetType()
+    infoset.setDfdlInfoset(dfdlInfoset)
+
+    val docPart = factory.createDocumentPartType()
+    docPart.setType(DocumentPartTypeEnum.FILE)
+    docPart.setValue(dataPath)
+
+    // These lines are necessary because there is no @XmlRootElement annotation on the DocumentPartType class in JAXB
+    // Ideally, we would want to have JAXB add the annotation - probably with the bindings.xjb file. The only way I found
+    //   that did that required an external plugin just to add the annotation (https://github.com/highsource/jaxb2-annotate-plugin).
+    // We are getting the namespace from the JAXB class so that we don't have to hard-code it here
+    // Unfortunately, it seems like hard-coding the class name isn't an easy thing to avoid. There is a name in the XmlType
+    //   annotation, but it is documentPartType instead of documentPart. We would need to remove the Type from this anyway.
+    val tdmlNamespacePrefix = classOf[DocumentPartType].getAnnotation(classOf[XmlType]).namespace()
+    val docPartElement = new JAXBElement[DocumentPartType](
+      new QName(tdmlNamespacePrefix, "documentPart"),
+      classOf[DocumentPartType],
+      docPart
+    )
+
+    val doc = factory.createDocumentType()
+    doc.getContent().add(docPartElement)
+
+    val testCase = factory.createParserTestCaseType()
+    testCase.setName(tdmlName)
+    testCase.setRoot("file")
+    testCase.setModel(schemaPath)
+    testCase.setDescription(tdmlDescription)
+    testCase.setRoundTrip(RoundTripType.ONE_PASS)
+    testCase.getTutorialOrDocumentOrInfoset().add(doc)
+    testCase.getTutorialOrDocumentOrInfoset().add(infoset)
+
+    return testCase
+  }
+
+  // Generate a new TDML file.
+  // There is a suiteName attribute in the root element (TestSuite) of the document. This is set to $tdmlName
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  //
+  // There is a suiteName attribute in the root element of the document. This is set to tdmlName
+  def generate(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+    val factory = new ObjectFactory()
+
+    val testSuite = factory.createTestSuite()
+    testSuite.setSuiteName(tdmlName)
+    testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Append a new test case to an existing TDML file.
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  def append(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Find the parameters needed to execute a DFDL parse based on the given TDML Parameters
+  //
+  // tdmlName:        Test case name to run
+  // tdmlDescription: Description of test case to run
+  // tdmlPath:        File path of TDML file to extract test case from
+  //
+  // Returns a tuple containing the following (Path to DFDL Schema, Path to Data File)
+  // All paths returned could be either relative or absolute - it depends on what exists in the TDML file
+  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): (String, String) = {
+    val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent()
+
+    val testCaseList = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+      .getTutorialOrParserTestCaseOrDefineSchema()
+
+    testCaseList.forEach { tc =>
+      tc match {
+        case ptc: ParserTestCaseType =>
+          if (ptc.getName() == tdmlName && ptc.getDescription() == tdmlDescription) {
+            ptc.getTutorialOrDocumentOrInfoset().forEach { dis =>
+              dis match {
+                case doc: DocumentType =>
+                  // The right part of the tuple only takes the first DocumentPart inside the Document.
+                  // In the case that there are more than one, any extras will be ignored.
+                  val schemaPath = Paths.get(basePath + File.separator + ptc.getModel()).normalize().toString()
+                  val dataPath = Paths
+                    .get(
+                      basePath + File.separator + doc
+                        .getContent()
+                        .get(0)
+                        .asInstanceOf[JAXBElement[DocumentPartType]]
+                        .getValue()
+                        .getValue()
+                    )
+                    .normalize()
+                    .toString()
+                  return (schemaPath, dataPath)

Review Comment:
   Worry: this is an early return, so if there are multiple test cases then only the first is executed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1233386220

   > Should the version be incremented as a part of this PR - going from 1.1.0 to 1.1.1? If version 1.1.0 of the extension has already been used on a PC and this branch is installed and run, the Scala backend won't be re-downloaded and updated, and the old, existing backend will be used. This results in the TDML commands showing up in the frontend, but no TDML code will actually be executed in the Scala backend.
   
   The convention in JVM libraries is to have, on the main branch, a version string of `x.y.z-SNAPSHOT` which means the artifact is continually changing and therefore should be re-fetched on every resolution. The download-the-scala-backend functionality in the extension should have something similar, or at least have a way to override the backend location for local development.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil VsCode TDML

Posted by "michael-hoke (via GitHub)" <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1466546031

   I'll go in and do some rebasing magic to rebase this branch and move the commit out to my fork's main.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955314011


##########
build.sbt:
##########
@@ -88,3 +90,183 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+      // "org.relaxng" % "jing" % "20220510" % "runtime",
+
+      // "com.sun.istack" % "istack-commons-tools" % "4.1.1"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(

Review Comment:
   Concern: it looks very suspicious that all of these runtime dependencies have to be specified this way. What is requiring them, the XJC tool itself?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on pull request #253: Daffodil vscode tdml

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1460701568

   > I get this error when activating the Launch Config Wizard via the "gear" icon next to the open file tabs:
   
   It's from a trailing comma in a launch config that the wizard is parsing. Apparently the JSON parser doesn't like trailing commas.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955476038


##########
build.sbt:
##########
@@ -88,3 +90,183 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+      // "org.relaxng" % "jing" % "20220510" % "runtime",
+
+      // "com.sun.istack" % "istack-commons-tools" % "4.1.1"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(

Review Comment:
   Yes. The sbt-xjc plugin can be found here: https://github.com/sbt/sbt-xjc. The details for the different keys are provided there as well.
   
   The "-p org.apache.daffodil.tdml" on the command line specifies the namespace for the generated files.
   
   I'd love to be able to take out the classpath, but the generation of the JAXB files errors out because the underlying java process can't find classes that it's looking for. Each item on the classpath was found manually through build failures.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955305322


##########
build.sbt:
##########
@@ -88,3 +90,183 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+      // "org.relaxng" % "jing" % "20220510" % "runtime",
+
+      // "com.sun.istack" % "istack-commons-tools" % "4.1.1"

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955477257


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDML.scala:
##########
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Paths
+import javax.xml.bind.JAXBContext
+import javax.xml.bind.JAXBElement
+import javax.xml.bind.Marshaller
+import javax.xml.namespace.QName
+import javax.xml.bind.annotation.XmlType
+
+object TDML {
+  // Create a ParserTestCaseType object that can be put into a TestSuite
+  // These types are generated when JAXB is executed on the TDML schema
+  //
+  // The format of the new ParserTestCase is as follows:
+  //
+  // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" description="$tdmlDescription" roundTrip="onePass">
+  //   <tdml:document>
+  //     <tdml:documentPart type="file">$dataPath</tdml:documentPart>
+  //   <tdml:document>
+  //   <tdml:infoset>
+  //     <tdml:dfdlInfoset type="file">$infosetPath</tdml:dfdlInfoset>
+  //   </tdml:infoset>
+  // </tdml:parserTestCase>
+  //
+  // infosetPath:     Path to the infoset
+  // dataPath:        Path to the data file
+  // schemaPath:      Path to the DFDL Schema
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  //
+  // Returns the ParserTestCase object created with the applied paths
+  def createTestCase(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String
+  ): ParserTestCaseType = {
+    val factory = new ObjectFactory()
+
+    val dfdlInfoset = factory.createDfdlInfosetType()
+    dfdlInfoset.setType("file")
+    dfdlInfoset.getContent().add(infosetPath)
+
+    val infoset = factory.createInfosetType()
+    infoset.setDfdlInfoset(dfdlInfoset)
+
+    val docPart = factory.createDocumentPartType()
+    docPart.setType(DocumentPartTypeEnum.FILE)
+    docPart.setValue(dataPath)
+
+    // These lines are necessary because there is no @XmlRootElement annotation on the DocumentPartType class in JAXB
+    // Ideally, we would want to have JAXB add the annotation - probably with the bindings.xjb file. The only way I found
+    //   that did that required an external plugin just to add the annotation (https://github.com/highsource/jaxb2-annotate-plugin).
+    // We are getting the namespace from the JAXB class so that we don't have to hard-code it here
+    // Unfortunately, it seems like hard-coding the class name isn't an easy thing to avoid. There is a name in the XmlType
+    //   annotation, but it is documentPartType instead of documentPart. We would need to remove the Type from this anyway.
+    val tdmlNamespacePrefix = classOf[DocumentPartType].getAnnotation(classOf[XmlType]).namespace()
+    val docPartElement = new JAXBElement[DocumentPartType](
+      new QName(tdmlNamespacePrefix, "documentPart"),
+      classOf[DocumentPartType],
+      docPart
+    )
+
+    val doc = factory.createDocumentType()
+    doc.getContent().add(docPartElement)
+
+    val testCase = factory.createParserTestCaseType()
+    testCase.setName(tdmlName)
+    testCase.setRoot("file")
+    testCase.setModel(schemaPath)
+    testCase.setDescription(tdmlDescription)
+    testCase.setRoundTrip(RoundTripType.ONE_PASS)
+    testCase.getTutorialOrDocumentOrInfoset().add(doc)
+    testCase.getTutorialOrDocumentOrInfoset().add(infoset)
+
+    return testCase
+  }
+
+  // Generate a new TDML file.
+  // There is a suiteName attribute in the root element (TestSuite) of the document. This is set to $tdmlName
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  //
+  // There is a suiteName attribute in the root element of the document. This is set to tdmlName
+  def generate(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+    val factory = new ObjectFactory()
+
+    val testSuite = factory.createTestSuite()
+    testSuite.setSuiteName(tdmlName)
+    testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Append a new test case to an existing TDML file.
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  def append(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Find the parameters needed to execute a DFDL parse based on the given TDML Parameters
+  //
+  // tdmlName:        Test case name to run
+  // tdmlDescription: Description of test case to run
+  // tdmlPath:        File path of TDML file to extract test case from
+  //
+  // Returns a tuple containing the following (Path to DFDL Schema, Path to Data File)
+  // All paths returned could be either relative or absolute - it depends on what exists in the TDML file
+  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): (String, String) = {
+    val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent()
+
+    val testCaseList = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+      .getTutorialOrParserTestCaseOrDefineSchema()
+
+    testCaseList.forEach { tc =>
+      tc match {
+        case ptc: ParserTestCaseType =>
+          if (ptc.getName() == tdmlName && ptc.getDescription() == tdmlDescription) {
+            ptc.getTutorialOrDocumentOrInfoset().forEach { dis =>
+              dis match {
+                case doc: DocumentType =>
+                  // The right part of the tuple only takes the first DocumentPart inside the Document.
+                  // In the case that there are more than one, any extras will be ignored.
+                  val schemaPath = Paths.get(basePath + File.separator + ptc.getModel()).normalize().toString()
+                  val dataPath = Paths
+                    .get(
+                      basePath + File.separator + doc
+                        .getContent()
+                        .get(0)
+                        .asInstanceOf[JAXBElement[DocumentPartType]]
+                        .getValue()
+                        .getValue()
+                    )
+                    .normalize()
+                    .toString()
+                  return (schemaPath, dataPath)
+              }
+            }
+          }
+      }
+    }
+
+    // If there is no test case in the TDML file meeting the name/description criteria, return empty

Review Comment:
   Does rephrasing the end portion from "... return empty" to "... return an empty tuple" remove this implication?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1213388488

   Please squash into a single commit and rebase on top of the main branch. And please make the comment desribe what and why you're adding. It looks like some files are just copied form Daffodil source or other pleases. Please mention that and if any changes were made so we know what and what not to focus on.
   
   Also, in the future, please try to split of PR's into smaller bite size chunks. This PR closes 8 issues. I would usually prefer 8 separate PR's specific to each issue. That makes things much easier to review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963951659


##########
bindings.xjb:
##########
@@ -0,0 +1,58 @@
+<jxb:bindings version="2.1"
+          xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <jxb:globalBindings>
+        <jxb:serializable uid="1" />
+    </jxb:globalBindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part3_model.xsd" version="1.0">
+        <jxb:bindings node="//xs:attributeGroup[@name='SetVariableAG']/xs:attribute[@name='value']">
+            <jxb:property name="ValueAttribute"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='simpleType']">
+            <jxb:class name="simpleTypeClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='group']">
+            <jxb:class name="groupClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='choice']">
+            <jxb:class name="choiceClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='sequence']">
+            <jxb:class name="sequenceClass"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:element[@name='element']">
+            <jxb:class name="elementClass"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part2_attributes.xsd" version="1.0">
+        <jxb:bindings node="//xs:attributeGroup[@name='BaseAGQualified']/xs:attribute[@name='ref']">
+            <jxb:property name="RefAttribute"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/DFDL_part1_simpletypes.xsd" version="1.0">
+        <jxb:bindings node="//xs:simpleType[@name='ByteOrderEnum']">
+            <jxb:typesafeEnumClass name="ByteOrderEnumType"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:simpleType[@name='BitOrderEnum']">
+            <jxb:typesafeEnumClass name="BitOrderEnumType"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/dafext.xsd" version="1.0">
+        <jxb:bindings node="//xs:attribute[@name='parseUnparsePolicy']">
+            <jxb:property name="ParseUnparsePolicyExt"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+            <jxb:typesafeEnumClass name="PropertyNameTypeExt"/>
+        </jxb:bindings>
+        <jxb:bindings node="//xs:complexType[@name='PropertyType']">
+            <jxb:class name="PropertyTypeClass"/>
+        </jxb:bindings>
+    </jxb:bindings>
+    <jxb:bindings schemaLocation="resources/xsd/dfdlx.xsd" version="1.0">
+        <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+            <jxb:typesafeEnumClass name="PropertyNameTypeX"/>
+        </jxb:bindings>
+    </jxb:bindings>
+</jxb:bindings>

Review Comment:
   Trial and error with the jaxb build. I would try to build it, and it would fail.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1213583301

   No idea what's going on with the CI right now. I pushed up formatting and Rat changes. The formatting is passing on my local machine... For the licensing, I think the bindings.xjb file is what it is complaining about - do I add that to the exclude list, or is there a license you have in mind for an XML file?
   
   Also not sure why ubuntu would be failing - I'm using wsl/ubuntu and it builds locally for me. I'll look into these more on Monday.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329606358

   I think I have the extraction working properly on non-Linux platforms, but it looks like it's failing a bit further in the compilation process now:
   
   - If I leave the generator as a resourceGenerator, it doesn't look like Compile / xjc / sources is able to pick up the generated sources because they're generated after the sources list is compiled.
   
   - If I change it to a sourceGenerator, sbt tries to read the XML as source files, which causes syntax errors.
   
   - The bindings file is using Linux slashes/paths in the schemaLocation. I'm not sure yet if that matters (it looks like the plugin might automatically switch), but I'll note it here so it doesn't get forgotten.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329688358

   Looks like it does build in Windows/Mac if I take out the Windows-specific portion of the CI. It's failing in the Test portion now, which makes sense. The settings for XJC that start with Compile / ... need to be duplicated to Test / ...
   
   Hopefully, there's a way to do that without duplicating all of the code


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329649131

   Thanks, that's what it should be.... Wonder if it actually is an issue with the runner then?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1080719987


##########
build.sbt:
##########
@@ -62,6 +64,8 @@ lazy val ratSettings = Seq(
   ratFailBinaries := true
 )
 
+lazy val xjcTask = taskKey[Seq[File]]("Create JAXB Bindings for DFDL Schemas")

Review Comment:
   Suggestions: This seems to be unused and not necessary. Delete?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1081824306


##########
bindings.xjb:
##########
@@ -0,0 +1,78 @@
+<!--

Review Comment:
   Suggestion: can this file be moved into the server directory? The example project at https://github.com/sbt/sbt-xjc/blob/master/src/sbt-test/sbt-xjc/xero/build.sbt puts both the xjb and xsd files under src/main/resources.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1220038575

   In order to pass the Rat check, I added the JAXB bindings.xjb file to the exclude list. If there is an appropriate license for an xjb file, let me know, and I'll put that in.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r956149637


##########
build.sbt:
##########
@@ -88,3 +90,183 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+      // "org.relaxng" % "jing" % "20220510" % "runtime",
+
+      // "com.sun.istack" % "istack-commons-tools" % "4.1.1"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(

Review Comment:
   I guess I find it weird the tool isn't self-contained, but I'll check that out out-of-band.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963950336


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   This is the launch config for the scala backend. I was using this during debugging. I can remove this if we don't want it in the repo, but I think we should at least have it documented somewhere because it is needed to debug the scala backend.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963950612


##########
bindings.xjb:
##########
@@ -0,0 +1,58 @@
+<jxb:bindings version="2.1"

Review Comment:
   This is a manually generated file. Which license header should be added?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r963986008


##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   > find the libraries downloaded as dependencies
   
   These are dependencies of xjc correct? Seems odd that this would be needed, I would expect xjc to handle that. I wonder if we are using/configuring it incorrectly? None of the examples in the xjc repo require manually listing xjc dependencies.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r964035706


##########
build.sbt:
##########
@@ -88,3 +89,180 @@ lazy val core = project
     packageName := s"${name.value}-$daffodilVer"
   )
   .enablePlugins(commonPlugins: _*)
+  .dependsOn(sbtXjcProject)
+  .aggregate(sbtXjcProject)
+
+lazy val sbtXjcProject = project
+  .in(file("server/sbtXjc"))
+  .enablePlugins(SbtXjcPlugin)
+  .settings(
+    name := "daffodil-xjc",
+    libraryDependencies ++= Seq(
+      "javax.activation" % "activation" % "1.1.1",
+      "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6"
+    ),
+    xjcCommandLine += "-nv",
+    xjcCommandLine += "-p",
+    xjcCommandLine += "org.apache.daffodil.tdml",
+    xjcBindings += "bindings.xjb",
+    xjcJvmOpts += "-classpath",
+    xjcJvmOpts += Seq(
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "activation",
+        "1.1.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "activation",
+        "javax.activation-api",
+        "1.2.0",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "txw2",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "relaxngDatatype",
+        "relaxngDatatype",
+        "20020414",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xsom",
+        "xsom",
+        "20140925",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "external",
+        "rngom",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-runtime",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "codemodel",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-core",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "javax",
+        "xml",
+        "bind",
+        "jaxb-api",
+        "2.1",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "istack",
+        "istack-commons-tools",
+        "2.21",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "org",
+        "glassfish",
+        "jaxb",
+        "jaxb-xjc",
+        "2.2.11",
+        "*"
+      ).mkString(java.io.File.separator),
+      Seq(
+        s"${csrCacheDirectory.value}",
+        "https",
+        "repo1.maven.org",
+        "maven2",
+        "com",
+        "sun",
+        "xml",
+        "bind",
+        "jaxb-impl",
+        "2.2.11",
+        "*"

Review Comment:
   I added that setting, commented out the classpath lines I added, and I'm getting the ClassNotFoundExceptions. It looks like it's re-downloading the dependencies, so I'm assuming that means it's not using couriser anymore. I'll dig around with this for a bit to see if I can get it to work.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r1082035016


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDML.scala:
##########
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Paths
+import javax.xml.bind.JAXBContext
+import javax.xml.bind.JAXBElement
+import javax.xml.bind.Marshaller
+import javax.xml.namespace.QName
+import javax.xml.bind.annotation.XmlType
+
+object TDML {
+  // Create a ParserTestCaseType object that can be put into a TestSuite
+  // These types are generated when JAXB is executed on the TDML schema
+  //
+  // The format of the new ParserTestCase is as follows:
+  //
+  // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" description="$tdmlDescription" roundTrip="onePass">
+  //   <tdml:document>
+  //     <tdml:documentPart type="file">$dataPath</tdml:documentPart>
+  //   <tdml:document>
+  //   <tdml:infoset>
+  //     <tdml:dfdlInfoset type="file">$infosetPath</tdml:dfdlInfoset>
+  //   </tdml:infoset>
+  // </tdml:parserTestCase>
+  //
+  // infosetPath:     Path to the infoset
+  // dataPath:        Path to the data file
+  // schemaPath:      Path to the DFDL Schema
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  //
+  // Returns the ParserTestCase object created with the applied paths
+  def createTestCase(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String
+  ): ParserTestCaseType = {
+    val factory = new ObjectFactory()
+
+    val dfdlInfoset = factory.createDfdlInfosetType()
+    dfdlInfoset.setType("file")
+    dfdlInfoset.getContent().add(infosetPath)
+
+    val infoset = factory.createInfosetType()
+    infoset.setDfdlInfoset(dfdlInfoset)
+
+    val docPart = factory.createDocumentPartType()
+    docPart.setType(DocumentPartTypeEnum.FILE)
+    docPart.setValue(dataPath)
+
+    // These lines are necessary because there is no @XmlRootElement annotation on the DocumentPartType class in JAXB
+    // Ideally, we would want to have JAXB add the annotation - probably with the bindings.xjb file. The only way I found
+    //   that did that required an external plugin just to add the annotation (https://github.com/highsource/jaxb2-annotate-plugin).
+    // We are getting the namespace from the JAXB class so that we don't have to hard-code it here
+    // Unfortunately, it seems like hard-coding the class name isn't an easy thing to avoid. There is a name in the XmlType
+    //   annotation, but it is documentPartType instead of documentPart. We would need to remove the Type from this anyway.
+    val tdmlNamespacePrefix = classOf[DocumentPartType].getAnnotation(classOf[XmlType]).namespace()
+    val docPartElement = new JAXBElement[DocumentPartType](
+      new QName(tdmlNamespacePrefix, "documentPart"),
+      classOf[DocumentPartType],
+      docPart
+    )
+
+    val doc = factory.createDocumentType()
+    doc.getContent().add(docPartElement)
+
+    val testCase = factory.createParserTestCaseType()
+    testCase.setName(tdmlName)
+    testCase.setRoot("file")
+    testCase.setModel(schemaPath)
+    testCase.setDescription(tdmlDescription)
+    testCase.setRoundTrip(RoundTripType.ONE_PASS)
+    testCase.getTutorialOrDocumentOrInfoset().add(doc)
+    testCase.getTutorialOrDocumentOrInfoset().add(infoset)
+
+    return testCase
+  }
+
+  // Generate a new TDML file.
+  // There is a suiteName attribute in the root element (TestSuite) of the document. This is set to $tdmlName
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  //
+  // There is a suiteName attribute in the root element of the document. This is set to tdmlName
+  def generate(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+    val factory = new ObjectFactory()
+
+    val testSuite = factory.createTestSuite()
+    testSuite.setSuiteName(tdmlName)
+    testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Append a new test case to an existing TDML file.
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  def append(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Find the parameters needed to execute a DFDL parse based on the given TDML Parameters
+  //
+  // tdmlName:        Test case name to run
+  // tdmlDescription: Description of test case to run
+  // tdmlPath:        File path of TDML file to extract test case from
+  //
+  // Returns a tuple containing the following (Path to DFDL Schema, Path to Data File)
+  // All paths returned could be either relative or absolute - it depends on what exists in the TDML file
+  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): (String, String) = {
+    val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent()
+
+    val testCaseList = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+      .getTutorialOrParserTestCaseOrDefineSchema()
+
+    testCaseList.forEach { tc =>
+      tc match {
+        case ptc: ParserTestCaseType =>
+          if (ptc.getName() == tdmlName && ptc.getDescription() == tdmlDescription) {
+            ptc.getTutorialOrDocumentOrInfoset().forEach { dis =>
+              dis match {
+                case doc: DocumentType =>
+                  // The right part of the tuple only takes the first DocumentPart inside the Document.
+                  // In the case that there are more than one, any extras will be ignored.
+                  val schemaPath = Paths.get(basePath + File.separator + ptc.getModel()).normalize().toString()
+                  val dataPath = Paths
+                    .get(
+                      basePath + File.separator + doc
+                        .getContent()
+                        .get(0)
+                        .asInstanceOf[JAXBElement[DocumentPartType]]
+                        .getValue()
+                        .getValue()
+                    )
+                    .normalize()
+                    .toString()
+                  return (schemaPath, dataPath)
+              }
+            }
+          }
+      }
+    }
+
+    // If there is no test case in the TDML file meeting the name/description criteria, return empty

Review Comment:
   Sorry, I mean I'm actually suggesting changing the return type to `Option[(String, String)]` so the caller doesn't have to check for empty strings.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] NolanMatt commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
NolanMatt commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329624014

   After pulling in your latest changes @michael-hoke I was able to successfully build the vsix on windows.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1329440703

   I'm seeing the same thing now - thought it was just something with my local changes. You can run the following to get the branch to a more stable state:
   
   git reset hard d0de0700e
   
   If that's not enough of the hash, you can run `git status` and find the full hash. I'll be pushing more changes soon to test the windows/mac builds, and you're probably not going to want those, so I'd stay based off of that commit. If you get it working on Windows, we can figure out the easiest way to get your changes up.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r955319839


##########
server/core/src/main/scala/org.apache.daffodil.tdml/TDML.scala:
##########
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.tdml
+
+import java.io.File
+import java.nio.file.Paths
+import javax.xml.bind.JAXBContext
+import javax.xml.bind.JAXBElement
+import javax.xml.bind.Marshaller
+import javax.xml.namespace.QName
+import javax.xml.bind.annotation.XmlType
+
+object TDML {
+  // Create a ParserTestCaseType object that can be put into a TestSuite
+  // These types are generated when JAXB is executed on the TDML schema
+  //
+  // The format of the new ParserTestCase is as follows:
+  //
+  // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" description="$tdmlDescription" roundTrip="onePass">
+  //   <tdml:document>
+  //     <tdml:documentPart type="file">$dataPath</tdml:documentPart>
+  //   <tdml:document>
+  //   <tdml:infoset>
+  //     <tdml:dfdlInfoset type="file">$infosetPath</tdml:dfdlInfoset>
+  //   </tdml:infoset>
+  // </tdml:parserTestCase>
+  //
+  // infosetPath:     Path to the infoset
+  // dataPath:        Path to the data file
+  // schemaPath:      Path to the DFDL Schema
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  //
+  // Returns the ParserTestCase object created with the applied paths
+  def createTestCase(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String
+  ): ParserTestCaseType = {
+    val factory = new ObjectFactory()
+
+    val dfdlInfoset = factory.createDfdlInfosetType()
+    dfdlInfoset.setType("file")
+    dfdlInfoset.getContent().add(infosetPath)
+
+    val infoset = factory.createInfosetType()
+    infoset.setDfdlInfoset(dfdlInfoset)
+
+    val docPart = factory.createDocumentPartType()
+    docPart.setType(DocumentPartTypeEnum.FILE)
+    docPart.setValue(dataPath)
+
+    // These lines are necessary because there is no @XmlRootElement annotation on the DocumentPartType class in JAXB
+    // Ideally, we would want to have JAXB add the annotation - probably with the bindings.xjb file. The only way I found
+    //   that did that required an external plugin just to add the annotation (https://github.com/highsource/jaxb2-annotate-plugin).
+    // We are getting the namespace from the JAXB class so that we don't have to hard-code it here
+    // Unfortunately, it seems like hard-coding the class name isn't an easy thing to avoid. There is a name in the XmlType
+    //   annotation, but it is documentPartType instead of documentPart. We would need to remove the Type from this anyway.
+    val tdmlNamespacePrefix = classOf[DocumentPartType].getAnnotation(classOf[XmlType]).namespace()
+    val docPartElement = new JAXBElement[DocumentPartType](
+      new QName(tdmlNamespacePrefix, "documentPart"),
+      classOf[DocumentPartType],
+      docPart
+    )
+
+    val doc = factory.createDocumentType()
+    doc.getContent().add(docPartElement)
+
+    val testCase = factory.createParserTestCaseType()
+    testCase.setName(tdmlName)
+    testCase.setRoot("file")
+    testCase.setModel(schemaPath)
+    testCase.setDescription(tdmlDescription)
+    testCase.setRoundTrip(RoundTripType.ONE_PASS)
+    testCase.getTutorialOrDocumentOrInfoset().add(doc)
+    testCase.getTutorialOrDocumentOrInfoset().add(infoset)
+
+    return testCase
+  }
+
+  // Generate a new TDML file.
+  // There is a suiteName attribute in the root element (TestSuite) of the document. This is set to $tdmlName
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  //
+  // There is a suiteName attribute in the root element of the document. This is set to tdmlName
+  def generate(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+    val factory = new ObjectFactory()
+
+    val testSuite = factory.createTestSuite()
+    testSuite.setSuiteName(tdmlName)
+    testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Append a new test case to an existing TDML file.
+  // Paths given to this function should be relative as it should be expected for the TDML files to be shared on the mailing list
+  //
+  // infosetPath:     Path to the infoset
+  // schemaPath:      Path to the DFDL Schema
+  // dataPath:        Path to the data file
+  // tdmlName:        Name of the DFDL operation
+  // tdmlDescription: Description for the DFDL operation
+  // tdmlPath:        Path to the TDML file
+  def append(
+      infosetPath: String,
+      schemaPath: String,
+      dataPath: String,
+      tdmlName: String,
+      tdmlDescription: String,
+      tdmlPath: String
+  ): Unit = {
+
+    val testSuite = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+
+    testSuite
+      .getTutorialOrParserTestCaseOrDefineSchema()
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription))
+
+    val marshaller = JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
+    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
+  }
+
+  // Find the parameters needed to execute a DFDL parse based on the given TDML Parameters
+  //
+  // tdmlName:        Test case name to run
+  // tdmlDescription: Description of test case to run
+  // tdmlPath:        File path of TDML file to extract test case from
+  //
+  // Returns a tuple containing the following (Path to DFDL Schema, Path to Data File)
+  // All paths returned could be either relative or absolute - it depends on what exists in the TDML file
+  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): (String, String) = {
+    val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent()
+
+    val testCaseList = JAXBContext
+      .newInstance(classOf[TestSuite])
+      .createUnmarshaller()
+      .unmarshal(new File(tdmlPath))
+      .asInstanceOf[TestSuite]
+      .getTutorialOrParserTestCaseOrDefineSchema()
+
+    testCaseList.forEach { tc =>
+      tc match {
+        case ptc: ParserTestCaseType =>
+          if (ptc.getName() == tdmlName && ptc.getDescription() == tdmlDescription) {
+            ptc.getTutorialOrDocumentOrInfoset().forEach { dis =>
+              dis match {
+                case doc: DocumentType =>
+                  // The right part of the tuple only takes the first DocumentPart inside the Document.
+                  // In the case that there are more than one, any extras will be ignored.
+                  val schemaPath = Paths.get(basePath + File.separator + ptc.getModel()).normalize().toString()
+                  val dataPath = Paths
+                    .get(
+                      basePath + File.separator + doc
+                        .getContent()
+                        .get(0)
+                        .asInstanceOf[JAXBElement[DocumentPartType]]
+                        .getValue()
+                        .getValue()
+                    )
+                    .normalize()
+                    .toString()
+                  return (schemaPath, dataPath)
+              }
+            }
+          }
+      }
+    }
+
+    // If there is no test case in the TDML file meeting the name/description criteria, return empty

Review Comment:
   Suggestion: the comment implies that the return type should be `Option[(String, String)]`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1244595310

   There are a couple of places that I could have put this, so I'll just put it as a separate comment at the end:
   
   This last push includes the bigger changes - removing hard coded classpath creation and downloading the daffodil-lib jar to get the schema files
   
   I wanted to note that what appears to be duplication of dependencies in the libraryDependencies and xjcLibs keys is intentional and necessary. It appears that including a jar in libraryDependencies is necessary for downloading it, and including a jar in xjcLibs is necessary for properly setting up the classpath for the JAXB generation.
   
   Anyways, it looks like the Windows build is failing again because paths are different somewhere...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on a diff in pull request #253: Daffodil vscode tdml

Posted by GitBox <gi...@apache.org>.
arosien commented on code in PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#discussion_r970007188


##########
.vscode/launch.json:
##########
@@ -48,6 +48,15 @@
 			],
 			"internalConsoleOptions": "openOnSessionStart",
 			"preLaunchTask": "npm: compile"
+		},
+		{
+			"type": "scala",
+			"request": "launch",
+			"name": "DAPodil",

Review Comment:
   You're right it's only for extension developers, and one would only see this if they cloned the repo and were using VS Code, so I think it's ok to be specific about its DAP purpose.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] arosien commented on pull request #253: Daffodil VsCode TDML

Posted by "arosien (via GitHub)" <gi...@apache.org>.
arosien commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1466387921

   @Shanedell would you be available to take a look at this? If you don't feel too comfortable going in to the Scala you could just check it out and try out the feature.
   
   @mbeckerle, @stevedlawrence need your 👀 also.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] Shanedell commented on pull request #253: Daffodil VsCode TDML

Posted by "Shanedell (via GitHub)" <gi...@apache.org>.
Shanedell commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1466541961

   @scholarsmate Don't pull main into branches. The workflow is to rebase and force push to sync branches with main. @stevedlawrence Can correct me if I am misspeaking but I believe we don't want these merged in commits inside of branches or the repository.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [daffodil-vscode] michael-hoke commented on pull request #253: Daffodil VsCode TDML

Posted by "michael-hoke (via GitHub)" <gi...@apache.org>.
michael-hoke commented on PR #253:
URL: https://github.com/apache/daffodil-vscode/pull/253#issuecomment-1466603527

   Thanks for looking @Shanedell 
   
   The force push that just happened was reverting the merge commit and updating branches to point to the latest apache:main.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org