Package net.officefloor.script
Class AbstractScriptProcedureSourceServiceFactory
java.lang.Object
net.officefloor.script.AbstractScriptProcedureSourceServiceFactory
- All Implemented Interfaces:
ProcedureSourceServiceFactory,ServiceFactory<ProcedureSource>
- Direct Known Subclasses:
JavaScriptProcedureSourceServiceFactory
public abstract class AbstractScriptProcedureSourceServiceFactory
extends Object
implements ProcedureSourceServiceFactory
ProcedureSourceServiceFactory providing abstract support for Scripts.- Author:
- Daniel Sagenschneider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateService(ServiceContext context) Creates the service.protected voiddecorateScriptEngine(ScriptEngine engine, SourceContext context) Enables overriding to decorate theScriptEngine.protected abstract StringgetMetaDataScriptPath(SourceContext context) Obtains the path to the script that extracts the function meta-data.protected abstract StringgetScriptEngineName(SourceContext context) Obtains the name of theScriptEngine.protected ScriptExceptionTranslatorObtains theScriptExceptionTranslator.protected abstract String[]getScriptFileExtensions(SourceContext context) Obtains the extensions for the script resource.protected StringgetSetupScriptPath(SourceContext context) Obtains the path to the setup script.protected abstract StringObtains the source name for thisProcedureSource.protected voidlistProcedures(ProcedureListContext context) Lists theProcedureinstances.protected voidLoads theManagedFunctionfor theProcedure.protected StringloadResourceScript(String resource, SourceContext sourceContext) Loads the source script.protected InvocableloadScriptEngine(ScriptEngineManager engineManager, String engineName, String setupScript, String script, String metaDataScript, SourceContext sourceContext) Loads theScriptEngine.protected StringloadSetupScript(SourceContext sourceContext) Loads the setup script.
-
Constructor Details
-
AbstractScriptProcedureSourceServiceFactory
public AbstractScriptProcedureSourceServiceFactory()
-
-
Method Details
-
getSourceName
Obtains the source name for thisProcedureSource.- Returns:
- Source name for this
ProcedureSource.
-
getScriptFileExtensions
Obtains the extensions for the script resource.- Parameters:
context-SourceContext.- Returns:
- Extensions for the script resource.
- Throws:
Exception- If fails to obtain the file extensions.
-
getScriptEngineName
Obtains the name of theScriptEngine.- Parameters:
context-SourceContext.- Returns:
- Name of the
ScriptEngine. - Throws:
Exception- If fails to obtain the name of theScriptEngine.
-
decorateScriptEngine
Enables overriding to decorate theScriptEngine.- Parameters:
engine-ScriptEngine.context-SourceContext.- Throws:
Exception- If fails to decorate theScriptEngine.
-
getSetupScriptPath
Obtains the path to the setup script.- Parameters:
context-SourceContext.- Returns:
- Path to the setup script or
nullif no setup. - Throws:
Exception- If fails to obtain the setup script path.
-
getMetaDataScriptPath
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:
Exception- If fails to obtain the path to the function meta-data script.
-
getScriptExceptionTranslator
Obtains theScriptExceptionTranslator.- Returns:
ScriptExceptionTranslator.
-
loadSetupScript
Loads the setup script.- Parameters:
sourceContext-SourceContext.- Returns:
- Setup script or
nullif no setup. - Throws:
Exception- If fails to load setup script.
-
loadResourceScript
Loads the source script.- Parameters:
resource- Resource.sourceContext-SourceContext.- Returns:
- Resource script.
- Throws:
Exception- If fails to load resource script.
-
loadScriptEngine
protected Invocable loadScriptEngine(ScriptEngineManager engineManager, String engineName, String setupScript, String script, String metaDataScript, SourceContext sourceContext) throws Exception Loads theScriptEngine.- Parameters:
engineManager-ScriptEngineManager.engineName- Name of theScriptEngine.setupScript- Setup script. May benullfor no setup.script- Script containing the function(s).metaDataScript- Script to extract meta-data.sourceContext-SourceContext.- Returns:
Invocablefor theScriptEngine.- Throws:
Exception- IF fails to load theScriptEngine.
-
listProcedures
Lists theProcedureinstances.- Parameters:
context-ProcedureListContext.- Throws:
Exception- If fails to list theProcedureinstances.
-
loadManagedFunction
Loads theManagedFunctionfor theProcedure.- Parameters:
context-ProcedureManagedFunctionContext.- Throws:
Exception- If fails to load theManagedFunction.
-
createService
Description copied from interface:ServiceFactoryCreates the service.- Specified by:
createServicein interfaceServiceFactory<ProcedureSource>- Parameters:
context-ServiceContext.- Returns:
- Service.
- Throws:
Throwable- If fails to create the service.
-