Source Code Cross Referenced for Notification.java in  » JMX » jfoxmx » javax » management » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » jfoxmx » javax.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.org
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package javax.management;
009:
010:        import java.util.EventObject;
011:        import java.io.ObjectInputStream;
012:        import java.io.IOException;
013:        import java.io.ObjectOutputStream;
014:
015:        /**
016:         * The Notification class represents a notification emitted by an MBean.
017:         * It contains a reference to the source MBean: if the notification has been forwarded through the MBean server,
018:         * this is the object name of the MBean. If the listener has registered directly with the MBean, this is a direct reference
019:         * to the MBean.
020:         *
021:         * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
022:         */
023:
024:        public class Notification extends EventObject {
025:
026:            /**
027:             * The notification type. A string expressed in a dot notation similar to Java properties.
028:             * An example of a notification type is network.alarm.router
029:             */
030:            private String type;
031:
032:            /**
033:             * The notification sequence number. A serial number which identify particular instance
034:             * of notification in the context of the notification source.
035:             */
036:            private long sequenceNumber;
037:
038:            /**
039:             * The notification timestamp. Indicating when the notification was generated
040:             */
041:            private long timeStamp;
042:
043:            /**
044:             * The notification user data.  Used for whatever other data the notification
045:             * source wishes to communicate to its consumers
046:             */
047:            private Object userData = null;
048:
049:            /**
050:             * The notification message.
051:             */
052:            private String message = new String();
053:
054:            /**
055:             * The ObjectName source
056:             */
057:            private ObjectName sourceObjectName = null;
058:
059:            /**
060:             * The object on which the notification initially occurred.
061:             */
062:            protected Object source = null;
063:
064:            /**
065:             * Creates a Notification object.
066:             * The notification timeStamp is set to the curent date.
067:             *
068:             * @param type The notification type.
069:             * @param source The notification source.
070:             * @param sequenceNumber The notification sequence number within the source object.
071:             *
072:             */
073:            public Notification(String type, Object source, long sequenceNumber) {
074:                super (source);
075:                this .source = source;
076:                this .type = type;
077:                this .sequenceNumber = sequenceNumber;
078:                this .timeStamp = (new java.util.Date()).getTime();
079:            }
080:
081:            /**
082:             * Creates a Notification object.
083:             * The notification timeStamp is set to the curent date.
084:             *
085:             * @param type The notification type.
086:             * @param source The notification source.
087:             * @param sequenceNumber The notification sequence number within the source object.
088:             * @param message The detailed message.
089:             *
090:             */
091:            public Notification(String type, Object source,
092:                    long sequenceNumber, String message) {
093:                super (source);
094:                this .source = source;
095:                this .type = type;
096:                this .sequenceNumber = sequenceNumber;
097:                this .timeStamp = (new java.util.Date()).getTime();
098:                this .message = message;
099:            }
100:
101:            /**
102:             * Creates a Notification object.
103:             *
104:             * @param type The notification type.
105:             * @param source The notification source.
106:             * @param sequenceNumber The notification sequence number within the source object.
107:             * @param timeStamp The notification emission date.
108:             *
109:             */
110:            public Notification(String type, Object source,
111:                    long sequenceNumber, long timeStamp) {
112:                super (source);
113:                this .source = source;
114:                this .type = type;
115:                this .sequenceNumber = sequenceNumber;
116:                this .timeStamp = timeStamp;
117:            }
118:
119:            /**
120:             * Creates a Notification object.
121:             *
122:             * @param type The notification type.
123:             * @param source The notification source.
124:             * @param sequenceNumber The notification sequence number within the source object.
125:             * @param timeStamp The notification emission date.
126:             * @param message The detailed message.
127:             *
128:             */
129:            public Notification(String type, Object source,
130:                    long sequenceNumber, long timeStamp, String message) {
131:                super (source);
132:                this .source = source;
133:                this .type = type;
134:                this .sequenceNumber = sequenceNumber;
135:                this .timeStamp = timeStamp;
136:                this .message = message;
137:            }
138:
139:            /**
140:             * Get the source object name
141:             *
142:             *@return The MBean object name on which the notification initially occurred.
143:             *
144:             */
145:            public Object getSource() {
146:                if (sourceObjectName == null) {
147:                    return source;
148:                } else {
149:                    return sourceObjectName;
150:                }
151:            }
152:
153:            /**
154:             * Set the source object name
155:             *
156:             * @exception java.lang.IllegalArgumentException The source is not a ObjectName
157:             *
158:             */
159:            public void setSource(Object source)
160:                    throws java.lang.IllegalArgumentException {
161:                if (!(source instanceof  ObjectName)) {
162:                    throw new java.lang.IllegalArgumentException();
163:                }
164:                this .sourceObjectName = (ObjectName) source;
165:                this .source = source;
166:            }
167:
168:            /**
169:             * Get the notification sequence number.
170:             *
171:             * @return The notification sequence number within the source object. It's a serial number
172:             * identifying a particular instance of notification in the context of the notification source.
173:             * The notification model does not assume that notifications will be received in the same order
174:             * that they are sent. The sequence number helps listeners to sort received notifications.
175:             *
176:             */
177:            public long getSequenceNumber() {
178:                return sequenceNumber;
179:            }
180:
181:            /**
182:             * Set the notification sequence number.
183:             *
184:             * @param sequenceNumber The notification sequence number within the source object. It is
185:             * a serial number identifying a particular instance of notification in the
186:             * context of the notification source.
187:             *
188:             */
189:            public void setSequenceNumber(long sequenceNumber) {
190:                this .sequenceNumber = sequenceNumber;
191:            }
192:
193:            /**
194:             * Get the notification type.
195:             *
196:             * @return The notification type. It's a string expressed in a dot notation similar
197:             * to Java properties. An example of a notification type is network.alarm.router .
198:             *
199:             */
200:            public String getType() {
201:                return type;
202:            }
203:
204:            /**
205:             * Get the notification timestamp.
206:             *
207:             * @return The notification timestamp.
208:             *
209:             */
210:            public long getTimeStamp() {
211:                return timeStamp;
212:            }
213:
214:            /**
215:             * Set the notification timestamp.
216:             *
217:             * @param timeStamp The notification timestamp. It indicates when the notification was generated.
218:             *
219:             */
220:            public void setTimeStamp(long timeStamp) {
221:                this .timeStamp = timeStamp;
222:            }
223:
224:            /**
225:             * Get the notification message.
226:             *
227:             * @return The message string of this notification object. It contains in a string,
228:             * which could be the explanation of the notification for displaying to a user
229:             *
230:             */
231:            public String getMessage() {
232:                return message;
233:            }
234:
235:            /**
236:             * Get the user data.
237:             *
238:             * @return The user data object. It is used for whatever data
239:             * the notification source wishes to communicate to its consumers.
240:             *
241:             */
242:            public Object getUserData() {
243:                return userData;
244:            }
245:
246:            /**
247:             * Set the user data.
248:             *
249:             * @param userData The user data object. It is used for whatever data
250:             * the notification source wishes to communicate to its consumers.
251:             *
252:             */
253:            public void setUserData(Object userData) {
254:                this .userData = userData;
255:            }
256:
257:            private void readObject(ObjectInputStream in) throws IOException,
258:                    ClassNotFoundException {
259:                in.defaultReadObject();
260:                super .source = source;
261:            }
262:
263:            private void writeObject(ObjectOutputStream out) throws IOException {
264:                out.defaultWriteObject();
265:            }
266:
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.