- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/security/Permission.java (modified) (7 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/security/Permission.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 1 /* 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. 3 3 4 4 This file is part of GNU Classpath. … … 42 42 /** 43 43 * 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 45 45 * and optionally a list of actions that relate to the permission. The 46 46 * actual meaning of the name of the permission is defined only in the … … 52 52 * or you don't. 53 53 * 54 * The most important method in this class is <code>implies</code>. This54 * The most important method in this class is <code>implies</code>. This 55 55 * checks whether if one has this permission, then the specified 56 56 * permission is also implied. As a conceptual example, consider the … … 59 59 * file foo. 60 60 * 61 * < code>Permission</code>'s are not dynamic objects. Once created, a62 * <code>Permission</code>'s name and action list cannot be changed.61 * < 62 * . 63 63 * 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 67 69 */ 68 70 public abstract class Permission implements Guard, Serializable 69 71 { 70 72 /** 71 * This is the name assigned to this permission object.73 * . 72 74 */ 73 private String name; // Taken from the serializable form information75 private 74 76 75 77 /** 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 78 88 */ 79 89 public Permission(String name) … … 83 93 84 94 /** 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 /**103 95 * 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 105 97 * <code>SecurityManager</code> with this <code>Permission</code> as its 106 98 * argument. This method returns silently if the security check succeeds 107 99 * or throws an exception if it fails. 108 100 * 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) 112 105 */ 113 public void checkGuard(Object obj) throws SecurityException106 public void checkGuard(Object obj) 114 107 { 115 108 SecurityManager sm = System.getSecurityManager(); … … 119 112 120 113 /** 121 * Check to see if this object equals OBJ.122 */123 public abstract boolean equals (Object obj);124 125 /**126 114 * This method tests whether this <code>Permission</code> implies that the 127 115 * specified <code>Permission</code> is also granted. 128 116 * 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 132 119 */ 133 120 public abstract boolean implies(Permission perm); 134 121 135 122 /** 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. 137 125 * 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 139 136 */ 140 137 public abstract int hashCode(); 141 138 142 139 /** 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>. 145 141 * 146 * @return This object as a <code>String</code>.142 * @return 147 143 */ 148 public String toString()144 public () 149 145 { 150 return ("'\"" + getClass().getName() + "\" \"" + getName() + 151 "\"" + " \"" + getActions() + "\")'"); 146 return name; 152 147 } 148 149 150 151 152 153 154 155 156 157 158 153 159 154 160 /** 155 161 * This method returns an empty <code>PermissionCollection</code> object 156 162 * 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>. 158 166 * 159 * @return Anew <code>PermissionCollection</code>167 * @return new <code>PermissionCollection</code> 160 168 */ 161 169 public PermissionCollection newPermissionCollection() … … 163 171 return null; 164 172 } 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 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
