User: ejort   
  Date: 02/02/08 13:17:54

  Modified:    src/main/javax/management/relation
                        MBeanServerNotificationFilter.java
                        RelationNotification.java RelationSupport.java
                        RelationSupportMBean.java RelationTypeSupport.java
                        Role.java RoleInfo.java RoleList.java
                        RoleUnresolved.java RoleUnresolvedList.java
  Log:
  Working version of relation classes - still RelationSupport and RelationService to 
test
  
  Revision  Changes    Path
  1.3       +18 -15    
jmx/src/main/javax/management/relation/MBeanServerNotificationFilter.java
  
  Index: MBeanServerNotificationFilter.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/MBeanServerNotificationFilter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MBeanServerNotificationFilter.java        26 Jan 2002 15:13:24 -0000      1.2
  +++ MBeanServerNotificationFilter.java        8 Feb 2002 21:17:54 -0000       1.3
  @@ -18,7 +18,7 @@
    * unregistration of selected object names.
    * 
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *
    */
   public class MBeanServerNotificationFilter
  @@ -31,27 +31,26 @@
     /**
      * Enabled Object Names.
      */
  -  private Vector enabled;
  +  private Vector enabled = new Vector();
   
     /**
      * Disable Object Names.
      */
  -  private Vector disabled;
  +  private Vector disabled = null;
   
     // Static ------------------------------------------------------
   
     // Constructors ------------------------------------------------
   
     /**
  -   * Create a filter selecting all MBeanServerNotifications for all 
  -   * object names.
  +   * Create a filter selecting nothing by default<p>
      *
  +   * WARNING!! WARNING!! The spec says the MBeanServerNotificationFilter
  +   * accepts everything by default. The RI does exactly the opposite.
  +   * I follow the RI.
      */
     public MBeanServerNotificationFilter()
     {
  -    enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
  -    enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
  -    enableAllObjectNames();
     }
   
     // Public ------------------------------------------------------
  @@ -117,7 +116,9 @@
      */
     public synchronized Vector getDisabledObjectNames()
     {
  -    return (Vector) disabled.clone();
  +    if (disabled == null)
  +      return null;
  +    return new Vector(disabled);
     }
   
     /**
  @@ -131,7 +132,9 @@
      */
     public synchronized Vector getEnabledObjectNames()
     {
  -    return (Vector) enabled.clone();
  +    if (enabled == null)
  +      return null;
  +    return new Vector(enabled);
     }
   
     // NotificationFilterSupport overrides -------------------------
  @@ -161,12 +164,12 @@
       if (enabled != null)
         return enabled.contains(objectName);
   
  -    // Is it disabled?
  -    if (disabled != null)
  -      return disabled.contains(objectName);
  +    // Is it not disabled?
  +    if (disabled.contains(objectName) == false)
  +      return true;
   
  -    // Both lists shouldn't be null
  -    throw new RuntimeException("MBeanServerNotificationFilter broken - sorry");
  +    // Disabled
  +    return false;
     }
   
     // Private -----------------------------------------------------
  
  
  
  1.3       +21 -9     jmx/src/main/javax/management/relation/RelationNotification.java
  
  Index: RelationNotification.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/RelationNotification.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RelationNotification.java 26 Jan 2002 15:13:24 -0000      1.2
  +++ RelationNotification.java 8 Feb 2002 21:17:54 -0000       1.3
  @@ -18,7 +18,7 @@
    * A notification from the relation service.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RelationNotification
     extends Notification
  @@ -133,7 +133,7 @@
      *        removal. Only relevant for removals, can be null.
      * @exception IllegalArgumentException for null or invalid parameters.
      */
  -  RelationNotification(String type, Object source, long sequenceNumber, 
  +  public RelationNotification(String type, Object source, long sequenceNumber, 
                  long timeStamp, String message, String relTypeId, 
                  String relTypeName, ObjectName relObjName, List unregMBeans)
       throws IllegalArgumentException
  @@ -168,7 +168,7 @@
      * @param newRoleValue the old value of the role
      * @exception IllegalArgumentException for null or invalid parameters.
      */
  -  RelationNotification(String type, Object source, long sequenceNumber, 
  +  public RelationNotification(String type, Object source, long sequenceNumber, 
                  long timeStamp, String message, String relTypeId, 
                  String relTypeName, ObjectName relObjName, String roleName, 
                  List newRoleValue, List oldRoleValue)
  @@ -239,7 +239,7 @@
      */
     public String getRelationId()
     {
  -    return new String(relTypeId);
  +    return relTypeId;
     }
   
     /**
  @@ -249,7 +249,7 @@
      */
     public String getRelationTypeName()
     {
  -    return new String(relTypeName);
  +    return relTypeName;
     }
   
     /**
  @@ -259,7 +259,7 @@
      */
     public String getRoleName()
     {
  -    return new String(roleName);
  +    return roleName;
     }
   
     // Notification overrides ----------------------------------------
  @@ -323,13 +323,25 @@
       if (relTypeName == null)
         throw new IllegalArgumentException("null relation type name");
   
  -    this.relTypeId = new String(relTypeId);
  -    this.relTypeName = new String(relTypeName);
  +    // Role Info
  +    if (which == UPDATE && roleName == null)
  +      throw new IllegalArgumentException("null role name");
  +
  +    // New role value
  +    if (which == UPDATE && newRoleValue == null)
  +      throw new IllegalArgumentException("null new role value");
  +
  +    // Old role value
  +    if (which == UPDATE && oldRoleValue == null)
  +      throw new IllegalArgumentException("null old role value");
  +
  +    this.relTypeId = relTypeId;
  +    this.relTypeName = relTypeName;
       this.relObjName = relObjName;
       if (unregMBeans != null)
         this.unregMBeans = new ArrayList(unregMBeans);
       if (roleName != null)
  -      this.roleName = new String(roleName);
  +      this.roleName = roleName;
       if (newRoleValue != null)
         this.newRoleValue = new ArrayList(newRoleValue);
       if (oldRoleValue != null)
  
  
  
  1.3       +8 -7      jmx/src/main/javax/management/relation/RelationSupport.java
  
  Index: RelationSupport.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/RelationSupport.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RelationSupport.java      26 Jan 2002 15:13:24 -0000      1.2
  +++ RelationSupport.java      8 Feb 2002 21:17:54 -0000       1.3
  @@ -29,7 +29,7 @@
    * extending it, and then registered with the relation service.<p>
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RelationSupport
     implements RelationSupportMBean, MBeanRegistration
  @@ -197,7 +197,7 @@
   
     public String getRelationId()
     {
  -    return new String(relationId);
  +    return relationId;
     }
   
     public ObjectName getRelationServiceName()
  @@ -207,7 +207,7 @@
   
     public String getRelationTypeName()
     {
  -    return new String(relationTypeName);
  +    return relationTypeName;
     }
   
     public List getRole(String roleName)
  @@ -317,9 +317,9 @@
   
     // RelationSupport implementation --------------------------------
   
  -  public boolean isInRelationService()
  +  public Boolean isInRelationService()
     {
  -    return registered.booleanValue();
  +    return registered;
     }
   
     public void setRelationServiceManagementFlag(Boolean value)
  @@ -382,7 +382,8 @@
         throw new IllegalArgumentException("null relation type name");
   
       // Easy parameters
  -    this.relationId = new String(relationId);
  +    this.relationId = relationId;
  +    this.relationTypeName = relationTypeName;
       this.relationService = relationService;
       if (mbeanServer != null)
         server = mbeanServer;
  @@ -414,7 +415,7 @@
     private void checkRegistered()
        throws RelationNotFoundException
     {
  -    if (isInRelationService() == false)
  +    if (isInRelationService().booleanValue() == false)
         throw new RelationNotFoundException("not registered with relation service");
       // What is the purpose of this flag? Why not invoke hasRelation?
     }
  
  
  
  1.2       +1 -1      jmx/src/main/javax/management/relation/RelationSupportMBean.java
  
  Index: RelationSupportMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/RelationSupportMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RelationSupportMBean.java 20 Jan 2002 14:36:20 -0000      1.1
  +++ RelationSupportMBean.java 8 Feb 2002 21:17:54 -0000       1.2
  @@ -15,7 +15,7 @@
    * extending it, and then registered with the relation service.<p>
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface RelationSupportMBean
     extends Relation
  @@ -33,7 +33,7 @@
       *
       * @return true when it is registered.
       */
  -   public boolean isInRelationService();
  +   public Boolean isInRelationService();
   
      /**
       * Set the flag to specify whether this relation is registered with
  
  
  
  1.3       +7 -3      jmx/src/main/javax/management/relation/RelationTypeSupport.java
  
  Index: RelationTypeSupport.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/RelationTypeSupport.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RelationTypeSupport.java  26 Jan 2002 15:13:24 -0000      1.2
  +++ RelationTypeSupport.java  8 Feb 2002 21:17:54 -0000       1.3
  @@ -17,7 +17,7 @@
    * It holds RoleInfo objects for all roles in the relation.
    * 
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *
    */
   public class RelationTypeSupport
  @@ -71,8 +71,10 @@
     {
       if (name == null)
         throw new IllegalArgumentException("Null name");
  -    if (infos == null || infos.length == 0)
  +    if (infos == null)
         throw new IllegalArgumentException("No role information");
  +    if (infos.length == 0)
  +      throw new InvalidRelationTypeException("No role information");
       this.name = name;
       // Check and store the role information
       HashSet roleNames = new HashSet();
  @@ -125,7 +127,7 @@
       return result;
     }
   
  -  // Private -----------------------------------------------------
  +  // Protected ---------------------------------------------------
   
     /**
      * Add a role information object to the relation type.
  @@ -155,4 +157,6 @@
         roleInfos.add(roleInfo);
       }
     }
  +
  +  // Private -----------------------------------------------------
   }
  
  
  
  1.3       +49 -31    jmx/src/main/javax/management/relation/Role.java
  
  Index: Role.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/relation/Role.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Role.java 26 Jan 2002 15:13:24 -0000      1.2
  +++ Role.java 8 Feb 2002 21:17:54 -0000       1.3
  @@ -13,11 +13,11 @@
   import java.util.List;
   
   /**
  - * A role is a role name and a an ordered list of object names to
  + * A role is a role name and an ordered list of object names to
    * the MBeans in the role.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class Role
     implements Serializable
  @@ -36,6 +36,32 @@
   
      // Static --------------------------------------------------------
   
  +   /**
  +    * Formats the role value for output.<p>
  +    *
  +    * The spec says it should be a comma separated list of object names.
  +    * But the RI uses new lines which makes more sense for object names.
  +    *
  +    * @param roleValue the role value to print
  +    * @return the string representation
  +    * @exception IllegalArgumentException for null value.
  +    */
  +   public static String roleValueToString(List roleValue)
  +     throws IllegalArgumentException
  +   {
  +     if (roleValue == null)
  +       throw new IllegalArgumentException("null roleValue");
  +     StringBuffer buffer = new StringBuffer();
  +     Iterator iterator = roleValue.iterator(); 
  +     while (iterator.hasNext())
  +     {
  +       buffer.append(iterator.next());
  +       if (iterator.hasNext())
  +         buffer.append("\n");
  +     }
  +     return buffer.toString();
  +   }
  +
      // Constructors --------------------------------------------------
   
      /**
  @@ -53,12 +79,8 @@
      public Role(String roleName, List roleValue)
        throws IllegalArgumentException
      {
  -     if (roleName == null)
  -       throw new IllegalArgumentException("Null roleName");
  -     if (roleValue == null)
  -       throw new IllegalArgumentException("Null roleValue");
  -     name = roleName;
  -     value = (ArrayList) roleValue; 
  +     setRoleName(roleName);
  +     setRoleValue(roleValue); 
      }
   
      // Public ---------------------------------------------------------
  @@ -80,16 +102,20 @@
       */
      public List getRoleValue()
      {
  -     return value;
  +     return new ArrayList(value);
      }
   
      /**
       * Set the role name.
       * 
       * @param roleName the role name.
  +    * @exception IllegalArgumentException for a null value
       */
      public void setRoleName(String roleName)
  +     throws IllegalArgumentException
      {
  +     if (roleName == null)
  +       throw new IllegalArgumentException("Null roleName");
        name = roleName;
      }
   
  @@ -98,53 +124,45 @@
       * A list of mbean object names.
       * 
       * @param roleValue the role value.
  +    * @exception IllegalArgumentException for a null value or not an
  +    *            array list
       */
      public void setRoleValue(List roleValue)
  +     throws IllegalArgumentException
      {
  -     value = (ArrayList) roleValue;
  -   }
  -
  -   /**
  -    * Formats the role value for output.
  -    */
  -   public String roleValueToString()
  -   {
  -     StringBuffer buffer = new StringBuffer("ObjectNames (");
  -     Iterator iterator = new ArrayList(value).iterator(); 
  -     while (iterator.hasNext())
  -     {
  -       buffer.append(iterator.next());
  -       if (iterator.hasNext())
  -         buffer.append(" ");
  -     }
  -     buffer.append(")");
  -     return buffer.toString();
  +     if (roleValue == null)
  +       throw new IllegalArgumentException("Null roleValue");
  +     value = new ArrayList(roleValue);
      }
   
      // Object Overrides -------------------------------------------------
   
      /**
       * Clones the object.
  +    *
  +    * @return a copy of the role
       */
      public Object clone()
      {
  -     return new Role(new String(name), new ArrayList(value));
  +     return new Role(name, value);
      }
   
      /**
       * Formats the role for output.
  +    *
  +    * @return a human readable string
       */
      public String toString()
      {
        StringBuffer buffer = new StringBuffer("Role Name (");
        buffer.append(name);
  -     buffer.append(") ObjectNames (");
  -     Iterator iterator = new ArrayList(value).iterator(); 
  +     buffer.append(") Object Names (");
  +     Iterator iterator = value.iterator(); 
        while (iterator.hasNext())
        {
          buffer.append(iterator.next());
          if (iterator.hasNext())
  -         buffer.append(" ");
  +         buffer.append(" & ");
        }
        buffer.append(")");
        return buffer.toString();
  
  
  
  1.3       +9 -14     jmx/src/main/javax/management/relation/RoleInfo.java
  
  Index: RoleInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/relation/RoleInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleInfo.java     26 Jan 2002 15:13:24 -0000      1.2
  +++ RoleInfo.java     8 Feb 2002 21:17:54 -0000       1.3
  @@ -12,13 +12,15 @@
   import javax.management.DynamicMBean;
   import javax.management.NotCompliantMBeanException;
   
  +import org.jboss.mx.capability.MBeanCapability;
  +
   /**
    * This class contains information about a role. For example the
    * number of mbean class name of the role, how many mbeans
    * are part of the role, whether the role is read/write, etc.<p>
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *
    */
   public class RoleInfo
  @@ -177,7 +179,10 @@
        if (className == null)
          throw new IllegalArgumentException("Null class name");
        if (maxDegree < minDegree && maxDegree != ROLE_CARDINALITY_INFINITY)
  -       throw new InvalidRoleInfoException("maximum greater than minimum");
  +       throw new InvalidRoleInfoException("maximum less than minimum");
  +     if (minDegree == ROLE_CARDINALITY_INFINITY && 
  +         maxDegree != ROLE_CARDINALITY_INFINITY)
  +       throw new InvalidRoleInfoException("maximum less than minimum");
        this.name = name;
        this.className = className;
        this.minDegree = minDegree;
  @@ -323,17 +328,7 @@
      {
        Class clazz = 
Thread.currentThread().getContextClassLoader().loadClass(className);
   
  -     // FIXME! FIXME! This is nearly duplicated from MBeanServerImpl
  -
  -     // Basic compliance test
  -     if (clazz.getModifiers() == Modifier.ABSTRACT)
  -        throw new NotCompliantMBeanException("MBean class must be a concrete 
class.");
  -     if (clazz.getConstructors().length == 0)
  -        throw new NotCompliantMBeanException("MBean class must have at least one 
public constructor.");
  - 
  -     if (DynamicMBean.class.isAssignableFrom(clazz) == false)
  -     {
  -       // TODO Check compliance of Standard MBean
  -     }
  +     // See if this is capable of being an MBean
  +     MBeanCapability.of(clazz);
      }
   }
  
  
  
  1.3       +26 -12    jmx/src/main/javax/management/relation/RoleList.java
  
  Index: RoleList.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/relation/RoleList.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleList.java     26 Jan 2002 15:13:24 -0000      1.2
  +++ RoleList.java     8 Feb 2002 21:17:54 -0000       1.3
  @@ -11,11 +11,13 @@
   import java.util.List;
   
   /**
  - * A list of roles. This is basically an array list with methods
  - * overridden to ensure the only role are accepted in the list.
  + * A list of roles.<p>
  + *
  + * I think the idea is supposed to be that only roles should be in the
  + * list. But this isn't true.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RoleList
     extends ArrayList
  @@ -53,6 +55,7 @@
       *            an list element that is not a role.
       */
      public RoleList(List list)
  +     throws IllegalArgumentException
      {
        super();
        if (list == null)
  @@ -71,7 +74,7 @@
        }
      }
   
  -   // Array List Overrides -------------------------------------------
  +   // Public ---------------------------------------------------------
   
      /**
       * Appends a role to the end of the list.
  @@ -107,14 +110,17 @@
      /**
       * Appends a role list to the end of the list.
       * 
  -    * @param roleList the role list to append (can be null).
  +    * @param roleList the role list to insert, can be null
  +    * @return true if the list changes, false otherwise
       * @exception IndexOutOfBoundsException if there is no such index
  -    *            in the list
  +    *            in the list (this is part of ArrayList for some reason?)
       */
  -   public void addAll(RoleList roleList)
  +   public boolean addAll(RoleList roleList)
        throws IndexOutOfBoundsException
      {
  -     super.addAll(roleList);
  +     if (roleList == null)
  +       return false;
  +     return super.addAll(roleList);
      }
   
      /**
  @@ -122,14 +128,17 @@
       * 
       * @param index the location at which to insert the role list.
       * @param roleList the role list to insert.
  +    * @return true if the list changes, false otherwise
       * @exception IllegalArgumentException if the role list is null
       * @exception IndexOutOfBoundsException if there is no such index
       *            in the list
       */
  -   public void addAll(int index, RoleList roleList)
  +   public boolean addAll(int index, RoleList roleList)
        throws IllegalArgumentException, IndexOutOfBoundsException
      {
  -     super.addAll(index, roleList);
  +     if (roleList == null)
  +       throw new IllegalArgumentException("null roleList");
  +     return super.addAll(index, roleList);
      }
   
      /**
  @@ -149,16 +158,21 @@
        super.set(index, role);
      }
   
  +   // Array List Overrides -------------------------------------------
  +
  +   // NONE! I think there was supposed to be?
  +
      // Object Overrides -----------------------------------------------
   
      /**
  -    * Cloning, returns a empty role list.
  +    * Cloning, creates a new RoleList with the same elements.
  +    * The roles in the list are not cloned.
       * 
       * @return the new empty role list.
       */
      public Object clone()
      {
  -     return new RoleList();
  +     return new RoleList(this);
      }
   }
   
  
  
  
  1.3       +12 -4     jmx/src/main/javax/management/relation/RoleUnresolved.java
  
  Index: RoleUnresolved.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/javax/management/relation/RoleUnresolved.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleUnresolved.java       26 Jan 2002 15:13:24 -0000      1.2
  +++ RoleUnresolved.java       8 Feb 2002 21:17:54 -0000       1.3
  @@ -18,7 +18,7 @@
    * was passed and the problem type.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RoleUnresolved
     implements Serializable
  @@ -45,14 +45,14 @@
      // Constructors --------------------------------------------------
   
      /**
  -    * Construct a new role unreolved role.<p>
  +    * Construct a new unresolved role.<p>
       *
       * See {@link RoleStatus} for the problem types.<p>
       * 
       * The passed list must be an ArrayList.
       *
       * @param roleName the role name
  -    * @param roleValue the MBean object names in the role
  +    * @param roleValue the MBean object names in the role can be null
       * @param problemType the problem type. 
       * @exception IllegalArgumentException for null values or
       *            incorrect problem type.
  @@ -107,18 +107,26 @@
       * Set the problem type.
       * 
       * @param problemType the problem type.
  +    * @exception IllegalArgumentException for an invalid problem type
       */
      public void setProblemType(int problemType)
  +     throws IllegalArgumentException
      {
  +     if (RoleStatus.isRoleStatus(problemType) == false)
  +       throw new IllegalArgumentException("Invalid problem type.");
        problem = problemType;
      }
      /**
       * Set the role name.
       * 
       * @param roleName the role name.
  +    * @exception IllegalArgumentException for a null name
       */
      public void setRoleName(String roleName)
  +     throws IllegalArgumentException
      {
  +     if (roleName == null)
  +       throw new IllegalArgumentException("Null roleName");
        name = roleName;
      }
   
  @@ -140,7 +148,7 @@
       */
      public Object clone()
      {
  -     return new RoleUnresolved(new String(name), new ArrayList(value), problem);
  +     return new RoleUnresolved(name, new ArrayList(value), problem);
      }
   
      /**
  
  
  
  1.3       +24 -11    jmx/src/main/javax/management/relation/RoleUnresolvedList.java
  
  Index: RoleUnresolvedList.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/relation/RoleUnresolvedList.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleUnresolvedList.java   26 Jan 2002 15:13:24 -0000      1.2
  +++ RoleUnresolvedList.java   8 Feb 2002 21:17:54 -0000       1.3
  @@ -11,11 +11,10 @@
   import java.util.List;
   
   /**
  - * A list of unresolved roles. This is basically an array list with methods
  - * overridden to ensure that only roles are accepted in the list.
  + * A list of unresolved roles.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RoleUnresolvedList
     extends ArrayList
  @@ -53,6 +52,7 @@
       *            an list element that is not a role unresolved.
       */
      public RoleUnresolvedList(List list)
  +     throws IllegalArgumentException
      {
        super();
        if (list == null)
  @@ -71,7 +71,7 @@
        }
      }
   
  -   // Array List Overrides -------------------------------------------
  +   // Public ---------------------------------------------------------
   
      /**
       * Appends a unresolved role to the end of the list.
  @@ -108,13 +108,16 @@
       * Appends an unresolved role list to the end of the list.
       * 
       * @param roleUnresolvedList the unresolved role list to append (can be null).
  +    * @return true if the list changes, false otherwise
       * @exception IndexOutOfBoundsException if there is no such index
       *            in the list
       */
  -   public void addAll(RoleUnresolvedList roleUnresolvedList)
  +   public boolean addAll(RoleUnresolvedList roleUnresolvedList)
        throws IndexOutOfBoundsException
      {
  -     super.addAll(roleUnresolvedList);
  +     if (roleUnresolvedList == null)
  +       return false;
  +     return super.addAll(roleUnresolvedList);
      }
   
      /**
  @@ -122,14 +125,17 @@
       * 
       * @param index the location at which to insert the unresolved role list.
       * @param roleUnresolvedList the unresolved role list to insert.
  +    * @return true if the list changes, false otherwise
       * @exception IllegalArgumentException if the unresolved role list is null
       * @exception IndexOutOfBoundsException if there is no such index
       *            in the list
       */
  -   public void addAll(int index, RoleUnresolvedList roleUnresolvedList)
  +   public boolean addAll(int index, RoleUnresolvedList roleUnresolvedList)
        throws IllegalArgumentException, IndexOutOfBoundsException
      {
  -     super.addAll(index, roleUnresolvedList);
  +     if (roleUnresolvedList == null)
  +       throw new IllegalArgumentException("null roleUnresolvedList");
  +     return super.addAll(index, roleUnresolvedList);
      }
   
      /**
  @@ -149,16 +155,23 @@
        super.set(index, roleUnresolved);
      }
   
  +   // Array List Overrides -------------------------------------------
  +
  +   // NONE! I think there was supposed to be?
  +
      // Object Overrides -----------------------------------------------
   
      /**
  -    * Cloning, returns a empty unresolved role list.
  +    * Cloning.
  +    *
  +    * REVIEW: The spec says to return a RoleList, that's not very much
  +    * of a clone is it? It must be a typo in the RI.
       * 
  -    * @return the new empty unresolved role list.
  +    * @return the new unresolved role list with the same unresolved roles.
       */
      public Object clone()
      {
  -     return new RoleUnresolvedList();
  +     return new RoleUnresolvedList(this);
      }
   }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to