Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.core.report.impl
Class DefaultReporter<T extends Message>

java.lang.Object
  extended by eu.esdihumboldt.hale.common.core.report.impl.DefaultReporter<T>
Type Parameters:
T - the message type
All Implemented Interfaces:
Report<T>, Reporter<T>, ReportLog<T>
Direct Known Subclasses:
DefaultInstanceValidationReporter, DefaultIOReporter, DefaultTransformationReporter

public class DefaultReporter<T extends Message>
extends Object
implements Reporter<T>

Default report implementation

Since:
2.5
Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Field Summary
static de.cs3d.util.logging.ALogger log
          The logger
 
Constructor Summary
DefaultReporter(String taskName, Class<T> messageType, boolean doLog)
          Create an empty report.
 
Method Summary
 void error(T message)
          Adds an error to the report.
 Collection<T> getErrors()
          Get the error messages
protected  String getFailSummary()
          Get the default report summary if it was not successful.
 Collection<T> getInfos()
          Get the info messages
 Class<T> getMessageType()
          Get the message type (for determining the message type at runtime).
 Date getStartTime()
          Get the start time of the report.
protected  String getSuccessSummary()
          Get the default report summary if it was successful.
 String getSummary()
          Get a short message stating a summary of the report
 String getTaskName()
          Get the name of the task the report relates to
 Date getTimestamp()
          Get the report time
 Collection<T> getWarnings()
          Get the warning messages
 void info(T message)
          Adds an info to the report.
 boolean isSuccess()
          States if the report represents a successful task
 void setStartTime(Date starttime)
          Set the start time of the report.
 void setSuccess(boolean success)
          Set if the task was successful.
 void setSummary(String summary)
          Set the summary message of the report.
 void setTimestamp(Date timestamp)
          Set the report time
 String toString()
           
 void warn(T message)
          Adds a warning to the report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static final de.cs3d.util.logging.ALogger log
The logger

Constructor Detail

DefaultReporter

public DefaultReporter(String taskName,
                       Class<T> messageType,
                       boolean doLog)
Create an empty report. It is set to not successful by default. But you should call setSuccess(boolean) nonetheless to update the timestamp after the task has finished.

Parameters:
taskName - the name of the task the report is related to
messageType - the message type
doLog - if added messages shall also be logged using ALogger
Method Detail

warn

public void warn(T message)
Adds a warning to the report. If configured accordingly a log message will also be created.

Specified by:
warn in interface ReportLog<T extends Message>
Parameters:
message - the warning message

error

public void error(T message)
Adds an error to the report. If configured accordingly a log message will also be created.

Specified by:
error in interface ReportLog<T extends Message>
Parameters:
message - the error message

info

public void info(T message)
Description copied from interface: ReportLog
Adds an info to the report. If configured accordingly a log message will also be created.

Specified by:
info in interface ReportLog<T extends Message>
Parameters:
message - the info message
See Also:
ReportLog.info(eu.esdihumboldt.hale.common.core.report.Message)

setSummary

public void setSummary(String summary)
Set the summary message of the report.

Specified by:
setSummary in interface Reporter<T extends Message>
Parameters:
summary - the summary to set, if null the report will revert to the default summary.

getTaskName

public String getTaskName()
Description copied from interface: Report
Get the name of the task the report relates to

Specified by:
getTaskName in interface Report<T extends Message>
Returns:
the task name
See Also:
Report.getTaskName()

getErrors

public Collection<T> getErrors()
Description copied from interface: Report
Get the error messages

Specified by:
getErrors in interface Report<T extends Message>
Returns:
the error messages
See Also:
Report.getErrors()

getMessageType

public Class<T> getMessageType()
Description copied from interface: Report
Get the message type (for determining the message type at runtime).

Specified by:
getMessageType in interface Report<T extends Message>
Returns:
the message type
See Also:
Report.getMessageType()

getSummary

public String getSummary()
Description copied from interface: Report
Get a short message stating a summary of the report

Specified by:
getSummary in interface Report<T extends Message>
Returns:
a short summary message
See Also:
Report.getSummary()

getFailSummary

protected String getFailSummary()
Get the default report summary if it was not successful.

Returns:
the report summary

getSuccessSummary

protected String getSuccessSummary()
Get the default report summary if it was successful.

Returns:
the report summary

getTimestamp

public Date getTimestamp()
Description copied from interface: Report
Get the report time

Specified by:
getTimestamp in interface Report<T extends Message>
Returns:
the report time
See Also:
Report.getTimestamp()

getWarnings

public Collection<T> getWarnings()
Description copied from interface: Report
Get the warning messages

Specified by:
getWarnings in interface Report<T extends Message>
Returns:
the warning messages
See Also:
Report.getWarnings()

getInfos

public Collection<T> getInfos()
Description copied from interface: Report
Get the info messages

Specified by:
getInfos in interface Report<T extends Message>
Returns:
the info messages
See Also:
Report.getInfos()

setSuccess

public void setSuccess(boolean success)
Description copied from interface: Reporter
Set if the task was successful. Should set the timestamps if none are provided so far. Should be called when the task is finished.

Specified by:
setSuccess in interface Reporter<T extends Message>
Parameters:
success - if the task was successful
See Also:
Reporter.setSuccess(boolean)

isSuccess

public boolean isSuccess()
Description copied from interface: Report
States if the report represents a successful task

Specified by:
isSuccess in interface Report<T extends Message>
Returns:
if the task was successful
See Also:
Report.isSuccess()

getStartTime

public Date getStartTime()
Description copied from interface: Report
Get the start time of the report. This is optional. If a start time is present the Report.getTimestamp() can be seen as an end time and used to compute a duration.

Specified by:
getStartTime in interface Report<T extends Message>
Returns:
the start time or null
See Also:
Report.getStartTime()

toString

public String toString()
Overrides:
toString in class Object

setTimestamp

public void setTimestamp(Date timestamp)
Description copied from interface: Reporter
Set the report time

Specified by:
setTimestamp in interface Reporter<T extends Message>
Parameters:
timestamp - the timestamp
See Also:
Reporter.setTimestamp(java.util.Date)

setStartTime

public void setStartTime(Date starttime)
Description copied from interface: Reporter
Set the start time of the report. This is optional. If a start time is present the Report.getTimestamp() can be seen as an end time and used to compute a duration.

Specified by:
setStartTime in interface Reporter<T extends Message>
Parameters:
starttime - the starttime
See Also:
Reporter.setStartTime(java.util.Date)

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d