home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Group.java < prev    next >
Text File  |  1997-05-20  |  3KB  |  85 lines

  1. /*
  2.  * @(#)Group.java    1.10 97/01/31
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.security.acl;
  24.  
  25. import java.util.Enumeration;
  26. import java.security.Principal;
  27.  
  28. /**
  29.  * This interface is used to represent a group of principals. (A principal
  30.  * represents an entity such as an individual user or a company). <p>     
  31.  *
  32.  * Note that Group extends Principal. Thus, either a Principal or a Group can 
  33.  * be passed as an argument to methods containing a Principal parameter. For 
  34.  * example, you can add either a Principal or a Group to a Group object by 
  35.  * calling the object's <code>addMember</code> method, passing it the 
  36.  * Principal or Group.
  37.  *
  38.  * @author     Satish Dharmaraj
  39.  */
  40. public interface Group extends Principal {
  41.  
  42.     /**
  43.      * Adds the specified member to the group. 
  44.      *  
  45.      * @param user the principal to add to this group.
  46.      * 
  47.      * @return true if the member was successfully added, 
  48.      * false if the principal was already a member.
  49.      */
  50.     public boolean addMember(Principal user);
  51.  
  52.     /**
  53.      * Removes the specified member from the group.
  54.      * 
  55.      * @param user the principal to remove from this group.
  56.      * 
  57.      * @return true if the principal was removed, or 
  58.      * false if the principal was not a member.
  59.      */
  60.     public boolean removeMember(Principal user);
  61.  
  62.     /**
  63.      * Returns true if the passed principal is a member of the group. 
  64.      * This method does a recursive search, so if a principal belongs to a 
  65.      * group which is a member of this group, true is returned.
  66.      * 
  67.      * @param member the principal whose membership is to be checked.
  68.      * 
  69.      * @return true if the principal is a member of this group, 
  70.      * false otherwise.
  71.      */
  72.     public boolean isMember(Principal member);
  73.  
  74.  
  75.     /**
  76.      * Returns an enumeration of the members in the group.
  77.      * The returned objects can be instances of either Principal 
  78.      * or Group (which is a subclass of Principal).
  79.      * 
  80.      * @return an enumeration of the group members.
  81.      */
  82.     public Enumeration members();
  83.  
  84. }
  85.