KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > sql > SQLPermission


1 /*
2  * @(#)SQLPermission.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8
9 package java.sql;
10
11 import java.security.*;
12
13 /**
14  * The permission for which the <code>SecurityManager</code> will check
15  * when code that is running in an applet calls the
16  * <code>DriverManager.setLogWriter</code> method or the
17  * <code>DriverManager.setLogStream</code> (deprecated) method.
18  * If there is no <code>SQLPermission</code> object, these methods
19  * throw a <code>java.lang.SecurityException</code> as a runtime exception.
20  * <P>
21  * A <code>SQLPermission</code> object contains
22  * a name (also referred to as a "target name") but no actions
23  * list; there is either a named permission or there is not.
24  * The target name is the name of the permission (see below). The
25  * naming convention follows the hierarchical property naming convention.
26  * In addition, an asterisk
27  * may appear at the end of the name, following a ".", or by itself, to
28  * signify a wildcard match. For example: <code>loadLibrary.*</code>
29  * or <code>*</code> is valid,
30  * but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
31  * <P>
32  * The following table lists all the possible <code>SQLPermission</code> target names.
33  * Currently, the only name allowed is <code>setLog</code>.
34  * The table gives a description of what the permission allows
35  * and a discussion of the risks of granting code the permission.
36  * <P>
37  *
38  * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
39  * <tr>
40  * <th>Permission Target Name</th>
41  * <th>What the Permission Allows</th>
42  * <th>Risks of Allowing this Permission</th>
43  * </tr>
44  *
45  * <tr>
46  * <td>setLog</td>
47  * <td>Setting of the logging stream</td>
48  * <td>This is a dangerous permission to grant.
49  * The contents of the log may contain usernames and passwords,
50  * SQL statements, and SQL data.</td>
51  * </tr>
52  *
53  * </table>
54  *
55  * The person running an applet decides what permissions to allow
56  * and will run the <code>Policy Tool</code> to create an
57  * <code>SQLPermission</code> in a policy file. A programmer does
58  * not use a constructor directly to create an instance of <code>SQLPermission</code>
59  * but rather uses a tool.
60  * @since 1.3
61  * @see java.security.BasicPermission
62  * @see java.security.Permission
63  * @see java.security.Permissions
64  * @see java.security.PermissionCollection
65  * @see java.lang.SecurityManager
66  *
67  */

68
69 public final class SQLPermission extends BasicPermission {
70
71     /**
72      * Creates a new <code>SQLPermission</code> object with the specified name.
73      * The name is the symbolic name of the <code>SQLPermission</code>; currently,
74      * the only name allowed is "setLog".
75      *
76      * @param name the name of this <code>SQLPermission</code> object, which must
77      * be <code>setLog</code>
78      */

79
80     public SQLPermission(String JavaDoc name) {
81         super(name);
82     }
83
84     /**
85      * Creates a new <code>SQLPermission</code> object with the specified name.
86      * The name is the symbolic name of the <code>SQLPermission</code>; the
87      * actions <code>String</code> is currently unused and should be
88      * <code>null</code>.
89      *
90      * @param name the name of this <code>SQLPermission</code> object, which must
91      * be <code>setLog</code>
92      * @param actions should be <code>null</code>
93      */

94
95     public SQLPermission(String JavaDoc name, String JavaDoc actions) {
96         super(name, actions);
97     }
98
99     /**
100      * Private serial version unique ID to ensure serialization
101      * compatibility.
102      */

103     static final long serialVersionUID = -1439323187199563495L;
104
105 }
106
Popular Tags