1   /*
2    * %W% %E%
3    *
4    * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5    * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6    */
7   
8   
9   package java.util.logging;
10  
11  import java.security.*;
12  
13  /**
14   * The permission which the SecurityManager will check when code
15   * that is running with a SecurityManager calls one of the logging
16   * control methods (such as Logger.setLevel).
17   * <p>
18   * Currently there is only one named LoggingPermission.  This is "control"
19   * and it grants the ability to control the logging configuration, for
20   * example by adding or removing Handlers, by adding or removing Filters,
21   * or by changing logging levels.
22   * <p>
23   * Programmers do not normally create LoggingPermission objects directly.
24   * Instead they are created by the security policy code based on reading
25   * the security policy file.
26   *
27   *
28   * @version %I%, %G%
29   * @since 1.4
30   * @see java.security.BasicPermission
31   * @see java.security.Permission
32   * @see java.security.Permissions
33   * @see java.security.PermissionCollection
34   * @see java.lang.SecurityManager
35   *
36   */
37  
38  public final class LoggingPermission extends java.security.BasicPermission {
39  
40      private static final long serialVersionUID = 63564341580231582L;
41  
42      /**
43       * Creates a new LoggingPermission object.
44       *
45       * @param name Permission name.  Must be "control".
46       * @param actions Must be either null or the empty string.
47       *
48       * @throws NullPointerException if <code>name</code> is <code>null</code>.
49       * @throws IllegalArgumentException if <code>name</code> is empty or if
50       * arguments are invalid.
51       */
52      public LoggingPermission(String name, String actions) throws IllegalArgumentException {
53          super(name);
54      if (!name.equals("control")) {
55          throw new IllegalArgumentException("name: " + name);
56      }
57      if (actions != null && actions.length() > 0) {
58          throw new IllegalArgumentException("actions: " + actions);
59      }
60      }
61  }
62