com.nokia.ant
Class HeliumLogger

java.lang.Object
  extended by org.apache.tools.ant.DefaultLogger
      extended by com.nokia.ant.HeliumLogger
All Implemented Interfaces:
java.util.EventListener, org.apache.tools.ant.BuildListener, org.apache.tools.ant.BuildLogger

public class HeliumLogger
extends org.apache.tools.ant.DefaultLogger

Logger class that can connect to Ant and log information regarding to build times, number of errors and such. Data is sent to Diamonds server, where it is processed further. This class is listening all build related events. It catches the build start-finish, target start-finish events of Ant and gather build start-end time, errors/warnings and store in BuildData class. Stored data will be exported to XML and uploaded to Diamonds server after each specific target. For example after target "create-bom" this class will upload all BOM data to Diamonds.


Field Summary
 
Fields inherited from class org.apache.tools.ant.DefaultLogger
emacsMode, err, LEFT_COLUMN_SIZE, lSep, msgOutputLevel, out
 
Constructor Summary
HeliumLogger()
          Default constructor.
 
Method Summary
 void buildFinished(org.apache.tools.ant.BuildEvent event)
          Triggered when the build finishes.
 void buildStarted(org.apache.tools.ant.BuildEvent event)
          Ant call this function when bjuild start.
protected  java.util.Date getStageStartTime(org.apache.tools.ant.Target target, java.util.Hashtable tempStartTime)
          This function finds the actual start time of a target based on its the depency list if no dependecy exist for a target it returns null
static boolean getStopLogToConsole()
          Get log to console status
 void messageLogged(org.apache.tools.ant.BuildEvent event)
          Triggered when a build message is logged.
static void setStopLogToConsole(boolean stop)
          Set log to console status
 void targetFinished(org.apache.tools.ant.BuildEvent event)
          Triggered when a target finishes.
 void targetStarted(org.apache.tools.ant.BuildEvent event)
          Triggered when a target starts.
 void taskFinished(org.apache.tools.ant.BuildEvent event)
          Triggered when a task finishes.
 void taskStarted(org.apache.tools.ant.BuildEvent event)
          Triggered when a task starts.
protected  void writeStages(java.lang.StringBuffer allStages, java.lang.String filePath)
          Write all stages to temp dir to include in diamond-full.xml
 
Methods inherited from class org.apache.tools.ant.DefaultLogger
formatTime, getBuildFailedMessage, getBuildSuccessfulMessage, log, printMessage, setEmacsMode, setErrorPrintStream, setMessageOutputLevel, setOutputPrintStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeliumLogger

public HeliumLogger()
Default constructor.

Method Detail

buildStarted

public void buildStarted(org.apache.tools.ant.BuildEvent event)
Ant call this function when bjuild start.

Specified by:
buildStarted in interface org.apache.tools.ant.BuildListener
Overrides:
buildStarted in class org.apache.tools.ant.DefaultLogger

targetStarted

public void targetStarted(org.apache.tools.ant.BuildEvent event)
Triggered when a target starts.

Specified by:
targetStarted in interface org.apache.tools.ant.BuildListener
Overrides:
targetStarted in class org.apache.tools.ant.DefaultLogger

targetFinished

public void targetFinished(org.apache.tools.ant.BuildEvent event)
Triggered when a target finishes.

Specified by:
targetFinished in interface org.apache.tools.ant.BuildListener
Overrides:
targetFinished in class org.apache.tools.ant.DefaultLogger

buildFinished

public void buildFinished(org.apache.tools.ant.BuildEvent event)
Triggered when the build finishes.

Specified by:
buildFinished in interface org.apache.tools.ant.BuildListener
Overrides:
buildFinished in class org.apache.tools.ant.DefaultLogger

getStageStartTime

protected java.util.Date getStageStartTime(org.apache.tools.ant.Target target,
                                           java.util.Hashtable tempStartTime)
This function finds the actual start time of a target based on its the depency list if no dependecy exist for a target it returns null

Parameters:
target - name to get the start time
tempStartTime - hashtable that contains the start time of targets
Returns:
if target is start of a stage or not as boolean

writeStages

protected void writeStages(java.lang.StringBuffer allStages,
                           java.lang.String filePath)
Write all stages to temp dir to include in diamond-full.xml

Parameters:
allStages - contains all the stage info
filePath - path to save the file of stages information

getStopLogToConsole

public static boolean getStopLogToConsole()
Get log to console status


setStopLogToConsole

public static void setStopLogToConsole(boolean stop)
Set log to console status


taskStarted

public void taskStarted(org.apache.tools.ant.BuildEvent event)
Triggered when a task starts.

Specified by:
taskStarted in interface org.apache.tools.ant.BuildListener
Overrides:
taskStarted in class org.apache.tools.ant.DefaultLogger

taskFinished

public void taskFinished(org.apache.tools.ant.BuildEvent event)
Triggered when a task finishes.

Specified by:
taskFinished in interface org.apache.tools.ant.BuildListener
Overrides:
taskFinished in class org.apache.tools.ant.DefaultLogger

messageLogged

public void messageLogged(org.apache.tools.ant.BuildEvent event)
Triggered when a build message is logged.

Specified by:
messageLogged in interface org.apache.tools.ant.BuildListener
Overrides:
messageLogged in class org.apache.tools.ant.DefaultLogger