org.schmant.report
Class ReportManager

java.lang.Object
  extended by org.schmant.report.ReportManager

public class ReportManager
extends Object

The ReportManager creates and manages a Schmant application's different Report instances. Every execution thread has its own Report. A Schmant task or script can get its thread's Report instance by calling getReport(). (Supported script types have utility methods defined for this and do not have to call the ReportManager methods themselves.)

Since:
0.5
Author:
Karl Gustafsson
See Also:
Report, ReportFactory

Constructor Summary
ReportManager()
           
 
Method Summary
static ReportFactory getDefaultReportFactory()
          Get the default ReportFactory that is used for creating Report objects unless no factory is specified.
static Report getReport()
          Get the Report for the current thread.
static Report init()
          This method is called by Launcher to set up the report manager.
static Report newReport()
          Create a new Report for the current thread using the current default ReportFactory.
static Report newReport(ReportFactory rf)
          Create a new Report for the current thread using the supplied ReportFactory.
static Report newReport(ReportFactory rf, String identifier)
          Create a new Report for the current thread using the supplied ReportFactory.
static Report newReport(String identifier)
          Create a new Report for the current thread using the current default ReportFactory.
static void setDefaultReportFactory(ReportFactory rf)
          Set a new default ReportFactory.
static void setReport(Report r)
          Set a new Report for the current thread.
static void tearDown(Report prevReport)
          Tear down the report manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportManager

public ReportManager()
Method Detail

init

public static Report init()
This method is called by Launcher to set up the report manager.

Returns:
If there already is a report, it is returned by this method. Launcher will keep it and return it when it calls tearDown(Report).
See Also:
tearDown(Report)

tearDown

public static void tearDown(Report prevReport)
Tear down the report manager. This is called by Launcher.

Parameters:
prevReport - The previous report, if any.

newReport

public static Report newReport()
Create a new Report for the current thread using the current default ReportFactory. The report will not have its identifier set.

Returns:
A new report.

newReport

public static Report newReport(String identifier)
Create a new Report for the current thread using the current default ReportFactory.

Parameters:
identifier - The identifier for the report.
Returns:
A new report.

newReport

public static Report newReport(ReportFactory rf,
                               String identifier)
Create a new Report for the current thread using the supplied ReportFactory.

Parameters:
rf - The report factory.
identifier - The identifier for the report.
Returns:
A new report.

newReport

public static Report newReport(ReportFactory rf)
Create a new Report for the current thread using the supplied ReportFactory. The report will not have its identifier set.

Parameters:
rf - The report factory.
Returns:
A new report.

getReport

public static Report getReport()
Get the Report for the current thread.

Returns:
The Report.

setReport

public static void setReport(Report r)
Set a new Report for the current thread.

Parameters:
r - The new Report. This may be null.

setDefaultReportFactory

public static void setDefaultReportFactory(ReportFactory rf)
Set a new default ReportFactory.

Parameters:
rf - The report factory.

getDefaultReportFactory

public static ReportFactory getDefaultReportFactory()
Get the default ReportFactory that is used for creating Report objects unless no factory is specified.

Returns:
The default ReportFactory.