blob: cf1f0496ede28c440c892de2dcb1a3d0a2643f26 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1999-2005 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26
27package java.sql;
28
29import java.security.*;
30
31/**
32 * The permission for which the <code>SecurityManager</code> will check
33 * when code that is running in an applet calls the
34 * <code>DriverManager.setLogWriter</code> method or the
35 * <code>DriverManager.setLogStream</code> (deprecated) method.
36 * If there is no <code>SQLPermission</code> object, these methods
37 * throw a <code>java.lang.SecurityException</code> as a runtime exception.
38 * <P>
39 * A <code>SQLPermission</code> object contains
40 * a name (also referred to as a "target name") but no actions
41 * list; there is either a named permission or there is not.
42 * The target name is the name of the permission (see below). The
43 * naming convention follows the hierarchical property naming convention.
44 * In addition, an asterisk
45 * may appear at the end of the name, following a ".", or by itself, to
46 * signify a wildcard match. For example: <code>loadLibrary.*</code>
47 * or <code>*</code> is valid,
48 * but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
49 * <P>
50 * The following table lists all the possible <code>SQLPermission</code> target names.
51 * Currently, the only name allowed is <code>setLog</code>.
52 * The table gives a description of what the permission allows
53 * and a discussion of the risks of granting code the permission.
54 * <P>
55 *
56 * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
57 * <tr>
58 * <th>Permission Target Name</th>
59 * <th>What the Permission Allows</th>
60 * <th>Risks of Allowing this Permission</th>
61 * </tr>
62 *
63 * <tr>
64 * <td>setLog</td>
65 * <td>Setting of the logging stream</td>
66 * <td>This is a dangerous permission to grant.
67 * The contents of the log may contain usernames and passwords,
68 * SQL statements, and SQL data.</td>
69 * </tr>
70 *
71 * </table>
72 *
73 * The person running an applet decides what permissions to allow
74 * and will run the <code>Policy Tool</code> to create an
75 * <code>SQLPermission</code> in a policy file. A programmer does
76 * not use a constructor directly to create an instance of <code>SQLPermission</code>
77 * but rather uses a tool.
78 * @since 1.3
79 * @see java.security.BasicPermission
80 * @see java.security.Permission
81 * @see java.security.Permissions
82 * @see java.security.PermissionCollection
83 * @see java.lang.SecurityManager
84 *
85 */
86
87public final class SQLPermission extends BasicPermission {
88
89 /**
90 * Creates a new <code>SQLPermission</code> object with the specified name.
91 * The name is the symbolic name of the <code>SQLPermission</code>; currently,
92 * the only name allowed is "setLog".
93 *
94 * @param name the name of this <code>SQLPermission</code> object, which must
95 * be <code>setLog</code>
96 * @throws NullPointerException if <code>name</code> is <code>null</code>.
97 * @throws IllegalArgumentException if <code>name</code> is empty.
98
99 */
100
101 public SQLPermission(String name) {
102 super(name);
103 }
104
105 /**
106 * Creates a new <code>SQLPermission</code> object with the specified name.
107 * The name is the symbolic name of the <code>SQLPermission</code>; the
108 * actions <code>String</code> is currently unused and should be
109 * <code>null</code>.
110 *
111 * @param name the name of this <code>SQLPermission</code> object, which must
112 * be <code>setLog</code>
113 * @param actions should be <code>null</code>
114 * @throws NullPointerException if <code>name</code> is <code>null</code>.
115 * @throws IllegalArgumentException if <code>name</code> is empty.
116
117 */
118
119 public SQLPermission(String name, String actions) {
120 super(name, actions);
121 }
122
123 /**
124 * Private serial version unique ID to ensure serialization
125 * compatibility.
126 */
127 static final long serialVersionUID = -1439323187199563495L;
128
129}