diff options
Diffstat (limited to '')
-rw-r--r-- | java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java index 0d94af0070..9fe13020a6 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java @@ -174,5 +174,32 @@ public abstract class Monitor { } } + /** + * A utility function for raising an error. It creates the problem and + * adds it to the monitor + * + * @param monitor + * @param reportingObject + * @param messageBundle + * @param messageId + * @param exception + */ + public static void error (Monitor monitor, + Object reportingObject, + String messageBundle, + String messageId, + Exception cause){ + if (monitor != null) { + Problem problem = + monitor.createProblem(reportingObject.getClass().getName(), + messageBundle, + Severity.ERROR, + null, + messageId, + cause); + monitor.problem(problem); + } + } + // ===================================================== } |