1. /*
  2. * @(#)SQLPermission.java 1.9 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.sql;
  11. import java.security.*;
  12. /**
  13. * The permission for which the <code>SecurityManager</code> will check
  14. * when code that is running in an applet calls one of the
  15. * <code>setLogWriter</code> methods. These methods include those in the
  16. * following list.
  17. * <UL>
  18. * <LI><code>DriverManager.setLogWriter</code> <br>
  19. * <LI><code>DriverManager.setLogStream</code> (deprecated)<br>
  20. * <LI><code>javax.sql.DataSource.setLogWriter</code><br>
  21. * <LI><code>javax.sql.ConnectionPoolDataSource.setLogWriter</code><br>
  22. * <LI><code>javax.sql.XADataSource.setLogWriter</code><br>
  23. * </UL>
  24. * If there is no <code>SQLPermission</code> object, this method
  25. * throws a <code>java.lang.SecurityException</code> as a runtime exception.
  26. * <P>
  27. * A <code>SQLPermission</code> object contains
  28. * a name (also referred to as a "target name") but no actions
  29. * list; there is either a named permission or there is not.
  30. * The target name is the name of the permission (see below). The
  31. * naming convention follows the hierarchical property naming convention.
  32. * In addition, an asterisk
  33. * may appear at the end of the name, following a ".", or by itself, to
  34. * signify a wildcard match. For example: <code>loadLibrary.*</code>
  35. * or <code>*</code> is valid,
  36. * but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
  37. * <P>
  38. * The following table lists all the possible <code>SQLPermission</code> target names.
  39. * Currently, the only name allowed is <code>setLog</code>.
  40. * The table gives a description of what the permission allows
  41. * and a discussion of the risks of granting code the permission.
  42. * <P>
  43. *
  44. * <table border=1 cellpadding=5>
  45. * <tr>
  46. * <th>Permission Target Name</th>
  47. * <th>What the Permission Allows</th>
  48. * <th>Risks of Allowing this Permission</th>
  49. * </tr>
  50. *
  51. * <tr>
  52. * <td>setLog</td>
  53. * <td>Setting of the logging stream</td>
  54. * <td>This is a dangerous permission to grant.
  55. * The contents of the log may contain usernames and passwords,
  56. * SQL statements, and SQL data.</td>
  57. * </tr>
  58. *
  59. * </table>
  60. *
  61. * The person running an applet decides what permissions to allow
  62. * and will run the <code>Policy Tool</code> to create an
  63. * <code>SQLPermission</code> in a policy file. A programmer does
  64. * not use a constructor directly to create an instance of <code>SQLPermission</code>
  65. * but rather uses a tool.
  66. * @since 1.3
  67. * @see java.security.BasicPermission
  68. * @see java.security.Permission
  69. * @see java.security.Permissions
  70. * @see java.security.PermissionCollection
  71. * @see java.lang.SecurityManager
  72. *
  73. */
  74. public final class SQLPermission extends BasicPermission {
  75. /**
  76. * Creates a new <code>SQLPermission</code> object with the specified name.
  77. * The name is the symbolic name of the <code>SQLPermission</code> currently,
  78. * the only name allowed is "setLog".
  79. *
  80. * @param name the name of this <code>SQLPermission</code> object, which must
  81. * be <code>setLog</code>
  82. */
  83. public SQLPermission(String name) {
  84. super(name);
  85. }
  86. /**
  87. * Creates a new <code>SQLPermission</code> object with the specified name.
  88. * The name is the symbolic name of the <code>SQLPermission</code> the
  89. * actions <code>String</code> is currently unused and should be
  90. * <code>null</code>.
  91. *
  92. * @param name the name of this <code>SQLPermission</code> object, which must
  93. * be <code>setLog</code>
  94. * @param actions should be <code>null</code>
  95. */
  96. public SQLPermission(String name, String actions) {
  97. super(name, actions);
  98. }
  99. }