sofya.ed.structural.processors
Class JUnitBlockSequenceProcessingStrategy

java.lang.Object
  extended by sofya.ed.structural.processors.AbstractProcessingStrategy
      extended by sofya.ed.structural.processors.AbstractJUnitProcessingStrategy
          extended by sofya.ed.structural.processors.JUnitBlockSequenceProcessingStrategy
All Implemented Interfaces:
ActiveComponent, BlockInstrumentationStrategy, JUnitProcessingStrategy

public class JUnitBlockSequenceProcessingStrategy
extends AbstractJUnitProcessingStrategy
implements BlockInstrumentationStrategy

Processing strategy to receive JUnit basic block sequence probes and dispatch basic block sequence events.

Version:
04/24/2006
Author:
Alex Kinneer

Field Summary
 
Fields inherited from class sofya.ed.structural.processors.AbstractJUnitProcessingStrategy
err
 
Fields inherited from class sofya.ed.structural.processors.AbstractProcessingStrategy
instMode, sbjout, stderr, stdout
 
Constructor Summary
JUnitBlockSequenceProcessingStrategy()
          Creates a new instance of the processing strategy.
 
Method Summary
 void addEventListener(BlockEventListener listener)
          Registers a listener for observable events.
 boolean areCallBlocksActive()
          Reports whether call blocks are selected.
 boolean areCodeBlocksActive()
          Reports whether general basic blocks are selected; general basic blocks are any basic blocks corresponding to actual program code other than method call blocks.
 boolean areEntryBlocksActive()
          Reports whether entry blocks are selected.
 boolean areExitBlocksActive()
          Reports whether exit blocks are selected.
 java.util.List configure(java.util.List params)
          Configures this component from command line parameters.
 void endTest(int testNum)
          Notifies the processor that a test case has finished executing; this is normally relayed to attached listeners.
 SConstants.TraceObjectType getObjectType()
          Gets the type of structural object for which this processor can receive probes.
 int getTypeFlags()
          Gets the bitmask corresponding to the types of basic blocks currently selected.
 boolean isReady()
          Reports whether this component is ready for the event dispatcher to begin dispatching events.
 void newTest(int testNum)
          Notifies the processor that a new test case is about to execute; this is normally relayed to attached listeners.
 void processData(java.lang.Object instArray, java.lang.String mSig, int fromIndex, int toIndex)
          Instrumentation data received from the subject.
 void register(EventDispatcherConfiguration edConfig)
          Registers this component with the event dispatcher.
 void release()
          Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources.
 void removeEventListener(BlockEventListener listener)
          Unregisters a listener for observable events.
 void setCallBlocksActive(boolean enable)
          Sets whether call blocks are selected.
 void setCodeBlocksActive(boolean enable)
          Sets whether general basic blocks are selected; general basic blocks are any basic blocks corresponding to actual program code other than method call blocks.
 void setEntryBlocksActive(boolean enable)
          Sets whether entry blocks are selected.
 void setExitBlocksActive(boolean enable)
          Sets whether exit blocks are selected.
 void setMethodObjectCount(java.lang.String mSig, int objCount)
          Notification received from the instrumentated subject indicating a structural object count for a method.
 void setup()
          Notifies the processor to perform any setup required to receive probes from the subject.
 
Methods inherited from class sofya.ed.structural.processors.AbstractJUnitProcessingStrategy
checkError, reset, setInstrumentationMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUnitBlockSequenceProcessingStrategy

public JUnitBlockSequenceProcessingStrategy()
Creates a new instance of the processing strategy.

Method Detail

addEventListener

public void addEventListener(BlockEventListener listener)
Registers a listener for observable events.

Parameters:
listener - Observer that wishes to receive basic block events from the event dispatcher.

removeEventListener

public void removeEventListener(BlockEventListener listener)
Unregisters a listener for observable events.

Parameters:
listener - Object that no longer wishes to receive basic block events from the event dispatcher.

register

public void register(EventDispatcherConfiguration edConfig)
Description copied from class: AbstractProcessingStrategy

Registers this component with the event dispatcher.

Specified by:
register in interface ActiveComponent
Overrides:
register in class AbstractProcessingStrategy
Parameters:
edConfig - The current configuration of system global resources and settings that the component will use as appropriate.

configure

public java.util.List configure(java.util.List params)
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
Overrides:
configure in class AbstractJUnitProcessingStrategy
Parameters:
params - 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.

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
Overrides:
isReady in class AbstractJUnitProcessingStrategy
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
Overrides:
release in class AbstractJUnitProcessingStrategy

getObjectType

public SConstants.TraceObjectType getObjectType()
Description copied from interface: JUnitProcessingStrategy
Gets the type of structural object for which this processor can receive probes.

This is used by the JUnit event dispatcher for certain configuration activities.

Specified by:
getObjectType in interface JUnitProcessingStrategy
Returns:
The type of structural object for which this processor knows how to receive probes.

setup

public void setup()
Description copied from interface: JUnitProcessingStrategy
Notifies the processor to perform any setup required to receive probes from the subject.

Specified by:
setup in interface JUnitProcessingStrategy

newTest

public void newTest(int testNum)
Description copied from interface: JUnitProcessingStrategy
Notifies the processor that a new test case is about to execute; this is normally relayed to attached listeners.

Specified by:
newTest in interface JUnitProcessingStrategy
Parameters:
testNum - The number of the test case about to execute.

endTest

public void endTest(int testNum)
Description copied from interface: JUnitProcessingStrategy
Notifies the processor that a test case has finished executing; this is normally relayed to attached listeners.

Specified by:
endTest in interface JUnitProcessingStrategy
Parameters:
testNum - The number of the test case that finished executing.

setMethodObjectCount

public void setMethodObjectCount(java.lang.String mSig,
                                 int objCount)
Description copied from interface: JUnitProcessingStrategy
Notification received from the instrumentated subject indicating a structural object count for a method.

Specified by:
setMethodObjectCount in interface JUnitProcessingStrategy
Parameters:
mSig - Concatenation of the fully qualified class name, method name, and JNI signature of the method for which an object count is being reported.
objCount - The number of structural objects in the method.

processData

public void processData(java.lang.Object instArray,
                        java.lang.String mSig,
                        int fromIndex,
                        int toIndex)
Description copied from interface: JUnitProcessingStrategy
Instrumentation data received from the subject.

This is a mapping of the actual instrumentation method called from the subject. The data provided varies depending on the the type of instrumentation applied.

Specified by:
processData in interface JUnitProcessingStrategy
Parameters:
instArray - Array of instrumentation data. The type and contents depend on the type of instrumentation applied.
mSig - Concatenation of the fully qualified class name, method name, and JNI signature of the method for which an object count is being reported.
fromIndex - Start index of the segment of the array to be processed on this invocation.
toIndex - End index of the segment of the array to be processed on this invocation.

areCodeBlocksActive

public boolean areCodeBlocksActive()
Description copied from interface: BlockInstrumentationStrategy
Reports whether general basic blocks are selected; general basic blocks are any basic blocks corresponding to actual program code other than method call blocks.

Specified by:
areCodeBlocksActive in interface BlockInstrumentationStrategy
Returns:
true if general basic blocks are selected, false otherwise.

setCodeBlocksActive

public void setCodeBlocksActive(boolean enable)
Description copied from interface: BlockInstrumentationStrategy
Sets whether general basic blocks are selected; general basic blocks are any basic blocks corresponding to actual program code other than method call blocks.

Specified by:
setCodeBlocksActive in interface BlockInstrumentationStrategy
Parameters:
enable - true to select general basic blocks, false to ignore.

areEntryBlocksActive

public boolean areEntryBlocksActive()
Description copied from interface: BlockInstrumentationStrategy
Reports whether entry blocks are selected.

Specified by:
areEntryBlocksActive in interface BlockInstrumentationStrategy
Returns:
true if entry blocks are selected, false otherwise.

setEntryBlocksActive

public void setEntryBlocksActive(boolean enable)
Description copied from interface: BlockInstrumentationStrategy
Sets whether entry blocks are selected.

Specified by:
setEntryBlocksActive in interface BlockInstrumentationStrategy
Parameters:
enable - true to select entry blocks, false to ignore.

areExitBlocksActive

public boolean areExitBlocksActive()
Description copied from interface: BlockInstrumentationStrategy
Reports whether exit blocks are selected.

Specified by:
areExitBlocksActive in interface BlockInstrumentationStrategy
Returns:
true if exit blocks are selected, false otherwise.

setExitBlocksActive

public void setExitBlocksActive(boolean enable)
Description copied from interface: BlockInstrumentationStrategy
Sets whether exit blocks are selected.

Specified by:
setExitBlocksActive in interface BlockInstrumentationStrategy
Parameters:
enable - true to select exit blocks, false to ignore.

areCallBlocksActive

public boolean areCallBlocksActive()
Description copied from interface: BlockInstrumentationStrategy
Reports whether call blocks are selected.

Specified by:
areCallBlocksActive in interface BlockInstrumentationStrategy
Returns:
true if call blocks are selected, false otherwise.

setCallBlocksActive

public void setCallBlocksActive(boolean enable)
Description copied from interface: BlockInstrumentationStrategy
Sets whether call blocks are selected.

Specified by:
setCallBlocksActive in interface BlockInstrumentationStrategy
Parameters:
enable - true to select call blocks, false to ignore.

getTypeFlags

public int getTypeFlags()
Description copied from interface: BlockInstrumentationStrategy
Gets the bitmask corresponding to the types of basic blocks currently selected.

Used for communicating configuration information to certain other components. To be phased out at a future date.

Specified by:
getTypeFlags in interface BlockInstrumentationStrategy
Returns:
The bitmask indicating which basic block types have been selected in this configuration.