Class DataSonnetErrorMessageFormatter

java.lang.Object
org.frankframework.errormessageformatters.ErrorMessageFormatter
org.frankframework.errormessageformatters.DataSonnetErrorMessageFormatter
All Implemented Interfaces:
IConfigurable, IErrorMessageFormatter, IScopeProvider, IWithParameters

@NullMarked public class DataSonnetErrorMessageFormatter extends ErrorMessageFormatter implements IErrorMessageFormatter, IConfigurable, IScopeProvider, IWithParameters
Applies a DataSonnet .jsonnet JSON transformation file to the standard JSON error message generated by the ErrorMessageFormatter.

If the transformation does not succeed, this 'standard' error message is returned in JSON format and an exception is logged.

Since:
9.2
See Also:
Parameters
All parameters are added to the .jsonnet stylesheet. Parameter names must be unique.
  • Constructor Details

    • DataSonnetErrorMessageFormatter

      public DataSonnetErrorMessageFormatter()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • format

      public Message format(@Nullable String errorMessage, @Nullable Throwable t, @Nullable HasName location, @Nullable Message originalMessage, PipeLineSession session)
      Description copied from class: ErrorMessageFormatter
      Format the available parameters into an XML or JSON message.
      Override this method in subclasses to obtain the required behaviour.
      Specified by:
      format in interface IErrorMessageFormatter
      Overrides:
      format in class ErrorMessageFormatter
    • setStyleSheetName

      @Mandatory public void setStyleSheetName(String styleSheetName)
      Set a DataSonnet stylesheet to transform the default JSON error message to a custom format.
    • setOutputFileFormat

      public void setOutputFileFormat(DataSonnetOutputType outputType)
      Output file format. DataSonnet is semi-capable of converting the converted JSON to a different format.
      Default value
      JSON
    • setOutputType

      @Deprecated @ConfigurationWarning("for documentation purposes we've renamed this field to [outputFileFormat]") public void setOutputType(DataSonnetOutputType outputType)
      Deprecated.
    • setMessageFormat

      @Protected public void setMessageFormat(DocumentFormat messageFormat)
      Description copied from class: ErrorMessageFormatter
      Format the error message as XML or as JSON.
      Overrides:
      setMessageFormat in class ErrorMessageFormatter
    • addParameter

      public void addParameter(IParameter p)
      Specified by:
      addParameter in interface IWithParameters
    • getParameterList

      public ParameterList getParameterList()
      Specified by:
      getParameterList in interface IWithParameters
    • setImports

      public void setImports(String imports)
      List of stylesheets / DataSonnet files imported by the stylesheet to be executed. Stylesheets are only evaluated as JSonnet files if the filename has the extension .ds or .libsonnet.

      The list of stylesheets is expected to be a comma-separated list of files, which are loaded from the configuration. Import statements in DataSonnet cannot be used unless each file to be imported is listed here in the imports attribute.

      Imported files may not be able to use DataSonnet functions from DataSonnet's own libraries, normally available as ds.map() and the like. The cause for this is not yet known.