Source Code Cross Referenced for Notification.java in  » EJB-Server-JBoss-4.2.1 » jmx » 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 » EJB Server JBoss 4.2.1 » jmx » javax.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package javax.management;
023:
024:        import java.io.IOException;
025:        import java.io.ObjectInputStream;
026:        import java.io.ObjectOutputStream;
027:        import java.io.ObjectStreamField;
028:
029:        import org.jboss.mx.util.Serialization;
030:
031:        /**
032:         * A Notification.<p>
033:         *
034:         * <p><b>Revisions:</b>
035:         * <p><b>20020329 Adrian Brock:</b>
036:         * <ul>
037:         * <li>Make the source serializable
038:         * </ul>
039:         * <p><b>20020710 Adrian Brock:</b>
040:         * <ul>
041:         * <li> Serialization </li>
042:         * </ul>
043:         * 
044:         * @author  <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
045:         * @version $Revision: 57200 $
046:         */
047:        public class Notification extends java.util.EventObject {
048:            // Constants ---------------------------------------------------
049:
050:            private static final long serialVersionUID;
051:            private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[] {
052:                    new ObjectStreamField("message", String.class),
053:                    new ObjectStreamField("sequenceNumber", Long.TYPE),
054:                    new ObjectStreamField("source", Object.class),
055:                    new ObjectStreamField("timeStamp", Long.TYPE),
056:                    new ObjectStreamField("type", String.class),
057:                    new ObjectStreamField("userData", Object.class) };
058:
059:            // Attributes --------------------------------------------------
060:
061:            /**
062:             * The notification type
063:             */
064:            private String type = null;
065:
066:            /**
067:             * The sequence number of the notification
068:             */
069:            private long sequenceNumber = 0;
070:
071:            /**
072:             * The message of the notification
073:             */
074:            private String message = null;
075:
076:            /**
077:             * The time of the notification
078:             */
079:            private long timeStamp = System.currentTimeMillis();
080:
081:            /**
082:             * The user data of the notification
083:             */
084:            private Object userData = null;
085:
086:            /**
087:             * The source of the notification
088:             */
089:            private Object mySource = null;
090:
091:            // Static ------------------------------------------------------
092:
093:            static {
094:                switch (Serialization.version) {
095:                case Serialization.V1R0:
096:                    serialVersionUID = 1716977971058914352L;
097:                    break;
098:                default:
099:                    serialVersionUID = -7516092053498031989L;
100:                }
101:            }
102:
103:            // Constructors ------------------------------------------------
104:
105:            /**
106:             * Create a new notification
107:             *
108:             * @param type the type of the notification
109:             * @param source the source of the notification
110:             * @param sequenceNumber the sequence number of the notification
111:             */
112:            public Notification(String type, Object source, long sequenceNumber) {
113:                super (source);
114:                mySource = source;
115:                this .type = type;
116:                this .sequenceNumber = sequenceNumber;
117:                this .timeStamp = System.currentTimeMillis();
118:            }
119:
120:            /**
121:             * Create a new notification
122:             *
123:             * @param type the type of the notification
124:             * @param source the source of the notification
125:             * @param sequenceNumber the sequence number of the notification
126:             * @param message the message of the notification
127:             */
128:            public Notification(String type, Object source,
129:                    long sequenceNumber, String message) {
130:                this (type, source, sequenceNumber);
131:                this .message = message;
132:                this .timeStamp = System.currentTimeMillis();
133:            }
134:
135:            /**
136:             * Create a new notification
137:             *
138:             * @param type the type of the notification
139:             * @param source the source of the notification
140:             * @param sequenceNumber the sequence number of the notification
141:             * @param timeStamp the time of the notification
142:             */
143:            public Notification(String type, Object source,
144:                    long sequenceNumber, long timeStamp) {
145:                this (type, source, sequenceNumber);
146:                this .timeStamp = timeStamp;
147:            }
148:
149:            /**
150:             * Create a new notification
151:             *
152:             * @param type the type of the notification
153:             * @param source the source of the notification
154:             * @param sequenceNumber the sequence number of the notification
155:             * @param timeStamp the time of the notification
156:             * @param message the message of the notification
157:             */
158:            public Notification(String type, Object source,
159:                    long sequenceNumber, long timeStamp, String message) {
160:                this (type, source, sequenceNumber, timeStamp);
161:                this .message = message;
162:            }
163:
164:            // Public ------------------------------------------------------
165:
166:            /**
167:             * Retrieve the source of the notification
168:             *
169:             * @return the source
170:             */
171:            public Object getSource() {
172:                return mySource;
173:            }
174:
175:            /**
176:             * Set the source of the notification<p>
177:             *
178:             * The source must be either a object name or a string that can be
179:             * used to create a valid object name.
180:             *
181:             * @param source the new source
182:             * @exception IllegalArgumentException when the object name is invalid
183:             */
184:            public void setSource(Object source) {
185:                if (source instanceof  String) {
186:                    try {
187:                        super .source = new ObjectName((String) source);
188:                    } catch (MalformedObjectNameException e) {
189:                        throw new IllegalArgumentException(
190:                                "malformed object name: " + source);
191:                    }
192:                } else if (source instanceof  ObjectName) {
193:                    super .source = source;
194:                } else
195:                    throw new IllegalArgumentException(
196:                            "Notification source must be an object name");
197:                mySource = super .source;
198:            }
199:
200:            /**
201:             * Retrieve the sequence number of the notification
202:             *
203:             * @return the sequence number
204:             */
205:            public long getSequenceNumber() {
206:                return sequenceNumber;
207:            }
208:
209:            /**
210:             * Set the sequence number of the notifiction
211:             *
212:             * @param sequenceNumber the new sequence number
213:             */
214:            public void setSequenceNumber(long sequenceNumber) {
215:                this .sequenceNumber = sequenceNumber;
216:            }
217:
218:            /**
219:             * Retrieve the type of the notification
220:             *
221:             * @return the type
222:             */
223:            public String getType() {
224:                return type;
225:            }
226:
227:            /**
228:             * Retrieve the time of the notification
229:             *
230:             * @return the time
231:             */
232:            public long getTimeStamp() {
233:                return timeStamp;
234:            }
235:
236:            /**
237:             * Set the time of the notifiction
238:             *
239:             * @param timeStamp the new time
240:             */
241:            public void setTimeStamp(long timeStamp) {
242:                this .timeStamp = timeStamp;
243:            }
244:
245:            /**
246:             * Retrieve the message of the notification
247:             *
248:             * @return the message
249:             */
250:            public String getMessage() {
251:                return message;
252:            }
253:
254:            /**
255:             * Retrieve the user data of the notification
256:             *
257:             * @return the user data
258:             */
259:            public Object getUserData() {
260:                return userData;
261:            }
262:
263:            /**
264:             * Set the user data of the notifiction
265:             *
266:             * @param userData the new user data
267:             */
268:            public void setUserData(Object userData) {
269:                this .userData = userData;
270:            }
271:
272:            public String toString() {
273:                StringBuffer tmp = new StringBuffer(getClass().getName());
274:                tmp.append('[');
275:                tmp.append("source=");
276:                tmp.append(this .getSource());
277:                tmp.append(",type=");
278:                tmp.append(this .getType());
279:                tmp.append(",sequenceNumber=");
280:                tmp.append(this .getSequenceNumber());
281:                tmp.append(",timeStamp=");
282:                tmp.append(this .getTimeStamp());
283:                tmp.append(",message=");
284:                tmp.append(this .getMessage());
285:                tmp.append(",userData=");
286:                tmp.append(this .getUserData());
287:                tmp.append(']');
288:                return tmp.toString();
289:            }
290:
291:            // X implementation --------------------------------------------
292:
293:            // Y overrides -------------------------------------------------
294:
295:            // Protected ---------------------------------------------------
296:
297:            // Private -----------------------------------------------------
298:
299:            private void readObject(ObjectInputStream ois) throws IOException,
300:                    ClassNotFoundException {
301:                ObjectInputStream.GetField getField = ois.readFields();
302:                message = (String) getField.get("message", null);
303:                sequenceNumber = getField.get("sequenceNumber", 0L);
304:                mySource = getField.get("source", null);
305:                timeStamp = getField.get("timeStamp", 0L);
306:                type = (String) getField.get("type", null);
307:                userData = getField.get("userData", null);
308:                source = mySource;
309:            }
310:
311:            private void writeObject(ObjectOutputStream oos) throws IOException {
312:                ObjectOutputStream.PutField putField = oos.putFields();
313:                putField.put("message", message);
314:                putField.put("sequenceNumber", sequenceNumber);
315:                putField.put("source", mySource);
316:                putField.put("timeStamp", timeStamp);
317:                putField.put("type", type);
318:                putField.put("userData", userData);
319:                oos.writeFields();
320:            }
321:
322:            // Inner classes -----------------------------------------------
323:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.