Package adams.scripting.engine
Class DefaultMainScriptingEngine
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.scripting.engine.AbstractScriptingEngine
-
- adams.scripting.engine.AbstractScriptingEngineEnhancer
-
- adams.scripting.engine.DefaultMainScriptingEngine
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,Pausable
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,FlowContextHandler
,MainScriptingEngine
,RemoteScriptingEngine
,RemoteCommandProcessorHandler
,Serializable
public class DefaultMainScriptingEngine extends AbstractScriptingEngineEnhancer implements MainScriptingEngine
Manages worker scripting engines and sends them jobs for execution.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultMainScriptingEngine.RemoteCommandGrabber
Handles the registering/deregistering of workers.
-
Field Summary
Fields Modifier and Type Field Description protected LoadBalancer
m_Workers
for keeping track of workers.-
Fields inherited from class adams.scripting.engine.AbstractScriptingEngineEnhancer
m_ScriptingEngine
-
Fields inherited from class adams.scripting.engine.AbstractScriptingEngine
m_CommandHandler, m_CommandProcessor, m_FlowContext, m_Paused, m_PermissionHandler, m_RemoteScriptingEngineHandler, m_RequestHandler, m_ResponseHandler, m_Running, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description DefaultMainScriptingEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregisterWorker(Connection conn)
Deregisters a worker with the given connection.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.void
killWorkers()
Kills all workers registered.protected String
preExecute()
Hook method which gets called just before the base engine is executed.void
registerWorker(Connection conn)
Registers a worker with the given connection.protected void
reset()
Resets the scheme.String
sendCommand(RemoteCommand cmd)
Sends the command to a worker.void
setLoggingLevel(LoggingLevel value)
Sets the logging level.-
Methods inherited from class adams.scripting.engine.AbstractScriptingEngineEnhancer
defineOptions, doExecute, executeJob, getDefaultScriptingEngine, getScriptingEngine, pauseExecution, resumeExecution, scriptingEngineTipText, setScriptingEngine, stopExecution
-
Methods inherited from class adams.scripting.engine.AbstractScriptingEngine
commandProcessorTipText, execute, forCommandLine, forName, getCommandHandler, getCommandProcessor, getDefaultCommandHandler, getDefaultCommandProcessor, getDefaultPermissionHandler, getDefaultRequestHandler, getDefaultResponseHandler, getFlowContext, getPermissionHandler, getRemoteScriptingEngineHandler, getRequestHandler, getResponseHandler, isPaused, isRunning, isStopped, permissionHandlerTipText, requestHandlerTipText, responseHandlerTipText, runScriptingEngine, runScriptingEngine, setCommandHandler, setCommandProcessor, setFlowContext, setPermissionHandler, setRemoteScriptingEngineHandler, setRequestHandler, setResponseHandler
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.core.Pausable
isPaused, pauseExecution, resumeExecution
-
Methods inherited from interface adams.scripting.processor.RemoteCommandProcessorHandler
getCommandProcessor, setCommandProcessor
-
Methods inherited from interface adams.scripting.engine.RemoteScriptingEngine
execute, executeJob, getCommandHandler, getFlowContext, getPermissionHandler, getRemoteScriptingEngineHandler, getRequestHandler, getResponseHandler, isRunning, permissionHandlerTipText, requestHandlerTipText, responseHandlerTipText, setCommandHandler, setFlowContext, setPermissionHandler, setRemoteScriptingEngineHandler, setRequestHandler, setResponseHandler
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
Methods inherited from interface adams.core.StoppableWithFeedback
isStopped
-
-
-
-
Field Detail
-
m_Workers
protected LoadBalancer m_Workers
for keeping track of workers.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractScriptingEngine
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setLoggingLevel
public void setLoggingLevel(LoggingLevel value)
Sets the logging level.- Specified by:
setLoggingLevel
in interfaceLoggingLevelHandler
- Overrides:
setLoggingLevel
in classAbstractOptionHandler
- Parameters:
value
- the level
-
registerWorker
public void registerWorker(Connection conn)
Registers a worker with the given connection.- Specified by:
registerWorker
in interfaceMainScriptingEngine
- Parameters:
conn
- the connection of the worker
-
deregisterWorker
public void deregisterWorker(Connection conn)
Deregisters a worker with the given connection.- Specified by:
deregisterWorker
in interfaceMainScriptingEngine
- Parameters:
conn
- the connection of the worker
-
killWorkers
public void killWorkers()
Kills all workers registered.- Specified by:
killWorkers
in interfaceMainScriptingEngine
-
sendCommand
public String sendCommand(RemoteCommand cmd)
Sends the command to a worker.- Specified by:
sendCommand
in interfaceMainScriptingEngine
- Parameters:
cmd
- the command to send- Returns:
- null if successful, otherwise error message
-
preExecute
protected String preExecute()
Description copied from class:AbstractScriptingEngineEnhancer
Hook method which gets called just before the base engine is executed.
Default implementation does nothing.- Overrides:
preExecute
in classAbstractScriptingEngineEnhancer
- Returns:
- null if successful, otherwise error message
-
-