Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Recorder JSON file format



This article presents the JSON file format for the recorder Application. Note that this format will be used for recording only if the value of the "format" property is "json".

Note that the JSON file format does not allow for the moment to replay it in the player Application.

Overview

The JSON file format allows to record the the services for which the recorder module is a subscriber. There are several options to serialize the record:
  • Either in only one JSON file for all the records, or with one file for each notification ("splitFiles" and "splitNamePattern" options)
  • Serializing for each notification only the service which notifies the module, or all the services for which the module is a subscriber ("includeAllServices" option)

Properties

Several properties are used only if the format is "json":
  • "splitFiles": true if the recorded scenario will be splitted, with one file per sercvice reception. If will only be used if the format is the json format. Note that by default the record is not splitted in several files, but is in only one file
  • "includeAllServices": true if all services should be included in each recorder event
  • "splitNamePattern": the pattern of splitted files
  • "includeAllServices": true if all services should be included in each recorder event
  • "splitIndexName": the name for the index element in splitted files
  • "splitTimeName": the name for the time and absolut time elements in splitted files
  • "splitGroups": the specification of the groups of services to consider for splitted files

If the "splitFiles" property is true, then the path is the path of the directory which will contain the files. This directory must exist, and may not be empty, but you will see a warning if it contain any json files prior to the recording.

Properties for splitting the file


  • The boolean "splitFiles" property allows to split the JSON files. If the property is set to true, there will be one file for each notification
  • The boolean "includeAllServices" specifies if only the notified service will be included in the file, (the default), or if all the subscribed services will be included if the property is set to true
The "splitNamePattern" is the pattern for the splitted file. It specifies the template for the splitted file name:
  • The ${YEAR} variable will output the current year
  • The ${MONTH} variable will output the current month (as a number)
  • The ${DAY} variable will output the current day in the month (as a number)
  • The ${INDEX} variable will output the index of the file
For example, with the following "splitNamePattern" content:
      ${YEAR}_${MONTH}_${DAY}_scenario_${INDEX}
We will have files with names such as:
      2024-3-26-scenario-6.json
The "splitGroups" is used only if the "includeAllServices" property is not present or false, and is used to groups services in the records. See splitGroups property and recorder splitFiles options for how to use this property.

The "splitIndexName" is the name of the index element which is included in the json content (the default is "index").

The "splitTimeName" is the name used for the time and absolute time elements which are included in the json content (the defaults are "time" and "absolutetime").

splitGroups property

The "splitGroups" is used only if the "includeAllServices" property is not present or false. It is used to groups services in the records. The idea of this property is:
  • To only create a record for some specified services
  • To include in the record the content of all services associated with the specified service

Contrary to the includeAllServices property where each serice notification wlll create a record with the content of all services for which the recorder is a subscriber, only some services will create a record. This property is useful if the invoker of some services will always invoke a list of related services, which means that it is useful to merge in the same record several services.

Examples

We use the example of the first tutorial:
      <applications>
         <application name="eventAppli">
            <deployment>
               <lib url="samplesEvent.jar" />
            </deployment>
            <modules>
               <module name="EventModule"> 
                  <implementation path="org.da.samples.protoframework.event.EventModule" >
                     <initEntryPoint method="init" />
                     <defaultReceiveEntryPoint method="subscribe" />
                  </implementation>
                  <interfaces>
                     <eventSend service="event" attach="attach"/>
                     <subscribe service="published" />
                  </interfaces>             
               </module>
            </modules>
         </application>      
         <application name="publishAppli">
            <deployment>
               <lib url="samplesPublish.jar" />
            </deployment>
            <modules>
               <module name="PublishModule"> 
                  <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                     <initEntryPoint method="init" />
                     <defaultReceiveEntryPoint method="subscribe" />
                     <defaultSendEntryPoint method="publish" /> 
                  </implementation>
                  <interfaces>
                     <eventReceived service="event"/>
                     <cyclic service="published" frequency="200ms" attach="attach"/>
                  </interfaces>             
               </module>
            </modules>
         </application>     
      <application name="recorder">
            <deployment>
               <lib url="recorderEngine.jar"/>
            </deployment>   
            <modules>
               <module name="recorder">	
                  <interfaces>
                     <eventReceived service="event"/>
                     <subscribe service="published" />
                  </interfaces>
               </module>			
            </modules>			
         </application>        
      </applications>

One file format specification

There is by default only one file for all the records. For example the following properties configuration specifies the properties for this case:
      <properties>   
         <application name="recorder">
            <module name="recorder">
               <moduleProperty value="true" key="autoStart"/>
               <moduleProperty value="scenario.json" key="scenario"/>   
               <moduleProperty value="json" key="format"/>  
            </module>	
         </application>   
      </properties>
An example of the output JSON file is:
      {
      _  "date": "20240326",
      _  "records": [
      _  {
      _  "absoluteTime": 1711467240167,
      _  "time": 195,
      _  "published":  {"value": 1}
      _  },
      _  {
      _  "absoluteTime": 1711467240959,
      _  "time": 987,
      _  "published":  {"value": 5}
      _  },
      _  {
      _  "absoluteTime": 1711467243099,
      _  "time": 3127,
      _  "event":  {"event": true}
      _  },
      _  {
      _  "absoluteTime": 1711467245161,
      _  "time": 5189,
      _  "published":  {"value": 20}
      _  }
      _  ]
      }      

Splitted file format specification


The "splitFiles" property allows to serialize one file for each notification. For example the following properties configuration specifies the properties for this case:
      <properties>   
         <application name="recorder">
            <module name="recorder">
               <moduleProperty value="true" key="autoStart"/>
               <moduleProperty value="scenario.json" key="scenario"/>   
               <moduleProperty value="true" key="splitFiles"/>  
               <moduleProperty value="${YEAR}-${MONTH}-${DAY}-scenario-${INDEX}" key="splitNamePattern"/>  
               <moduleProperty value="json" key="format"/>  
            </module>	
         </application>   
      </properties>
An example of the output JSON file for one notification is:
      {
      _  "absoluteTime": 1711461669201,
      _  "time": 396,
      _  "published":  {"value": 2}
      }
If the "includeAllServices" property is set to true, the result will be:
      {
      _  "absoluteTime": 1711461669201,
      _  "time": 396,
      _  "published":  {"value": 2},
      _  "event":  {"event": false}
      }

See also


Categories: builtin-applis

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence