/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* 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.
*
* <p>The <b>serialVersionUID</b> of this class is <code>-6871117877523310399L</code>.
*
* @since 1.5
*/
// Serialization compatibility stuff:
// Two serial forms are supported in this class. The selected form depends
// on system property "jmx.serial.form":
// - "1.0" for JMX 1.0
// - any other value for JMX 1.1 and higher
//
// Serial version for old serial form
//
// Serial version for new serial form
//
// Serializable fields in old serial form
{
};
//
// Serializable fields in new serial form
{
};
//
// Actual serial version and serial form
private static final long serialVersionUID;
/**
* @serialField relationId String Relation identifier of
* @serialField relationTypeName String Relation type name of
* @serialField relationObjName ObjectName {@link ObjectName} of
* the relation is represented by an MBean)
* @serialField unregisterMBeanList List List of {@link
* ObjectName}s of referenced MBeans to be unregistered due to
* relation removal
* @serialField roleName String Name of updated role (only for role update)
* @serialField oldRoleValue List Old role value ({@link
* ArrayList} of {@link ObjectName}s) (only for role update)
* @serialField newRoleValue List New role value ({@link
* ArrayList} of {@link ObjectName}s) (only for role update)
*/
private static boolean compat = false;
static {
try {
} catch (Exception e) {
// OK : Too bad, no compat with 1.0
}
if (compat) {
} else {
}
}
//
// END Serialization compatibility stuff
//
// Notification types
//
/**
* Type for the creation of an internal relation.
*/
/**
* Type for the relation MBean added into the Relation Service.
*/
/**
* Type for an update of an internal relation.
*/
/**
* Type for the update of a relation MBean.
*/
/**
* Type for the removal from the Relation Service of an internal relation.
*/
/**
* Type for the removal from the Relation Service of a relation MBean.
*/
//
// Private members
//
/**
*/
/**
*/
/**
* (only if the relation is represented by an MBean)
*/
/**
* @serial List of {@link ObjectName}s of referenced MBeans to be unregistered due to
* relation removal
*/
/**
* @serial Name of updated role (only for role update)
*/
/**
* @serial Old role value ({@link ArrayList} of {@link ObjectName}s) (only for role update)
*/
/**
* @serial New role value ({@link ArrayList} of {@link ObjectName}s) (only for role update)
*/
//
// Constructors
//
/**
* 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.
*
* @param notifType type of the notification; either:
* <P>- RELATION_BASIC_CREATION
* <P>- RELATION_MBEAN_CREATION
* <P>- RELATION_BASIC_REMOVAL
* <P>- RELATION_MBEAN_REMOVAL
* @param sourceObj source object, sending the notification. This is either
* an ObjectName or a RelationService object. In the latter case it must be
* the MBean emitting the notification; the MBean Server will rewrite the
* source to be the ObjectName under which that MBean is registered.
* @param sequence sequence number to identify the notification
* @param timeStamp time stamp
* @param message human-readable message describing the notification
* @param id relation id identifying the relation in the Relation
* Service
* @param typeName name of the relation type
* @param objectName ObjectName of the relation object if it is an MBean
* (null for relations internally handled by the Relation Service)
* @param unregMBeanList list of ObjectNames of referenced MBeans
* expected to be unregistered due to relation removal (only for removal,
* due to CIM qualifiers, can be null)
*
* @exception IllegalArgumentException if:
* <P>- no value for the notification type
* <P>- the notification type is not RELATION_BASIC_CREATION,
* RELATION_MBEAN_CREATION, RELATION_BASIC_REMOVAL or
* RELATION_MBEAN_REMOVAL
* <P>- no source object
* <P>- the source object is not a Relation Service
* <P>- no relation id
* <P>- no relation type name
*/
long sequence,
long timeStamp,
throws IllegalArgumentException {
throw new IllegalArgumentException("Invalid parameter.");
}
relationId = id;
}
/**
* Creates a notification for a role update in a relation.
*
* @param notifType type of the notification; either:
* <P>- RELATION_BASIC_UPDATE
* <P>- RELATION_MBEAN_UPDATE
* @param sourceObj source object, sending the notification. This is either
* an ObjectName or a RelationService object. In the latter case it must be
* the MBean emitting the notification; the MBean Server will rewrite the
* source to be the ObjectName under which that MBean is registered.
* @param sequence sequence number to identify the notification
* @param timeStamp time stamp
* @param message human-readable message describing the notification
* @param id relation id identifying the relation in the Relation
* Service
* @param typeName name of the relation type
* @param objectName ObjectName of the relation object if it is an MBean
* (null for relations internally handled by the Relation Service)
* @param name name of the updated role
* @param newValue new role value (List of ObjectName objects)
* @param oldValue old role value (List of ObjectName objects)
*
* @exception IllegalArgumentException if null parameter
*/
long sequence,
long timeStamp,
)
throws IllegalArgumentException {
if (!isValidBasic(notifType,sourceObj,id,typeName) || !isValidUpdate(notifType,name,newValue,oldValue)) {
throw new IllegalArgumentException("Invalid parameter.");
}
relationId = id;
}
//
// Accessors
//
/**
*
* @return the relation id.
*/
return relationId;
}
/**
*
* @return the relation type name.
*/
return relationTypeName;
}
/**
* Returns the ObjectName of the
*
* @return the ObjectName if the relation is an MBean, otherwise null.
*/
return relationObjName;
}
/**
* Returns the list of ObjectNames of MBeans expected to be unregistered
* due to a relation removal (only for relation removal).
*
* @return a {@link List} of {@link ObjectName}.
*/
if (unregisterMBeanList != null) {
} else {
}
return result;
}
/**
* Returns name of updated role of updated relation (only for role update).
*
* @return the name of the updated role.
*/
}
return result;
}
/**
* Returns old value of updated role (only for role update).
*
* @return the old value of the updated role.
*/
if (oldRoleValue != null) {
} else {
}
return result;
}
/**
* Returns new value of updated role (only for role update).
*
* @return the new value of the updated role.
*/
if (newRoleValue != null) {
} else {
}
return result;
}
//
// Misc
//
// Initializes members
//
// -param notifType type of the notification; either:
// - RELATION_BASIC_UPDATE
// - RELATION_MBEAN_UPDATE
// for an update, or:
// - RELATION_BASIC_CREATION
// - RELATION_MBEAN_CREATION
// - RELATION_BASIC_REMOVAL
// - RELATION_MBEAN_REMOVAL
// for a creation or removal
// -param sourceObj source object, sending the notification. Will always
// be a RelationService object.
// -param sequence sequence number to identify the notification
// -param timeStamp time stamp
// -param message human-readable message describing the notification
// -param id relation id identifying the relation in the Relation
// Service
// -param typeName name of the relation type
// -param objectName ObjectName of the relation object if it is an MBean
// (null for relations internally handled by the Relation Service)
// -param unregMBeanList list of ObjectNames of MBeans expected to be
// removed due to relation removal
// -param name name of the updated role
// -param newValue new value (List of ObjectName objects)
// -param oldValue old value (List of ObjectName objects)
//
// -exception IllegalArgumentException if:
// - no value for the notification type
// - incorrect notification type
// - no source object
// - the source object is not a Relation Service
// - no relation id
// - no relation type name
// - no role name (for role update)
// - no role old value (for role update)
// - no role new value (for role update)
return false;
}
if (!(sourceObj instanceof RelationService) &&
!(sourceObj instanceof ObjectName)) {
return false;
}
return true;
}
}
return false;
}
return false;
}
return true;
}
// NPE thrown if we attempt to add null object
}
}
return dest;
}
}
return dest;
}
/**
* Deserializes a {@link RelationNotification} from an {@link ObjectInputStream}.
*/
throws IOException, ClassNotFoundException {
if (compat) {
}
else {
}
// Validate fields we just read, throw InvalidObjectException
// if something goes wrong
(!isValidCreate(notifType) &&
throw new InvalidObjectException("Invalid object read");
}
// assign deserialized vaules to object fields
}
/**
* Serializes a {@link RelationNotification} to an {@link ObjectOutputStream}.
*/
throws IOException {
if (compat)
{
// Serializes this instance in the old serial form
//
out.writeFields();
}
else
{
// Serializes this instance in the new serial form
//
}
}
}