org.rexxla.bsf.engines.rexx

## Class RexxScriptEngineFactory

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

- All Implemented Interfaces:
    javax.script.ScriptEngineFactory

      public class RexxScriptEngineFactory
      extends java.lang.Object
      implements javax.script.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 and 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 RexxScriptEngineFactory` | `DEFAULT_REXX_SCRIPT_ENGINE_FACTORY` If a RexxScriptEngine gets created directly, allow it to fetch an instance of the RexxScriptEngineFactory.
    `protected static java.lang.String` | `ENGINE_NAME`
    `protected static java.lang.String` | `ENGINE_VERSION`
    `protected static java.util.List<java.lang.String>` | `EXTENSIONS`
    `protected static java.lang.String` | `LANGUAGE_NAME`
    `protected static java.lang.String` | `LANGUAGE_VERSION`
    `protected static java.util.List<java.lang.String>` | `MIME_TYPES`
    `protected static java.util.List<java.lang.String>` | `SCRIPT_ENGINE_SHORT_NAMES`
    `protected static java.lang.String` | `SHORT_NAME`
    `protected static java.lang.String` | `THREADING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RexxScriptEngineFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getEngineName()` Returns the full name of the ScriptEngine.
    `java.lang.String` | `getEngineVersion()` Returns the version of the ScriptEngine.
    `java.util.List<java.lang.String>` | `getExtensions()` Returns an immutable list of filename extensions, which generally identify scripts written in the language supported by this ScriptEngine.
    `static java.lang.String` | `getGMTFormattedDateAsISO()` Utility method that creates and returns a GMT-based ISO date string.
    `java.lang.String` | `getLanguageName()` Returns the name of the scripting langauge supported by this ScriptEngine.
    `java.lang.String` | `getLanguageVersion()` Returns the version of the scripting language supported by this ScriptEngine.
    `java.lang.String` | `getMethodCallSyntax(java.lang.String obj, java.lang.String m, java.lang.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.
    `java.util.List<java.lang.String>` | `getMimeTypes()` Returns an immutable list of mimetypes, associated with scripts that can be executed by the engine.
    `java.lang.String` | `getName()` Returns the short name of the scripting language supported by this ScriptEngine.
    `java.util.List<java.lang.String>` | `getNames()` Returns an immutable list of short names for the ScriptEngine, which may be used to identify the ScriptEngine by the ScriptEngineManager.
    `java.lang.String` | `getOutputStatement(java.lang.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.
    `java.lang.Object` | `getParameter(java.lang.String key)` Returns the value of an attribute whose meaning may be implementation-specific.
    `java.lang.String` | `getProgram(java.lang.String... statements)` Returns a valid scripting language executable program with given statements.
    `javax.script.ScriptEngine` | `getScriptEngine()` Creates and returns a new RexxScriptEngine instance.
    `static java.lang.String` | `getStringLiteral(java.lang.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 Detail

    - #### 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 java.lang.String ENGINE_NAME

      See Also:
        Constant Field Values

    - #### ENGINE_VERSION

          protected static final java.lang.String ENGINE_VERSION

      See Also:
        Constant Field Values

    - #### EXTENSIONS

          protected static final java.util.List<java.lang.String> EXTENSIONS

    - #### LANGUAGE_NAME

          protected static final java.lang.String LANGUAGE_NAME

      See Also:
        Constant Field Values

    - #### LANGUAGE_VERSION

          protected static java.lang.String LANGUAGE_VERSION

    - #### SHORT_NAME

          protected static final java.lang.String SHORT_NAME

      See Also:
        Constant Field Values

    - #### MIME_TYPES

          protected static final java.util.List<java.lang.String> MIME_TYPES

    - #### SCRIPT_ENGINE_SHORT_NAMES

          protected static final java.util.List<java.lang.String> SCRIPT_ENGINE_SHORT_NAMES

    - #### THREADING

          protected static final java.lang.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 Detail

    - #### RexxScriptEngineFactory

          public RexxScriptEngineFactory()

  - ### Method Detail

    - #### getEngineName

          public java.lang.String getEngineName()

      Returns the full name of the ScriptEngine.
      Specified by:
        `getEngineName` in interface `javax.script.ScriptEngineFactory`

    - #### getEngineVersion

          public java.lang.String getEngineVersion()

      Returns the version of the ScriptEngine.
      Specified by:
        `getEngineVersion` in interface `javax.script.ScriptEngineFactory`

    - #### getExtensions

          public java.util.List<java.lang.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 `javax.script.ScriptEngineFactory`

    - #### getLanguageName

          public java.lang.String getLanguageName()

      Returns the name of the scripting langauge supported by this ScriptEngine.
      Specified by:
        `getLanguageName` in interface `javax.script.ScriptEngineFactory`

    - #### getLanguageVersion

          public java.lang.String getLanguageVersion()

      Returns the version of the scripting language supported by this ScriptEngine.
      Specified by:
        `getLanguageVersion` in interface `javax.script.ScriptEngineFactory`

    - #### getName

          public java.lang.String getName()

      Returns the short name of the scripting language supported by this ScriptEngine.

    - #### getMethodCallSyntax

          public java.lang.String getMethodCallSyntax(java.lang.String obj,
                                                      java.lang.String m,
                                                      java.lang.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 `javax.script.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 java.util.List<java.lang.String> getMimeTypes()

      Returns an immutable list of mimetypes, associated with scripts that can be executed by the engine.
      Specified by:
        `getMimeTypes` in interface `javax.script.ScriptEngineFactory`

    - #### getNames

          public java.util.List<java.lang.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 `javax.script.ScriptEngineFactory`

    - #### getOutputStatement

          public java.lang.String getOutputStatement(java.lang.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 `javax.script.ScriptEngineFactory`

    - #### getStringLiteral

          public static java.lang.String getStringLiteral(java.lang.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 java.lang.Object getParameter(java.lang.String key)

      Returns the value of an attribute whose meaning may be implementation-specific.
      Specified by:
        `getParameter` in interface `javax.script.ScriptEngineFactory`

    - #### getProgram

          public java.lang.String getProgram(java.lang.String... statements)

      Returns a valid scripting language executable program with given statements.
      Specified by:
        `getProgram` in interface `javax.script.ScriptEngineFactory`

    - #### getScriptEngine

          public javax.script.ScriptEngine getScriptEngine()

      Creates and returns a new RexxScriptEngine instance.
      Specified by:
        `getScriptEngine` in interface `javax.script.ScriptEngineFactory`

    - #### getGMTFormattedDateAsISO

          public static java.lang.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