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