Class AbstractRecorder

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  AbstractRecorder.MsgType  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_MSG_LIMIT  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Resets this MessageRecorder.
      java.lang.String getContext()
      Get the current context string.
      int getErrorCount()  
      int getInfoCount()  
      long getRunTimeMillis()
      How long the MessageRecorder has been running since it was created or the last time clear was called.
      long getStartTimeMillis()
      Get the time when the MessageRecorder was created or the last time that the clear method was called.
      int getWarningCount()  
      boolean hasErrors()
      Returns true if there are one or more error messages.
      boolean hasInformation()
      Returns true if there are one or more informational messages.
      boolean hasWarnings()
      Returns true if there are one or more warning messages.
      static void logMessage​(java.lang.String context, java.lang.String msg, AbstractRecorder.MsgType msgType, org.apache.log4j.Logger logger)
      Helper method to format a message and write to logger.
      void popContextName()
      Remove the last context name added.
      void pushContextName​(java.lang.String name)
      Add the name parameter to the current context.
      protected abstract void recordMessage​(java.lang.String msg, java.lang.Object info, AbstractRecorder.MsgType msgType)
      Handles a message.
      void reportError​(java.lang.Exception ex)
      Add an Exception.
      void reportError​(java.lang.Exception ex, java.lang.Object info)
      Add an Exception and extra informaton.
      void reportError​(java.lang.String msg)
      Add an error message.
      void reportError​(java.lang.String msg, java.lang.Object info)
      Add an error message and extra information.
      void reportInfo​(java.lang.String msg)
      Add an informational message.
      void reportInfo​(java.lang.String msg, java.lang.Object info)
      Add an informational message and extra information.
      void reportWarning​(java.lang.String msg)
      Add a warning message.
      void reportWarning​(java.lang.String msg, java.lang.Object info)
      Add a warning message and extra information.
      void throwRTException()
      This simply throws a RTException.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractRecorder

        protected AbstractRecorder()
      • AbstractRecorder

        protected AbstractRecorder​(int errorMsgLimit)
    • Method Detail

      • logMessage

        public static void logMessage​(java.lang.String context,
                                      java.lang.String msg,
                                      AbstractRecorder.MsgType msgType,
                                      org.apache.log4j.Logger logger)
        Helper method to format a message and write to logger.
      • clear

        public void clear()
        Resets this MessageRecorder.
        Specified by:
        clear in interface MessageRecorder
      • getStartTimeMillis

        public long getStartTimeMillis()
        Description copied from interface: MessageRecorder
        Get the time when the MessageRecorder was created or the last time that the clear method was called.
        Specified by:
        getStartTimeMillis in interface MessageRecorder
        Returns:
        the start time
      • getRunTimeMillis

        public long getRunTimeMillis()
        Description copied from interface: MessageRecorder
        How long the MessageRecorder has been running since it was created or the last time clear was called.
        Specified by:
        getRunTimeMillis in interface MessageRecorder
      • hasInformation

        public boolean hasInformation()
        Description copied from interface: MessageRecorder
        Returns true if there are one or more informational messages.
        Specified by:
        hasInformation in interface MessageRecorder
        Returns:
        true if there are one or more infos.
      • hasWarnings

        public boolean hasWarnings()
        Description copied from interface: MessageRecorder
        Returns true if there are one or more warning messages.
        Specified by:
        hasWarnings in interface MessageRecorder
        Returns:
        true if there are one or more warnings.
      • hasErrors

        public boolean hasErrors()
        Description copied from interface: MessageRecorder
        Returns true if there are one or more error messages.
        Specified by:
        hasErrors in interface MessageRecorder
        Returns:
        true if there are one or more errors.
      • getInfoCount

        public int getInfoCount()
      • getWarningCount

        public int getWarningCount()
      • getErrorCount

        public int getErrorCount()
      • getContext

        public java.lang.String getContext()
        Description copied from interface: MessageRecorder
        Get the current context string.
        Specified by:
        getContext in interface MessageRecorder
        Returns:
        the context string.
      • pushContextName

        public void pushContextName​(java.lang.String name)
        Description copied from interface: MessageRecorder
        Add the name parameter to the current context.
        Specified by:
        pushContextName in interface MessageRecorder
      • throwRTException

        public void throwRTException()
                              throws RecorderException
        Description copied from interface: MessageRecorder
        This simply throws a RTException. A client calls this if 1) there is one or more error messages reported and 2) the client wishes to stop processing. Implementations of this method should only throw the RTException if there have been errors reported - if there are no errors, then this method does nothing.
        Specified by:
        throwRTException in interface MessageRecorder
        Throws:
        RecorderException
      • reportError

        public void reportError​(java.lang.Exception ex,
                                java.lang.Object info)
                         throws RecorderException
        Description copied from interface: MessageRecorder
        Add an Exception and extra informaton.
        Specified by:
        reportError in interface MessageRecorder
        Parameters:
        ex - the Exception added.
        info - extra information (not meant to be part of printed message)
        Throws:
        RecorderException - if too many error messages have been added.
      • reportError

        public void reportError​(java.lang.String msg,
                                java.lang.Object info)
                         throws RecorderException
        Description copied from interface: MessageRecorder
        Add an error message and extra information.
        Specified by:
        reportError in interface MessageRecorder
        Parameters:
        msg - the text of the error message.
        info - extra information (not meant to be part of printed message)
        Throws:
        RecorderException - if too many error messages have been added.
      • reportWarning

        public void reportWarning​(java.lang.String msg)
        Description copied from interface: MessageRecorder
        Add a warning message.
        Specified by:
        reportWarning in interface MessageRecorder
        Parameters:
        msg - the text of the warning message.
      • reportWarning

        public void reportWarning​(java.lang.String msg,
                                  java.lang.Object info)
        Description copied from interface: MessageRecorder
        Add a warning message and extra information.
        Specified by:
        reportWarning in interface MessageRecorder
        Parameters:
        msg - the text of the warning message.
        info - extra information (not meant to be part of printed message)
      • reportInfo

        public void reportInfo​(java.lang.String msg)
        Description copied from interface: MessageRecorder
        Add an informational message.
        Specified by:
        reportInfo in interface MessageRecorder
        Parameters:
        msg - the text of the info message.
      • reportInfo

        public void reportInfo​(java.lang.String msg,
                               java.lang.Object info)
        Description copied from interface: MessageRecorder
        Add an informational message and extra information.
        Specified by:
        reportInfo in interface MessageRecorder
        Parameters:
        msg - the text of the info message.
        info - extra information (not meant to be part of printed message)
      • recordMessage

        protected abstract void recordMessage​(java.lang.String msg,
                                              java.lang.Object info,
                                              AbstractRecorder.MsgType msgType)
        Handles a message. Classes implementing this abstract class must provide an implemention of this method; it receives all warning/error messages.
        Parameters:
        msg - the error or warning message.
        info - the information Object which might be null.
        msgType - one of the message type enum values