|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.util.logging.AbstractReporter
public abstract class AbstractReporter
base implementation of a Reporter. This class provides default
behaviors for the org.eclipse.actf.core.logging.Reporter
interface, which
adds functionality for identifying the source of reported messages and for
rerouting errors and exceptions using the error-logging features added to ACTF.
Note: Clients should subclass this class rather than implementing Reporter
to avoid
API incompatibilities and to insure appropriate behavior.
IReporter
Field Summary | |
---|---|
protected ResourceBundle |
bundle
|
protected Stack |
categories
|
static MessageFormat |
CATEGORY_FORMATTER
formatter for forming category id strings. |
protected MessageFormat |
categoryFormatter
|
protected int |
defaultOutputLevel
|
protected List |
errorLoggers
|
protected static Map |
SOURCE_ID_MAP
|
protected String |
sourceID
|
Fields inherited from interface org.eclipse.actf.util.logging.IReporter |
---|
CONFIG, CONFIGURATION, DEFAULT_LEVEL, DETAIL, ERROR, INFO, KEYS, MAX_LEVEL, MIN_LEVEL, SEVERE, SYSTEM_FATAL, SYSTEM_NONFATAL, TRACE, UNKNOWN, USER, VALIDATION, WARNING |
Constructor Summary | |
---|---|
AbstractReporter()
|
Method Summary | |
---|---|
void |
endCategory()
end the current reporting category |
void |
endCategory(String id)
end the category with the given id |
String |
getCategory()
get the category id string of current reporting |
MessageFormat |
getCategoryFormatter()
|
int |
getDefaultOutputLevel()
get the default output level. |
static IReporter |
getReporter(int traceLevel,
String traceStream)
utility method to construct reporters |
ResourceBundle |
getResourceBundle()
get the underlying resource bundle |
String |
getSourceID()
gets the id or name of this reporter |
String |
getSourceIDString(String id)
get the source id string associated with the given key. |
void |
registerErrorLogger(IErrorLogger logger)
add an error logger to the list of loggers to receive requests to report errors from this reporter. |
void |
report(int level,
String message)
report the message at the given level. |
void |
report(int level,
String msg,
Throwable t)
reports an exception or error. |
void |
report(int level,
Throwable t)
reports an exception or error. |
void |
report(String message)
report the message |
void |
report(String message,
Object[] values)
report an information message using the substitution values |
void |
report(Throwable t)
reports an exception or error. |
void |
reset()
reset the reporter. |
void |
setCategoryFormatter(MessageFormat formatter)
|
void |
setDefaultOutputLevel(int level)
set the default output level. |
void |
setResourceBundle(ResourceBundle bundle)
set the resource bundle |
void |
setSourceID(String id)
set the source id for future reports. |
void |
startCategory(String id)
start a new category with the given id. |
void |
unregisterErrorLogger(IErrorLogger logger)
remove an error logger from the list of loggers to receive errors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.actf.util.logging.IReporter |
---|
close, endReport, flush, getLastReport, isOpen, open, report, setLastReport, startReport |
Field Detail |
---|
public static final MessageFormat CATEGORY_FORMATTER
<nodeName>[<nodeDescription>][@id=<nodeId>]
where:
nodeName
is the node name of the node as returned by IModel.getNodeName
nodeDescription
is the node description of the node as returned by IModel.getNodeLocator.describe
nodeId
is the unique node id of the node as returned by IModel.getNodeId
The category formatter can be changed using the setCategoryFormatter(messageFormat)
method.
setCategoryFormatter(MessageFormat)
protected static final Map SOURCE_ID_MAP
protected int defaultOutputLevel
protected Stack categories
protected MessageFormat categoryFormatter
protected String sourceID
protected ResourceBundle bundle
protected List errorLoggers
Constructor Detail |
---|
public AbstractReporter()
Method Detail |
---|
public void registerErrorLogger(IErrorLogger logger)
registerErrorLogger
in interface IReporter
logger
- - error logger for reporting errorspublic void unregisterErrorLogger(IErrorLogger logger)
unregisterErrorLogger
in interface IReporter
logger
- - error logger to be removedpublic ResourceBundle getResourceBundle()
public void setResourceBundle(ResourceBundle bundle)
bundle
- public void setCategoryFormatter(MessageFormat formatter)
public MessageFormat getCategoryFormatter()
public void setSourceID(String id)
The id can be one of the following:
VALIDATION
- validation violation
USER
- user error (i.e. can be remedied by user)
SYSTEM_FATAL
- fatal system error (e.g. resource not found)
SYSTEM_NONFATAL
- nonfatal system error (i.e. process can continue but results are suspect)
TRACE
- message related to tracing or debugging
CONFIGURATION
- message related to configuration
setSourceID
in interface IReporter
id
- - name or id of this reporterpublic String getSourceID()
getSourceID
in interface IReporter
IReporter.setSourceID(String)
public String getSourceIDString(String id)
null
if one of the pre-defined symbolic constants in the Reporter
interface
are not used.
id
-
public void setDefaultOutputLevel(int level)
setDefaultOutputLevel
in interface IReporter
level
- - default output levelpublic int getDefaultOutputLevel()
getDefaultOutputLevel
in interface IReporter
IReporter.setDefaultOutputLevel(int)
public void report(String message)
report
in interface IReporter
message
- -- message to be writtenpublic void report(String message, Object[] values)
report
in interface IReporter
message
- -- message to be reportedvalues
- -- substitution valuespublic void report(int level, String message)
report
in interface IReporter
level
- -- level of messagemessage
- -- message to be reportedpublic void report(Throwable t)
The default level of this report message is Reporter.SEVERE
.
report
in interface IReporter
t
- - Throwable being reportedpublic void report(int level, Throwable t)
report
in interface IReporter
level
- - level of exception or errort
- - Throwable being reportedpublic void report(int level, String msg, Throwable t)
report
in interface IReporter
level
- - level of exception or errormsg
- - optional messaget
- - Throwable being reportedpublic String getCategory()
getCategory
in interface IReporter
public void startCategory(String id)
startCategory
in interface IReporter
id
- -- new category idpublic void endCategory()
endCategory
in interface IReporter
public void endCategory(String id)
endCategory
in interface IReporter
id
- -- id of category to endpublic static IReporter getReporter(int traceLevel, String traceStream)
traceLevel
- - level at which to reporttraceStream
- - stream to which report is sent (either a file, 'stderr', or 'stdout')
public void reset()
reset
in interface IReporter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |