* config/m32r/m32r.c (move_src_operand): Fix 32-bit int test.
[official-gcc.git] / libjava / java / security / UnresolvedPermission.java
blob8f9e06a1352c0c8cf80bbf1c558ed6c926a4c412
1 /* UnresolvedPermission.java -- Placeholder for unresolved permissions.
2 Copyright (C) 1998, 2001 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
27 package java.security;
29 import java.io.Serializable;
30 // All uses of Certificate in this file refer to this class.
31 import java.security.cert.Certificate;
33 /**
34 * This class is used to hold instances of all permissions that cannot
35 * be resolved to available permission classes when the security
36 * <code>Policy</code> object is instantiated. This may happen when the
37 * necessary security class has not yet been downloaded from the network.
38 * <p>
39 * Instances of this class are re-resolved when <code>AccessController</code>
40 * check is done. At that time, a scan is made of all existing
41 * <code>UnresolvedPermission</code> objects and they are converted to
42 * objects of the appropriate permission type if the class for that type
43 * is then available.
45 * @version 0.0
47 * @author Aaron M. Renn (arenn@urbanophile.com)
49 public final class UnresolvedPermission
50 extends Permission
51 implements Serializable
54 /**
55 * The list of actions associated with this permission object
57 private String actions;
59 /**
60 * The list of <code>Certificates</code> associated with this object
62 private Certificate[] certs;
64 /**
65 * The name of the class this object should be resolved to.
67 private String type;
69 /**
70 * This method initializes a new instance of <code>UnresolvedPermission</code>
71 * with all the information necessary to resolve it to an instance of the
72 * proper class at a future time.
74 * @param type The name of the desired class this permission should be resolved to
75 * @param name The name of this permission
76 * @param actions The action list for this permission
77 * @param certs The list of certificates this permission's class was signed with
79 public UnresolvedPermission(String type, String name, String actions,
80 Certificate[] certs)
82 super(name);
84 this.type = type;
85 this.actions = actions;
86 this.certs = certs;
89 /**
90 * This method returns the list of actions associated with this
91 * permission.
93 * @return The action list
95 public String getActions()
97 return (actions);
101 * This method returns <code>false</code> always to indicate that this
102 * permission does not imply the specified permission. An
103 * <code>UnresolvedPermission</code> never grants any permissions.
105 * @param perm The <code>Permission</code> object to test against - ignored by this class
107 * @return <code>false</code> to indicate this permission does not imply the specified permission.
109 public boolean implies(Permission perm)
111 return (false);
115 * This method tests this permission for equality against the specified
116 * <code>Object</code>. This will be true if and only if the following
117 * conditions are met:
118 * <p>
119 * <ul>
120 * <li>The specified <code>Object</code> is an instance of
121 * <code>UnresolvedPermission</code>, or a subclass.
122 * <li>The specified permission has the same type (i.e., desired class name)
123 * as this permission.
124 * <li>The specified permission has the same name as this one.
125 * <li>The specified permissoin has the same action list as this one.
126 * <li>The specified permission has the same certificate list as this one.
127 * </ul>
129 * @param obj The <code>Object</code> to test for equality
131 * @return <code>true</code> if the specified object is equal to this one, <code>false</code> otherwise.
133 public boolean equals(Object obj)
135 if (!(obj instanceof UnresolvedPermission))
136 return (false);
138 UnresolvedPermission up = (UnresolvedPermission) obj;
140 if (!getName().equals(up.getName()))
141 return (false);
143 if (!getActions().equals(up.getActions()))
144 return (false);
146 if (!type.equals(up.type))
147 return (false);
149 if (!certs.equals(up.certs))
150 return (false);
152 return (true);
156 * Returns a hash code value for this object.
158 * @return A hash value
160 public int hashCode()
162 return (System.identityHashCode(this));
166 * This method returns a <code>String</code> representation of this
167 * class. The format is: '(unresolved "ClassName "name" "actions")'
169 * @return A <code>String</code> representation of this object
171 public String toString()
173 return "(unresolved " + type + " " + getName() + " " + getActions() + ")";
177 * This class returns a <code>PermissionCollection</code> object that can
178 * be used to store instances of <code>UnresolvedPermission</code>. If
179 * <code>null</code> is returned, the caller is free to use any desired
180 * <code>PermissionCollection</code>.
182 * @return A new <code>PermissionCollection</code>.
184 public PermissionCollection newPermissionCollection()
186 return (null);