Source Code Cross Referenced for RelationNotification.java in  » JMX » XMOJO » javax » management » relation » 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 » XMOJO » javax.management.relation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * The XMOJO Project 5
003:         * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005:         * NO WARRANTY
006:
007:         * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008:         * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009:         * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010:         * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011:         * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013:         * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014:         * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015:         * REPAIR OR CORRECTION.
016:
017:         * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018:         * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019:         * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020:         * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021:         * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022:         * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023:         * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024:         * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025:         * SUCH DAMAGES.
026:         **/package javax.management.relation;
027:
028:        import java.util.List;
029:        import java.util.ArrayList;
030:
031:        import javax.management.ObjectName;
032:        import javax.management.Notification;
033:
034:        /**
035:         * A RelationNotification notification is sent when a relation is created via
036:         * the Relation Service, or a MBean is added as a relation in the Relation
037:         * Service, or a role is updated in a relation, or a relation is removed
038:         * from the Relation Service
039:         */
040:        public class RelationNotification extends Notification {
041:            /**
042:             * Type for the creation of an internal relation
043:             */
044:            public static final String RELATION_BASIC_CREATION = "jmx.relation.creation.basic";
045:
046:            /**
047:             * Type for the removal from the Relation Service of an internal relation
048:             */
049:            public static final String RELATION_BASIC_REMOVAL = "jmx.relation.removal.basic";
050:
051:            /**
052:             * Type for an update of an internal relation
053:             */
054:            public static final String RELATION_BASIC_UPDATE = "jmx.relation.update.basic";
055:
056:            /**
057:             * Type for the relation MBean added into the Relation Service
058:             */
059:            public static final String RELATION_MBEAN_CREATION = "jmx.relation.creation.mbean";
060:
061:            /**
062:             * Type for the removal from the Relation Service of a relation MBean
063:             */
064:            public static final String RELATION_MBEAN_REMOVAL = "jmx.relation.removal.mbean";
065:
066:            /**
067:             * Type for the update of a relation MBean
068:             */
069:            public static final String RELATION_MBEAN_UPDATE = "jmx.relation.update.mbean";
070:
071:            String type = null;
072:            Object source = null;
073:            long seqno = 0;
074:            long timeStamp = 0;
075:
076:            // Relation identifier of created/removed/updated relation
077:            String relId = null;
078:
079:            // Relation type name of created/removed/updated relation
080:            String relTypeName = null;
081:
082:            String message = null;
083:
084:            // ObjectName of the relation MBean of created/removed/updated relation
085:            // (only if the relation is represented by a MBean)
086:            ObjectName relObjectName = null;
087:
088:            // List of MBean ObjectNames to be unregistered
089:            ArrayList unRegMBeanList = null;
090:
091:            // Name of updated role (only for role update)
092:            String roleName = null;
093:
094:            ArrayList newRoleValue = new ArrayList();
095:
096:            // Old role value (ArrayList of ObjectNames) (only for role update)
097:            ArrayList oldRoleValue = new ArrayList();
098:
099:            /**
100:             * Creates a notification for either a relation creation (RelationSupport
101:             * object created internally in the Relation Service, or a MBean added as
102:             * a relation) or for a relation removal from the Relation Service
103:             *
104:             * @param theNtfType - type of the notification; either:
105:             *           - RELATION_BASIC_CREATION
106:             *           - RELATION_MBEAN_CREATION
107:             *           - RELATION_BASIC_REMOVAL
108:             *           - RELATION_MBEAN_REMOVAL
109:             *
110:             * @param  theSrcObj - source object, sending the notification. Will always
111:             * 				be a RelationService object.
112:             *
113:             * @param theSeqNbr - sequence number to identify the notification
114:             *
115:             * @param theTimeStamp - time stamp
116:             *
117:             * @param theMsg - human-readable message describing the notification
118:             *
119:             * @param theRelId - relation id identifying the relation in the Relation Service
120:             *
121:             * @param theRelTypeName - name of the relation type
122:             *
123:             * @param theRelObjName - ObjectName of the relation object if it is a MBean
124:             * 				(null for relations internally handled by the Relation Service)
125:             *
126:             * @param theUnregMBeanList - list of ObjectNames of referenced MBeans
127:             * 				expected to be unregistered due to relation removal (only
128:             * 				for removal, due to CIM qualifiers, can be null)
129:             *
130:             * @throws java.lang.IllegalArgumentException - if:
131:             * 				- no value for the notification type
132:             * 				- the notification type is not RELATION_BASIC_CREATION,
133:             * 					RELATION_MBEAN_CREATION, RELATION_BASIC_REMOVAL
134:             * 					or RELATION_MBEAN_REMOVAL
135:             * 				- no source object
136:             * 				- the source object is not a Relation Service
137:             * 				- no relation id
138:             * 				- no relation type name
139:             */
140:            public RelationNotification(String theNtfType, Object theSrcObj,
141:                    long theSeqNbr, long theTimeStamp, String theMsg,
142:                    String theRelId, String theRelTypeName,
143:                    ObjectName theRelObjName, List theUnregMBeanList)
144:                    throws IllegalArgumentException {
145:                super (theNtfType, theSrcObj, theSeqNbr);
146:
147:                if (theNtfType == null || theNtfType.equals(""))
148:                    throw new IllegalArgumentException(
149:                            RelationErrs.ERR_ILLEGAL_ARG);
150:
151:                if (!(this .isCreateOrRemovalNotificationType(theNtfType)))
152:                    throw new IllegalArgumentException(
153:                            RelationErrs.ERR_ILLEGAL_ARG);
154:
155:                if (theSrcObj == null)
156:                    throw new IllegalArgumentException(
157:                            RelationErrs.ERR_ILLEGAL_ARG);
158:
159:                if (theRelId == null || theRelTypeName == null)
160:                    throw new IllegalArgumentException(
161:                            RelationErrs.ERR_ILLEGAL_ARG);
162:
163:                this .type = theNtfType;
164:                this .source = theSrcObj;
165:                this .seqno = theSeqNbr;
166:                this .timeStamp = theTimeStamp;
167:                this .message = theMsg;
168:                this .relId = theRelId;
169:                this .relObjectName = theRelObjName;
170:                this .relTypeName = theRelTypeName;
171:                this .unRegMBeanList = (ArrayList) theUnregMBeanList;
172:            }
173:
174:            /**
175:             * Creates a notification for a role update in a relation
176:             *
177:             * @param theNtfType - type of the notification; either:
178:             * 				- RELATION_BASIC_UPDATE
179:             * 				- RELATION_MBEAN_UPDATE
180:             *
181:             * @param theSrcObj - source object, sending the notification. Will always
182:             * 				be a RelationService object.
183:             *
184:             * @param theSeqNbr - sequence number to identify the notification
185:             *
186:             * @param theTimeStamp - time stamp
187:             *
188:             * @param theMsg - human-readable message describing the notification
189:             *
190:             * @param theRelId - relation id identifying the relation in the Relation Service
191:             *
192:             * @param theRelTypeName - name of the relation type
193:             *
194:             * @param theRelObjName - ObjectName of the relation object if it is a MBean
195:             * 				(null for relations internally handled by the Relation Service)
196:             *
197:             * @param theRoleName - name of the updated role
198:             *
199:             * @param theNewRoleValue - new value (ArrayList of ObjectName objects)
200:             *
201:             * @param theOldRoleValue - old value (ArrayList of ObjectName objects)
202:             *
203:             * @throws java.lang.IllegalArgumentException - if null parameter
204:             */
205:            public RelationNotification(String theNtfType, Object theSrcObj,
206:                    long theSeqNbr, long theTimeStamp, String theMsg,
207:                    String theRelId, String theRelTypeName,
208:                    ObjectName theRelObjName, String theRoleName,
209:                    List theNewRoleValue, List theOldRoleValue)
210:                    throws IllegalArgumentException {
211:                super (theNtfType, theSrcObj, theSeqNbr);
212:
213:                if (theNtfType == null || theNtfType.equals(""))
214:                    throw new IllegalArgumentException(
215:                            RelationErrs.ERR_ILLEGAL_ARG);
216:
217:                if (!(this .isUpdateNotificationType(theNtfType)))
218:                    throw new IllegalArgumentException(
219:                            RelationErrs.ERR_ILLEGAL_ARG);
220:
221:                if (theSrcObj == null)
222:                    throw new IllegalArgumentException(
223:                            RelationErrs.ERR_ILLEGAL_ARG);
224:
225:                if (theRelId == null || theRelTypeName == null)
226:                    throw new IllegalArgumentException(
227:                            RelationErrs.ERR_ILLEGAL_ARG);
228:
229:                this .type = theNtfType;
230:                this .source = theSrcObj;
231:                this .seqno = theSeqNbr;
232:                this .timeStamp = theTimeStamp;
233:                this .message = theMsg;
234:                this .relId = theRelId;
235:                this .relObjectName = theRelObjName;
236:                this .relTypeName = theRelTypeName;
237:                this .roleName = theRoleName;
238:                this .oldRoleValue = (ArrayList) theOldRoleValue;
239:                this .newRoleValue = (ArrayList) theNewRoleValue;
240:            }
241:
242:            /**
243:             * Returns the list of ObjectNames of MBeans expected to be unregistered
244:             * due to a relation removal (only for relation removal)
245:             *
246:             * @return The list of ObjectNames of MBeans expected to be unregistered
247:             * 				due to a relation removal
248:             */
249:            public List getMBeansToUnregister() {
250:                return this .unRegMBeanList;
251:            }
252:
253:            /**
254:             * Returns new value of updated role (only for role update)
255:             *
256:             * @return New role value
257:             */
258:            public List getNewRoleValue() {
259:                return this .newRoleValue;
260:            }
261:
262:            /**
263:             * Returns the ObjectName (if the relation is a MBean, else null) of the
264:             * created/removed/updated relation
265:             *
266:             * @return  Name of the Object
267:             */
268:            public ObjectName getObjectName() {
269:                return this .relObjectName;
270:            }
271:
272:            /**
273:             * Returns old value of updated role (only for role update)
274:             *
275:             * @return The old role value
276:             */
277:            public List getOldRoleValue() {
278:                return this .oldRoleValue;
279:            }
280:
281:            /**
282:             * Returns the relation identifier of created/removed/updated relation
283:             *
284:             * @return The relation identifier of created/removed/updated relation
285:             */
286:            public String getRelationId() {
287:                return this .relId;
288:            }
289:
290:            /**
291:             * Returns the relation type name of created/removed/updated relation
292:             *
293:             * @return The relation type name of created/removed/updated relation
294:             */
295:            public String getRelationTypeName() {
296:                return this .relTypeName;
297:            }
298:
299:            /**
300:             * Returns name of updated role of updated relation (only for role update)
301:             *
302:             * @return The name of the updated role of updated relation
303:             */
304:            public String getRoleName() {
305:                return this .roleName;
306:            }
307:
308:            //*************************** private Methods ***************************//
309:
310:            private boolean isCreateOrRemovalNotificationType(String notifType) {
311:                if (notifType
312:                        .equals(RelationNotification.RELATION_BASIC_CREATION))
313:                    return true;
314:                else if (notifType
315:                        .equals(RelationNotification.RELATION_MBEAN_CREATION))
316:                    return true;
317:                else if (notifType
318:                        .equals(RelationNotification.RELATION_BASIC_REMOVAL))
319:                    return true;
320:                else if (notifType
321:                        .equals(RelationNotification.RELATION_MBEAN_REMOVAL))
322:                    return true;
323:                else
324:                    return false;
325:            }
326:
327:            private boolean isUpdateNotificationType(String notifType) {
328:                if (notifType
329:                        .equals(RelationNotification.RELATION_BASIC_UPDATE))
330:                    return true;
331:                else if (notifType
332:                        .equals(RelationNotification.RELATION_MBEAN_UPDATE))
333:                    return true;
334:                else
335:                    return false;
336:            }
337:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.