RelationNotificationpublic class RelationNotification extends Notification A notification of a change in the Relation Service.
A RelationNotification notification is sent when a relation is created via
the Relation Service, or an MBean is added as a relation in the Relation
Service, or a role is updated in a relation, or a relation is removed from
the Relation Service.
The serialVersionUID of this class is -6871117877523310399L . |
Fields Summary |
---|
private static final long | oldSerialVersionUID | private static final long | newSerialVersionUID | private static final ObjectStreamField[] | oldSerialPersistentFields | private static final ObjectStreamField[] | newSerialPersistentFields | private static final long | serialVersionUID | private static final ObjectStreamField[] | serialPersistentFields | private static boolean | compat | public static final String | RELATION_BASIC_CREATIONType for the creation of an internal relation. | public static final String | RELATION_MBEAN_CREATIONType for the relation MBean added into the Relation Service. | public static final String | RELATION_BASIC_UPDATEType for an update of an internal relation. | public static final String | RELATION_MBEAN_UPDATEType for the update of a relation MBean. | public static final String | RELATION_BASIC_REMOVALType for the removal from the Relation Service of an internal relation. | public static final String | RELATION_MBEAN_REMOVALType for the removal from the Relation Service of a relation MBean. | private String | relationId | private String | relationTypeName | private ObjectName | relationObjName | private List | unregisterMBeanList | private String | roleName | private List | oldRoleValue | private List | newRoleValue |
Constructors Summary |
---|
public RelationNotification(String notifType, Object sourceObj, long sequence, long timeStamp, String message, String id, String typeName, ObjectName objectName, List unregMBeanList)Creates a notification for either a relation creation (RelationSupport
object created internally in the Relation Service, or an MBean added as a
relation) or for a relation removal from the Relation Service.
//
// Constructors
//
super(notifType, sourceObj, sequence, timeStamp, message);
// Can throw IllegalArgumentException
initMembers(1,
notifType,
sourceObj,
sequence,
timeStamp,
message,
id,
typeName,
objectName,
unregMBeanList,
null,
null,
null);
return;
| public RelationNotification(String notifType, Object sourceObj, long sequence, long timeStamp, String message, String id, String typeName, ObjectName objectName, String name, List newValue, List oldValue)Creates a notification for a role update in a relation.
super(notifType, sourceObj, sequence, timeStamp, message);
// Can throw IllegalArgumentException
initMembers(2,
notifType,
sourceObj,
sequence,
timeStamp,
message,
id,
typeName,
objectName,
null,
name,
newValue,
oldValue);
return;
|
Methods Summary |
---|
public java.util.List | getMBeansToUnregister()Returns the list of ObjectNames of MBeans expected to be unregistered
due to a relation removal (only for relation removal).
List<ObjectName> result = null;
if (unregisterMBeanList != null) {
result = new ArrayList<ObjectName>(unregisterMBeanList);
} else {
result = Collections.emptyList();
}
return result;
| public java.util.List | getNewRoleValue()Returns new value of updated role (only for role update).
List<ObjectName> result = null;
if (newRoleValue != null) {
result = new ArrayList<ObjectName>(newRoleValue);
} else {
result = Collections.emptyList();
}
return result;
| public javax.management.ObjectName | getObjectName()Returns the ObjectName of the
created/removed/updated relation.
return relationObjName;
| public java.util.List | getOldRoleValue()Returns old value of updated role (only for role update).
List<ObjectName> result = null;
if (oldRoleValue != null) {
result = new ArrayList<ObjectName>(oldRoleValue);
} else {
result = Collections.emptyList();
}
return result;
| public java.lang.String | getRelationId()Returns the relation identifier of created/removed/updated relation.
return relationId;
| public java.lang.String | getRelationTypeName()Returns the relation type name of created/removed/updated relation.
return relationTypeName;
| public java.lang.String | getRoleName()Returns name of updated role of updated relation (only for role update).
String result = null;
if (roleName != null) {
result = roleName;
}
return result;
| private void | initMembers(int notifKind, java.lang.String notifType, java.lang.Object sourceObj, long sequence, long timeStamp, java.lang.String message, java.lang.String id, java.lang.String typeName, javax.management.ObjectName objectName, java.util.List unregMBeanList, java.lang.String name, java.util.List newValue, java.util.List oldValue)
boolean badInitFlg = false;
if (notifType == null ||
sourceObj == null ||
(!(sourceObj instanceof RelationService) &&
!(sourceObj instanceof ObjectName)) ||
id == null ||
typeName == null) {
badInitFlg = true;
}
if (notifKind == 1) {
if ((!(notifType.equals(RelationNotification.RELATION_BASIC_CREATION)))
&&
(!(notifType.equals(RelationNotification.RELATION_MBEAN_CREATION)))
&&
(!(notifType.equals(RelationNotification.RELATION_BASIC_REMOVAL)))
&&
(!(notifType.equals(RelationNotification.RELATION_MBEAN_REMOVAL)))
) {
// Creation/removal
badInitFlg = true;
}
} else if (notifKind == 2) {
if (((!(notifType.equals(RelationNotification.RELATION_BASIC_UPDATE)))
&&
(!(notifType.equals(RelationNotification.RELATION_MBEAN_UPDATE))))
|| name == null ||
oldValue == null ||
newValue == null) {
// Role update
badInitFlg = true;
}
}
if (badInitFlg) {
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
relationId = id;
relationTypeName = typeName;
relationObjName = objectName;
if (unregMBeanList != null) {
unregisterMBeanList = new ArrayList<ObjectName>(unregMBeanList);
}
if (name != null) {
roleName = name;
}
if (oldValue != null) {
oldRoleValue = new ArrayList<ObjectName>(oldValue);
}
if (newValue != null) {
newRoleValue = new ArrayList<ObjectName>(newValue);
}
return;
| private void | readObject(java.io.ObjectInputStream in)Deserializes a {@link RelationNotification} from an {@link ObjectInputStream}.
if (compat)
{
// Read an object serialized in the old serial form
//
ObjectInputStream.GetField fields = in.readFields();
newRoleValue = (List<ObjectName>) fields.get("myNewRoleValue", null);
if (fields.defaulted("myNewRoleValue"))
{
throw new NullPointerException("newRoleValue");
}
oldRoleValue = (List<ObjectName>) fields.get("myOldRoleValue", null);
if (fields.defaulted("myOldRoleValue"))
{
throw new NullPointerException("oldRoleValue");
}
relationId = (String) fields.get("myRelId", null);
if (fields.defaulted("myRelId"))
{
throw new NullPointerException("relationId");
}
relationObjName = (ObjectName) fields.get("myRelObjName", null);
if (fields.defaulted("myRelObjName"))
{
throw new NullPointerException("relationObjName");
}
relationTypeName = (String) fields.get("myRelTypeName", null);
if (fields.defaulted("myRelTypeName"))
{
throw new NullPointerException("relationTypeName");
}
roleName = (String) fields.get("myRoleName", null);
if (fields.defaulted("myRoleName"))
{
throw new NullPointerException("roleName");
}
unregisterMBeanList =
(List<ObjectName>) fields.get("myUnregMBeanList", null);
if (fields.defaulted("myUnregMBeanList"))
{
throw new NullPointerException("unregisterMBeanList");
}
}
else
{
// Read an object serialized in the new serial form
//
in.defaultReadObject();
}
| private void | writeObject(java.io.ObjectOutputStream out)Serializes a {@link RelationNotification} to an {@link ObjectOutputStream}.
if (compat)
{
// Serializes this instance in the old serial form
//
ObjectOutputStream.PutField fields = out.putFields();
fields.put("myNewRoleValue", newRoleValue);
fields.put("myOldRoleValue", oldRoleValue);
fields.put("myRelId", relationId);
fields.put("myRelObjName", relationObjName);
fields.put("myRelTypeName", relationTypeName);
fields.put("myRoleName",roleName);
fields.put("myUnregMBeanList", unregisterMBeanList);
out.writeFields();
}
else
{
// Serializes this instance in the new serial form
//
out.defaultWriteObject();
}
|
|