jadams-tresys commented on a change in pull request #343: Daffodil 2302 fixes 
external variables API difficulties
URL: https://github.com/apache/incubator-daffodil/pull/343#discussion_r401714244
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
 ##########
 @@ -96,15 +106,41 @@ class SerializableDataProcessor(
  * The very last aspects of compilation, and the start of the
  * back-end runtime.
  */
-class DataProcessor(
-  val ssrd: SchemaSetRuntimeData,
-  protected var tunablesObj: DaffodilTunables // Compiler-set tunables
-)
+class DataProcessor private (
+  //
+  // Once the deprecated API goes away, these var can become val.
+  //
+  var ssrd: SchemaSetRuntimeData,
+  var tunables: DaffodilTunables, // Compiler-set tunables
+  @TransientParam var areDebugging : Boolean, // Transient so they are 
forgotten upon serialization and restore
+  @TransientParam var optDebugger : Option[Debugger],
+  @TransientParam var validationMode: ValidationMode.Type,
+  var variableMap: VariableMap,
+  @TransientParam private var externalVars: Queue[Binding])
   extends DFDL.DataProcessor with Logging
   with HasSetDebugger with Serializable
   with MultipleEventHandler {
 
-  def tunable = getTunables
+  /**
+   * The compilerExternalVars argument supports the deprecated feature to 
assign external var bindings
+   * on the compiler object.
+   *
+   * These are just incorporated into the initial variable map of the data 
processor.
+   */
+  def this(ssrd: SchemaSetRuntimeData, tunables:DaffodilTunables, 
compilerExternalVars: Queue[Binding] = Queue.empty) =
+    this(ssrd, tunables, false, None, ValidationMode.Off,
+      ExternalVariablesLoader.loadVariables(compilerExternalVars, ssrd, 
ssrd.originalVariables),
+      compilerExternalVars)
+
+  private def copy(
 
 Review comment:
   This will come in handy with some of the issues I was running into with 
making Variables mutable.  Was running into issues with the DataProcessor being 
shared between threads, so the parse thread was effecting the state of 
variables for unparse and I was going to need to implement a copying function 
just like this.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to