Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/security/Permission.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* Permission.java -- The superclass for all permission objects
    2    Copyright (C) 1998, 2001 Free Software Foundation, Inc.
     2   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
    33
    44This file is part of GNU Classpath.
     
    4242/**
    4343 * This class is the abstract superclass of all classes that implement
    44  * the concept of a permission.  A permission consists of a permission name 
     44 * the concept of a permission.  A permission consists of a permission name
    4545 * and optionally a list of actions that relate to the permission.  The
    4646 * actual meaning of the name of the permission is defined only in the
     
    5252 * or you don't.
    5353 *
    54  * The most important method in this class is <code>implies</code>.  This
     54 * The most important method in this class is <code>implies</code>.  This
    5555 * checks whether if one has this permission, then the specified
    5656 * permission is also implied.  As a conceptual example, consider the
     
    5959 * file foo.
    6060 *
    61  * <code>Permission</code>'s are not dynamic objects.  Once created, a
    62  * <code>Permission</code>'s name and action list cannot be changed.
     61 * <
     62 * .
    6363 *
    64  * @version 0.0
    65  *
    66  * @author Aaron M. Renn ([email protected])
     64 * @author Aaron M. Renn <[email protected]>
     65 * @see Permissions
     66 * @see PermissionCollection
     67 * @since 1.1
     68 * @status updated to 1.4
    6769 */
    6870public abstract class Permission implements Guard, Serializable
    6971{
    7072  /**
    71    * This is the name assigned to this permission object.
     73   * .
    7274   */
    73   private String name;          // Taken from the serializable form information
     75  private
    7476
    7577  /**
    76    * This method initializes a new instance of <code>Permission</code> to
    77    * have the specified name.
     78   * This is the name assigned to this permission object.
     79   *
     80   * @serial the name of the permission
     81   */
     82  private String name;
     83
     84  /**
     85   * Create an instance with the specified name.
     86   *
     87   * @param name the permission name
    7888   */
    7989  public Permission(String name)
     
    8393
    8494  /**
    85    * This method returns the name of this <code>Permission</code>
    86    *
    87    * @return The name of this <code>Permission</code>
    88    */
    89   public final String getName()
    90   {
    91     return (name);
    92   }
    93 
    94   /**
    95    * This method returns the list of actions for this <code>Permission</code>
    96    * as a <code>String</code>.
    97    *
    98    * @return The action list for this <code>Permission</code>.
    99    */
    100   public abstract String getActions();
    101 
    102   /**
    10395   * This method implements the <code>Guard</code> interface for this class.
    104    * It calls the <code>checkPermission</code> method in 
     96   * It calls the <code>checkPermission</code> method in
    10597   * <code>SecurityManager</code> with this <code>Permission</code> as its
    10698   * argument.  This method returns silently if the security check succeeds
    10799   * or throws an exception if it fails.
    108100   *
    109    * @param obj The <code>Object</code> being guarded - ignored by this class
    110    *
    111    * @exception SecurityException If the security check fails
     101   * @param obj the <code>Object</code> being guarded - ignored by this class
     102   * @throws SecurityException if the security check fails
     103   * @see GuardedObject
     104   * @see SecurityManager#checkPermission(Permission)
    112105   */
    113   public void checkGuard(Object obj) throws SecurityException
     106  public void checkGuard(Object obj)
    114107  {
    115108    SecurityManager sm = System.getSecurityManager();
     
    119112
    120113  /**
    121    * Check to see if this object equals OBJ.
    122    */
    123   public abstract boolean equals (Object obj);
    124 
    125   /**
    126114   * This method tests whether this <code>Permission</code> implies that the
    127115   * specified <code>Permission</code> is also granted.
    128116   *
    129    * @param perm The <code>Permission</code> to test against
    130    *
    131    * @return <code>true</code> if the specified <code>Permission</code> is implied by this one, <code>false</code> otherwise.
     117   * @param perm the <code>Permission</code> to test against
     118   * @return true if perm is implied by this
    132119   */
    133120  public abstract boolean implies(Permission perm);
    134121
    135122  /**
    136    * This method returns a hash code for this <code>Permission</code>.
     123   * Check to see if this object equals obj. Use <code>implies</code>, rather
     124   * than <code>equals</code>, when making access control decisions.
    137125   *
    138    * @return A hash value.
     126   * @param obj the object to compare to
     127   */
     128  public abstract boolean equals(Object obj);
     129
     130  /**
     131   * This method returns a hash code for this <code>Permission</code>. It
     132   * must satisfy the contract of <code>Object.hashCode</code>: it must be
     133   * the same for all objects that equals considers to be the same.
     134   *
     135   * @return a hash value
    139136   */
    140137  public abstract int hashCode();
    141138
    142139  /**
    143    * This method returns a <code>String</code> representation of this
    144    * <code>Permission</code> object.
     140   * Get the name of this <code>Permission</code>.
    145141   *
    146    * @return This object as a <code>String</code>.
     142   * @return
    147143   */
    148   public String toString()
     144  public ()
    149145  {
    150     return ("'\"" + getClass().getName() + "\" \"" + getName() +
    151             "\"" + " \"" + getActions() + "\")'");
     146    return name;
    152147  }
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
    153159
    154160  /**
    155161   * This method returns an empty <code>PermissionCollection</code> object
    156162   * that can store permissions of this type, or <code>null</code> if no
    157    * such collection is defined.
     163   * such collection is defined. Subclasses must override this to provide
     164   * an appropriate collection when one is needed to accurately calculate
     165   * <code>implies</code>.
    158166   *
    159    * @return A new <code>PermissionCollection</code>
     167   * @return new <code>PermissionCollection</code>
    160168   */
    161169  public PermissionCollection newPermissionCollection()
     
    163171    return null;
    164172  }
    165 }
     173
     174  /**
     175   * This method returns a <code>String</code> representation of this
     176   * <code>Permission</code> object. This is in the format:
     177   * <code>'(' + getClass().getName() + ' ' + getName() + ' ' + getActions
     178   * + ')'</code>.
     179   *
     180   * @return this object as a <code>String</code>
     181   */
     182  public String toString()
     183  {
     184    return '(' + getClass().getName() + ' ' + getName() + ' '
     185      + getActions() + ')';
     186  }
     187} // class Permission
Note: See TracChangeset for help on using the changeset viewer.