From 017d141d3df74bd849cba03166dd4784a53ca92a Mon Sep 17 00:00:00 2001 From: edwardsmj Date: Wed, 22 Apr 2009 09:12:47 +0000 Subject: Extended Monitoring to give better diagnostic messages which include the name of the artifact being processed. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@767422 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/tuscany/sca/monitor/Monitor.java | 12 ++++++++++++ .../org/apache/tuscany/sca/monitor/impl/MonitorImpl.java | 11 +++++++++++ 2 files changed, 23 insertions(+) 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 f0ac8a6dbb..14366b423d 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 @@ -76,4 +76,16 @@ public interface Monitor { */ Problem createProblem(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Object... messageParams ); + /** + * Set the name of an artifact for which errors are Monitored + * @param artifactName the artifact name + */ + void setArtifactName( String artifactName ); + + /** + * Get the name of the artifact for which errors are Monitored + * @return the name of the Artifact or null if no artifact name has been set + */ + String getArtifactName(); + } diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java index fa562a5f23..ca0c7d865c 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java @@ -38,6 +38,9 @@ public class MonitorImpl implements Monitor { // Cache all the problem reported to monitor for further analysis private List problemCache = new ArrayList(); + + // Name of an artifact for which problems are being Monitored + private String artifactName = null; public void problem(Problem problem) { @@ -89,4 +92,12 @@ public class MonitorImpl implements Monitor { public Problem createProblem(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Object... messageParams) { return new ProblemImpl(sourceClassName, bundleName, severity, problemObject, messageId, messageParams); } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } } -- cgit v1.2.3