sofya.ed.structural.processors
Class AbstractJUnitProcessingStrategy

java.lang.Object
  extended by sofya.ed.structural.processors.AbstractProcessingStrategy
      extended by sofya.ed.structural.processors.AbstractJUnitProcessingStrategy
All Implemented Interfaces:
ActiveComponent, JUnitProcessingStrategy
Direct Known Subclasses:
JUnitBlockCoverageProcessingStrategy, JUnitBlockSequenceProcessingStrategy, JUnitBranchCoverageProcessingStrategy, JUnitBranchSequenceProcessingStrategy

public abstract class AbstractJUnitProcessingStrategy
extends AbstractProcessingStrategy
implements JUnitProcessingStrategy

Base class for strategies to receive and process probes for a JUnit event dispatcher.

Version:
04/24/2006
Author:
Alex Kinneer

Field Summary
protected  java.lang.Exception err
          Stores the exception that stopped probe processing, if any.
 
Fields inherited from class sofya.ed.structural.processors.AbstractProcessingStrategy
instMode, sbjout, stderr, stdout
 
Constructor Summary
protected AbstractJUnitProcessingStrategy()
           
 
Method Summary
 void checkError()
          Checks whether any exceptions have been raised during processing, and rethrows the exception for handling if so.
 java.util.List configure(java.util.List parameters)
          Configures this component from command line parameters.
 boolean isReady()
          Reports whether this component is ready for the event dispatcher to begin dispatching events.
 void release()
          Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources.
 void reset()
          Notifies this component to clear its configuration and reset any internal state.
 void setInstrumentationMode(JUnitEventDispatcher.InstrumentationMode instMode)
          Notifies the processor of the instrumentation mode detected in the subject.
 
Methods inherited from class sofya.ed.structural.processors.AbstractProcessingStrategy
register
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sofya.ed.structural.JUnitProcessingStrategy
endTest, getObjectType, newTest, processData, setMethodObjectCount, setup
 
Methods inherited from interface sofya.ed.structural.ActiveComponent
register
 

Field Detail

err

protected java.lang.Exception err
Stores the exception that stopped probe processing, if any.

Constructor Detail

AbstractJUnitProcessingStrategy

protected AbstractJUnitProcessingStrategy()
Method Detail

configure

public java.util.List configure(java.util.List parameters)
Description copied from interface: ActiveComponent

Configures this component from command line parameters.

This method provides a component the opportunity to define and process command line parameters required to configure itself. Components participate in a processing chain, initiated in Sofya-provided event dispatchers by calling this method on the processing strategy. The processing strategies provided by Sofya in turn invoke this method on any listeners implementing this interface.

Specified by:
configure in interface ActiveComponent
Parameters:
parameters - A list of command line tokens that have not yet been processed by any previous components.
Returns:
The list of parameters, with any recognized parameters and associated values removed. This enables the chaining of parameter processing.

reset

public void reset()
Description copied from interface: ActiveComponent

Notifies this component to clear its configuration and reset any internal state.

Calls to this method are chained similary to the ActiveComponent.configure(java.util.List) method. This method is invoked by the event dispatcher prior to reconfiguration. Normally it should be used to clear any configuration state to avoid using stale values.

Specified by:
reset in interface ActiveComponent

isReady

public boolean isReady()
Description copied from interface: ActiveComponent

Reports whether this component is ready for the event dispatcher to begin dispatching events.

Calls to this method are chained similarly to the ActiveComponent.configure(java.util.List) method. The event dispatcher will fail with an error if a client invokes ProgramEventDispatcher.startDispatcher() when any attached component returns false from this method.

Specified by:
isReady in interface ActiveComponent
Returns:
true if this component is ready for the event dispatcher to begin dispatching events, false otherwise.

release

public void release()
Description copied from interface: ActiveComponent

Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources.

Calls to this method are chained similary to the ActiveComponent.configure(java.util.List) method. This method is invoked directly by a client of the event dispatcher. Normally, it should be used to release any resources that were required to persist over multiple runs of the event dispatcher.

Specified by:
release in interface ActiveComponent

setInstrumentationMode

public void setInstrumentationMode(JUnitEventDispatcher.InstrumentationMode instMode)
Description copied from interface: JUnitProcessingStrategy
Notifies the processor of the instrumentation mode detected in the subject.

Specified by:
setInstrumentationMode in interface JUnitProcessingStrategy
Parameters:
instMode - A callback object to be used to retrieve the instrumentation mode detected by the JUnit event dispatcher.

checkError

public void checkError()
                throws java.lang.Exception
Description copied from interface: JUnitProcessingStrategy
Checks whether any exceptions have been raised during processing, and rethrows the exception for handling if so. This method returns without action if there are no errors.

Specified by:
checkError in interface JUnitProcessingStrategy
Throws:
java.lang.Exception - For any exception that was raised and stored.