javarequirementstracer
Class JavaRequirementsTracerBean

java.lang.Object
  extended by javarequirementstracer.JavaRequirementsTracerBean

public final class JavaRequirementsTracerBean
extends Object

Class for generating a traceablity report. It scans for Requirements annotations.

Author:
Ronald Koster
See Also:
init()

Constructor Summary
JavaRequirementsTracerBean()
           
 
Method Summary
 String getExpectedLabelsFilename()
           
 String getParamsFilename()
           
 String getReportFilename()
           
 void init()
          Prepare a scan for current options.
 void run()
          Create a report using current options.
 SortedMap<String,SortedSet<String>> scanRequirements()
          Does actual tracing (ie.
 SortedSet<String> scanUntraceable()
           
 void setBuildNumber(String buildNumber)
          Injector.
 void setClassLoader(ClassLoader classLoader)
          Injector.
 void setParamsFilename(String paramsFilename)
          Injector, see init().
 void write(SortedMap<String,SortedSet<String>> codeNamesToLabels, SortedSet<String> untraceableTypes)
          Write scanned traceability map to the report file indicated by #setReportFileName(String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaRequirementsTracerBean

public JavaRequirementsTracerBean()
Method Detail

getParamsFilename

public String getParamsFilename()
Returns:
See init().

setParamsFilename

public void setParamsFilename(String paramsFilename)
Injector, see init().


getExpectedLabelsFilename

public String getExpectedLabelsFilename()
Returns:
See init().

getReportFilename

public String getReportFilename()
Returns:
See init().

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Injector. ClassLoader to be used for loading this class and the classes to be scanned. Default (null) system ClassLoader is used. Needed for javarequirementstracer.mojo.JrtMojo mainly/only.


setBuildNumber

public void setBuildNumber(String buildNumber)
Injector. Optional buildnumber to be used for the reporting.

Parameters:
buildNumber - the buildnumber.

init

public void init()
Prepare a scan for current options.

Throws:
UncheckedException - Wrapper around FileNotFoundException IOException, in case loading the properties from setParamsFilename(String) or #setExpectedLabelsFilename(String) throws such an exception.

run

public void run()
Create a report using current options.

Throws:
UncheckedException - Idem as at init().

scanRequirements

public SortedMap<String,SortedSet<String>> scanRequirements()
Does actual tracing (ie. scanning for Requirements annotations).

Returns:
A map mapping codeElementNames (aka. codeNames) to the requirements labels (aka. labels) they implement according to their annotations.
Throws:
IllegalStateException - If init() has not been invoked yet.

scanUntraceable

public SortedSet<String> scanUntraceable()
Returns:
All public or protected types (classes/interfaces) not annotated with Requirements, nor with SuppressTraceabilityWarnings, nor having a supertype annotated with Requirements. NB. Having a supertype annotated with SuppressTraceabilityWarnings will not exclude it from the untraceable report. This is because many Use Case specific service implementations may implement a general technical (thus annotated with SuppressTraceabilityWarnings) interface.
Throws:
IllegalStateException - Idem as at scanRequirements().

write

public void write(SortedMap<String,SortedSet<String>> codeNamesToLabels,
                  SortedSet<String> untraceableTypes)
Write scanned traceability map to the report file indicated by #setReportFileName(String). Also reports:

Parameters:
codeNamesToLabels - As returned by scanRequirements().
untraceableTypes - As retuned by scanUntraceable().
Throws:
RuntimeException - Wrapper around IOException, in case writing to the report file throws such an exception.


Copyright © 2010. All Rights Reserved.