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. |
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 theNtfType, Object theSrcObj, long TheSeqNbr, long theTimeStamp, String theMsg, String theRelId, String theRelTypeName, ObjectName theRelObjName, List theUnregMBeanList)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(theNtfType, theSrcObj, TheSeqNbr, theTimeStamp, theMsg);
// Can throw IllegalArgumentException
initMembers(1,
theNtfType,
theSrcObj,
TheSeqNbr,
theTimeStamp,
theMsg,
theRelId,
theRelTypeName,
theRelObjName,
theUnregMBeanList,
null,
null,
null);
return;
| public RelationNotification(String theNtfType, Object theSrcObj, long TheSeqNbr, long theTimeStamp, String theMsg, String theRelId, String theRelTypeName, ObjectName theRelObjName, String theRoleName, List theNewRoleValue, List theOldRoleValue)Creates a notification for a role update in a relation.
super(theNtfType, theSrcObj, TheSeqNbr, theTimeStamp, theMsg);
// Can throw IllegalArgumentException
initMembers(2,
theNtfType,
theSrcObj,
TheSeqNbr,
theTimeStamp,
theMsg,
theRelId,
theRelTypeName,
theRelObjName,
null,
theRoleName,
theNewRoleValue,
theOldRoleValue);
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 result = null;
if (unregisterMBeanList != null) {
result = (List)((ArrayList)unregisterMBeanList).clone();
} else {
result = Collections.EMPTY_LIST;
}
return result;
| public java.util.List | getNewRoleValue()Returns new value of updated role (only for role update).
List result = null;
if (newRoleValue != null) {
result = (List)((ArrayList)newRoleValue).clone();
} else {
result = Collections.EMPTY_LIST;
}
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 result = null;
if (oldRoleValue != null) {
result = (List)((ArrayList)oldRoleValue).clone();
} else {
result = Collections.EMPTY_LIST;
}
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 theNtfKind, java.lang.String theNtfType, java.lang.Object theSrcObj, long TheSeqNbr, long theTimeStamp, java.lang.String theMsg, java.lang.String theRelId, java.lang.String theRelTypeName, javax.management.ObjectName theRelObjName, java.util.List theUnregMBeanList, java.lang.String theRoleName, java.util.List theNewRoleValue, java.util.List theOldRoleValue)
boolean badInitFlg = false;
if (theNtfType == null ||
theSrcObj == null ||
(!(theSrcObj instanceof RelationService)) ||
theRelId == null ||
theRelTypeName == null) {
badInitFlg = true;
}
if (theNtfKind == 1) {
if ((!(theNtfType.equals(RelationNotification.RELATION_BASIC_CREATION)))
&&
(!(theNtfType.equals(RelationNotification.RELATION_MBEAN_CREATION)))
&&
(!(theNtfType.equals(RelationNotification.RELATION_BASIC_REMOVAL)))
&&
(!(theNtfType.equals(RelationNotification.RELATION_MBEAN_REMOVAL)))
) {
// Creation/removal
badInitFlg = true;
}
} else if (theNtfKind == 2) {
if (((!(theNtfType.equals(RelationNotification.RELATION_BASIC_UPDATE)))
&&
(!(theNtfType.equals(RelationNotification.RELATION_MBEAN_UPDATE))))
|| theRoleName == null ||
theOldRoleValue == null ||
theNewRoleValue == null) {
// Role update
badInitFlg = true;
}
}
if (badInitFlg) {
// Revisit [cebro] Localize message
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
relationId = theRelId;
relationTypeName = theRelTypeName;
relationObjName = theRelObjName;
if (theUnregMBeanList != null) {
unregisterMBeanList = new ArrayList(theUnregMBeanList);
}
if (theRoleName != null) {
roleName = theRoleName;
}
if (theOldRoleValue != null) {
oldRoleValue = new ArrayList(theOldRoleValue);
}
if (theNewRoleValue != null) {
newRoleValue = new ArrayList(theNewRoleValue);
}
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) fields.get("myNewRoleValue", null);
if (fields.defaulted("myNewRoleValue"))
{
throw new NullPointerException("newRoleValue");
}
oldRoleValue = (List) 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) 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();
}
|
|