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