author | herrick |
Wed, 20 Nov 2019 10:17:37 -0500 | |
branch | JDK-8200758-branch |
changeset 59160 | e90068e7afa1 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
45126
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
2 |
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
||
27 |
package java.sql; |
|
28 |
||
29 |
import java.security.*; |
|
30 |
||
31 |
/** |
|
32 |
* The permission for which the <code>SecurityManager</code> will check |
|
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
33 |
* when code that is running an application with a |
6540 | 34 |
* <code>SecurityManager</code> enabled, calls the |
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
35 |
* {@code DriverManager.deregisterDriver} method, |
6540 | 36 |
* <code>DriverManager.setLogWriter</code> method, |
37 |
* <code>DriverManager.setLogStream</code> (deprecated) method, |
|
38 |
* {@code SyncFactory.setJNDIContext} method, |
|
39 |
* {@code SyncFactory.setLogger} method, |
|
25976
4de01a56e3ee
8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents:
23590
diff
changeset
|
40 |
* {@code Connection.setNetworkTimeout} method, |
6540 | 41 |
* or the <code>Connection.abort</code> method. |
2 | 42 |
* If there is no <code>SQLPermission</code> object, these methods |
43 |
* throw a <code>java.lang.SecurityException</code> as a runtime exception. |
|
44 |
* <P> |
|
45 |
* A <code>SQLPermission</code> object contains |
|
46 |
* a name (also referred to as a "target name") but no actions |
|
47 |
* list; there is either a named permission or there is not. |
|
48 |
* The target name is the name of the permission (see below). The |
|
49 |
* naming convention follows the hierarchical property naming convention. |
|
50 |
* In addition, an asterisk |
|
51 |
* may appear at the end of the name, following a ".", or by itself, to |
|
52 |
* signify a wildcard match. For example: <code>loadLibrary.*</code> |
|
14667
6862285acf46
7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents:
9262
diff
changeset
|
53 |
* and <code>*</code> signify a wildcard match, |
6862285acf46
7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents:
9262
diff
changeset
|
54 |
* while <code>*loadLibrary</code> and <code>a*b</code> do not. |
2 | 55 |
* <P> |
56 |
* The following table lists all the possible <code>SQLPermission</code> target names. |
|
57 |
* The table gives a description of what the permission allows |
|
58 |
* and a discussion of the risks of granting code the permission. |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
18564
diff
changeset
|
59 |
* |
2 | 60 |
* |
45126
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
61 |
* <table class="striped"> |
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
62 |
* <caption style="display:none">permission target name, what the permission allows, and associated risks</caption> |
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
63 |
* <thead> |
2 | 64 |
* <tr> |
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
65 |
* <th scope="col">Permission Target Name</th> |
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
66 |
* <th scope="col">What the Permission Allows</th> |
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
67 |
* <th scope="col">Risks of Allowing this Permission</th> |
2 | 68 |
* </tr> |
45126
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
69 |
* </thead> |
2 | 70 |
* |
45126
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
71 |
* <tbody> |
2 | 72 |
* <tr> |
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
73 |
* <th scope="row">setLog</th> |
2 | 74 |
* <td>Setting of the logging stream</td> |
75 |
* <td>This is a dangerous permission to grant. |
|
76 |
* The contents of the log may contain usernames and passwords, |
|
77 |
* SQL statements, and SQL data.</td> |
|
78 |
* </tr> |
|
6540 | 79 |
* <tr> |
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
80 |
* <th scope="row">callAbort</th> |
6540 | 81 |
* <td>Allows the invocation of the {@code Connection} method |
82 |
* {@code abort}</td> |
|
83 |
* <td>Permits an application to terminate a physical connection to a |
|
84 |
* database.</td> |
|
85 |
* </tr> |
|
86 |
* <tr> |
|
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
87 |
* <th scope="row">setSyncFactory</th> |
6540 | 88 |
* <td>Allows the invocation of the {@code SyncFactory} methods |
89 |
* {@code setJNDIContext} and {@code setLogger}</td> |
|
90 |
* <td>Permits an application to specify the JNDI context from which the |
|
91 |
* {@code SyncProvider} implementations can be retrieved from and the logging |
|
7284 | 92 |
* object to be used by the {@code SyncProvider} implementation.</td> |
6540 | 93 |
* </tr> |
2 | 94 |
* |
6540 | 95 |
* <tr> |
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
96 |
* <th scope="row">setNetworkTimeout</th> |
6540 | 97 |
* <td>Allows the invocation of the {@code Connection} method |
98 |
* {@code setNetworkTimeout}</td> |
|
99 |
* <td>Permits an application to specify the maximum period a |
|
100 |
* <code>Connection</code> or |
|
101 |
* objects created from the <code>Connection</code> |
|
102 |
* will wait for the database to reply to any one request.</td> |
|
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
103 |
* <tr> |
45885
562fed91cd84
8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents:
45126
diff
changeset
|
104 |
* <th scope="row">deregisterDriver</th> |
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
105 |
* <td>Allows the invocation of the {@code DriverManager} |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
106 |
* method {@code deregisterDriver}</td> |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
107 |
* <td>Permits an application to remove a JDBC driver from the list of |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
108 |
* registered Drivers and release its resources.</td> |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
14668
diff
changeset
|
109 |
* </tr> |
45126
9c8ac4361d9f
8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents:
25991
diff
changeset
|
110 |
* </tbody> |
2 | 111 |
* </table> |
23590 | 112 |
* |
2 | 113 |
* @since 1.3 |
114 |
* @see java.security.BasicPermission |
|
115 |
* @see java.security.Permission |
|
116 |
* @see java.security.Permissions |
|
117 |
* @see java.security.PermissionCollection |
|
118 |
* @see java.lang.SecurityManager |
|
119 |
* |
|
120 |
*/ |
|
121 |
||
122 |
public final class SQLPermission extends BasicPermission { |
|
123 |
||
124 |
/** |
|
125 |
* Creates a new <code>SQLPermission</code> object with the specified name. |
|
9262
8d4c68eccc47
7036251: Correct SQLPermission constructor javadocs for permission target names
lancea
parents:
7284
diff
changeset
|
126 |
* The name is the symbolic name of the <code>SQLPermission</code>. |
2 | 127 |
* |
128 |
* @param name the name of this <code>SQLPermission</code> object, which must |
|
9262
8d4c68eccc47
7036251: Correct SQLPermission constructor javadocs for permission target names
lancea
parents:
7284
diff
changeset
|
129 |
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, |
21950 | 130 |
* {@code deregisterDriver}, or {@code setNetworkTimeout} |
2 | 131 |
* @throws NullPointerException if <code>name</code> is <code>null</code>. |
132 |
* @throws IllegalArgumentException if <code>name</code> is empty. |
|
133 |
||
134 |
*/ |
|
135 |
||
136 |
public SQLPermission(String name) { |
|
137 |
super(name); |
|
138 |
} |
|
139 |
||
140 |
/** |
|
141 |
* Creates a new <code>SQLPermission</code> object with the specified name. |
|
142 |
* The name is the symbolic name of the <code>SQLPermission</code>; the |
|
143 |
* actions <code>String</code> is currently unused and should be |
|
9262
8d4c68eccc47
7036251: Correct SQLPermission constructor javadocs for permission target names
lancea
parents:
7284
diff
changeset
|
144 |
* <code>null</code>. |
2 | 145 |
* |
146 |
* @param name the name of this <code>SQLPermission</code> object, which must |
|
9262
8d4c68eccc47
7036251: Correct SQLPermission constructor javadocs for permission target names
lancea
parents:
7284
diff
changeset
|
147 |
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, |
21950 | 148 |
* {@code deregisterDriver}, or {@code setNetworkTimeout} |
2 | 149 |
* @param actions should be <code>null</code> |
150 |
* @throws NullPointerException if <code>name</code> is <code>null</code>. |
|
151 |
* @throws IllegalArgumentException if <code>name</code> is empty. |
|
152 |
||
153 |
*/ |
|
154 |
||
155 |
public SQLPermission(String name, String actions) { |
|
156 |
super(name, actions); |
|
157 |
} |
|
158 |
||
159 |
/** |
|
160 |
* Private serial version unique ID to ensure serialization |
|
161 |
* compatibility. |
|
162 |
*/ |
|
163 |
static final long serialVersionUID = -1439323187199563495L; |
|
164 |
||
165 |
} |