Class ScriptExecutorFactory


  • public abstract class ScriptExecutorFactory
    extends java.lang.Object
    Abstraction for finding script executors to allow us to invoke scripts from java.

    NOTE: This is intended purely for executing java-embedable scripting languages. That is, the execution model is assumed to be same-JVM, so scripts can have side effects on objects passed to the script. This is used internally by the connector framework in its implementation of ScriptOnConnectorApiOp and should be used by connectors should they need to have a custom implementation of ScriptOnConnectorOp. This is not intended for use by connectors that implement ScriptOnResourceOp.

    • Constructor Detail

      • ScriptExecutorFactory

        public ScriptExecutorFactory()
    • Method Detail

      • getSupportedLanguages

        public static java.util.Set<java.lang.String> getSupportedLanguages()
        Returns the set of supported languages.
        Returns:
        The set of supported languages.
      • newInstance

        public static ScriptExecutorFactory newInstance​(java.lang.String language)
        Creates a ScriptExecutorFactory for the given language.
        Parameters:
        language - The name of the language
        Returns:
        The script executor factory
        Throws:
        java.lang.IllegalArgumentException - If the given language is not supported.
      • newScriptExecutor

        public abstract ScriptExecutor newScriptExecutor​(java.lang.ClassLoader loader,
                                                         java.lang.String script,
                                                         boolean compile)
        Creates a script executor for the given script.
        Parameters:
        loader - The classloader that contains the java classes that the script should have access to.
        script - The script text.
        compile - A hint to tell the script executor whether or not to compile the given script. This need not be implemented by all script executors. If true, the caller is saying that they intend to call the script multiple times with different arguments, so compile if possible.
        Returns:
        A script executor.
      • getLanguageName

        public abstract java.lang.String getLanguageName()
        Returns the name of the language supported by this factory.
        Returns:
        the name of the language.