1 /* |
1 /* |
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
34 import java.util.Iterator; |
34 import java.util.Iterator; |
35 import java.util.List; |
35 import java.util.List; |
36 import java.util.Map; |
36 import java.util.Map; |
37 import java.util.Set; |
37 import java.util.Set; |
38 import java.util.concurrent.atomic.AtomicLong; |
38 import java.util.concurrent.atomic.AtomicLong; |
39 import java.util.logging.Level; |
39 import java.lang.System.Logger.Level; |
40 |
40 |
41 import javax.management.Attribute; |
41 import javax.management.Attribute; |
42 import javax.management.AttributeNotFoundException; |
42 import javax.management.AttributeNotFoundException; |
43 import javax.management.InstanceNotFoundException; |
43 import javax.management.InstanceNotFoundException; |
44 import javax.management.InvalidAttributeValueException; |
44 import javax.management.InvalidAttributeValueException; |
155 * when the purgeRelations method will be explicitly called. |
155 * when the purgeRelations method will be explicitly called. |
156 * <P>true is immediate purge. |
156 * <P>true is immediate purge. |
157 */ |
157 */ |
158 public RelationService(boolean immediatePurgeFlag) { |
158 public RelationService(boolean immediatePurgeFlag) { |
159 |
159 |
160 RELATION_LOGGER.entering(RelationService.class.getName(), |
160 RELATION_LOGGER.log(Level.TRACE, "ENTRY"); |
161 "RelationService"); |
|
162 |
161 |
163 setPurgeFlag(immediatePurgeFlag); |
162 setPurgeFlag(immediatePurgeFlag); |
164 |
163 |
165 RELATION_LOGGER.exiting(RelationService.class.getName(), |
164 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
166 "RelationService"); |
|
167 return; |
165 return; |
168 } |
166 } |
169 |
167 |
170 /** |
168 /** |
171 * Checks if the Relation Service is active. |
169 * Checks if the Relation Service is active. |
284 if (relationTypeName == null || roleInfoArray == null) { |
282 if (relationTypeName == null || roleInfoArray == null) { |
285 String excMsg = "Invalid parameter."; |
283 String excMsg = "Invalid parameter."; |
286 throw new IllegalArgumentException(excMsg); |
284 throw new IllegalArgumentException(excMsg); |
287 } |
285 } |
288 |
286 |
289 RELATION_LOGGER.entering(RelationService.class.getName(), |
287 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); |
290 "createRelationType", relationTypeName); |
|
291 |
288 |
292 // Can throw an InvalidRelationTypeException |
289 // Can throw an InvalidRelationTypeException |
293 RelationType relType = |
290 RelationType relType = |
294 new RelationTypeSupport(relationTypeName, roleInfoArray); |
291 new RelationTypeSupport(relationTypeName, roleInfoArray); |
295 |
292 |
296 addRelationTypeInt(relType); |
293 addRelationTypeInt(relType); |
297 |
294 |
298 RELATION_LOGGER.exiting(RelationService.class.getName(), |
295 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
299 "createRelationType"); |
|
300 return; |
296 return; |
301 } |
297 } |
302 |
298 |
303 /** |
299 /** |
304 * Adds given object as a relation type. The object is expected to |
300 * Adds given object as a relation type. The object is expected to |
323 if (relationTypeObj == null) { |
319 if (relationTypeObj == null) { |
324 String excMsg = "Invalid parameter."; |
320 String excMsg = "Invalid parameter."; |
325 throw new IllegalArgumentException(excMsg); |
321 throw new IllegalArgumentException(excMsg); |
326 } |
322 } |
327 |
323 |
328 RELATION_LOGGER.entering(RelationService.class.getName(), |
324 RELATION_LOGGER.log(Level.TRACE, "ENTRY"); |
329 "addRelationType"); |
|
330 |
325 |
331 // Checks the role infos |
326 // Checks the role infos |
332 List<RoleInfo> roleInfoList = relationTypeObj.getRoleInfos(); |
327 List<RoleInfo> roleInfoList = relationTypeObj.getRoleInfos(); |
333 if (roleInfoList == null) { |
328 if (roleInfoList == null) { |
334 String excMsg = "No role info provided."; |
329 String excMsg = "No role info provided."; |
383 if (relationTypeName == null) { |
377 if (relationTypeName == null) { |
384 String excMsg = "Invalid parameter."; |
378 String excMsg = "Invalid parameter."; |
385 throw new IllegalArgumentException(excMsg); |
379 throw new IllegalArgumentException(excMsg); |
386 } |
380 } |
387 |
381 |
388 RELATION_LOGGER.entering(RelationService.class.getName(), |
382 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); |
389 "getRoleInfos", relationTypeName); |
|
390 |
383 |
391 // Can throw a RelationTypeNotFoundException |
384 // Can throw a RelationTypeNotFoundException |
392 RelationType relType = getRelationType(relationTypeName); |
385 RelationType relType = getRelationType(relationTypeName); |
393 |
386 |
394 RELATION_LOGGER.exiting(RelationService.class.getName(), |
387 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
395 "getRoleInfos"); |
|
396 return relType.getRoleInfos(); |
388 return relType.getRoleInfos(); |
397 } |
389 } |
398 |
390 |
399 /** |
391 /** |
400 * Retrieves role info for given role name of a given relation type. |
392 * Retrieves role info for given role name of a given relation type. |
419 if (relationTypeName == null || roleInfoName == null) { |
411 if (relationTypeName == null || roleInfoName == null) { |
420 String excMsg = "Invalid parameter."; |
412 String excMsg = "Invalid parameter."; |
421 throw new IllegalArgumentException(excMsg); |
413 throw new IllegalArgumentException(excMsg); |
422 } |
414 } |
423 |
415 |
424 RELATION_LOGGER.entering(RelationService.class.getName(), |
416 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
425 "getRoleInfo", new Object[] {relationTypeName, roleInfoName}); |
417 relationTypeName, roleInfoName); |
426 |
418 |
427 // Can throw a RelationTypeNotFoundException |
419 // Can throw a RelationTypeNotFoundException |
428 RelationType relType = getRelationType(relationTypeName); |
420 RelationType relType = getRelationType(relationTypeName); |
429 |
421 |
430 // Can throw a RoleInfoNotFoundException |
422 // Can throw a RoleInfoNotFoundException |
431 RoleInfo roleInfo = relType.getRoleInfo(roleInfoName); |
423 RoleInfo roleInfo = relType.getRoleInfo(roleInfoName); |
432 |
424 |
433 RELATION_LOGGER.exiting(RelationService.class.getName(), |
425 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
434 "getRoleInfo"); |
|
435 return roleInfo; |
426 return roleInfo; |
436 } |
427 } |
437 |
428 |
438 /** |
429 /** |
439 * Removes given relation type from Relation Service. |
430 * Removes given relation type from Relation Service. |
459 if (relationTypeName == null) { |
450 if (relationTypeName == null) { |
460 String excMsg = "Invalid parameter."; |
451 String excMsg = "Invalid parameter."; |
461 throw new IllegalArgumentException(excMsg); |
452 throw new IllegalArgumentException(excMsg); |
462 } |
453 } |
463 |
454 |
464 RELATION_LOGGER.entering(RelationService.class.getName(), |
455 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); |
465 "removeRelationType", relationTypeName); |
|
466 |
456 |
467 // Checks if the relation type to be removed exists |
457 // Checks if the relation type to be removed exists |
468 // Can throw a RelationTypeNotFoundException |
458 // Can throw a RelationTypeNotFoundException |
469 RelationType relType = getRelationType(relationTypeName); |
459 RelationType relType = getRelationType(relationTypeName); |
470 |
460 |
564 relationTypeName == null) { |
553 relationTypeName == null) { |
565 String excMsg = "Invalid parameter."; |
554 String excMsg = "Invalid parameter."; |
566 throw new IllegalArgumentException(excMsg); |
555 throw new IllegalArgumentException(excMsg); |
567 } |
556 } |
568 |
557 |
569 RELATION_LOGGER.entering(RelationService.class.getName(), |
558 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
570 "createRelation", |
559 relationId, relationTypeName, roleList); |
571 new Object[] {relationId, relationTypeName, roleList}); |
|
572 |
560 |
573 // Creates RelationSupport object |
561 // Creates RelationSupport object |
574 // Can throw InvalidRoleValueException |
562 // Can throw InvalidRoleValueException |
575 RelationSupport relObj = new RelationSupport(relationId, |
563 RelationSupport relObj = new RelationSupport(relationId, |
576 myObjName, |
564 myObjName, |
652 if (relationObjectName == null) { |
639 if (relationObjectName == null) { |
653 String excMsg = "Invalid parameter."; |
640 String excMsg = "Invalid parameter."; |
654 throw new IllegalArgumentException(excMsg); |
641 throw new IllegalArgumentException(excMsg); |
655 } |
642 } |
656 |
643 |
657 RELATION_LOGGER.entering(RelationService.class.getName(), |
644 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationObjectName); |
658 "addRelation", relationObjectName); |
|
659 |
645 |
660 // Can throw RelationServiceNotRegisteredException |
646 // Can throw RelationServiceNotRegisteredException |
661 isActive(); |
647 isActive(); |
662 |
648 |
663 // Checks that the relation MBean implements the Relation interface. |
649 // Checks that the relation MBean implements the Relation interface. |
789 // unregistration of this MBean |
775 // unregistration of this MBean |
790 List<ObjectName> newRefList = new ArrayList<ObjectName>(); |
776 List<ObjectName> newRefList = new ArrayList<ObjectName>(); |
791 newRefList.add(relationObjectName); |
777 newRefList.add(relationObjectName); |
792 updateUnregistrationListener(newRefList, null); |
778 updateUnregistrationListener(newRefList, null); |
793 |
779 |
794 RELATION_LOGGER.exiting(RelationService.class.getName(), |
780 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
795 "addRelation"); |
|
796 return; |
781 return; |
797 } |
782 } |
798 |
783 |
799 /** |
784 /** |
800 * If the relation is represented by an MBean (created by the user and |
785 * If the relation is represented by an MBean (created by the user and |
817 if (relationId == null) { |
802 if (relationId == null) { |
818 String excMsg = "Invalid parameter."; |
803 String excMsg = "Invalid parameter."; |
819 throw new IllegalArgumentException(excMsg); |
804 throw new IllegalArgumentException(excMsg); |
820 } |
805 } |
821 |
806 |
822 RELATION_LOGGER.entering(RelationService.class.getName(), |
807 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
823 "isRelationMBean", relationId); |
|
824 |
808 |
825 // Can throw RelationNotFoundException |
809 // Can throw RelationNotFoundException |
826 Object result = getRelation(relationId); |
810 Object result = getRelation(relationId); |
827 if (result instanceof ObjectName) { |
811 if (result instanceof ObjectName) { |
828 return ((ObjectName)result); |
812 return ((ObjectName)result); |
848 if (objectName == null) { |
832 if (objectName == null) { |
849 String excMsg = "Invalid parameter."; |
833 String excMsg = "Invalid parameter."; |
850 throw new IllegalArgumentException(excMsg); |
834 throw new IllegalArgumentException(excMsg); |
851 } |
835 } |
852 |
836 |
853 RELATION_LOGGER.entering(RelationService.class.getName(), |
837 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", objectName); |
854 "isRelation", objectName); |
|
855 |
838 |
856 String result = null; |
839 String result = null; |
857 synchronized(myRelMBeanObjName2RelIdMap) { |
840 synchronized(myRelMBeanObjName2RelIdMap) { |
858 String relId = myRelMBeanObjName2RelIdMap.get(objectName); |
841 String relId = myRelMBeanObjName2RelIdMap.get(objectName); |
859 if (relId != null) { |
842 if (relId != null) { |
879 if (relationId == null) { |
862 if (relationId == null) { |
880 String excMsg = "Invalid parameter."; |
863 String excMsg = "Invalid parameter."; |
881 throw new IllegalArgumentException(excMsg); |
864 throw new IllegalArgumentException(excMsg); |
882 } |
865 } |
883 |
866 |
884 RELATION_LOGGER.entering(RelationService.class.getName(), |
867 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
885 "hasRelation", relationId); |
|
886 |
868 |
887 try { |
869 try { |
888 // Can throw RelationNotFoundException |
870 // Can throw RelationNotFoundException |
889 Object result = getRelation(relationId); |
871 Object result = getRelation(relationId); |
890 return true; |
872 return true; |
931 if (roleName == null || relationTypeName == null) { |
913 if (roleName == null || relationTypeName == null) { |
932 String excMsg = "Invalid parameter."; |
914 String excMsg = "Invalid parameter."; |
933 throw new IllegalArgumentException(excMsg); |
915 throw new IllegalArgumentException(excMsg); |
934 } |
916 } |
935 |
917 |
936 RELATION_LOGGER.entering(RelationService.class.getName(), |
918 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
937 "checkRoleReading", new Object[] {roleName, relationTypeName}); |
919 roleName, relationTypeName); |
938 |
920 |
939 Integer result; |
921 Integer result; |
940 |
922 |
941 // Can throw a RelationTypeNotFoundException |
923 // Can throw a RelationTypeNotFoundException |
942 RelationType relType = getRelationType(relationTypeName); |
924 RelationType relType = getRelationType(relationTypeName); |
993 initFlag == null) { |
974 initFlag == null) { |
994 String excMsg = "Invalid parameter."; |
975 String excMsg = "Invalid parameter."; |
995 throw new IllegalArgumentException(excMsg); |
976 throw new IllegalArgumentException(excMsg); |
996 } |
977 } |
997 |
978 |
998 RELATION_LOGGER.entering(RelationService.class.getName(), |
979 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
999 "checkRoleWriting", |
980 role, relationTypeName, initFlag); |
1000 new Object[] {role, relationTypeName, initFlag}); |
|
1001 |
981 |
1002 // Can throw a RelationTypeNotFoundException |
982 // Can throw a RelationTypeNotFoundException |
1003 RelationType relType = getRelationType(relationTypeName); |
983 RelationType relType = getRelationType(relationTypeName); |
1004 |
984 |
1005 String roleName = role.getRoleName(); |
985 String roleName = role.getRoleName(); |
1011 |
991 |
1012 RoleInfo roleInfo; |
992 RoleInfo roleInfo; |
1013 try { |
993 try { |
1014 roleInfo = relType.getRoleInfo(roleName); |
994 roleInfo = relType.getRoleInfo(roleName); |
1015 } catch (RoleInfoNotFoundException exc) { |
995 } catch (RoleInfoNotFoundException exc) { |
1016 RELATION_LOGGER.exiting(RelationService.class.getName(), |
996 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
1017 "checkRoleWriting"); |
|
1018 return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); |
997 return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); |
1019 } |
998 } |
1020 |
999 |
1021 Integer result = checkRoleInt(2, |
1000 Integer result = checkRoleInt(2, |
1022 roleName, |
1001 roleName, |
1023 roleValue, |
1002 roleValue, |
1024 roleInfo, |
1003 roleInfo, |
1025 writeChkFlag); |
1004 writeChkFlag); |
1026 |
1005 |
1027 RELATION_LOGGER.exiting(RelationService.class.getName(), |
1006 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
1028 "checkRoleWriting"); |
|
1029 return result; |
1007 return result; |
1030 } |
1008 } |
1031 |
1009 |
1032 /** |
1010 /** |
1033 * Sends a notification (RelationNotification) for a relation creation. |
1011 * Sends a notification (RelationNotification) for a relation creation. |
1053 if (relationId == null) { |
1031 if (relationId == null) { |
1054 String excMsg = "Invalid parameter."; |
1032 String excMsg = "Invalid parameter."; |
1055 throw new IllegalArgumentException(excMsg); |
1033 throw new IllegalArgumentException(excMsg); |
1056 } |
1034 } |
1057 |
1035 |
1058 RELATION_LOGGER.entering(RelationService.class.getName(), |
1036 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
1059 "sendRelationCreationNotification", relationId); |
|
1060 |
1037 |
1061 // Message |
1038 // Message |
1062 StringBuilder ntfMsg = new StringBuilder("Creation of relation "); |
1039 StringBuilder ntfMsg = new StringBuilder("Creation of relation "); |
1063 ntfMsg.append(relationId); |
1040 ntfMsg.append(relationId); |
1064 |
1041 |
1112 } |
1088 } |
1113 |
1089 |
1114 if (!(oldValue instanceof ArrayList<?>)) |
1090 if (!(oldValue instanceof ArrayList<?>)) |
1115 oldValue = new ArrayList<ObjectName>(oldValue); |
1091 oldValue = new ArrayList<ObjectName>(oldValue); |
1116 |
1092 |
1117 RELATION_LOGGER.entering(RelationService.class.getName(), |
1093 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
1118 "sendRoleUpdateNotification", |
1094 relationId, newRole, oldValue); |
1119 new Object[] {relationId, newRole, oldValue}); |
|
1120 |
1095 |
1121 String roleName = newRole.getRoleName(); |
1096 String roleName = newRole.getRoleName(); |
1122 List<ObjectName> newRoleVal = newRole.getRoleValue(); |
1097 List<ObjectName> newRoleVal = newRole.getRoleValue(); |
1123 |
1098 |
1124 // Message |
1099 // Message |
1170 if (relationId == null) { |
1144 if (relationId == null) { |
1171 String excMsg = "Invalid parameter"; |
1145 String excMsg = "Invalid parameter"; |
1172 throw new IllegalArgumentException(excMsg); |
1146 throw new IllegalArgumentException(excMsg); |
1173 } |
1147 } |
1174 |
1148 |
1175 RELATION_LOGGER.entering(RelationService.class.getName(), |
1149 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
1176 "sendRelationRemovalNotification", |
1150 relationId, unregMBeanList); |
1177 new Object[] {relationId, unregMBeanList}); |
|
1178 |
1151 |
1179 // Can throw RelationNotFoundException |
1152 // Can throw RelationNotFoundException |
1180 sendNotificationInt(3, |
1153 sendNotificationInt(3, |
1181 "Removal of relation " + relationId, |
1154 "Removal of relation " + relationId, |
1182 relationId, |
1155 relationId, |
1224 oldValue == null) { |
1196 oldValue == null) { |
1225 String excMsg = "Invalid parameter."; |
1197 String excMsg = "Invalid parameter."; |
1226 throw new IllegalArgumentException(excMsg); |
1198 throw new IllegalArgumentException(excMsg); |
1227 } |
1199 } |
1228 |
1200 |
1229 RELATION_LOGGER.entering(RelationService.class.getName(), |
1201 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
1230 "updateRoleMap", new Object[] {relationId, newRole, oldValue}); |
1202 relationId, newRole, oldValue); |
1231 |
1203 |
1232 // Can throw RelationServiceNotRegisteredException |
1204 // Can throw RelationServiceNotRegisteredException |
1233 isActive(); |
1205 isActive(); |
1234 |
1206 |
1235 // Verifies the relation has been added in the Relation Service |
1207 // Verifies the relation has been added in the Relation Service |
1301 // To avoid having one listener per ObjectName of referenced MBean, |
1273 // To avoid having one listener per ObjectName of referenced MBean, |
1302 // and to increase performances, there is only one listener recording |
1274 // and to increase performances, there is only one listener recording |
1303 // all ObjectNames of interest |
1275 // all ObjectNames of interest |
1304 updateUnregistrationListener(newRefList, obsRefList); |
1276 updateUnregistrationListener(newRefList, obsRefList); |
1305 |
1277 |
1306 RELATION_LOGGER.exiting(RelationService.class.getName(), |
1278 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
1307 "updateRoleMap"); |
|
1308 return; |
1279 return; |
1309 } |
1280 } |
1310 |
1281 |
1311 /** |
1282 /** |
1312 * Removes given relation from the Relation Service. |
1283 * Removes given relation from the Relation Service. |
1336 if (relationId == null) { |
1307 if (relationId == null) { |
1337 String excMsg = "Invalid parameter."; |
1308 String excMsg = "Invalid parameter."; |
1338 throw new IllegalArgumentException(excMsg); |
1309 throw new IllegalArgumentException(excMsg); |
1339 } |
1310 } |
1340 |
1311 |
1341 RELATION_LOGGER.entering(RelationService.class.getName(), |
1312 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
1342 "removeRelation", relationId); |
|
1343 |
1313 |
1344 // Checks there is a relation with this id |
1314 // Checks there is a relation with this id |
1345 // Can throw RelationNotFoundException |
1315 // Can throw RelationNotFoundException |
1346 Object result = getRelation(relationId); |
1316 Object result = getRelation(relationId); |
1347 |
1317 |
1608 if (mbeanName == null) { |
1575 if (mbeanName == null) { |
1609 String excMsg = "Invalid parameter."; |
1576 String excMsg = "Invalid parameter."; |
1610 throw new IllegalArgumentException(excMsg); |
1577 throw new IllegalArgumentException(excMsg); |
1611 } |
1578 } |
1612 |
1579 |
1613 RELATION_LOGGER.entering(RelationService.class.getName(), |
1580 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
1614 "findReferencingRelations", |
1581 mbeanName, relationTypeName, roleName); |
1615 new Object[] {mbeanName, relationTypeName, roleName}); |
|
1616 |
1582 |
1617 Map<String,List<String>> result = new HashMap<String,List<String>>(); |
1583 Map<String,List<String>> result = new HashMap<String,List<String>>(); |
1618 |
1584 |
1619 synchronized(myRefedMBeanObjName2RelIdsMap) { |
1585 synchronized(myRefedMBeanObjName2RelIdsMap) { |
1620 |
1586 |
1718 if (mbeanName == null) { |
1683 if (mbeanName == null) { |
1719 String excMsg = "Invalid parameter."; |
1684 String excMsg = "Invalid parameter."; |
1720 throw new IllegalArgumentException(excMsg); |
1685 throw new IllegalArgumentException(excMsg); |
1721 } |
1686 } |
1722 |
1687 |
1723 RELATION_LOGGER.entering(RelationService.class.getName(), |
1688 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
1724 "findAssociatedMBeans", |
1689 mbeanName, relationTypeName, roleName); |
1725 new Object[] {mbeanName, relationTypeName, roleName}); |
|
1726 |
1690 |
1727 // Retrieves the map <relation id> -> <role names> for those |
1691 // Retrieves the map <relation id> -> <role names> for those |
1728 // criterias |
1692 // criterias |
1729 Map<String,List<String>> relId2RoleNamesMap = |
1693 Map<String,List<String>> relId2RoleNamesMap = |
1730 findReferencingRelations(mbeanName, |
1694 findReferencingRelations(mbeanName, |
1792 if (relationTypeName == null) { |
1755 if (relationTypeName == null) { |
1793 String excMsg = "Invalid parameter."; |
1756 String excMsg = "Invalid parameter."; |
1794 throw new IllegalArgumentException(excMsg); |
1757 throw new IllegalArgumentException(excMsg); |
1795 } |
1758 } |
1796 |
1759 |
1797 RELATION_LOGGER.entering(RelationService.class.getName(), |
1760 RELATION_LOGGER.log(Level.TRACE, "ENTRY"); |
1798 "findRelationsOfType"); |
|
1799 |
1761 |
1800 // Can throw RelationTypeNotFoundException |
1762 // Can throw RelationTypeNotFoundException |
1801 RelationType relType = getRelationType(relationTypeName); |
1763 RelationType relType = getRelationType(relationTypeName); |
1802 |
1764 |
1803 List<String> result; |
1765 List<String> result; |
1843 if (relationId == null || roleName == null) { |
1804 if (relationId == null || roleName == null) { |
1844 String excMsg = "Invalid parameter."; |
1805 String excMsg = "Invalid parameter."; |
1845 throw new IllegalArgumentException(excMsg); |
1806 throw new IllegalArgumentException(excMsg); |
1846 } |
1807 } |
1847 |
1808 |
1848 RELATION_LOGGER.entering(RelationService.class.getName(), |
1809 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
1849 "getRole", new Object[] {relationId, roleName}); |
1810 relationId, roleName); |
1850 |
1811 |
1851 // Can throw RelationServiceNotRegisteredException |
1812 // Can throw RelationServiceNotRegisteredException |
1852 isActive(); |
1813 isActive(); |
1853 |
1814 |
1854 // Can throw a RelationNotFoundException |
1815 // Can throw a RelationNotFoundException |
1929 if (relationId == null || roleNameArray == null) { |
1890 if (relationId == null || roleNameArray == null) { |
1930 String excMsg = "Invalid parameter."; |
1891 String excMsg = "Invalid parameter."; |
1931 throw new IllegalArgumentException(excMsg); |
1892 throw new IllegalArgumentException(excMsg); |
1932 } |
1893 } |
1933 |
1894 |
1934 RELATION_LOGGER.entering(RelationService.class.getName(), |
1895 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
1935 "getRoles", relationId); |
|
1936 |
1896 |
1937 // Can throw RelationServiceNotRegisteredException |
1897 // Can throw RelationServiceNotRegisteredException |
1938 isActive(); |
1898 isActive(); |
1939 |
1899 |
1940 // Can throw a RelationNotFoundException |
1900 // Can throw a RelationNotFoundException |
2002 if (relationId == null) { |
1962 if (relationId == null) { |
2003 String excMsg = "Invalid parameter."; |
1963 String excMsg = "Invalid parameter."; |
2004 throw new IllegalArgumentException(excMsg); |
1964 throw new IllegalArgumentException(excMsg); |
2005 } |
1965 } |
2006 |
1966 |
2007 RELATION_LOGGER.entering(RelationService.class.getName(), |
1967 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
2008 "getRoles", relationId); |
|
2009 |
1968 |
2010 // Can throw a RelationNotFoundException |
1969 // Can throw a RelationNotFoundException |
2011 Object relObj = getRelation(relationId); |
1970 Object relObj = getRelation(relationId); |
2012 |
1971 |
2013 RoleResult result; |
1972 RoleResult result; |
2053 if (relationId == null || roleName == null) { |
2012 if (relationId == null || roleName == null) { |
2054 String excMsg = "Invalid parameter."; |
2013 String excMsg = "Invalid parameter."; |
2055 throw new IllegalArgumentException(excMsg); |
2014 throw new IllegalArgumentException(excMsg); |
2056 } |
2015 } |
2057 |
2016 |
2058 RELATION_LOGGER.entering(RelationService.class.getName(), |
2017 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
2059 "getRoleCardinality", new Object[] {relationId, roleName}); |
2018 relationId, roleName); |
2060 |
2019 |
2061 // Can throw a RelationNotFoundException |
2020 // Can throw a RelationNotFoundException |
2062 Object relObj = getRelation(relationId); |
2021 Object relObj = getRelation(relationId); |
2063 |
2022 |
2064 Integer result; |
2023 Integer result; |
2145 if (relationId == null || role == null) { |
2103 if (relationId == null || role == null) { |
2146 String excMsg = "Invalid parameter."; |
2104 String excMsg = "Invalid parameter."; |
2147 throw new IllegalArgumentException(excMsg); |
2105 throw new IllegalArgumentException(excMsg); |
2148 } |
2106 } |
2149 |
2107 |
2150 RELATION_LOGGER.entering(RelationService.class.getName(), |
2108 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
2151 "setRole", new Object[] {relationId, role}); |
2109 relationId, role); |
2152 |
2110 |
2153 // Can throw RelationServiceNotRegisteredException |
2111 // Can throw RelationServiceNotRegisteredException |
2154 isActive(); |
2112 isActive(); |
2155 |
2113 |
2156 // Can throw a RelationNotFoundException |
2114 // Can throw a RelationNotFoundException |
2245 if (relationId == null || roleList == null) { |
2203 if (relationId == null || roleList == null) { |
2246 String excMsg = "Invalid parameter."; |
2204 String excMsg = "Invalid parameter."; |
2247 throw new IllegalArgumentException(excMsg); |
2205 throw new IllegalArgumentException(excMsg); |
2248 } |
2206 } |
2249 |
2207 |
2250 RELATION_LOGGER.entering(RelationService.class.getName(), |
2208 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", |
2251 "setRoles", new Object[] {relationId, roleList}); |
2209 relationId, roleList); |
2252 |
2210 |
2253 // Can throw RelationServiceNotRegisteredException |
2211 // Can throw RelationServiceNotRegisteredException |
2254 isActive(); |
2212 isActive(); |
2255 |
2213 |
2256 // Can throw a RelationNotFoundException |
2214 // Can throw a RelationNotFoundException |
2320 if (relationId == null) { |
2278 if (relationId == null) { |
2321 String excMsg = "Invalid parameter."; |
2279 String excMsg = "Invalid parameter."; |
2322 throw new IllegalArgumentException(excMsg); |
2280 throw new IllegalArgumentException(excMsg); |
2323 } |
2281 } |
2324 |
2282 |
2325 RELATION_LOGGER.entering(RelationService.class.getName(), |
2283 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", |
2326 "getReferencedMBeans", relationId); |
2284 relationId); |
2327 |
2285 |
2328 // Can throw a RelationNotFoundException |
2286 // Can throw a RelationNotFoundException |
2329 Object relObj = getRelation(relationId); |
2287 Object relObj = getRelation(relationId); |
2330 |
2288 |
2331 Map<ObjectName,List<String>> result; |
2289 Map<ObjectName,List<String>> result; |
2369 if (relationId == null) { |
2326 if (relationId == null) { |
2370 String excMsg = "Invalid parameter."; |
2327 String excMsg = "Invalid parameter."; |
2371 throw new IllegalArgumentException(excMsg); |
2328 throw new IllegalArgumentException(excMsg); |
2372 } |
2329 } |
2373 |
2330 |
2374 RELATION_LOGGER.entering(RelationService.class.getName(), |
2331 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
2375 "getRelationTypeName", relationId); |
|
2376 |
2332 |
2377 // Can throw a RelationNotFoundException |
2333 // Can throw a RelationNotFoundException |
2378 Object relObj = getRelation(relationId); |
2334 Object relObj = getRelation(relationId); |
2379 |
2335 |
2380 String result; |
2336 String result; |
2419 if (notif == null) { |
2374 if (notif == null) { |
2420 String excMsg = "Invalid parameter."; |
2375 String excMsg = "Invalid parameter."; |
2421 throw new IllegalArgumentException(excMsg); |
2376 throw new IllegalArgumentException(excMsg); |
2422 } |
2377 } |
2423 |
2378 |
2424 RELATION_LOGGER.entering(RelationService.class.getName(), |
2379 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", notif); |
2425 "handleNotification", notif); |
|
2426 |
2380 |
2427 if (notif instanceof MBeanServerNotification) { |
2381 if (notif instanceof MBeanServerNotification) { |
2428 |
2382 |
2429 MBeanServerNotification mbsNtf = (MBeanServerNotification) notif; |
2383 MBeanServerNotification mbsNtf = (MBeanServerNotification) notif; |
2430 String ntfType = notif.getType(); |
2384 String ntfType = notif.getType(); |
2493 * Returns a NotificationInfo object containing the name of the Java class |
2446 * Returns a NotificationInfo object containing the name of the Java class |
2494 * of the notification and the notification types sent. |
2447 * of the notification and the notification types sent. |
2495 */ |
2448 */ |
2496 public MBeanNotificationInfo[] getNotificationInfo() { |
2449 public MBeanNotificationInfo[] getNotificationInfo() { |
2497 |
2450 |
2498 RELATION_LOGGER.entering(RelationService.class.getName(), |
2451 RELATION_LOGGER.log(Level.TRACE, "ENTRY"); |
2499 "getNotificationInfo"); |
|
2500 |
2452 |
2501 String ntfClass = "javax.management.relation.RelationNotification"; |
2453 String ntfClass = "javax.management.relation.RelationNotification"; |
2502 |
2454 |
2503 String[] ntfTypes = new String[] { |
2455 String[] ntfTypes = new String[] { |
2504 RelationNotification.RELATION_BASIC_CREATION, |
2456 RelationNotification.RELATION_BASIC_CREATION, |
2512 String ntfDesc = "Sent when a relation is created, updated or deleted."; |
2464 String ntfDesc = "Sent when a relation is created, updated or deleted."; |
2513 |
2465 |
2514 MBeanNotificationInfo ntfInfo = |
2466 MBeanNotificationInfo ntfInfo = |
2515 new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc); |
2467 new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc); |
2516 |
2468 |
2517 RELATION_LOGGER.exiting(RelationService.class.getName(), |
2469 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
2518 "getNotificationInfo"); |
|
2519 return new MBeanNotificationInfo[] {ntfInfo}; |
2470 return new MBeanNotificationInfo[] {ntfInfo}; |
2520 } |
2471 } |
2521 |
2472 |
2522 // |
2473 // |
2523 // Misc |
2474 // Misc |
2537 if (relationTypeObj == null) { |
2488 if (relationTypeObj == null) { |
2538 String excMsg = "Invalid parameter."; |
2489 String excMsg = "Invalid parameter."; |
2539 throw new IllegalArgumentException(excMsg); |
2490 throw new IllegalArgumentException(excMsg); |
2540 } |
2491 } |
2541 |
2492 |
2542 RELATION_LOGGER.entering(RelationService.class.getName(), |
2493 RELATION_LOGGER.log(Level.TRACE, "ENTRY"); |
2543 "addRelationTypeInt"); |
|
2544 |
2494 |
2545 String relTypeName = relationTypeObj.getRelationTypeName(); |
2495 String relTypeName = relationTypeObj.getRelationTypeName(); |
2546 |
2496 |
2547 // Checks that there is not already a relation type with that name |
2497 // Checks that there is not already a relation type with that name |
2548 // existing in the Relation Service |
2498 // existing in the Relation Service |
2593 if (relationTypeName == null) { |
2542 if (relationTypeName == null) { |
2594 String excMsg = "Invalid parameter."; |
2543 String excMsg = "Invalid parameter."; |
2595 throw new IllegalArgumentException(excMsg); |
2544 throw new IllegalArgumentException(excMsg); |
2596 } |
2545 } |
2597 |
2546 |
2598 RELATION_LOGGER.entering(RelationService.class.getName(), |
2547 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); |
2599 "getRelationType", relationTypeName); |
|
2600 |
2548 |
2601 // No null relation type accepted, so can use get() |
2549 // No null relation type accepted, so can use get() |
2602 RelationType relType; |
2550 RelationType relType; |
2603 synchronized(myRelType2ObjMap) { |
2551 synchronized(myRelType2ObjMap) { |
2604 relType = (myRelType2ObjMap.get(relationTypeName)); |
2552 relType = (myRelType2ObjMap.get(relationTypeName)); |
2637 if (relationId == null) { |
2584 if (relationId == null) { |
2638 String excMsg = "Invalid parameter."; |
2585 String excMsg = "Invalid parameter."; |
2639 throw new IllegalArgumentException(excMsg); |
2586 throw new IllegalArgumentException(excMsg); |
2640 } |
2587 } |
2641 |
2588 |
2642 RELATION_LOGGER.entering(RelationService.class.getName(), |
2589 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); |
2643 "getRelation", relationId); |
|
2644 |
2590 |
2645 // No null relation accepted, so can use get() |
2591 // No null relation accepted, so can use get() |
2646 Object rel; |
2592 Object rel; |
2647 synchronized(myRelId2ObjMap) { |
2593 synchronized(myRelId2ObjMap) { |
2648 rel = myRelId2ObjMap.get(relationId); |
2594 rel = myRelId2ObjMap.get(relationId); |
2682 roleName == null) { |
2627 roleName == null) { |
2683 String excMsg = "Invalid parameter."; |
2628 String excMsg = "Invalid parameter."; |
2684 throw new IllegalArgumentException(excMsg); |
2629 throw new IllegalArgumentException(excMsg); |
2685 } |
2630 } |
2686 |
2631 |
2687 RELATION_LOGGER.entering(RelationService.class.getName(), |
2632 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
2688 "addNewMBeanReference", |
2633 objectName, relationId, roleName); |
2689 new Object[] {objectName, relationId, roleName}); |
|
2690 |
2634 |
2691 boolean isNewFlag = false; |
2635 boolean isNewFlag = false; |
2692 |
2636 |
2693 synchronized(myRefedMBeanObjName2RelIdsMap) { |
2637 synchronized(myRefedMBeanObjName2RelIdsMap) { |
2694 |
2638 |
2770 roleName == null) { |
2713 roleName == null) { |
2771 String excMsg = "Invalid parameter."; |
2714 String excMsg = "Invalid parameter."; |
2772 throw new IllegalArgumentException(excMsg); |
2715 throw new IllegalArgumentException(excMsg); |
2773 } |
2716 } |
2774 |
2717 |
2775 RELATION_LOGGER.entering(RelationService.class.getName(), |
2718 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", |
2776 "removeMBeanReference", |
2719 objectName, relationId, roleName, allRolesFlag); |
2777 new Object[] {objectName, relationId, roleName, allRolesFlag}); |
|
2778 |
2720 |
2779 boolean noLongerRefFlag = false; |
2721 boolean noLongerRefFlag = false; |
2780 |
2722 |
2781 synchronized(myRefedMBeanObjName2RelIdsMap) { |
2723 synchronized(myRefedMBeanObjName2RelIdsMap) { |
2782 |
2724 |
2788 Map<String,List<String>> mbeanRefMap = |
2730 Map<String,List<String>> mbeanRefMap = |
2789 (myRefedMBeanObjName2RelIdsMap.get(objectName)); |
2731 (myRefedMBeanObjName2RelIdsMap.get(objectName)); |
2790 |
2732 |
2791 if (mbeanRefMap == null) { |
2733 if (mbeanRefMap == null) { |
2792 // The MBean is no longer referenced |
2734 // The MBean is no longer referenced |
2793 RELATION_LOGGER.exiting(RelationService.class.getName(), |
2735 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
2794 "removeMBeanReference"); |
|
2795 return true; |
2736 return true; |
2796 } |
2737 } |
2797 |
2738 |
2798 List<String> roleNames = null; |
2739 List<String> roleNames = null; |
2799 if (!allRolesFlag) { |
2740 if (!allRolesFlag) { |
3001 relationObj != null))) { |
2939 relationObj != null))) { |
3002 String excMsg = "Invalid parameter."; |
2940 String excMsg = "Invalid parameter."; |
3003 throw new IllegalArgumentException(excMsg); |
2941 throw new IllegalArgumentException(excMsg); |
3004 } |
2942 } |
3005 |
2943 |
3006 RELATION_LOGGER.entering(RelationService.class.getName(), |
2944 RELATION_LOGGER.log(Level.TRACE, |
3007 "addRelationInt", new Object[] {relationBaseFlag, relationObj, |
2945 "ENTRY {0} {1} {2} {3} {4} {5}", |
3008 relationObjName, relationId, relationTypeName, roleList}); |
2946 relationBaseFlag, relationObj, relationObjName, |
|
2947 relationId, relationTypeName, roleList); |
3009 |
2948 |
3010 // Can throw RelationServiceNotRegisteredException |
2949 // Can throw RelationServiceNotRegisteredException |
3011 isActive(); |
2950 isActive(); |
3012 |
2951 |
3013 // Checks if there is already a relation with given id |
2952 // Checks if there is already a relation with given id |
3183 (chkType == 2 && roleValue == null)) { |
3121 (chkType == 2 && roleValue == null)) { |
3184 String excMsg = "Invalid parameter."; |
3122 String excMsg = "Invalid parameter."; |
3185 throw new IllegalArgumentException(excMsg); |
3123 throw new IllegalArgumentException(excMsg); |
3186 } |
3124 } |
3187 |
3125 |
3188 RELATION_LOGGER.entering(RelationService.class.getName(), |
3126 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4}", |
3189 "checkRoleInt", new Object[] {chkType, roleName, |
3127 chkType, roleName, roleValue, roleInfo, writeChkFlag); |
3190 roleValue, roleInfo, writeChkFlag}); |
|
3191 |
3128 |
3192 // Compares names |
3129 // Compares names |
3193 String expName = roleInfo.getName(); |
3130 String expName = roleInfo.getName(); |
3194 if (!(roleName.equals(expName))) { |
3131 if (!(roleName.equals(expName))) { |
3195 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3132 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3196 "checkRoleInt"); |
|
3197 return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); |
3133 return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); |
3198 } |
3134 } |
3199 |
3135 |
3200 // Checks read access if required |
3136 // Checks read access if required |
3201 if (chkType == 1) { |
3137 if (chkType == 1) { |
3202 boolean isReadable = roleInfo.isReadable(); |
3138 boolean isReadable = roleInfo.isReadable(); |
3203 if (!isReadable) { |
3139 if (!isReadable) { |
3204 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3140 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3205 "checkRoleInt"); |
|
3206 return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE); |
3141 return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE); |
3207 } else { |
3142 } else { |
3208 // End of check :) |
3143 // End of check :) |
3209 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3144 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3210 "checkRoleInt"); |
|
3211 return 0; |
3145 return 0; |
3212 } |
3146 } |
3213 } |
3147 } |
3214 |
3148 |
3215 // Checks write access if required |
3149 // Checks write access if required |
3216 if (writeChkFlag) { |
3150 if (writeChkFlag) { |
3217 boolean isWritable = roleInfo.isWritable(); |
3151 boolean isWritable = roleInfo.isWritable(); |
3218 if (!isWritable) { |
3152 if (!isWritable) { |
3219 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3153 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3220 "checkRoleInt"); |
|
3221 return RoleStatus.ROLE_NOT_WRITABLE; |
3154 return RoleStatus.ROLE_NOT_WRITABLE; |
3222 } |
3155 } |
3223 } |
3156 } |
3224 |
3157 |
3225 int refNbr = roleValue.size(); |
3158 int refNbr = roleValue.size(); |
3226 |
3159 |
3227 // Checks minimum cardinality |
3160 // Checks minimum cardinality |
3228 boolean chkMinFlag = roleInfo.checkMinDegree(refNbr); |
3161 boolean chkMinFlag = roleInfo.checkMinDegree(refNbr); |
3229 if (!chkMinFlag) { |
3162 if (!chkMinFlag) { |
3230 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3163 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3231 "checkRoleInt"); |
|
3232 return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE; |
3164 return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE; |
3233 } |
3165 } |
3234 |
3166 |
3235 // Checks maximum cardinality |
3167 // Checks maximum cardinality |
3236 boolean chkMaxFlag = roleInfo.checkMaxDegree(refNbr); |
3168 boolean chkMaxFlag = roleInfo.checkMaxDegree(refNbr); |
3237 if (!chkMaxFlag) { |
3169 if (!chkMaxFlag) { |
3238 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3170 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3239 "checkRoleInt"); |
|
3240 return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE; |
3171 return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE; |
3241 } |
3172 } |
3242 |
3173 |
3243 // Verifies that each referenced MBean is registered in the MBean |
3174 // Verifies that each referenced MBean is registered in the MBean |
3244 // Server and that it is an instance of the class specified in the |
3175 // Server and that it is an instance of the class specified in the |
3250 |
3181 |
3251 for (ObjectName currObjName : roleValue) { |
3182 for (ObjectName currObjName : roleValue) { |
3252 |
3183 |
3253 // Checks it is registered |
3184 // Checks it is registered |
3254 if (currObjName == null) { |
3185 if (currObjName == null) { |
3255 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3186 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3256 "checkRoleInt"); |
|
3257 return RoleStatus.REF_MBEAN_NOT_REGISTERED; |
3187 return RoleStatus.REF_MBEAN_NOT_REGISTERED; |
3258 } |
3188 } |
3259 |
3189 |
3260 // Checks if it is of the correct class |
3190 // Checks if it is of the correct class |
3261 // Can throw an InstanceNotFoundException, if MBean not registered |
3191 // Can throw an InstanceNotFoundException, if MBean not registered |
3262 try { |
3192 try { |
3263 boolean classSts = myMBeanServer.isInstanceOf(currObjName, |
3193 boolean classSts = myMBeanServer.isInstanceOf(currObjName, |
3264 expClassName); |
3194 expClassName); |
3265 if (!classSts) { |
3195 if (!classSts) { |
3266 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3196 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3267 "checkRoleInt"); |
|
3268 return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS; |
3197 return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS; |
3269 } |
3198 } |
3270 |
3199 |
3271 } catch (InstanceNotFoundException exc) { |
3200 } catch (InstanceNotFoundException exc) { |
3272 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3201 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3273 "checkRoleInt"); |
|
3274 return RoleStatus.REF_MBEAN_NOT_REGISTERED; |
3202 return RoleStatus.REF_MBEAN_NOT_REGISTERED; |
3275 } |
3203 } |
3276 } |
3204 } |
3277 |
3205 |
3278 RELATION_LOGGER.exiting(RelationService.class.getName(), |
3206 RELATION_LOGGER.log(Level.TRACE, "RETURN"); |
3279 "checkRoleInt"); |
|
3280 return 0; |
3207 return 0; |
3281 } |
3208 } |
3282 |
3209 |
3283 |
3210 |
3284 // Initializes roles associated to given role infos to default value (empty |
3211 // Initializes roles associated to given role infos to default value (empty |
3326 roleInfoList == null) { |
3253 roleInfoList == null) { |
3327 String excMsg = "Invalid parameter."; |
3254 String excMsg = "Invalid parameter."; |
3328 throw new IllegalArgumentException(excMsg); |
3255 throw new IllegalArgumentException(excMsg); |
3329 } |
3256 } |
3330 |
3257 |
3331 RELATION_LOGGER.entering(RelationService.class.getName(), |
3258 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5}", |
3332 "initializeMissingRoles", new Object[] {relationBaseFlag, |
3259 relationBaseFlag, relationObj, relationObjName, |
3333 relationObj, relationObjName, relationId, relationTypeName, |
3260 relationId, relationTypeName, roleInfoList); |
3334 roleInfoList}); |
|
3335 |
3261 |
3336 // Can throw RelationServiceNotRegisteredException |
3262 // Can throw RelationServiceNotRegisteredException |
3337 isActive(); |
3263 isActive(); |
3338 |
3264 |
3339 // For each role info (corresponding to a role not initialized by the |
3265 // For each role info (corresponding to a role not initialized by the |
3526 oldValue == null))) { |
3451 oldValue == null))) { |
3527 String excMsg = "Invalid parameter."; |
3452 String excMsg = "Invalid parameter."; |
3528 throw new IllegalArgumentException(excMsg); |
3453 throw new IllegalArgumentException(excMsg); |
3529 } |
3454 } |
3530 |
3455 |
3531 RELATION_LOGGER.entering(RelationService.class.getName(), |
3456 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5} {6}", |
3532 "sendNotificationInt", new Object[] {intNtfType, message, |
3457 intNtfType, message, relationId, unregMBeanList, |
3533 relationId, unregMBeanList, roleName, roleNewValue, oldValue}); |
3458 roleName, roleNewValue, oldValue); |
3534 |
3459 |
3535 // Relation type name |
3460 // Relation type name |
3536 // Note: do not use getRelationTypeName() as if it is a relation MBean |
3461 // Note: do not use getRelationTypeName() as if it is a relation MBean |
3537 // it is already unregistered. |
3462 // it is already unregistered. |
3538 String relTypeName; |
3463 String relTypeName; |
3652 objectName == null) { |
3576 objectName == null) { |
3653 String excMsg = "Invalid parameter."; |
3577 String excMsg = "Invalid parameter."; |
3654 throw new IllegalArgumentException(excMsg); |
3578 throw new IllegalArgumentException(excMsg); |
3655 } |
3579 } |
3656 |
3580 |
3657 RELATION_LOGGER.entering(RelationService.class.getName(), |
3581 RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", |
3658 "handleReferenceUnregistration", |
3582 relationId, objectName, roleNameList); |
3659 new Object[] {relationId, objectName, roleNameList}); |
|
3660 |
3583 |
3661 // Can throw RelationServiceNotRegisteredException |
3584 // Can throw RelationServiceNotRegisteredException |
3662 isActive(); |
3585 isActive(); |
3663 |
3586 |
3664 // Retrieves the relation type name of the relation |
3587 // Retrieves the relation type name of the relation |