Class InitializationReportLogger
java.lang.Object
com.aquima.interactions.foundation.report.InitializationReportLogger
- All Implemented Interfaces:
IInitializationReport
,Serializable
This class is a minimal implementation of IInitializationReport which logs all the reported messages using the Logger
created by the LogFactory.
- Since:
- 5.1
- Author:
- Jon van Leuven, F. van der Meer
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final IInitializationReport
The reporting logger which uses the logging facility to log the report to a log file. -
Constructor Summary
ModifierConstructorDescriptionprotected
Construction is disabled as this reporter can be acquired byREPORTER
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addReport
(IInitializationReport other) int
beginScope
(Category category, ErrorCode code, String[] parameters) This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code.void
endScope
(int id) This method ends the scope of the initialisation report.int
This method returns the total number of messages that is present in the report.int
getMessageCount
(Severity severity) This method returns the number of messages with the requested severity.getMessages
(Severity severity) This method returns an array containing all the messages of the requested severity.This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.boolean
This method returns a boolean indicating if any messages have been added to the report.toXml()
This method returns an XML representation of the report.
-
Field Details
-
REPORTER
The reporting logger which uses the logging facility to log the report to a log file.
-
-
Constructor Details
-
InitializationReportLogger
protected InitializationReportLogger()Construction is disabled as this reporter can be acquired byREPORTER
.
-
-
Method Details
-
addMessage
public void addMessage(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) Description copied from interface:IInitializationReport
This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context. In addition a cause can be added in case of spurious errors.- Specified by:
addMessage
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.cause
- The exception which causes the error which is added to the report.
-
addMessage
Description copied from interface:IInitializationReport
This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.- Specified by:
addMessage
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.
-
endScope
public void endScope(int id) Description copied from interface:IInitializationReport
This method ends the scope of the initialisation report.- Specified by:
endScope
in interfaceIInitializationReport
- Parameters:
id
- The unique id which was retrieved by the beginscope call.
-
beginScope
Description copied from interface:IInitializationReport
This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code. Using this structure gives the initialisation messages a tree like structure.- Specified by:
beginScope
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message/scope originated from.code
- The code of the initialisation message which is used only if an initialisation message is added.parameters
- array of parameters for the message.- Returns:
- A unique identifier which can be used to end the current scope.
-
getRootMessage
Description copied from interface:IInitializationReport
This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.- Specified by:
getRootMessage
in interfaceIInitializationReport
- Returns:
- The root message of the initialisation report.
-
getMessageCount
public int getMessageCount()Description copied from interface:IInitializationReport
This method returns the total number of messages that is present in the report.- Specified by:
getMessageCount
in interfaceIInitializationReport
- Returns:
- the total number of messages that is present in the report.
-
getMessageCount
Description copied from interface:IInitializationReport
This method returns the number of messages with the requested severity.- Specified by:
getMessageCount
in interfaceIInitializationReport
- Parameters:
severity
- The severity of the requested message count.- Returns:
- the number of messages with the requested severity.
-
getMessages
Description copied from interface:IInitializationReport
This method returns an array containing all the messages of the requested severity. If no messages with the requested severity are found, an empty array is returned.- Specified by:
getMessages
in interfaceIInitializationReport
- Parameters:
severity
- The severity of the requested messages.- Returns:
- an array containing all the messages of the requested severity.
-
hasMessages
public boolean hasMessages()Description copied from interface:IInitializationReport
This method returns a boolean indicating if any messages have been added to the report.- Specified by:
hasMessages
in interfaceIInitializationReport
- Returns:
- a boolean indicating if any messages have been added to the report.
-
toXml
Description copied from interface:IInitializationReport
This method returns an XML representation of the report.- Specified by:
toXml
in interfaceIInitializationReport
- Returns:
- an XML representation of the report.
-
addReport
- Specified by:
addReport
in interfaceIInitializationReport
-