View Javadoc

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