1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package ch.syabru.nagios.broker.jmx;
17
18 import javax.management.Notification;
19
20 import org.apache.commons.lang.builder.ToStringBuilder;
21
22 import ch.syabru.nagios.broker.Message;
23
24
25
26
27
28
29
30 public class JmxMessage implements Message {
31
32 private String className;
33 private String message;
34 private String type;
35 private String source;
36
37
38
39
40
41 public JmxMessage(Notification notification) {
42 this.className = notification.getClass().getName();
43 this.message = notification.getMessage();
44 this.type = notification.getType();
45 this.source = notification.getSource().toString();
46 }
47
48 @Override
49 public String getClassName() {
50 return className;
51 }
52
53 @Override
54 public String getMessage() {
55 return message;
56 }
57
58 @Override
59 public String getType() {
60 return type;
61 }
62
63 @Override
64 public String getSource() {
65 return source;
66 }
67
68 @Override
69 public String toString() {
70 return new ToStringBuilder(this)
71 .append("className", className)
72 .append("message", message)
73 .append("type", type)
74 .append("source", source).toString();
75 }
76 }