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.lang.management;
19:
20: import java.security.BasicPermission;
21: import java.security.SecurityPermission;
22:
23: /**
24: * <p>
25: * A {@link SecurityPermission} for use with the management system.
26: * </p>
27: *
28: * @since 1.5
29: */
30: public final class ManagementPermission extends BasicPermission {
31: private static final long serialVersionUID = 1897496590799378737L;
32:
33: /**
34: * <p>
35: * Constructs and instance with the given name.
36: * </p>
37: *
38: * @param name The permission name, which must be <code>"monitor"</code>
39: * or <code>"control"</code>.
40: * @throws IllegalArgumentException if <code>name</code> is invalid.
41: */
42: public ManagementPermission(String name) {
43: super (name);
44: if (!"control".equals(name) && !"monitor".equals(name)) {
45: throw new IllegalArgumentException();
46: }
47: }
48:
49: /**
50: * <p>
51: * Constructs and instance with the given name.
52: * </p>
53: *
54: * @param name The permission name, which must be <code>"monitor"</code>
55: * or <code>"control"</code>.
56: * @param actions This is not used, so it must be <code>null</code> or
57: * empty.
58: * @throws IllegalArgumentException if <code>name</code> is invalid.
59: */
60: public ManagementPermission(String name, String actions) {
61: super (name, actions);
62: if (!"control".equals(name) && !"monitor".equals(name)) {
63: throw new IllegalArgumentException();
64: }
65: if (actions != null && actions.length() != 0) {
66: throw new IllegalArgumentException();
67: }
68: }
69: }
|