Package mondrian.recorder
Class AbstractRecorder
java.lang.Object
mondrian.recorder.AbstractRecorder
- All Implemented Interfaces:
MessageRecorder
- Direct Known Subclasses:
ListRecorder,LoggerRecorder,PrintStreamRecorder
Abstract implemention of the
MessageRecorder interface.- Author:
- Richard M. Emberson
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Resets this MessageRecorder.Get the current context string.intintlongHow long the MessageRecorder has been running since it was created or the last time clear was called.longGet the time when the MessageRecorder was created or the last time that the clear method was called.intbooleanReturns true if there are one or more error messages.booleanReturns true if there are one or more informational messages.booleanReturns true if there are one or more warning messages.static voidlogMessage(String context, String msg, mondrian.recorder.AbstractRecorder.MsgType msgType, org.apache.logging.log4j.Logger logger) Helper method to format a message and write to logger.voidRemove the last context name added.voidpushContextName(String name) Add the name parameter to the current context.protected abstract voidrecordMessage(String msg, Object info, mondrian.recorder.AbstractRecorder.MsgType msgType) Handles a message.voidreportError(Exception ex) Add an Exception.voidreportError(Exception ex, Object info) Add an Exception and extra informaton.voidreportError(String msg) Add an error message.voidreportError(String msg, Object info) Add an error message and extra information.voidreportInfo(String msg) Add an informational message.voidreportInfo(String msg, Object info) Add an informational message and extra information.voidreportWarning(String msg) Add a warning message.voidreportWarning(String msg, Object info) Add a warning message and extra information.voidThis simply throws a RTException.
-
Field Details
-
DEFAULT_MSG_LIMIT
public static final int DEFAULT_MSG_LIMIT- See Also:
-
-
Constructor Details
-
AbstractRecorder
protected AbstractRecorder() -
AbstractRecorder
protected AbstractRecorder(int errorMsgLimit)
-
-
Method Details
-
logMessage
public static void logMessage(String context, String msg, mondrian.recorder.AbstractRecorder.MsgType msgType, org.apache.logging.log4j.Logger logger) Helper method to format a message and write to logger. -
clear
public void clear()Resets this MessageRecorder.- Specified by:
clearin interfaceMessageRecorder
-
getStartTimeMillis
public long getStartTimeMillis()Description copied from interface:MessageRecorderGet the time when the MessageRecorder was created or the last time that the clear method was called.- Specified by:
getStartTimeMillisin interfaceMessageRecorder- Returns:
- the start time
-
getRunTimeMillis
public long getRunTimeMillis()Description copied from interface:MessageRecorderHow long the MessageRecorder has been running since it was created or the last time clear was called.- Specified by:
getRunTimeMillisin interfaceMessageRecorder
-
hasInformation
public boolean hasInformation()Description copied from interface:MessageRecorderReturns true if there are one or more informational messages.- Specified by:
hasInformationin interfaceMessageRecorder- Returns:
- true if there are one or more infos.
-
hasWarnings
public boolean hasWarnings()Description copied from interface:MessageRecorderReturns true if there are one or more warning messages.- Specified by:
hasWarningsin interfaceMessageRecorder- Returns:
- true if there are one or more warnings.
-
hasErrors
public boolean hasErrors()Description copied from interface:MessageRecorderReturns true if there are one or more error messages.- Specified by:
hasErrorsin interfaceMessageRecorder- Returns:
- true if there are one or more errors.
-
getInfoCount
public int getInfoCount() -
getWarningCount
public int getWarningCount() -
getErrorCount
public int getErrorCount() -
getContext
Description copied from interface:MessageRecorderGet the current context string.- Specified by:
getContextin interfaceMessageRecorder- Returns:
- the context string.
-
pushContextName
Description copied from interface:MessageRecorderAdd the name parameter to the current context.- Specified by:
pushContextNamein interfaceMessageRecorder
-
popContextName
public void popContextName()Description copied from interface:MessageRecorderRemove the last context name added.- Specified by:
popContextNamein interfaceMessageRecorder
-
throwRTException
Description copied from interface:MessageRecorderThis 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:
throwRTExceptionin interfaceMessageRecorder- Throws:
RecorderException
-
reportError
Description copied from interface:MessageRecorderAdd an Exception.- Specified by:
reportErrorin interfaceMessageRecorder- Parameters:
ex- the Exception added.- Throws:
RecorderException- if too many error messages have been added.
-
reportError
Description copied from interface:MessageRecorderAdd an Exception and extra informaton.- Specified by:
reportErrorin interfaceMessageRecorder- 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
Description copied from interface:MessageRecorderAdd an error message.- Specified by:
reportErrorin interfaceMessageRecorder- Parameters:
msg- the text of the error message.- Throws:
RecorderException- if too many error messages have been added.
-
reportError
Description copied from interface:MessageRecorderAdd an error message and extra information.- Specified by:
reportErrorin interfaceMessageRecorder- 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
Description copied from interface:MessageRecorderAdd a warning message.- Specified by:
reportWarningin interfaceMessageRecorder- Parameters:
msg- the text of the warning message.
-
reportWarning
Description copied from interface:MessageRecorderAdd a warning message and extra information.- Specified by:
reportWarningin interfaceMessageRecorder- Parameters:
msg- the text of the warning message.info- extra information (not meant to be part of printed message)
-
reportInfo
Description copied from interface:MessageRecorderAdd an informational message.- Specified by:
reportInfoin interfaceMessageRecorder- Parameters:
msg- the text of the info message.
-
reportInfo
Description copied from interface:MessageRecorderAdd an informational message and extra information.- Specified by:
reportInfoin interfaceMessageRecorder- Parameters:
msg- the text of the info message.info- extra information (not meant to be part of printed message)
-
recordMessage
protected abstract void recordMessage(String msg, Object info, mondrian.recorder.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
-