javax.management
Class MBeanServerPermission

java.lang.Object
  extended by java.security.Permission
      extended by java.security.BasicPermission
          extended by javax.management.MBeanServerPermission
All Implemented Interfaces:
Serializable, Guard

public class MBeanServerPermission
extends BasicPermission

Represents the permissions required to perform operations provided by the MBeanServerFactory. As with all 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 MBeanServerPermissions, implication checks are made using an instance of this class when a user requests an operation from the factory, and a 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
See Also:
Serialized Form

Constructor Summary
MBeanServerPermission(String name)
           Constructs a new MBeanServerPermission with the given name.
MBeanServerPermission(String name, String actions)
           Constructs a new MBeanServerPermission with the given name and actions.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the given object is also an MBeanServerPermission with the same name.
 int hashCode()
          Returns a unique hash code for this permission.
 boolean implies(Permission p)
          Returns true if this MBeanServerPermission implies the given permission.
 PermissionCollection newPermissionCollection()
          Returns a PermissionCollection which stores a series of MBeanServerPermissions as the union of their capabilities.
 
Methods inherited from class java.security.BasicPermission
getActions
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MBeanServerPermission

public MBeanServerPermission(String name)

Constructs a new 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(String,String)

MBeanServerPermission

public MBeanServerPermission(String name,
                             String actions)

Constructs a new 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(String,String)
Method Detail

equals

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

Overrides:
equals in class BasicPermission
Parameters:
obj - the object to compare with this one.
Returns:
true if the object is an MBeanPermission with the same name.
See Also:
Object.hashCode()

hashCode

public int hashCode()
Returns a unique hash code for this permission. This is simply the hashcode of Permission.getName().

Overrides:
hashCode in class BasicPermission
Returns:
the hashcode of this permission.
See Also:
Object.equals(Object), System.identityHashCode(Object)

implies

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

Overrides:
implies in class BasicPermission
Parameters:
p - the permission to check for implication.
Returns:
true if this permission implies p.

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a PermissionCollection which stores a series of MBeanServerPermissions as the union of their capabilities.

Overrides:
newPermissionCollection in class BasicPermission
Returns:
a collection for MBeanServerPermissions.