public abstract class AbstractRecorder extends Object implements MessageRecorder
MessageRecorder
interface.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MSG_LIMIT |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRecorder() |
protected |
AbstractRecorder(int errorMsgLimit) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Resets this MessageRecorder.
|
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(String context,
String msg,
mondrian.recorder.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(String name)
Add the name parameter to the current context.
|
protected abstract void |
recordMessage(String msg,
Object info,
mondrian.recorder.AbstractRecorder.MsgType msgType)
Handles a message.
|
void |
reportError(Exception ex)
Add an Exception.
|
void |
reportError(Exception ex,
Object info)
Add an Exception and extra informaton.
|
void |
reportError(String msg)
Add an error message.
|
void |
reportError(String msg,
Object info)
Add an error message and extra information.
|
void |
reportInfo(String msg)
Add an informational message.
|
void |
reportInfo(String msg,
Object info)
Add an informational message and extra information.
|
void |
reportWarning(String msg)
Add a warning message.
|
void |
reportWarning(String msg,
Object info)
Add a warning message and extra information.
|
void |
throwRTException()
This simply throws a RTException.
|
public static final int DEFAULT_MSG_LIMIT
protected AbstractRecorder()
protected AbstractRecorder(int errorMsgLimit)
public static void logMessage(String context, String msg, mondrian.recorder.AbstractRecorder.MsgType msgType, org.apache.log4j.Logger logger)
public void clear()
clear
in interface MessageRecorder
public long getStartTimeMillis()
MessageRecorder
getStartTimeMillis
in interface MessageRecorder
public long getRunTimeMillis()
MessageRecorder
getRunTimeMillis
in interface MessageRecorder
public boolean hasInformation()
MessageRecorder
hasInformation
in interface MessageRecorder
public boolean hasWarnings()
MessageRecorder
hasWarnings
in interface MessageRecorder
public boolean hasErrors()
MessageRecorder
hasErrors
in interface MessageRecorder
public int getInfoCount()
public int getWarningCount()
public int getErrorCount()
public String getContext()
MessageRecorder
getContext
in interface MessageRecorder
public void pushContextName(String name)
MessageRecorder
pushContextName
in interface MessageRecorder
public void popContextName()
MessageRecorder
popContextName
in interface MessageRecorder
public void throwRTException() throws RecorderException
MessageRecorder
throwRTException
in interface MessageRecorder
RecorderException
public void reportError(Exception ex) throws RecorderException
MessageRecorder
reportError
in interface MessageRecorder
ex
- the Exception added.RecorderException
- if too many error messages have been added.public void reportError(Exception ex, Object info) throws RecorderException
MessageRecorder
reportError
in interface MessageRecorder
ex
- the Exception added.info
- extra information (not meant to be part of printed message)RecorderException
- if too many error messages have been added.public void reportError(String msg) throws RecorderException
MessageRecorder
reportError
in interface MessageRecorder
msg
- the text of the error message.RecorderException
- if too many error messages have been added.public void reportError(String msg, Object info) throws RecorderException
MessageRecorder
reportError
in interface MessageRecorder
msg
- the text of the error message.info
- extra information (not meant to be part of printed message)RecorderException
- if too many error messages have been added.public void reportWarning(String msg)
MessageRecorder
reportWarning
in interface MessageRecorder
msg
- the text of the warning message.public void reportWarning(String msg, Object info)
MessageRecorder
reportWarning
in interface MessageRecorder
msg
- the text of the warning message.info
- extra information (not meant to be part of printed message)public void reportInfo(String msg)
MessageRecorder
reportInfo
in interface MessageRecorder
msg
- the text of the info message.public void reportInfo(String msg, Object info)
MessageRecorder
reportInfo
in interface MessageRecorder
msg
- the text of the info message.info
- extra information (not meant to be part of printed message)protected abstract void recordMessage(String msg, Object info, mondrian.recorder.AbstractRecorder.MsgType msgType)
msg
- the error or warning message.info
- the information Object which might be null.msgType
- one of the message type enum valuesCopyright © 2020 Hitachi Vantara. All rights reserved.