01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.util.logging;
19:
20: import java.io.Serializable;
21: import java.security.BasicPermission;
22: import java.security.Guard;
23:
24: import org.apache.harmony.logging.internal.nls.Messages;
25:
26: /**
27: * The permission required to control the logging when run with a
28: * <code>SecurityManager</code>.
29: */
30: public final class LoggingPermission extends BasicPermission implements
31: Guard, Serializable {
32:
33: // for serialization compatibility with J2SE 1.4.2
34: private static final long serialVersionUID = 63564341580231582L;
35:
36: /**
37: * Constructs a <code>LoggingPermission</code> object required to control
38: * the logging.
39: *
40: * @param name
41: * Currently must be "control".
42: * @param actions
43: * Currently must be either <code>null</code> or the empty
44: * string.
45: */
46: public LoggingPermission(String name, String actions) {
47: super (name, actions);
48: if (!"control".equals(name)) { //$NON-NLS-1$
49: // logging.6=Name must be "control".
50: throw new IllegalArgumentException(Messages
51: .getString("logging.6")); //$NON-NLS-1$
52: }
53: if (null != actions && !"".equals(actions)) { //$NON-NLS-1$
54: // logging.7=Actions must be either null or the empty string.
55: throw new IllegalArgumentException(Messages
56: .getString("logging.7")); //$NON-NLS-1$
57: }
58: }
59:
60: }
|