Class DataTransformerRegistry


  • public class DataTransformerRegistry
    extends Object
    Registry for all available on runtime DataTransformers for performing data input and output transformation. Be default it discovers and registers all available JSR 223 compliant scripting languages wrapped with JavaScriptingDataTransformer.
    Discovery is based on ScriptEngineManager.getEngineFactories() thus any scripting engines should follow instructions for Java Scripting.
    Each Java Scripting engine will get dedicated instance of JavaScriptingDataTransformer which will be registered under one or more key in the registry. The key will be built as follows>
    • constant prefix for URI like syntax : http://www.java.com/
    • names provided by given ScriptEngineFactory - JavaScript, js,....
    For example default JavaScript scripting engine will be registered under following keys:
    • http://www.java.com/js
    • http://www.java.com/rhino
    • http://www.java.com/JavaScript
    • http://www.java.com/javascript
    • http://www.java.com/ECMAScript
    • http://www.java.com/ecmascript
    when defining the language for transformation that of data input/output the complete key should be provided. <dataInputAssociation>
      <sourceRef>s</sourceRef>
      <targetRef>_2_param</targetRef>
      <transformation language="http://www.java.com/javascript">s.toUpperCase()</transformation>
    </dataInputAssociation>

    Besides JSR 223 scripting engine, there is MVEL based transformer available out of the box that is registered under http://www.mvel.org/2.0 key.
    Custom implementations can be provided and if they are compliant with JSR 223 then follows above registration approach otherwise they need to be registered manually with register method.
    See Also:
    JavaScriptingDataTransformer
    • Constructor Detail

      • DataTransformerRegistry

        protected DataTransformerRegistry()
    • Method Detail

      • register

        public void register​(String language,
                             org.kie.api.runtime.process.DataTransformer transformer)
      • find

        public org.kie.api.runtime.process.DataTransformer find​(String languge)