01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package example.jmx.notification;
09:
10: import javax.management.AttributeChangeNotification;
11: import javax.management.NotificationBroadcasterSupport;
12:
13: /**
14: *
15: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
16: */
17:
18: public class SimpleNotification extends NotificationBroadcasterSupport
19: implements SimpleNotificationMBean {
20: private String word;
21:
22: public SimpleNotification(String word) {
23: this .word = word;
24: }
25:
26: public String getWord() {
27: return word;
28: }
29:
30: public void setWord(String _word) {
31: Object old = word;
32: word = _word;
33:
34: /*
35: * send notification
36: */
37: AttributeChangeNotification notify = new AttributeChangeNotification(
38: this , System.currentTimeMillis(), System
39: .currentTimeMillis(), "Word Changed", "word",
40: "java.lang.String", old, word);
41: this .sendNotification(notify);
42:
43: }
44:
45: public void printWord() {
46: System.out.println(word);
47: }
48:
49: public void setString(String s) {
50:
51: }
52: }
|