sofya.ed.structural
Interface ActiveComponent

All Known Subinterfaces:
JUnitProcessingStrategy, SocketProcessingStrategy
All Known Implementing Classes:
AbstractJUnitProcessingStrategy, AbstractSocketProcessingStrategy, BlockCoverageProcessingStrategy, BlockInstrumentationConfiguration, BlockSequenceProcessingStrategy, BranchCoverageProcessingStrategy, BranchInstrumentationConfiguration, BranchSequenceProcessingStrategy, JUnitBlockCoverageProcessingStrategy, JUnitBlockSequenceProcessingStrategy, JUnitBranchCoverageProcessingStrategy, JUnitBranchSequenceProcessingStrategy, SequenceTraceWriter, TraceHandler

public interface ActiveComponent

An active component can be any component used by or attached to an event listener that maintains a configurable internal state that may be sensitive to the lifecycle of the event dispatcher, and that actively performs work during delivery of the event stream.

By implementing this interface, a component provides hooks that are used by event dispatchers to supply system global resources and opportunities for the component to configure itself and report whether it is ready for the initiation of the event stream.

Version:
03/13/2006
Author:
Alex Kinneer

Method Summary
 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 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 reset()
          Notifies this component to clear its configuration and reset any internal state.
 

Method Detail

register

void register(EventDispatcherConfiguration edConfig)

Registers this component with the event dispatcher.

This method is called each time an event dispatcher prepares to initiate a new event stream, caused by a call to ProgramEventDispatcher.startDispatcher().

Parameters:
edConfig - The current configuration of system global resources and settings that the component may (and should) use as appropriate.

configure

java.util.List configure(java.util.List parameters)

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.

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.
Throws:
ParameterValueAbsentException - If a required value for a recognized parameter is not provided.
BadParameterValueException - If a value for a recognized parameter is invalid.

reset

void reset()
           throws java.lang.IllegalStateException

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

Calls to this method are chained similary to the 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.

Throws:
java.lang.IllegalStateException - If it is impossible for this component to reset its configuration or internal state at the time of the request.

isReady

boolean isReady()

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

Calls to this method are chained similarly to the 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.

Returns:
true if this component is ready for the event dispatcher to begin dispatching events, false otherwise.

release

void release()

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 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.