FileDocCategorySizeDatePackage
ModelMBeanInfoSupport.javaAPI DocJava SE 5 API36397Fri Aug 26 14:57:34 BST 2005javax.management.modelmbean

ModelMBeanInfoSupport

public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo, Serializable
This class represents the meta data for ModelMBeans. Descriptors have been added on the meta data objects.

Java resources wishing to be manageable instantiate the ModelMBean using the MBeanServer's createMBean method. The resource then sets the ModelMBeanInfo and Descriptors for the ModelMBean instance. The attributes and operations exposed via the ModelMBeanInfo for the ModelMBean are accessible from MBeans, connectors/adaptors like other MBeans. Through the Descriptors, values and methods in the managed application can be defined and mapped to attributes and operations of the ModelMBean. This mapping can be defined during development in a file or dynamically and programmatically at runtime.

Every ModelMBean which is instantiated in the MBeanServer becomes manageable: its attributes and operations become remotely accessible through the connectors/adaptors connected to that MBeanServer. A Java object cannot be registered in the MBeanServer unless it is a JMX compliant MBean. By instantiating a ModelMBean, resources are guaranteed that the MBean is valid. MBeanException and RuntimeOperationsException must be thrown on every public method. This allows for wrapping exceptions from distributed communications (RMI, EJB, etc.)

since
1.5

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
private Descriptor
modelMBeanDescriptor
private MBeanAttributeInfo[]
modelMBeanAttributes
private MBeanConstructorInfo[]
modelMBeanConstructors
private MBeanNotificationInfo[]
modelMBeanNotifications
private MBeanOperationInfo[]
modelMBeanOperations
private static final String
ATTR
private static final String
OPER
private static final String
NOTF
private static final String
CONS
private static final String
MMB
private static final String
ALL
private static final String
currClass
private static final ModelMBeanAttributeInfo[]
NO_ATTRIBUTES
private static final ModelMBeanConstructorInfo[]
NO_CONSTRUCTORS
private static final ModelMBeanNotificationInfo[]
NO_NOTIFICATIONS
private static final ModelMBeanOperationInfo[]
NO_OPERATIONS
Constructors Summary
public ModelMBeanInfoSupport(ModelMBeanInfo mbi)
Constructs a ModelMBeanInfoSupport which is a duplicate of the one passed in.

param
mbi the ModelMBeanInfo instance from which the ModelMBeanInfo being created is initialized.


                                  
       
    
	super(mbi.getClassName(),
	      mbi.getDescription(),
	      mbi.getAttributes(),
	      mbi.getConstructors(),
	      mbi.getOperations(),
	      mbi.getNotifications());
          
	modelMBeanAttributes = mbi.getAttributes();
	modelMBeanConstructors = mbi.getConstructors();
	modelMBeanOperations = mbi.getOperations();
	modelMBeanNotifications = mbi.getNotifications();

	try
	    {
		Descriptor mbeandescriptor = mbi.getMBeanDescriptor();

		if ((mbeandescriptor != null) && isValidDescriptor(mbeandescriptor))
		    {
			if (tracing()) trace("ModelMBeanInfo(ModelMBeanInfo)","ModelMBeanDescriptor is valid, cloning Descriptor *" + mbeandescriptor.toString() + "*");
			modelMBeanDescriptor = (Descriptor) mbeandescriptor.clone();
			addDefaultFields();
		    } else
			{
			    if (tracing()) trace("ModelMBeanInfo(ModelMBeanInfo)",
						 "ModelMBeanDescriptor in ModelMBeanInfo is null or invalid, setting to default value");
			    modelMBeanDescriptor = createDefaultDescriptor();
			}
	    } catch (MBeanException mbe)
		{
		    modelMBeanDescriptor = createDefaultDescriptor();
		    if (tracing()) trace("ModelMBeanInfo(ModelMBeanInfo)","Could not get modelMBeanDescriptor, setting to default value");
		}

	if (tracing())
	    {
		trace("ModelMBeanInfo(ModelMBeanInfo)","Executed");
	    }
    
public ModelMBeanInfoSupport(String className, String description, ModelMBeanAttributeInfo[] attributes, ModelMBeanConstructorInfo[] constructors, ModelMBeanOperationInfo[] operations, ModelMBeanNotificationInfo[] notifications)
Creates a ModelMBeanInfoSupport with the provided information, but the descriptor is a default. The default descriptor is: name=mbeanName, descriptorType=mbean, displayName=ClassName, persistPolicy=never, log=F, visibility=1

param
className classname of the MBean
param
description human readable description of the ModelMBean
param
attributes array of ModelMBeanAttributeInfo objects which have descriptors
param
constructors array of ModelMBeanConstructorInfo objects which have descriptors
param
operations array of ModelMBeanOperationInfo objects which have descriptors
param
notifications array of ModelMBeanNotificationInfo objects which have descriptors

	    this(className, description, attributes, constructors,
		 operations, notifications, null);
    
public ModelMBeanInfoSupport(String className, String description, ModelMBeanAttributeInfo[] attributes, ModelMBeanConstructorInfo[] constructors, ModelMBeanOperationInfo[] operations, ModelMBeanNotificationInfo[] notifications, Descriptor mbeandescriptor)
Creates a ModelMBeanInfoSupport with the provided information and the descriptor given in parameter.

param
className classname of the MBean
param
description human readable description of the ModelMBean
param
attributes array of ModelMBeanAttributeInfo objects which have descriptors
param
constructors array of ModelMBeanConstructorInfo objects which have descriptor
param
operations array of ModelMBeanOperationInfo objects which have descriptor
param
notifications array of ModelMBeanNotificationInfo objects which have descriptor
param
mbeandescriptor descriptor to be used as the MBeanDescriptor containing MBean wide policy. If the descriptor is null, a default descriptor will be constructed. The default descriptor is: name=className, descriptorType=mbean, displayName=className, persistPolicy=never, log=F, visibility=1. If the descriptor does not contain all these fields, they will be added with these default values.
exception
RuntimeOperationsException Wraps an IllegalArgumentException for invalid descriptor passed in parameter. (see {@link #getMBeanDescriptor getMBeanDescriptor} for the definition of a valid MBean descriptor.)

	super(className,
	      description,
	      (attributes != null) ? attributes : NO_ATTRIBUTES,
	      (constructors != null) ? constructors : NO_CONSTRUCTORS,
	      (operations != null) ? operations : NO_OPERATIONS,
	      (notifications != null) ? notifications : NO_NOTIFICATIONS);
	/* The values saved here are possibly null, but we
	   check this everywhere they are referenced.  If at
	   some stage we replace null with an empty array
	   here, as we do in the superclass constructor
	   parameters, then we must also do this in
	   readObject().  */
	modelMBeanAttributes = attributes;
	modelMBeanConstructors = constructors;
	modelMBeanOperations = operations;
	modelMBeanNotifications = notifications;
	if (mbeandescriptor ==null) {
	    if (tracing())
		trace("ModelMBeanInfo(String,String,ModelMBeanAttributeInfo[],ModelMBeanConstructorInfo[],ModelMBeanOperationInfo[],ModelMBeanNotificationInfo[],Descriptor)",
		      "MBeanDescriptor is null, setting default descriptor");

	    modelMBeanDescriptor = createDefaultDescriptor();
	} else {
	    if (isValidDescriptor(mbeandescriptor)) {
		modelMBeanDescriptor = (Descriptor) mbeandescriptor.clone();
		addDefaultFields();
	    } else {
		throw new RuntimeOperationsException(new IllegalArgumentException("Invalid descriptor passed in parameter"));
	    }
	}	
	if (tracing())
	    {
		trace("ModelMBeanInfo(String,String,ModelMBeanAttributeInfo[],ModelMBeanConstructorInfo[],ModelMBeanOperationInfo[],ModelMBeanNotificationInfo[],Descriptor)",
		      "Executed");
	    }
    
Methods Summary
private voidaddDefaultFields()

	final Descriptor d = modelMBeanDescriptor;

	if ((d.getFieldValue("displayName")) == null)
	    d.setField("displayName",this.getClassName());
	if ((d.getFieldValue("persistPolicy")) == null)
	    d.setField("persistPolicy","never");
	if ((d.getFieldValue("log")) == null)
	    d.setField("log","F");
	if ((d.getFieldValue("visibility")) == null)
	    d.setField("visibility","1");
    
public java.lang.Objectclone()


    // Java doc inherited from MOdelMBeanInfo interface 
    
       
	return(new ModelMBeanInfoSupport(this));
    
private javax.management.DescriptorcreateDefaultDescriptor()


		Descriptor dftDesc = null;
		dftDesc = new DescriptorSupport(new String[] {("name=" + this.getClassName()),
								  "descriptorType=mbean",
								  ("displayName=" + this.getClassName()),
								  "persistPolicy=never",
								  "log=F",
								  "visibility=1"});
		return dftDesc;
	
public javax.management.modelmbean.ModelMBeanAttributeInfogetAttribute(java.lang.String inName)

		ModelMBeanAttributeInfo retInfo = null;
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getAttributeInfo(String)","Entry");
		}
		if (inName == null)
		{ 		
		    throw new RuntimeOperationsException(new IllegalArgumentException("Attribute Name is null"),
							 ("Exception occurred trying to get the ModelMBeanAttributeInfo of the MBean"));
		}
		MBeanAttributeInfo[] attrList = modelMBeanAttributes;
		int numAttrs = 0;
		if (attrList != null) numAttrs = attrList.length;

		for (int i=0; (i < numAttrs) && (retInfo == null); i++)
		{
			if (tracing())
			{
				trace("ModelMBeanInfoSupport.getAttribute","this.getAttributes() MBeanAttributeInfo Array " + i + ":" + ((ModelMBeanAttributeInfo)attrList[i]).getDescriptor().toString());
				trace("ModelMBeanInfoSupport.getAttribute","this.modelMBeanAttributes MBeanAttributeInfo Array " + i + ":" + ((ModelMBeanAttributeInfo)modelMBeanAttributes[i]).getDescriptor().toString());
			}
			if (inName.equals(attrList[i].getName()))
			{
				retInfo = ((ModelMBeanAttributeInfo)attrList[i].clone());
			}
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getAttribute()","Exit");
		}

		return retInfo;
	
public javax.management.modelmbean.ModelMBeanConstructorInfogetConstructor(java.lang.String inName)
Returns the ModelMBeanConstructorInfo requested by name. If no ModelMBeanConstructorInfo exists for this name null is returned.

param
inName the name of the constructor.
return
the constructor info for the named constructor, or null if there is none.
exception
MBeanException Wraps a distributed communication Exception.
exception
RuntimeOperationsException Wraps an IllegalArgumentException for a null constructor name.

		ModelMBeanConstructorInfo retInfo = null;
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getConstructor(String)","Entry");
		}
		if (inName == null)
		{ 
		    throw new RuntimeOperationsException(new IllegalArgumentException("Constructor name is null"),
							 ("Exception occurred trying to get the ModelMBeanConstructorInfo of the MBean"));
		}
		MBeanConstructorInfo[] consList = modelMBeanConstructors; //this.getConstructors();
		int numCons = 0;
		if (consList != null) numCons = consList.length;

		for (int i=0; (i < numCons) && (retInfo == null); i++)
		{
			if (inName.equals(consList[i].getName()))
			{
				retInfo = ((ModelMBeanConstructorInfo) consList[i].clone());
			}
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getConstructor(String)","Exit");
		}

		return retInfo;
	
public javax.management.DescriptorgetDescriptor(java.lang.String inDescriptorName)
Returns a Descriptor requested by name.

param
inDescriptorName The name of the descriptor.
return
Descriptor containing a descriptor for the ModelMBean with the same name. If no descriptor is found, null is returned.
exception
MBeanException Wraps a distributed communication Exception.
exception
RuntimeOperationsException Wraps an IllegalArgumentException for null name.
see
#setDescriptor

		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getDescriptor(String)","Entry");
		}
		return(getDescriptor(inDescriptorName, null));
	
public javax.management.DescriptorgetDescriptor(java.lang.String inDescriptorName, java.lang.String inDescriptorType)

	    if (inDescriptorName==null) {
		    // throw RuntimeOperationsException - invalid descriptor
		    throw new RuntimeOperationsException(new IllegalArgumentException("Descriptor is invalid"),
							 ("Exception occurred trying to set the descriptors of the MBeanInfo"));
	    }

	    if (MMB.equalsIgnoreCase(inDescriptorType)) {
		return (Descriptor) modelMBeanDescriptor.clone();
	    }

	    /* The logic here is a bit convoluted, because we are
	       dealing with two possible cases, depending on whether
	       inDescriptorType is null.  If it's not null, then only
	       one of the following ifs will run, and it will either
	       return a descriptor or null.  If inDescriptorType is
	       null, then all of the following ifs will run until one
	       of them finds a descriptor.  */
	    if (ATTR.equalsIgnoreCase(inDescriptorType) || inDescriptorType == null) {
		ModelMBeanAttributeInfo attr = getAttribute(inDescriptorName);
		if (attr != null)
		    return attr.getDescriptor();
		if (inDescriptorType != null)
		    return null;
	    }
	    if (OPER.equalsIgnoreCase(inDescriptorType) || inDescriptorType == null) {
		ModelMBeanOperationInfo oper = getOperation(inDescriptorName);
		if (oper != null)
		    return oper.getDescriptor();
		if (inDescriptorType != null)
		    return null;
	    }
	    if (CONS.equalsIgnoreCase(inDescriptorType) || inDescriptorType == null) {
		ModelMBeanConstructorInfo oper =
		    getConstructor(inDescriptorName);
		if (oper != null)
		    return oper.getDescriptor();
		if (inDescriptorType != null)
		    return null;
	    }
	    if (NOTF.equalsIgnoreCase(inDescriptorType) || inDescriptorType == null) {
		ModelMBeanNotificationInfo notif =
		    getNotification(inDescriptorName);
		if (notif != null)
		    return notif.getDescriptor();
		if (inDescriptorType != null)
		    return null;
	    }
	    if (inDescriptorType == null)
		return null;
	    throw new RuntimeOperationsException(new IllegalArgumentException("Descriptor Type is invalid"),
						 "Exception occurred trying to find the descriptors of the MBean");

	
public javax.management.Descriptor[]getDescriptors(java.lang.String inDescriptorType)

		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getDescriptors()","Entry");
		}

		if ((inDescriptorType == null) || (inDescriptorType == ""))
		{
			inDescriptorType = "all";
		}
		// if no descriptors of that type, will return empty array
		Descriptor[] retList;  

		if (inDescriptorType.equalsIgnoreCase(MMB))
		{
			retList = new Descriptor[] {modelMBeanDescriptor};
		} else if (inDescriptorType.equalsIgnoreCase(ATTR))
		{
			MBeanAttributeInfo[] attrList = modelMBeanAttributes;
			int numAttrs = 0;
			if (attrList != null) numAttrs = attrList.length;

			retList = new Descriptor[numAttrs];
			for (int i=0; i < numAttrs; i++)
			{
				retList[i] = (((ModelMBeanAttributeInfo) attrList[i]).getDescriptor());
			}
		} else if (inDescriptorType.equalsIgnoreCase(OPER))
		{
			MBeanOperationInfo[] operList = modelMBeanOperations; 
			int numOpers = 0;
			if (operList != null) numOpers = operList.length;

			retList = new Descriptor[numOpers];
			for (int i=0; i < numOpers; i++)
			{
				retList[i] = (((ModelMBeanOperationInfo) operList[i]).getDescriptor());
			}
		} else if (inDescriptorType.equalsIgnoreCase(CONS))
		{
			MBeanConstructorInfo[] consList =  modelMBeanConstructors;	
			int numCons = 0;
			if (consList != null) numCons = consList.length;

			retList = new Descriptor[numCons];
			for (int i=0; i < numCons; i++)
			{
				retList[i] = (((ModelMBeanConstructorInfo) consList[i]).getDescriptor());
			}
		} else if (inDescriptorType.equalsIgnoreCase(NOTF))
		{
			MBeanNotificationInfo[] notifList = modelMBeanNotifications; 
			int numNotifs = 0;
			if (notifList != null) numNotifs = notifList.length;

			retList = new Descriptor[numNotifs];
			for (int i=0; i < numNotifs; i++)
			{
				retList[i] = (((ModelMBeanNotificationInfo) notifList[i]).getDescriptor());
			}
		} else if (inDescriptorType.equalsIgnoreCase(ALL))
		{

			MBeanAttributeInfo[] attrList = modelMBeanAttributes; 
			int numAttrs = 0;
			if (attrList != null) numAttrs = attrList.length;

			MBeanOperationInfo[] operList = modelMBeanOperations; 
			int numOpers = 0;
			if (operList != null) numOpers = operList.length;

			MBeanConstructorInfo[] consList = modelMBeanConstructors; 
			int numCons = 0;
			if (consList != null) numCons = consList.length;

			MBeanNotificationInfo[] notifList = modelMBeanNotifications; 
			int numNotifs = 0;
			if (notifList != null) numNotifs = notifList.length;


			retList = new Descriptor[numAttrs + numCons + numOpers + numNotifs];
			int j=0;
			for (int i=0; i < numAttrs; i++)
			{
				retList[j] = (((ModelMBeanAttributeInfo) attrList[i]).getDescriptor());
				j++;
			}
			for (int i=0; i < numCons; i++)
			{
				retList[j] = (((ModelMBeanConstructorInfo)consList[i]).getDescriptor());
				j++;
			}
			for (int i=0; i < numOpers; i++)
			{
				retList[j] = (((ModelMBeanOperationInfo)operList[i]).getDescriptor());
				j++;
			}
			for (int i=0; i < numNotifs; i++)
			{
				retList[j] = (((ModelMBeanNotificationInfo)notifList[i]).getDescriptor());
				j++;
			}
		} else
		{
			throw new RuntimeOperationsException(new IllegalArgumentException("Descriptor Type is invalid"),
												 ("Exception occurred trying to find the descriptors of the MBean"));
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getDescriptors()","Exit");
		}

		return retList;
	
public javax.management.DescriptorgetMBeanDescriptor()

		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getMBeanDescriptor()","Executed");
		}
		if (modelMBeanDescriptor == null)
		{
			return null;
		}
		if (tracing()) trace("ModelMBeanInfoSupport.getMBeanDesriptor()", "Returning " + modelMBeanDescriptor.toString());
		return((Descriptor) modelMBeanDescriptor.clone());
	
public javax.management.modelmbean.ModelMBeanNotificationInfogetNotification(java.lang.String inName)

		ModelMBeanNotificationInfo retInfo = null;
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getNotification(String)","Entry");
		}
		if (inName == null)
		{ 
		    throw new RuntimeOperationsException(new IllegalArgumentException("Notification name is null"),
							 ("Exception occurred trying to get the ModelMBeanNotificationInfo of the MBean"));
		}
		MBeanNotificationInfo[] notifList = modelMBeanNotifications; //this.getNotifications();
		int numNotifs = 0;
		if (notifList != null) numNotifs = notifList.length;

		for (int i=0; (i < numNotifs) && (retInfo == null); i++)
		{
			if (inName.equals(notifList[i].getName()))
			{
				retInfo = ((ModelMBeanNotificationInfo) notifList[i].clone());
			}
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getNotification(String)","Exit");
		}

		return retInfo;
	
public javax.management.modelmbean.ModelMBeanOperationInfogetOperation(java.lang.String inName)

		ModelMBeanOperationInfo retInfo = null;
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getOperation(String)","Entry");
		}
		if (inName == null)
		{ 
		    throw new RuntimeOperationsException(new IllegalArgumentException("inName is null"),
							 ("Exception occurred trying to get the ModelMBeanOperationInfo of the MBean"));
		}
		MBeanOperationInfo[] operList = modelMBeanOperations; //this.getOperations();
		int numOpers = 0;
		if (operList != null) numOpers = operList.length;

		for (int i=0; (i < numOpers) && (retInfo == null); i++)
		{
			if (inName.equals(operList[i].getName()))
			{
				retInfo = ((ModelMBeanOperationInfo) operList[i].clone());
			}
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.getOperation(String)","Exit");
		}

		return retInfo;
	
private booleanisValidDescriptor(javax.management.Descriptor inDesc)

	String badField = null;
	// if name != mbi.getClassName
	// if (descriptorType != mbean)
	// look for displayName, persistPolicy, logging, visibility and add in
	if (tracing())
	    trace("isValidDescriptor",
		  "Validating descriptor: " + inDesc.toString());
	if (inDesc == null)
	    badField = "nullDescriptor";
	else if (!inDesc.isValid())
	    // checks for empty descriptors, null,
	    // checks for empty name and descriptorType and
	    // valid values for fields.
	    badField="InvalidDescriptor";           
	else if ((((String)inDesc.getFieldValue("name")) == null))
	    badField="name";
	else if (! ((String)inDesc.getFieldValue("descriptorType"))
		 .equalsIgnoreCase(MMB))
	    badField="descriptorType";
	else { // no bad fields
	    if (tracing())
		trace("isValidDescriptor", "returning true");
	    return true;
	}

	if (tracing())
	    trace("isValidDescriptor",
		  "returning false: invalid field is " + badField);

	return false;
    
private voidreadObject(java.io.ObjectInputStream in)
Deserializes a {@link ModelMBeanInfoSupport} from an {@link ObjectInputStream}.

      if (compat)
      {
        // Read an object serialized in the old serial form
        //
        ObjectInputStream.GetField fields = in.readFields();
	modelMBeanDescriptor = (Descriptor) fields.get("modelMBeanDescriptor", null);
	if (fields.defaulted("modelMBeanDescriptor"))
        {
          throw new NullPointerException("modelMBeanDescriptor");
        }
	modelMBeanAttributes = (MBeanAttributeInfo[]) fields.get("mmbAttributes", null);
	if (fields.defaulted("mmbAttributes"))
        {
          throw new NullPointerException("mmbAttributes");
        }
	modelMBeanConstructors = (MBeanConstructorInfo[]) fields.get("mmbConstructors", null);
	if (fields.defaulted("mmbConstructors"))
        {
          throw new NullPointerException("mmbConstructors");
        }
	modelMBeanNotifications = (MBeanNotificationInfo[]) fields.get("mmbNotifications", null);
	if (fields.defaulted("mmbNotifications"))
        {
          throw new NullPointerException("mmbNotifications");
        }
	modelMBeanOperations = (MBeanOperationInfo[]) fields.get("mmbOperations", null);
	if (fields.defaulted("mmbOperations"))
        {
          throw new NullPointerException("mmbOperations");
        }
      }
      else
      {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
      }
    
public voidsetDescriptor(javax.management.Descriptor inDescriptor, java.lang.String inDescriptorType)

	final String excMsg =
	    "Exception occurred trying to set the descriptors of the MBean";

	if (tracing()) {
	    trace("ModelMBeanInfoSupport.setDescriptor(Descriptor,String)",
		  "Entry");
	}

	if (inDescriptor==null) {
	    RuntimeException iae =
		new IllegalArgumentException("Null Descriptor");
	    throw new RuntimeOperationsException(iae, excMsg);
	}

	if ((inDescriptorType == null) || (inDescriptorType == "")) {
	    inDescriptorType =
		(String) inDescriptor.getFieldValue("descriptorType");

	    if (inDescriptorType == null) {
		RuntimeException iae =
		    new IllegalArgumentException("Descriptor type is invalid");
		throw new RuntimeOperationsException(iae, excMsg);
	    }
	}

	String inDescriptorName =
	    (String) inDescriptor.getFieldValue("name");
	if (inDescriptorName == null) {
		RuntimeException iae =
		    new IllegalArgumentException("Descriptor name is invalid");
		throw new RuntimeOperationsException(iae, excMsg);
	}
	boolean found = false;
	if (inDescriptorType.equalsIgnoreCase(MMB)) {
	    setMBeanDescriptor(inDescriptor);
	    found = true;
	} else if (inDescriptorType.equalsIgnoreCase(ATTR)) {
	    MBeanAttributeInfo[] attrList =  modelMBeanAttributes;
	    int numAttrs = 0;
	    if (attrList != null) numAttrs = attrList.length;

	    for (int i=0; i < numAttrs; i++) {
		if (inDescriptorName.equals(attrList[i].getName())) {
		    found = true;
		    ModelMBeanAttributeInfo mmbai =
			(ModelMBeanAttributeInfo) attrList[i];
		    mmbai.setDescriptor(inDescriptor);
		    if (tracing()) {
			trace("ModelMBeanInfoSupport.setDescriptor",
			      "setting descriptor to " + inDescriptor);
			trace("ModelMBeanInfoSupport.setDescriptor",
			      "local: AttributeInfo descriptor is " +
			      mmbai.getDescriptor());
			trace("ModelMBeanInfoSupport.setDescriptor",
			      "modelMBeanInfo: AttributeInfo descriptor is " +
			      this.getDescriptor(inDescriptorName,
						 "attribute"));
		    }
		}
	    }
	} else if (inDescriptorType.equalsIgnoreCase(OPER)) {
	    MBeanOperationInfo[] operList =  modelMBeanOperations;	
	    int numOpers = 0;
	    if (operList != null) numOpers = operList.length;

	    for (int i=0; i < numOpers; i++) {
		if (inDescriptorName.equals(operList[i].getName())) {
		    found = true;
		    ModelMBeanOperationInfo mmboi =
			(ModelMBeanOperationInfo) operList[i];
		    mmboi.setDescriptor(inDescriptor);
		}
	    }
	} else if (inDescriptorType.equalsIgnoreCase(CONS)) {
	    MBeanConstructorInfo[] consList =  modelMBeanConstructors;	
	    int numCons = 0;
	    if (consList != null) numCons = consList.length;

	    for (int i=0; i < numCons; i++) {
		if (inDescriptorName.equals(consList[i].getName())) {
		    found = true;
		    ModelMBeanConstructorInfo mmbci =
			(ModelMBeanConstructorInfo) consList[i];
		    mmbci.setDescriptor(inDescriptor);
		}
	    }
	} else if (inDescriptorType.equalsIgnoreCase(NOTF)) {
	    MBeanNotificationInfo[] notifList =  modelMBeanNotifications;
	    int numNotifs = 0;
	    if (notifList != null) numNotifs = notifList.length;

	    for (int i=0; i < numNotifs; i++) {
		if (inDescriptorName.equals(notifList[i].getName())) {
		    found = true;
		    ModelMBeanNotificationInfo mmbni =
			(ModelMBeanNotificationInfo) notifList[i];
		    mmbni.setDescriptor(inDescriptor);
		}
	    }
	} else {
	    RuntimeException iae =
		new IllegalArgumentException("Invalid descriptor type: " +
					     inDescriptorType);
	    throw new RuntimeOperationsException(iae, excMsg);
	}

	if (!found) {
	    RuntimeException iae =
		new IllegalArgumentException("Descriptor name is invalid: " +
					     "type=" + inDescriptorType +
					     "; name=" + inDescriptorName);
	    throw new RuntimeOperationsException(iae, excMsg);
	}
	if (tracing()) {
	    trace("ModelMBeanInfoSupport.setDescriptor(Descriptor,String)",
		  "Exit");
	}

    
public voidsetDescriptors(javax.management.Descriptor[] inDescriptors)

		if (tracing())
		{
			trace("ModelMBeanInfoSupport.setDescriptors(Descriptor[])","Entry");
		}
		if (inDescriptors==null)
		{ // throw RuntimeOperationsException - invalid descriptor
			throw new RuntimeOperationsException(new IllegalArgumentException("Descriptor list is invalid"),
												 ("Exception occurred trying to set the descriptors of the MBeanInfo"));
		}
		if (inDescriptors.length == 0)
		{ // empty list, no-op
			return;
		}
		for (int j=0; j < inDescriptors.length; j++)
		{
			setDescriptor(inDescriptors[j],null);
		}
		if (tracing())
		{
			trace("ModelMBeanInfoSupport.setDescriptors(Descriptor[])","Exit");
		}

	
public voidsetMBeanDescriptor(javax.management.Descriptor inMBeanDescriptor)

		if (tracing())
		{
			trace("ModelMBeanInfoSupport.setMBeanDescriptor(Descriptor)","Executed");
		}

		if (inMBeanDescriptor == null)
		{
			if (tracing()) trace("ModelMBeanInfoSupport.setMBeanDescriptor(Descriptor)","MBean Descriptor is not valid");
			modelMBeanDescriptor = createDefaultDescriptor();                              
		} else
		{
		    if (isValidDescriptor(inMBeanDescriptor)) {
			modelMBeanDescriptor = (Descriptor) inMBeanDescriptor.clone();
			addDefaultFields();
		    } else {
			throw new RuntimeOperationsException(new IllegalArgumentException("Invalid descriptor passed in parameter"));
		    }

		}
	
private voidtrace(java.lang.String inClass, java.lang.String inMethod, java.lang.String inText)

	Trace.send(Trace.LEVEL_TRACE, Trace.INFO_MODELMBEAN, inClass, 
		   inMethod, inText); 
    
private voidtrace(java.lang.String inMethod, java.lang.String inText)

	trace(currClass, inMethod, inText);
    
private booleantracing()

	return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_MODELMBEAN);
    
private voidwriteObject(java.io.ObjectOutputStream out)
Serializes a {@link ModelMBeanInfoSupport} to an {@link ObjectOutputStream}.

      if (compat)
      {
        // Serializes this instance in the old serial form
        //
        ObjectOutputStream.PutField fields = out.putFields();
	fields.put("modelMBeanDescriptor", modelMBeanDescriptor);
	fields.put("mmbAttributes", modelMBeanAttributes);
	fields.put("mmbConstructors", modelMBeanConstructors);
	fields.put("mmbNotifications", modelMBeanNotifications);
	fields.put("mmbOperations", modelMBeanOperations);
	fields.put("currClass", currClass);
	out.writeFields();
      }
      else
      {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
      }