01 /*
02 * Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * 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 package java.util.logging;
27
28 import java.security.*;
29
30 /**
31 * The permission which the SecurityManager will check when code
32 * that is running with a SecurityManager calls one of the logging
33 * control methods (such as Logger.setLevel).
34 * <p>
35 * Currently there is only one named LoggingPermission. This is "control"
36 * and it grants the ability to control the logging configuration, for
37 * example by adding or removing Handlers, by adding or removing Filters,
38 * or by changing logging levels.
39 * <p>
40 * Programmers do not normally create LoggingPermission objects directly.
41 * Instead they are created by the security policy code based on reading
42 * the security policy file.
43 *
44 *
45 * @version 1.17, 05/05/07
46 * @since 1.4
47 * @see java.security.BasicPermission
48 * @see java.security.Permission
49 * @see java.security.Permissions
50 * @see java.security.PermissionCollection
51 * @see java.lang.SecurityManager
52 *
53 */
54
55 public final class LoggingPermission extends
56 java.security.BasicPermission {
57
58 private static final long serialVersionUID = 63564341580231582L;
59
60 /**
61 * Creates a new LoggingPermission object.
62 *
63 * @param name Permission name. Must be "control".
64 * @param actions Must be either null or the empty string.
65 *
66 * @throws NullPointerException if <code>name</code> is <code>null</code>.
67 * @throws IllegalArgumentException if <code>name</code> is empty or if
68 * arguments are invalid.
69 */
70 public LoggingPermission(String name, String actions)
71 throws IllegalArgumentException {
72 super (name);
73 if (!name.equals("control")) {
74 throw new IllegalArgumentException("name: " + name);
75 }
76 if (actions != null && actions.length() > 0) {
77 throw new IllegalArgumentException("actions: " + actions);
78 }
79 }
80 }
|