src/java.sql/share/classes/java/sql/SQLPermission.java
author alanb
Tue, 15 May 2018 09:33:02 +0100
changeset 50109 ea54197f4fe4
parent 47216 71c04702a3d5
permissions -rw-r--r--
8203059: (so) Closing a socket channel registered with Selector and with SO_LINGER set to 0 does not reset connection Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    36
 * <code>DriverManager.setLogWriter</code> method,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    37
 * <code>DriverManager.setLogStream</code> (deprecated) method,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    38
 * {@code SyncFactory.setJNDIContext} method,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    41
 * or the <code>Connection.abort</code> method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * If there is no <code>SQLPermission</code> object, these methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * throw a <code>java.lang.SecurityException</code> as a runtime exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * A <code>SQLPermission</code> object contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * a name (also referred to as a "target name") but no actions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * list; there is either a named permission or there is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * The target name is the name of the permission (see below). The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * naming convention follows the  hierarchical property naming convention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * In addition, an asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * The following table lists all the possible <code>SQLPermission</code> target names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * The table gives a description of what the permission allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 25991
diff changeset
    71
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *   <td>Setting of the logging stream</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *   <td>This is a dangerous permission to grant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * The contents of the log may contain usernames and passwords,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * SQL statements, and SQL data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * </tr>
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    81
 *   <td>Allows the invocation of the {@code Connection} method
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    82
 *   {@code abort}</td>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    83
 *   <td>Permits an application to terminate a physical connection to a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    84
 *  database.</td>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    85
 * </tr>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    88
 *   <td>Allows the invocation of the {@code SyncFactory} methods
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    89
 *   {@code setJNDIContext} and {@code setLogger}</td>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    90
 *   <td>Permits an application to specify the JNDI context from which the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    91
 *   {@code SyncProvider} implementations can be retrieved from and the logging
7284
0e3ea546be45 7001669: Typo in javadocs for SQLPermission
lancea
parents: 6540
diff changeset
    92
 *   object to be used by the {@code SyncProvider} implementation.</td>
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    93
 * </tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    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
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    97
 *   <td>Allows the invocation of the {@code Connection} method
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    98
 *   {@code setNetworkTimeout}</td>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    99
 *   <td>Permits an application to specify the maximum period a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   100
 * <code>Connection</code> or
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   101
 * objects created from the <code>Connection</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * </table>
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21950
diff changeset
   112
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
public final class SQLPermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
db3c826749f7 8029417: JDBC 4.2 javadoc updates
lancea
parents: 20880
diff changeset
   130
     *  {@code deregisterDriver}, or {@code setNetworkTimeout}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public SQLPermission(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Creates a new <code>SQLPermission</code> object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * The name is the symbolic name of the <code>SQLPermission</code>; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
db3c826749f7 8029417: JDBC 4.2 javadoc updates
lancea
parents: 20880
diff changeset
   148
     *  {@code deregisterDriver}, or {@code setNetworkTimeout}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @param actions should be <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    public SQLPermission(String name, String actions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * Private serial version unique ID to ensure serialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    static final long serialVersionUID = -1439323187199563495L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
}