01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management;
10:
11: import java.security.BasicPermission;
12:
13: /**
14: * Permission that MBean class must have in order to be trusted. <p>
15: * Only MBeans whose codesource has this permission can be registered in the MBeanServer.
16: * This permission is composed by a target name, whose only valid value are
17: * <code>register</code> and the wildcard <code>*</code>.
18: * The actions are ignored.
19: *
20: * @version $Revision: 1.5 $
21: */
22: public class MBeanTrustPermission extends BasicPermission {
23: private static final long serialVersionUID = 0xd707c1ae24fd55e4L;
24:
25: /**
26: * Creates a new MBeanTrustPermission with the specified target name and no actions
27: *
28: * @param name Can only be "register" or "*"
29: */
30: public MBeanTrustPermission(String name) {
31: this (name, null);
32: }
33:
34: /**
35: * Creates a new MBeanTrustPermission with the specified target name and actions, but the actions will be ignored
36: *
37: * @param name Can only be "register" or "*"
38: * @param actions Ignored
39: */
40: public MBeanTrustPermission(String name, String actions) {
41: super (name, actions);
42: if (!"register".equals(name) && !"*".equals(name))
43: throw new IllegalArgumentException(
44: "Target name must be 'register' or '*' not '"
45: + name + "'");
46: }
47: }
|