History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/sql/SQLPermission.java (1 of 18352 files). Show all

Unified · Split

java/pkg/java/sql/SQLPermission.java+158−0
@@ -0,0 +1,158 @@
1+/*
2+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
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
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
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+ *
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.
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
33+ * when code that is running in an applet, or an application with a
34+ * <code>SecurityManager</code> enabled, calls the
35+ * <code>DriverManager.setLogWriter</code> method,
36+ * <code>DriverManager.setLogStream</code> (deprecated) method,
37+ * {@code SyncFactory.setJNDIContext} method,
38+ * {@code SyncFactory.setLogger} method,
39+ * {@code Connection.setNetworktimeout} method,
40+ * or the <code>Connection.abort</code> method.
41+ * If there is no <code>SQLPermission</code> object, these methods
42+ * throw a <code>java.lang.SecurityException</code> as a runtime exception.
43+ * <P>
44+ * A <code>SQLPermission</code> object contains
45+ * a name (also referred to as a "target name") but no actions
46+ * list; there is either a named permission or there is not.
47+ * The target name is the name of the permission (see below). The
48+ * naming convention follows the hierarchical property naming convention.
49+ * In addition, an asterisk
50+ * may appear at the end of the name, following a ".", or by itself, to
51+ * signify a wildcard match. For example: <code>loadLibrary.*</code>
52+ * or <code>*</code> is valid,
53+ * but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
54+ * <P>
55+ * The following table lists all the possible <code>SQLPermission</code> target names.
56+ * The table gives a description of what the permission allows
57+ * and a discussion of the risks of granting code the permission.
58+ * <P>
59+ *
60+ * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
61+ * <tr>
62+ * <th>Permission Target Name</th>
63+ * <th>What the Permission Allows</th>
64+ * <th>Risks of Allowing this Permission</th>
65+ * </tr>
66+ *
67+ * <tr>
68+ * <td>setLog</td>
69+ * <td>Setting of the logging stream</td>
70+ * <td>This is a dangerous permission to grant.
71+ * The contents of the log may contain usernames and passwords,
72+ * SQL statements, and SQL data.</td>
73+ * </tr>
74+ * <tr>
75+ * <td>callAbort</td>
76+ * <td>Allows the invocation of the {@code Connection} method
77+ * {@code abort}</td>
78+ * <td>Permits an application to terminate a physical connection to a
79+ * database.</td>
80+ * </tr>
81+ * <tr>
82+ * <td>setSyncFactory</td>
83+ * <td>Allows the invocation of the {@code SyncFactory} methods
84+ * {@code setJNDIContext} and {@code setLogger}</td>
85+ * <td>Permits an application to specify the JNDI context from which the
86+ * {@code SyncProvider} implementations can be retrieved from and the logging
87+ * object to be used by the {@code SyncProvider} implementation.</td>
88+ * </tr>
89+ *
90+ * <tr>
91+ * <td>setNetworkTimeout</td>
92+ * <td>Allows the invocation of the {@code Connection} method
93+ * {@code setNetworkTimeout}</td>
94+ * <td>Permits an application to specify the maximum period a
95+ * <code>Connection</code> or
96+ * objects created from the <code>Connection</code>
97+ * will wait for the database to reply to any one request.</td>
98+ * </tr>
99+ * </table>
100+ *<p>
101+ * The person running an applet decides what permissions to allow
102+ * and will run the <code>Policy Tool</code> to create an
103+ * <code>SQLPermission</code> in a policy file. A programmer does
104+ * not use a constructor directly to create an instance of <code>SQLPermission</code>
105+ * but rather uses a tool.
106+ * @since 1.3
107+ * @see java.security.BasicPermission
108+ * @see java.security.Permission
109+ * @see java.security.Permissions
110+ * @see java.security.PermissionCollection
111+ * @see java.lang.SecurityManager
112+ *
113+ */
114+
115+public final class SQLPermission extends BasicPermission {
116+
117+ /**
118+ * Creates a new <code>SQLPermission</code> object with the specified name.
119+ * The name is the symbolic name of the <code>SQLPermission</code>.
120+ *
121+ * @param name the name of this <code>SQLPermission</code> object, which must
122+ * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
123+ * or {@code setNetworkTimeout}
124+ * @throws NullPointerException if <code>name</code> is <code>null</code>.
125+ * @throws IllegalArgumentException if <code>name</code> is empty.
126+
127+ */
128+
129+ public SQLPermission(String name) {
130+ super(name);
131+ }
132+
133+ /**
134+ * Creates a new <code>SQLPermission</code> object with the specified name.
135+ * The name is the symbolic name of the <code>SQLPermission</code>; the
136+ * actions <code>String</code> is currently unused and should be
137+ * <code>null</code>.
138+ *
139+ * @param name the name of this <code>SQLPermission</code> object, which must
140+ * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
141+ * or {@code setNetworkTimeout}
142+ * @param actions should be <code>null</code>
143+ * @throws NullPointerException if <code>name</code> is <code>null</code>.
144+ * @throws IllegalArgumentException if <code>name</code> is empty.
145+
146+ */
147+
148+ public SQLPermission(String name, String actions) {
149+ super(name, actions);
150+ }
151+
152+ /**
153+ * Private serial version unique ID to ensure serialization
154+ * compatibility.
155+ */
156+ static final long serialVersionUID = -1439323187199563495L;
157+
158+}