javax.management
Class MBeanPermission

java.lang.Object
  |
  +--java.security.Permission
        |
        +--javax.management.MBeanPermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable

public class MBeanPermission
extends java.security.Permission

Permission controlling access to MBeanServer operations. If a security manager has been set using System.setSecurityManager(java.lang.SecurityManager), most operations on the MBean Server require that the caller's permissions imply an MBeanPermission appropriate for the operation. This is described in detail in the documentation for the MBeanServer interface.

As with other Permission objects, an MBeanPermission can represent either a permission that you have or a permission that you need. When a sensitive operation is being checked for permission, an MBeanPermission is constructed representing the permission you need. The operation is only allowed if the permissions you have imply the permission you need.

An MBeanPermission contains four items of information:

If you have an MBeanPermission, it allows operations only if all four of the items match.

The class name, member, and object name can be written together as a single string, which is the name of this permission. The name of the permission is the string returned by getName(). The format of the string is:

className#member[objectName]

The object name is written using the usual syntax for ObjectName. It may contain any legal characters, including ]. It is terminated by a ] character that is the last character in the string.

One or more of the className, member, or objectName may be omitted. If the member is omitted, the # may be too (but does not have to be). If the objectName is omitted, the [] may be too (but does not have to be). It is not legal to omit all three items, that is to have a name that is the empty string.

One or more of the className, member, or objectName may be the character "-", which is equivalent to a null value. A null value is implied by any value (including another null value) but does not imply any other value.

The possible action are these:

In a comma-separated list of action, spaces are allowed before and after each action.

Since:
JMX 1.2
Author:
Young Yang
See Also:
Serialized Form

Field Summary
static java.lang.String AddNotificationListener
           
static java.lang.String GetAttribute
           
static java.lang.String GetClassLoader
           
static java.lang.String GetClassLoaderFor
           
static java.lang.String GetClassLoaderRepository
           
static java.lang.String GetDomains
           
static java.lang.String GetMBeanInfo
           
static java.lang.String GetObjectInstance
           
static java.lang.String Instantiate
           
static java.lang.String Invoke
           
static java.lang.String IsInstanceOf
           
static java.lang.String QueryMBeans
           
static java.lang.String QueryNames
           
static java.lang.String RegisterMBean
           
static java.lang.String RemoveNotificationListener
           
static java.lang.String SetAttribute
           
static java.lang.String UnregisterMBean
           
 
Constructor Summary
MBeanPermission(java.lang.String name, java.lang.String action)
          Create a new MBeanPermission object with the specified target name and action.
MBeanPermission(java.lang.String className, java.lang.String member, ObjectName objectName, java.lang.String action)
          Create a new MBeanPermission object with the specified target name (class name, member, object name) and action.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks two MBeanPermission objects for equality.
 java.lang.String getActions()
           
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(java.security.Permission p)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AddNotificationListener

public static final java.lang.String AddNotificationListener
See Also:
Constant Field Values

GetAttribute

public static final java.lang.String GetAttribute
See Also:
Constant Field Values

GetClassLoader

public static final java.lang.String GetClassLoader
See Also:
Constant Field Values

GetClassLoaderFor

public static final java.lang.String GetClassLoaderFor
See Also:
Constant Field Values

GetClassLoaderRepository

public static final java.lang.String GetClassLoaderRepository
See Also:
Constant Field Values

GetDomains

public static final java.lang.String GetDomains
See Also:
Constant Field Values

GetMBeanInfo

public static final java.lang.String GetMBeanInfo
See Also:
Constant Field Values

GetObjectInstance

public static final java.lang.String GetObjectInstance
See Also:
Constant Field Values

Instantiate

public static final java.lang.String Instantiate
See Also:
Constant Field Values

Invoke

public static final java.lang.String Invoke
See Also:
Constant Field Values

IsInstanceOf

public static final java.lang.String IsInstanceOf
See Also:
Constant Field Values

QueryMBeans

public static final java.lang.String QueryMBeans
See Also:
Constant Field Values

QueryNames

public static final java.lang.String QueryNames
See Also:
Constant Field Values

RegisterMBean

public static final java.lang.String RegisterMBean
See Also:
Constant Field Values

RemoveNotificationListener

public static final java.lang.String RemoveNotificationListener
See Also:
Constant Field Values

SetAttribute

public static final java.lang.String SetAttribute
See Also:
Constant Field Values

UnregisterMBean

public static final java.lang.String UnregisterMBean
See Also:
Constant Field Values
Constructor Detail

MBeanPermission

public MBeanPermission(java.lang.String name,
                       java.lang.String action)

Create a new MBeanPermission object with the specified target name and action.

The target name is of the form "className#member[objectName]" where each part is optional. It must not be empty or null.

The action parameter contains a comma-separated list of the desired action granted on the target name. It must not be empty or null.

Parameters:
name - the triplet "className#member[objectName]".
action - the action string.
Throws:
java.lang.IllegalArgumentException - if the name or action is invalid.

MBeanPermission

public MBeanPermission(java.lang.String className,
                       java.lang.String member,
                       ObjectName objectName,
                       java.lang.String action)

Create a new MBeanPermission object with the specified target name (class name, member, object name) and action.

The class name, member and object name parameters define a target name of the form "className#member[objectName]" where each part is optional. This will be the result of Permission.getName() on the resultant MBeanPermission.

The action parameter contains a comma-separated list of the desired action granted on the target name. It must not be empty or null.

Parameters:
className - the class name to which this permission applies. May be null or "-", which represents a class name that is implied by any class name but does not imply any other class name.
member - the member to which this permission applies. May be null or "-", which represents a member that is implied by any member but does not imply any other member.
objectName - the object name to which this permission applies. May be null, which represents an object name that is implied by any object name but does not imply any other object name.
action - the action string.
Method Detail

implies

public boolean implies(java.security.Permission p)
Specified by:
implies in class java.security.Permission

getActions

public java.lang.String getActions()
Specified by:
getActions in class java.security.Permission

hashCode

public int hashCode()
Returns the hash code value for this object.

Specified by:
hashCode in class java.security.Permission
Returns:
a hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Checks two MBeanPermission objects for equality. Checks that obj is an MBeanPermission, and has the same name and actions as this object.

Specified by:
equals in class java.security.Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is an MBeanPermission, and has the same name and actions as this MBeanPermission object.

main

public static void main(java.lang.String[] args)