org.specrunner.runner.core
Class RunnerImpl

java.lang.Object
  extended by org.specrunner.runner.core.RunnerImpl
All Implemented Interfaces:
IRunner

public class RunnerImpl
extends Object
implements IRunner

Default runner implementation.

Author:
Thiago Santos

Constructor Summary
RunnerImpl()
           
 
Method Summary
protected  boolean checkConditional(IPlugin plugin, IContext context)
          Check condition to perform the plugin.
protected  void checkTimeout(IContext context, IResultSet result, IPlugin plugin, long start, String method)
          Check timeout to perform the plugin.
protected  void doSleep(IPlugin plugin, IContext context)
          Perform a sleep for the step, if specified.
protected  void doWait(IPlugin plugin, IContext context)
          Perform a sleep for the step, if specified.
protected  void end(IContext context, IResultSet result, IPlugin plugin, List<IPluginListener> listeners)
          Perform end operations.
 IFilter getFilter()
          Get runner filter.
protected  void initialization(IContext context, IResultSet result, IPlugin plugin, List<IPluginListener> listeners)
          Perform initialization.
protected  void local(nu.xom.Node node, IContext context, IResultSet result, IPlugin previous)
          Perform node execution.
protected  ENext nodeStart(nu.xom.Node node, IContext context, IResultSet result, List<INodeListener> listeners)
          Perform start node listeners.
 void run(IPlugin plugin, IContext context, IResultSet result)
          Performs a plugin without a node specification.
 void run(ISource source, IContext context, IResultSet result)
          Performs the specification in source.
 void run(nu.xom.Node node, IContext context, IResultSet result)
          Performs the specification node.
 void setFilter(IFilter filter)
          Set a filter.
protected  ENext start(IContext context, IResultSet result, IPlugin plugin, List<IPluginListener> listeners)
          Perform start operation of plugins.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunnerImpl

public RunnerImpl()
Method Detail

getFilter

public IFilter getFilter()
Description copied from interface: IRunner
Get runner filter.

Specified by:
getFilter in interface IRunner
Returns:
The filter.

setFilter

public void setFilter(IFilter filter)
Description copied from interface: IRunner
Set a filter.

Specified by:
setFilter in interface IRunner
Parameters:
filter - A block filter.

run

public void run(ISource source,
                IContext context,
                IResultSet result)
         throws RunnerException
Description copied from interface: IRunner
Performs the specification in source.

Specified by:
run in interface IRunner
Parameters:
source - The specification.
context - A context.
result - A result set.
Throws:
RunnerException - On execution fail.

run

public void run(nu.xom.Node node,
                IContext context,
                IResultSet result)
         throws RunnerException
Description copied from interface: IRunner
Performs the specification node.

Specified by:
run in interface IRunner
Parameters:
node - A specification node.
context - A context.
result - A result set.
Throws:
RunnerException - On execution fail.

run

public void run(IPlugin plugin,
                IContext context,
                IResultSet result)
         throws RunnerException
Description copied from interface: IRunner
Performs a plugin without a node specification.

Specified by:
run in interface IRunner
Parameters:
plugin - A plugin.
context - A context.
result - A result set.
Throws:
RunnerException - On execution fail.

local

protected void local(nu.xom.Node node,
                     IContext context,
                     IResultSet result,
                     IPlugin previous)
              throws RunnerException
Perform node execution.

Parameters:
node - The node.
context - The current context.
result - The result.
previous - The previous plugin.
Throws:
RunnerException - On execution errors.

nodeStart

protected ENext nodeStart(nu.xom.Node node,
                          IContext context,
                          IResultSet result,
                          List<INodeListener> listeners)
Perform start node listeners.

Parameters:
node - The node.
context - The current context.
result - The result.
listeners - Node listeners.
Returns:
The next step to be taken, SKIP or go DEEPer.

initialization

protected void initialization(IContext context,
                              IResultSet result,
                              IPlugin plugin,
                              List<IPluginListener> listeners)
                       throws PluginException
Perform initialization.

Parameters:
context - The context.
result - The result set.
plugin - The plugin.
listeners - Plugin listeners.
Throws:
PluginException - On initialization errors.

checkConditional

protected boolean checkConditional(IPlugin plugin,
                                   IContext context)
                            throws SpecRunnerException
Check condition to perform the plugin.

Parameters:
plugin - The plugin.
context - The context.
Returns:
true, if should be performed, false, otherwise.
Throws:
SpecRunnerException - On conditional evaluation errors.

doWait

protected void doWait(IPlugin plugin,
                      IContext context)
               throws SpecRunnerException
Perform a sleep for the step, if specified.

Parameters:
plugin - The plugin.
context - The context.
Throws:
SpecRunnerException - On sleep checking errors.

start

protected ENext start(IContext context,
                      IResultSet result,
                      IPlugin plugin,
                      List<IPluginListener> listeners)
               throws SpecRunnerException
Perform start operation of plugins.

Parameters:
context - The context.
result - The result.
plugin - The plugin.
listeners - List of listeners.
Returns:
The next step on state machine.
Throws:
SpecRunnerException - On start errors.

checkTimeout

protected void checkTimeout(IContext context,
                            IResultSet result,
                            IPlugin plugin,
                            long start,
                            String method)
                     throws SpecRunnerException
Check timeout to perform the plugin.

Parameters:
context - The context.
result - The result set.
plugin - The plugin.
start - The start time..
method - The method name.
Throws:
SpecRunnerException - On conditional evaluation errors.

end

protected void end(IContext context,
                   IResultSet result,
                   IPlugin plugin,
                   List<IPluginListener> listeners)
            throws SpecRunnerException
Perform end operations.

Parameters:
context - The context.
result - The result.
plugin - The plugin.
listeners - The listeners.
Throws:
SpecRunnerException - On ending errors.

doSleep

protected void doSleep(IPlugin plugin,
                       IContext context)
                throws SpecRunnerException
Perform a sleep for the step, if specified.

Parameters:
plugin - The plugin.
context - The context.
Throws:
SpecRunnerException - On sleep checking errors.


Copyright © 2014. All rights reserved.