Class InitializationReportLogger

java.lang.Object
com.aquima.interactions.foundation.report.InitializationReportLogger
All Implemented Interfaces:
IInitializationReport, Serializable

public class InitializationReportLogger extends Object implements IInitializationReport
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

    Fields
    Modifier and Type
    Field
    Description
    The reporting logger which uses the logging facility to log the report to a log file.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Construction is disabled as this reporter can be acquired by REPORTER.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
     
    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
    This method returns the number of messages with the requested 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.
    This method returns an XML representation of the report.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • REPORTER

      public static final IInitializationReport 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 by REPORTER.
  • 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 interface IInitializationReport
      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

      public void addMessage(Category category, ErrorCode code, String[] parameters, Severity severity)
      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 interface IInitializationReport
      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 interface IInitializationReport
      Parameters:
      id - The unique id which was retrieved by the beginscope call.
    • beginScope

      public int beginScope(Category category, ErrorCode code, String[] parameters)
      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 interface IInitializationReport
      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

      public InitializationMessage 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 interface IInitializationReport
      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 interface IInitializationReport
      Returns:
      the total number of messages that is present in the report.
    • getMessageCount

      public int getMessageCount(Severity severity)
      Description copied from interface: IInitializationReport
      This method returns the number of messages with the requested severity.
      Specified by:
      getMessageCount in interface IInitializationReport
      Parameters:
      severity - The severity of the requested message count.
      Returns:
      the number of messages with the requested severity.
    • getMessages

      public InitializationMessage[] getMessages(Severity severity)
      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 interface IInitializationReport
      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 interface IInitializationReport
      Returns:
      a boolean indicating if any messages have been added to the report.
    • toXml

      public IXmlElement toXml()
      Description copied from interface: IInitializationReport
      This method returns an XML representation of the report.
      Specified by:
      toXml in interface IInitializationReport
      Returns:
      an XML representation of the report.
    • addReport

      public void addReport(IInitializationReport other)
      Specified by:
      addReport in interface IInitializationReport