1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package javax.jdo.spi;
19
20 /**
21 * The <code>JDOPermission</code> class is for operations that are reserved for
22 * JDO implementations and should not be called by other code. A
23 * <code>JDOPermission</code> is a <em>named permission</em> and has no
24 * actions. There are two names currently defined. Each named permission
25 * has a corresponding public static final field which contains an instance
26 * of the named permission.
27 * <P>
28 * The following table
29 * provides a summary description of what each named permission allows,
30 * and discusses the risks of granting code the permission.
31 * <P>
32 *
33 * <table border=1 cellpadding=5>
34 * <tr>
35 * <th>Permission Target Name</th>
36 * <th>What the Permission Allows</th>
37 * <th>Risks of Allowing this Permission</th>
38 * </tr>
39 *
40 * <tr>
41 * <td><code>setStateManager</code></td>
42 * <td>This allows setting the <code>StateManager</code> for an instance of
43 * <code>PersistenceCapable</code>. The <code>StateManager</code>
44 * has unlimited access to get and set persistent and transactional fields of
45 * the <code>PersistenceCapable</code> instance.</td>
46 * <td>This is dangerous in that information (possibly confidential)
47 * normally unavailable would be accessible to malicious code.</td>
48 * </tr>
49 *
50 * <tr>
51 * <td><code>getMetadata</code></td>
52 * <td>This allows getting metadata for any <code>PersistenceCapable</code>
53 * class that has registered with <code>JDOImplHelper</code>.</td>
54 * <td>This is dangerous in that metadata information (possibly confidential)
55 * normally unavailable would be accessible to malicious code.</td>
56 * </tr>
57 *
58 * <tr>
59 * <td><code>manageMetadata</code></td>
60 * <td>This allows managing metadata for any <code>PersistenceCapable</code>
61 * class that has registered with <code>JDOImplHelper</code>.</td>
62 * <td>This is dangerous in that metadata information (possibly confidential)
63 * normally unavailable would be manageable (modifiable) by malicious code.
64 * </td>
65 * </tr>
66 *
67 * <tr>
68 * <td><code>closePersistenceManagerFactory</code></td>
69 * <td>This allows closing a <code>PersistenceManagerFactory</code>,
70 * thereby releasing resources.</td>
71 * <td>This is dangerous in that resources bound to the
72 * <code>PersistenceManagerFactory</code> would be releaseable by
73 * malicious code.</td>
74 * </tr>
75 *
76 * </table>
77 *
78 * @see java.security.Permission
79 * @see java.security.BasicPermission
80 * @see javax.jdo.spi.JDOImplHelper
81 * @see javax.jdo.spi.PersistenceCapable
82 * @version 1.0.2
83 */
84 public final
85 class JDOPermission extends java.security.BasicPermission {
86
87 /**
88 * Constructs a <code>JDOPermission</code> with the specified name.
89 *
90 * @param name the name of the <code>JDOPermission</code>
91 */
92 public JDOPermission(String name) {
93 super(name);
94 }
95
96 /**
97 * Constructs a <code>JDOPermission</code> with the specified name and
98 * actions. The actions should be <code>null</code>; they are ignored.
99 * This constructor exists for use by the <code>Policy</code> object
100 * to instantiate new <code>Permission</code> objects.
101 *
102 * @param name the name of the <code>JDOPermission</code>
103 * @param actions should be <code>null</code>.
104 */
105 public JDOPermission(String name, String actions) {
106 super(name, actions);
107 }
108
109 /** An instance of <code>JDOPermission</code> to be used for
110 * <code>getMetadata</code> permission checking.
111 */
112 public final static JDOPermission GET_METADATA =
113 new JDOPermission("getMetadata");
114
115 /** An instance of <code>JDOPermission</code> to be used for
116 * <code>manageMetadata</code> permission checking.
117 * @since 1.0.2
118 */
119 public final static JDOPermission MANAGE_METADATA =
120 new JDOPermission("manageMetadata");
121
122 /** An instance of <code>JDOPermission</code> to be used for
123 * <code>setStateManager</code> permission checking.
124 */
125 public final static JDOPermission SET_STATE_MANAGER =
126 new JDOPermission("setStateManager");
127
128 /** An instance of <code>JDOPermission</code> to be used for
129 * <code>closePersistenceManagerFactory</code> permission checking.
130 * @since 1.0.1
131 */
132 public final static JDOPermission CLOSE_PERSISTENCE_MANAGER_FACTORY =
133 new JDOPermission("closePersistenceManagerFactory");
134
135 }