FileDocCategorySizeDatePackage
RoleUnresolved.javaAPI DocJava SE 5 API8964Fri Aug 26 14:57:38 BST 2005javax.management.relation

RoleUnresolved

public class RoleUnresolved extends Object implements Serializable
Represents an unresolved role: a role not retrieved from a relation due to a problem. It provides the role name, value (if problem when trying to set the role) and an integer defining the problem (constants defined in RoleStatus).
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 String
roleName
private List
roleValue
private int
problemType
Constructors Summary
public RoleUnresolved(String theRoleName, List theRoleValue, int thePbType)
Constructor.

param
theRoleName name of the role
param
theRoleValue value of the role (if problem when setting the role)
param
thePbType type of problem (according to known problem types, listed as static final members).
exception
IllegalArgumentException if null parameter or incorrect problem type


    //
    // Constructor
    //

                                                        
      
			   
			   
	  

	if (theRoleName == null) {
	    // Revisit [cebro] Localize message
	    String excMsg = "Invalid parameter.";
	    throw new IllegalArgumentException(excMsg);
	}

	setRoleName(theRoleName);
	setRoleValue(theRoleValue);
	// Can throw IllegalArgumentException
	setProblemType(thePbType);
	return;
    
Methods Summary
public java.lang.Objectclone()
Clone this object.

return
an independent clone.

	try {
	    return new RoleUnresolved(roleName, roleValue, problemType);
	} catch (IllegalArgumentException exc) {
	    return null; // :)
	}
    
public intgetProblemType()
Retrieves problem type.

return
an integer corresponding to a problem, those being described as static final members of current class.
see
#setProblemType

	return problemType;
    
public java.lang.StringgetRoleName()
Retrieves role name.

return
the role name.
see
#setRoleName

	return roleName;
    
public java.util.ListgetRoleValue()
Retrieves role value.

return
an ArrayList of ObjectName objects, the one provided to be set in given role. Null if the unresolved role is returned for a read access.
see
#setRoleValue

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

      if (compat)
      {
        // Read an object serialized in the old serial form
        //
        ObjectInputStream.GetField fields = in.readFields();
	roleName = (String) fields.get("myRoleName", null);
	if (fields.defaulted("myRoleName"))
        {
          throw new NullPointerException("myRoleName");
        }
	roleValue = (List) fields.get("myRoleValue", null);
	if (fields.defaulted("myRoleValue"))
        {
          throw new NullPointerException("myRoleValue");
        }
	problemType = fields.get("myPbType", (int)0);
	if (fields.defaulted("myPbType"))
        {
          throw new NullPointerException("myPbType");
        }
      }
      else
      {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
      }
    
public voidsetProblemType(int thePbType)
Sets problem type.

param
thePbType integer corresponding to a problem. Must be one of those described as static final members of current class.
exception
IllegalArgumentException if incorrect problem type
see
#getProblemType


	if (!(RoleStatus.isRoleStatus(thePbType))) {
	    // Revisit [cebro] Localize message
	    String excMsg = "Incorrect problem type.";
	    throw new IllegalArgumentException(excMsg);
	}
	problemType = thePbType;
	return;
    
public voidsetRoleName(java.lang.String theRoleName)
Sets role name.

param
theRoleName the new role name.
exception
IllegalArgumentException if null parameter
see
#getRoleName


	if (theRoleName == null) {
	    // Revisit [cebro] Localize message
	    String excMsg = "Invalid parameter.";
	    throw new IllegalArgumentException(excMsg);
	}

	roleName = theRoleName;
	return;
    
public voidsetRoleValue(java.util.List theRoleValue)
Sets role value.

param
theRoleValue List of ObjectName objects for referenced MBeans not set in role.
see
#getRoleValue


	if (theRoleValue != null) {
	    roleValue = new ArrayList(theRoleValue);
	} else {
	    roleValue = null;
	}
	return;
    
public java.lang.StringtoString()
Return a string describing this object.

return
a description of this RoleUnresolved object.

	StringBuffer result = new StringBuffer();
	result.append("role name: " + roleName);
	if (roleValue != null) {
	    result.append("; value: ");
	    for (Iterator objNameIter = roleValue.iterator();
		 objNameIter.hasNext();) {
		ObjectName currObjName = (ObjectName)(objNameIter.next());
		result.append(currObjName.toString());
		if (objNameIter.hasNext()) {
		    result.append(", ");
		}
	    }
	}
	result.append("; problem type: " + problemType);
	return result.toString();
    
private voidwriteObject(java.io.ObjectOutputStream out)
Serializes a {@link RoleUnresolved} to an {@link ObjectOutputStream}.

      if (compat)
      {
        // Serializes this instance in the old serial form
        //
        ObjectOutputStream.PutField fields = out.putFields();
	fields.put("myRoleName", roleName);
	fields.put("myRoleValue", (ArrayList)roleValue);
	fields.put("myPbType", problemType);
	out.writeFields();
      }
      else
      {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
      }