com.ikokoon.serenity
Class Collector

java.lang.Object
  extended by com.ikokoon.serenity.Collector
All Implemented Interfaces:
IConstants

public class Collector
extends java.lang.Object
implements IConstants

TODO - make this class non static? Is this a better option? More OO? Better performance? Will it be easier to understand? In the case of distributing the collector class by putting it in the constant pool of the classes and then calling the instance variable from inside the classes, will this be more difficult to understand? In this static class all the real collection logic is in one place and is called statically. The generation of the instructions to call this class is simple and seemingly not much less performant than an instance variable. This class collects the data from the processing. It adds the metrics to the packages, classes, methods and lines and persists the data in the database. This is the central collection class for the coverage and dependency functionality.

Since:
12.07.09
Version:
01.00
Author:
Michael Couck

Field Summary
 
Fields inherited from interface com.ikokoon.serenity.IConstants
CLEAN_CLASSES, COMPLEXITY, COVERAGE, DATABASE_FILE_JPA, DATABASE_FILE_ODB, DATABASE_FILE_RAM, DEPENDENCY, EXCLUDED_PACKAGES_PROPERTY, INCLUDED_ADAPTERS_PROPERTY, INCLUDED_JARS_PROPERTY, INCLUDED_PACKAGES_PROPERTY, JAVA_CLASS_PATH, LOG_4_J_PROPERTIES, PROFILING, SEPARATOR, SERENITY_DIRECTORY, SERENITY_PERSISTENCE_UNIT, SERENITY_SOURCE, SUREFIRE_TEST_CLASS_PATH, WRITE_CLASSES
 
Constructor Summary
Collector()
           
 
Method Summary
static void collectAccess(java.lang.String className, java.lang.Integer access)
          Adds the access attribute to the class object.
static void collectAccess(java.lang.String className, java.lang.String methodName, java.lang.String methodDescription, java.lang.Integer access)
          Adds the access attribute to the method object.
static void collectComplexity(java.lang.String className, java.lang.String methodName, java.lang.String methodDescription, double complexity)
          This method is called after each jumps in the method graph.
static void collectCoverage(java.lang.String className, java.lang.String methodName, java.lang.String methodDescription, int lineNumber)
          This method accumulates the number of times a thread goes through each line in a method.
static void collectEfferentAndAfferent(java.lang.String className, java.lang.String... targetClassNames)
          Collects the packages that the class references and adds them to the document.
static void collectInnerClass(java.lang.String innerName, java.lang.String outerName)
          Collects the inner class for a class.
static void collectLine(java.lang.String className, java.lang.String methodName, java.lang.String methodDescription, java.lang.Integer lineNumber)
          This method just collect the line specified in the parameter list.
static void collectOuterClass(java.lang.String innerName, java.lang.String outerName, java.lang.String outerMethodName, java.lang.String outerMethodDescription)
          Collects the outer class of an inner class.
static void collectSource(java.lang.String className, java.lang.String source)
          This method collects the Java source for the class.
protected static Line<?,?> getLine(java.lang.String className, java.lang.String methodName, java.lang.String methodDescription, double lineNumber)
           
static void setDataBase(IDataBase dataBase)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collector

public Collector()
Method Detail

setDataBase

public static void setDataBase(IDataBase dataBase)

collectCoverage

public static final void collectCoverage(java.lang.String className,
                                         java.lang.String methodName,
                                         java.lang.String methodDescription,
                                         int lineNumber)
This method accumulates the number of times a thread goes through each line in a method.

Parameters:
className - the name of the class that is calling this method
methodName - the name of the method that the line is in
methodDescription - the description of the method
lineNumber - the line number of the line that is calling this method

collectLine

public static final void collectLine(java.lang.String className,
                                     java.lang.String methodName,
                                     java.lang.String methodDescription,
                                     java.lang.Integer lineNumber)
This method just collect the line specified in the parameter list.

Parameters:
className - the name of the class that is calling this method
lineNumber - the line number of the line that is calling this method
methodName - the name of the method that the line is in
methodDescription - the description of the method

collectSource

public static final void collectSource(java.lang.String className,
                                       java.lang.String source)
This method collects the Java source for the class.

Parameters:
className - the name of the class
source - the source for the class

collectComplexity

public static final void collectComplexity(java.lang.String className,
                                           java.lang.String methodName,
                                           java.lang.String methodDescription,
                                           double complexity)
This method is called after each jumps in the method graph. Every time there is a jump the complexity goes up one point. Jumps include if else statements, or just if, throws statements, switch and so on.

Parameters:
className - the name of the class the method is in
methodName - the name of the method
methodDescription - the methodDescriptionription of the method
complexity - the complexity of the method

collectEfferentAndAfferent

public static final void collectEfferentAndAfferent(java.lang.String className,
                                                    java.lang.String... targetClassNames)
Collects the packages that the class references and adds them to the document.

Parameters:
className - the name of the classes
targetClassNames - the referenced class names

collectAccess

public static final void collectAccess(java.lang.String className,
                                       java.lang.String methodName,
                                       java.lang.String methodDescription,
                                       java.lang.Integer access)
Adds the access attribute to the method object.

Parameters:
className - the name of the class
methodName - the name of the method
methodDescription - the description of the method
access - the access opcode associated with the method

collectAccess

public static final void collectAccess(java.lang.String className,
                                       java.lang.Integer access)
Adds the access attribute to the class object.

Parameters:
className - the name of the class
access - the access opcode associated with the class

collectInnerClass

public static final void collectInnerClass(java.lang.String innerName,
                                           java.lang.String outerName)
Collects the inner class for a class.

Parameters:
innerName - the name of the inner class
outerName - the name of the outer class

collectOuterClass

public static final void collectOuterClass(java.lang.String innerName,
                                           java.lang.String outerName,
                                           java.lang.String outerMethodName,
                                           java.lang.String outerMethodDescription)
Collects the outer class of an inner class.

Parameters:
innerName - the name of the inner class
outerName - the name of the outer class
outerMethodName - the method name in the case this is an in-method class definition
outerMethodDescription - the description of the method for anonymous and inline inner classes

getLine

protected static final Line<?,?> getLine(java.lang.String className,
                                         java.lang.String methodName,
                                         java.lang.String methodDescription,
                                         double lineNumber)


Copyright © 2010. All Rights Reserved.