javax.management

Class MBeanServerPermission

public class MBeanServerPermission extends BasicPermission

Represents the permissions required to perform operations provided by the {@link MBeanServerFactory}. As with all {@link java.security.Permission} objects, an instance of this class either represents a permission already held or one that is required to access a particular service. In the case of {@link MBeanServerPermission}s, implication checks are made using an instance of this class when a user requests an operation from the factory, and a {@link SecurityManager} is in place.

The permission is defined by its name, which may be either a '*' (to allow all) or one or more of the following, separated by a ',':

The names may be surrounded by arbitrary amounts of whitespace. createMBeanServer implies newMBeanServer.

Since: 1.5

Constructor Summary
MBeanServerPermission(String name)

Constructs a new {@link MBeanServerPermission} with the given name.

MBeanServerPermission(String name, String actions)

Constructs a new {@link MBeanServerPermission} with the given name and actions.

Method Summary
booleanequals(Object obj)
Returns true if the given object is also an {@link MBeanServerPermission} with the same name.
inthashCode()
Returns a unique hash code for this permission.
booleanimplies(Permission p)
Returns true if this {@link MBeanServerPermission} implies the given permission.
PermissionCollectionnewPermissionCollection()
Returns a {@link PermissionCollection} which stores a series of {@link MBeanServerPermission}s as the union of their capabilities.

Constructor Detail

MBeanServerPermission

public MBeanServerPermission(String name)

Constructs a new {@link MBeanServerPermission} with the given name. The name must not be null and must be equal to either "*" or a comma-separated list of valid permissions. The four valid constraints are:

  1. createMBeanServer
  2. findMBeanServer
  3. newMBeanServer
  4. releaseMBeanServer

Calling this constructor is equivalent to calling MBeanPermission(name, null).

Parameters: name the name of this permission.

Throws: NullPointerException if name is null. IllegalArgumentException if name is not either equal to "*" or forms a comma-separated list of valid constraints.

See Also: MBeanServerPermission

MBeanServerPermission

public MBeanServerPermission(String name, String actions)

Constructs a new {@link MBeanServerPermission} with the given name and actions. The actions are unused, and must be either null or the empty string. The name must not be null and must be equal to either "*" or a comma-separated list of valid permissions. The four valid constraints are:

  1. createMBeanServer
  2. findMBeanServer
  3. newMBeanServer
  4. releaseMBeanServer

Calling this constructor is equivalent to calling MBeanPermission(name, null).

Parameters: name the name of this permission.

Throws: NullPointerException if name is null. IllegalArgumentException if name is not either equal to "*" or forms a comma-separated list of valid constraints, or if actions is not null or the empty string.

See Also: MBeanServerPermission

Method Detail

equals

public boolean equals(Object obj)
Returns true if the given object is also an {@link MBeanServerPermission} with the same name.

Parameters: obj the object to compare with this one.

Returns: true if the object is an {@link MBeanPermission} with the same name.

hashCode

public int hashCode()
Returns a unique hash code for this permission. This is simply the hashcode of {@link BasicPermission#getName()}.

Returns: the hashcode of this permission.

implies

public boolean implies(Permission p)
Returns true if this {@link MBeanServerPermission} implies the given permission. This occurs if the given permission is also an {@link MBeanServerPermission} and its target names are a subset of the target names of this permission. Note that the name createMBeanServer implies newMBeanServer.

Parameters: p the permission to check for implication.

Returns: true if this permission implies p.

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a {@link PermissionCollection} which stores a series of {@link MBeanServerPermission}s as the union of their capabilities.

Returns: a collection for {@link MBeanServerPermission}s.