Package adams.scripting.engine
Class DefaultScriptingEngine
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,Pausable,SizeOfHandler,Stoppable,StoppableWithFeedback,FlowContextHandler,JobQueueHandler,RemoteScriptingEngine,RemoteCommandProcessorHandler,Serializable
public class DefaultScriptingEngine extends AbstractScriptingEngineWithJobQueue
Default implementation of scripting engine for remote commands.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PORTthe default port.protected intm_Portthe port to listen on.protected ServerSocketm_Serverfor accepting connections.protected intm_Timeoutthe timeout for the socket.-
Fields inherited from class adams.scripting.engine.AbstractScriptingEngineWithJobQueue
m_Executor, m_MaxConcurrentJobs
-
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 DefaultScriptingEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseSocket()Closes the server socket if necessary.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the scripting engine.intgetPort()Returns the port to listen on.intgetTimeout()Returns the timeout in milli-second to wait for new connections.StringglobalInfo()Returns a string describing the object.protected voidhandleClient(Socket client)Handles the client connection.static voidmain(String[] args)Starts the scripting engine from commandline.StringportTipText()Returns the tip text for this property.voidsetPort(int value)Sets the port to listen on.voidsetTimeout(int value)Sets the timeout in milli-second to wait for new connections.voidstopExecution()Stops the execution.StringtimeoutTipText()Returns the tip text for this property.-
Methods inherited from class adams.scripting.engine.AbstractScriptingEngineWithJobQueue
executeJob, getMaxConcurrentJobs, maxConcurrentJobsTipText, pauseExecution, resumeExecution, setMaxConcurrentJobs
-
Methods inherited from class adams.scripting.engine.AbstractScriptingEngine
commandProcessorTipText, execute, forCommandLine, forName, getCommandHandler, getCommandProcessor, getDefaultCommandHandler, getDefaultCommandProcessor, getDefaultPermissionHandler, getDefaultRequestHandler, getDefaultResponseHandler, getFlowContext, getPermissionHandler, getRemoteScriptingEngineHandler, getRequestHandler, getResponseHandler, initialize, 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, reset, setLoggingLevel, 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, getOptionManager, toCommandLine
-
Methods inherited from interface adams.scripting.processor.RemoteCommandProcessorHandler
getCommandProcessor, setCommandProcessor
-
Methods inherited from interface adams.scripting.engine.RemoteScriptingEngine
execute, getCommandHandler, getFlowContext, getPermissionHandler, getRemoteScriptingEngineHandler, getRequestHandler, getResponseHandler, isRunning, permissionHandlerTipText, requestHandlerTipText, responseHandlerTipText, setCommandHandler, setFlowContext, setPermissionHandler, setRemoteScriptingEngineHandler, setRequestHandler, setResponseHandler
-
Methods inherited from interface adams.core.StoppableWithFeedback
isStopped
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
the default port.- See Also:
- Constant Field Values
-
m_Server
protected transient ServerSocket m_Server
for accepting connections.
-
m_Timeout
protected int m_Timeout
the timeout for the socket.
-
m_Port
protected int m_Port
the port to listen on.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractScriptingEngineWithJobQueue
-
setPort
public void setPort(int value)
Sets the port to listen on.- Parameters:
value- the port to listen on
-
getPort
public int getPort()
Returns the port to listen on.- Returns:
- the port listening on
-
portTipText
public String portTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setTimeout
public void setTimeout(int value)
Sets the timeout in milli-second to wait for new connections.- Parameters:
value- the timeout in msec
-
getTimeout
public int getTimeout()
Returns the timeout in milli-second to wait for new connections.- Returns:
- the timeout in msec
-
timeoutTipText
public String timeoutTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
closeSocket
protected void closeSocket()
Closes the server socket if necessary.
-
handleClient
protected void handleClient(Socket client)
Handles the client connection.- Parameters:
client- the connection to handle
-
doExecute
protected String doExecute()
Executes the scripting engine.- Specified by:
doExecutein classAbstractScriptingEngine- Returns:
- error message in case of failure to start up or run, otherwise null
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractScriptingEngineWithJobQueue
-
main
public static void main(String[] args)
Starts the scripting engine from commandline.- Parameters:
args- additional options for the scripting engine
-
-