Class AbstractScriptProcedureSourceServiceFactory

    • Constructor Detail

      • AbstractScriptProcedureSourceServiceFactory

        public AbstractScriptProcedureSourceServiceFactory()
    • Method Detail

      • getSourceName

        protected abstract java.lang.String getSourceName()
        Obtains the source name for this ProcedureSource.
        Returns:
        Source name for this ProcedureSource.
      • getScriptFileExtensions

        protected abstract java.lang.String[] getScriptFileExtensions​(SourceContext context)
                                                               throws java.lang.Exception
        Obtains the extensions for the script resource.
        Parameters:
        context - SourceContext.
        Returns:
        Extensions for the script resource.
        Throws:
        java.lang.Exception - If fails to obtain the file extensions.
      • getScriptEngineName

        protected abstract java.lang.String getScriptEngineName​(SourceContext context)
                                                         throws java.lang.Exception
        Obtains the name of the ScriptEngine.
        Parameters:
        context - SourceContext.
        Returns:
        Name of the ScriptEngine.
        Throws:
        java.lang.Exception - If fails to obtain the name of the ScriptEngine.
      • decorateScriptEngine

        protected void decorateScriptEngine​(javax.script.ScriptEngine engine,
                                            SourceContext context)
                                     throws java.lang.Exception
        Enables overriding to decorate the ScriptEngine.
        Parameters:
        engine - ScriptEngine.
        context - SourceContext.
        Throws:
        java.lang.Exception - If fails to decorate the ScriptEngine.
      • getSetupScriptPath

        protected java.lang.String getSetupScriptPath​(SourceContext context)
                                               throws java.lang.Exception
        Obtains the path to the setup script.
        Parameters:
        context - SourceContext.
        Returns:
        Path to the setup script or null if no setup.
        Throws:
        java.lang.Exception - If fails to obtain the setup script path.
      • getMetaDataScriptPath

        protected abstract java.lang.String getMetaDataScriptPath​(SourceContext context)
                                                           throws java.lang.Exception
        Obtains the path to the script that extracts the function meta-data.
        Parameters:
        context - SourceContext.
        Returns:
        Path to the script that extracts the function meta-data.
        Throws:
        java.lang.Exception - If fails to obtain the path to the function meta-data script.
      • loadSetupScript

        protected java.lang.String loadSetupScript​(SourceContext sourceContext)
                                            throws java.lang.Exception
        Loads the setup script.
        Parameters:
        sourceContext - SourceContext.
        Returns:
        Setup script or null if no setup.
        Throws:
        java.lang.Exception - If fails to load setup script.
      • loadResourceScript

        protected java.lang.String loadResourceScript​(java.lang.String resource,
                                                      SourceContext sourceContext)
                                               throws java.lang.Exception
        Loads the source script.
        Parameters:
        resource - Resource.
        sourceContext - SourceContext.
        Returns:
        Resource script.
        Throws:
        java.lang.Exception - If fails to load resource script.
      • loadScriptEngine

        protected javax.script.Invocable loadScriptEngine​(javax.script.ScriptEngineManager engineManager,
                                                          java.lang.String engineName,
                                                          java.lang.String setupScript,
                                                          java.lang.String script,
                                                          java.lang.String metaDataScript,
                                                          SourceContext sourceContext)
                                                   throws java.lang.Exception
        Loads the ScriptEngine.
        Parameters:
        engineManager - ScriptEngineManager.
        engineName - Name of the ScriptEngine.
        setupScript - Setup script. May be null for no setup.
        script - Script containing the function(s).
        metaDataScript - Script to extract meta-data.
        sourceContext - SourceContext.
        Returns:
        Invocable for the ScriptEngine.
        Throws:
        java.lang.Exception - IF fails to load the ScriptEngine.