Package adams.scripting.engine
Class FileBasedScriptingEngine
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,Pausable
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,FlowContextHandler
,JobQueueHandler
,RemoteScriptingEngine
,RemoteCommandProcessorHandler
,Serializable
public class FileBasedScriptingEngine extends AbstractScriptingEngineWithJobQueue
Scripting engine that reads remote commands from disk.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_AtomicMove
whether to perform an atomic move.protected PlaceholderDirectory
m_Failed
the directory containing the elements that couldn't be processed.protected PlaceholderDirectory
m_Incoming
the directory to monitor for incoming commands.protected PlaceholderDirectory
m_Processed
the directory containing the elements that were processed successfully.protected PlaceholderDirectory
m_Processing
the directory containing the elements being processed.-
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 FileBasedScriptingEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
atomicMoveTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the scripting engine.String
failedTipText()
Returns the tip text for this property.boolean
getAtomicMove()
Returns whether to attempt atomic move operation.PlaceholderDirectory
getFailed()
Returns the "failed" directory.PlaceholderDirectory
getIncoming()
Returns the directory to monitor.PlaceholderDirectory
getProcessed()
Returns the "processed" directory.PlaceholderDirectory
getProcessing()
Returns the "processing" directory.String
globalInfo()
Returns a string describing the object.String
incomingTipText()
Returns the tip text for this property.static void
main(String[] args)
Starts the scripting engine from commandline.protected boolean
postProcessData(File file, boolean success)
Post-processes the data.protected File
prepareData(File file)
Moves the data to the "processing" directory.protected boolean
processData(File file)
Processes the given data.String
processedTipText()
Returns the tip text for this property.String
processingTipText()
Returns the tip text for this property.void
setAtomicMove(boolean value)
Sets whether to attempt atomic move operation.void
setFailed(PlaceholderDirectory value)
Sets the "failed" directory.void
setIncoming(PlaceholderDirectory value)
Sets the directory to monitor.void
setProcessed(PlaceholderDirectory value)
Sets the "processed" directory.void
setProcessing(PlaceholderDirectory value)
Sets the "processing" directory.-
Methods inherited from class adams.scripting.engine.AbstractScriptingEngineWithJobQueue
executeJob, getMaxConcurrentJobs, maxConcurrentJobsTipText, pauseExecution, resumeExecution, setMaxConcurrentJobs, 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, 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
-
m_Incoming
protected PlaceholderDirectory m_Incoming
the directory to monitor for incoming commands.
-
m_Processing
protected PlaceholderDirectory m_Processing
the directory containing the elements being processed.
-
m_Processed
protected PlaceholderDirectory m_Processed
the directory containing the elements that were processed successfully.
-
m_Failed
protected PlaceholderDirectory m_Failed
the directory containing the elements that couldn't be processed.
-
m_AtomicMove
protected boolean m_AtomicMove
whether to perform an atomic move.
-
-
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
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractScriptingEngineWithJobQueue
-
setIncoming
public void setIncoming(PlaceholderDirectory value)
Sets the directory to monitor.- Parameters:
value
- the directory
-
getIncoming
public PlaceholderDirectory getIncoming()
Returns the directory to monitor.- Returns:
- the directory
-
incomingTipText
public String incomingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setProcessing
public void setProcessing(PlaceholderDirectory value)
Sets the "processing" directory.- Parameters:
value
- the directory
-
getProcessing
public PlaceholderDirectory getProcessing()
Returns the "processing" directory.- Returns:
- the directory
-
processingTipText
public String processingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setProcessed
public void setProcessed(PlaceholderDirectory value)
Sets the "processed" directory.- Parameters:
value
- the directory
-
getProcessed
public PlaceholderDirectory getProcessed()
Returns the "processed" directory.- Returns:
- the directory
-
processedTipText
public String processedTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFailed
public void setFailed(PlaceholderDirectory value)
Sets the "failed" directory.- Parameters:
value
- the directory
-
getFailed
public PlaceholderDirectory getFailed()
Returns the "failed" directory.- Returns:
- the directory
-
failedTipText
public String failedTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAtomicMove
public void setAtomicMove(boolean value)
Sets whether to attempt atomic move operation.- Parameters:
value
- if true then attempt atomic move operation
-
getAtomicMove
public boolean getAtomicMove()
Returns whether to attempt atomic move operation.- Returns:
- true if to attempt atomic move operation
-
atomicMoveTipText
public String atomicMoveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
prepareData
protected File prepareData(File file)
Moves the data to the "processing" directory.- Parameters:
file
- the file/dir to move- Returns:
- the new location
-
processData
protected boolean processData(File file)
Processes the given data.- Parameters:
file
- the file/dir to process- Returns:
- true if everything went alright
-
postProcessData
protected boolean postProcessData(File file, boolean success)
Post-processes the data.- Parameters:
file
- the file to finish upsuccess
- whether processing was successful- Returns:
- true if successful
-
doExecute
protected String doExecute()
Executes the scripting engine.- Specified by:
doExecute
in classAbstractScriptingEngine
- Returns:
- error message in case of failure to start up or run, otherwise null
-
main
public static void main(String[] args)
Starts the scripting engine from commandline.- Parameters:
args
- additional options for the scripting engine
-
-