Package org.rexxla.bsf.engines.rexx

# Class RexxScriptEngineFactory

java.lang.Object
org.rexxla.bsf.engines.rexx.RexxScriptEngineFactory

All Implemented Interfaces:
  `ScriptEngineFactory`

public class RexxScriptEngineFactory extends Object implements ScriptEngineFactory
Class that implements the `javax.script.ScriptEngineFactory` interface for the ooRexx support.

Since:
  2015-05-11
Version:
  100.20220806
Author:
  Rony G. Flatscher

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static boolean`
  `bSay4Output`
  Field controls whether `getOutputStatement(String toDisplay)` uses the Rexx `SAY` (always appends a line-feed character) keyword statement or the ooRexx `.output` monitor with the `charOut` method (will output the string as is without appending anything).
  `static final RexxScriptEngineFactory`
  `DEFAULT_REXX_SCRIPT_ENGINE_FACTORY`
  If a RexxScriptEngine gets created directly, allow it to fetch an instance of the RexxScriptEngineFactory.
  `protected static final String`
  `ENGINE_NAME`
  `protected static final String`
  `ENGINE_VERSION`
  `protected static final List<String>`
  `EXTENSIONS`
  `protected static final String`
  `LANGUAGE_NAME`
  `protected static String`
  `LANGUAGE_VERSION`
  `protected static final List<String>`
  `MIME_TYPES`
  `protected static final List<String>`
  `SCRIPT_ENGINE_SHORT_NAMES`
  `protected static final String`
  `SHORT_NAME`
  `protected static final String`
  `THREADING`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RexxScriptEngineFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getEngineName()`
  Returns the full name of the ScriptEngine.
  `String`
  `getEngineVersion()`
  Returns the version of the ScriptEngine.
  `List<String>`
  `getExtensions()`
  Returns an immutable list of filename extensions, which generally identify scripts written in the language supported by this ScriptEngine.
  `static String`
  `getGMTFormattedDateAsISO()`
  Utility method that creates and returns a GMT-based ISO date string.
  `String`
  `getLanguageName()`
  Returns the name of the scripting langauge supported by this ScriptEngine.
  `String`
  `getLanguageVersion()`
  Returns the version of the scripting language supported by this ScriptEngine.
  `String`
  `getMethodCallSyntax(String obj, String m, String... args)`
  Returns a String which can be used to invoke a method of a Java object using the syntax of the supported scripting language.
  `List<String>`
  `getMimeTypes()`
  Returns an immutable list of mimetypes, associated with scripts that can be executed by the engine.
  `String`
  `getName()`
  Returns the short name of the scripting language supported by this ScriptEngine.
  `List<String>`
  `getNames()`
  Returns an immutable list of short names for the ScriptEngine, which may be used to identify the ScriptEngine by the ScriptEngineManager.
  `String`
  `getOutputStatement(String toDisplay)`
  Returns a String that can be used as a statement to display the specified String using the syntax of the supported scripting language.
  `Object`
  `getParameter(String key)`
  Returns the value of an attribute whose meaning may be implementation-specific.
  `String`
  `getProgram(String... statements)`
  Returns a valid scripting language executable program with given statements.
  `ScriptEngine`
  `getScriptEngine()`
  Creates and returns a new RexxScriptEngine instance.
  `static String`
  `getStringLiteral(String toDisplay)`
  Creates and returns a quoted Rexx string, with carriage return (CR) and line-feed (LF) characters escaped as concatenated Rexx hex strings.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_REXX_SCRIPT_ENGINE_FACTORY

    public static final RexxScriptEngineFactory DEFAULT_REXX_SCRIPT_ENGINE_FACTORY
    If a RexxScriptEngine gets created directly, allow it to fetch an instance of the RexxScriptEngineFactory.

  - ### ENGINE_NAME

    protected static final String ENGINE_NAME
    See Also:
      - Constant Field Values

  - ### ENGINE_VERSION

    protected static final String ENGINE_VERSION
    See Also:
      - Constant Field Values

  - ### EXTENSIONS

    protected static final List<String> EXTENSIONS

  - ### LANGUAGE_NAME

    protected static final String LANGUAGE_NAME
    See Also:
      - Constant Field Values

  - ### LANGUAGE_VERSION

    protected static String LANGUAGE_VERSION

  - ### SHORT_NAME

    protected static final String SHORT_NAME
    See Also:
      - Constant Field Values

  - ### MIME_TYPES

    protected static final List<String> MIME_TYPES

  - ### SCRIPT_ENGINE_SHORT_NAMES

    protected static final List<String> SCRIPT_ENGINE_SHORT_NAMES

  - ### THREADING

    protected static final String THREADING
    See Also:
      - Constant Field Values

  - ### bSay4Output

    public static boolean bSay4Output
    Field controls whether `getOutputStatement(String toDisplay)` uses the Rexx `SAY` (always appends a line-feed character) keyword statement or the ooRexx `.output` monitor with the `charOut` method (will output the string as is without appending anything). This field is set to `true` by default causing the `SAY` keyword statement to be used.

- ## Constructor Details

  - ### RexxScriptEngineFactory

    public RexxScriptEngineFactory()

- ## Method Details

  - ### getEngineName

    public String getEngineName()
    Returns the full name of the ScriptEngine.
    Specified by:
      `getEngineName` in interface `ScriptEngineFactory`

  - ### getEngineVersion

    public String getEngineVersion()
    Returns the version of the ScriptEngine.
    Specified by:
      `getEngineVersion` in interface `ScriptEngineFactory`

  - ### getExtensions

    public List<String> getExtensions()
    Returns an immutable list of filename extensions, which generally identify scripts written in the language supported by this ScriptEngine.
    Specified by:
      `getExtensions` in interface `ScriptEngineFactory`

  - ### getLanguageName

    public String getLanguageName()
    Returns the name of the scripting langauge supported by this ScriptEngine.
    Specified by:
      `getLanguageName` in interface `ScriptEngineFactory`

  - ### getLanguageVersion

    public String getLanguageVersion()
    Returns the version of the scripting language supported by this ScriptEngine.
    Specified by:
      `getLanguageVersion` in interface `ScriptEngineFactory`

  - ### getName

    public String getName()
    Returns the short name of the scripting language supported by this ScriptEngine.

  - ### getMethodCallSyntax

    public String getMethodCallSyntax(String obj, String m, String... args)
    Returns a String which can be used to invoke a method of a Java object using the syntax of the supported scripting language.
    Specified by:
      `getMethodCallSyntax` in interface `ScriptEngineFactory`
    Parameters:
      `obj` - - The name representing the object whose method is to be invoked.
      `m` - - The name of the method to invoke.
      `args` - - names of the arguments in the method call.

  - ### getMimeTypes

    public List<String> getMimeTypes()
    Returns an immutable list of mimetypes, associated with scripts that can be executed by the engine.
    Specified by:
      `getMimeTypes` in interface `ScriptEngineFactory`

  - ### getNames

    public List<String> getNames()
    Returns an immutable list of short names for the ScriptEngine, which may be used to identify the ScriptEngine by the ScriptEngineManager.
    Specified by:
      `getNames` in interface `ScriptEngineFactory`

  - ### getOutputStatement

    public String getOutputStatement(String toDisplay)
    Returns a String that can be used as a statement to display the specified String using the syntax of the supported scripting language. The boolean field `bSay4Output` value controls whether `SAY` (`true`) or `.output~charOut` (`false`) gets employed.
    Specified by:
      `getOutputStatement` in interface `ScriptEngineFactory`

  - ### getStringLiteral

    public static String getStringLiteral(String toDisplay)
    Creates and returns a quoted Rexx string, with carriage return (CR) and line-feed (LF) characters escaped as concatenated Rexx hex strings.
    Parameters:
      `toDisplay` - the string to encode as a Rexx string literal, if null then ".nil" gets returned
    Returns:
      a Rexx encoded string

  - ### getParameter

    public Object getParameter(String key)
    Returns the value of an attribute whose meaning may be implementation-specific.
    Specified by:
      `getParameter` in interface `ScriptEngineFactory`

  - ### getProgram

    public String getProgram(String... statements)
    Returns a valid scripting language executable program with given statements.
    Specified by:
      `getProgram` in interface `ScriptEngineFactory`

  - ### getScriptEngine

    public ScriptEngine getScriptEngine()
    Creates and returns a new RexxScriptEngine instance.
    Specified by:
      `getScriptEngine` in interface `ScriptEngineFactory`

  - ### getGMTFormattedDateAsISO

    public static String getGMTFormattedDateAsISO()
    Utility method that creates and returns a GMT-based ISO date string.
    Returns:
      the current ISO date, edited to be usable as a filename