javax.management
public class MBeanPermission extends Permission
Represents the permissions required to perform operations using the {@link MBeanServer}. 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 MBeanPermission}s, implication checks are made using an instance of this class when a user requests an operation from the server, and a {@link SecurityManager} is in place.
An {@link MBeanPermission} consists of four elements, which all have to match for the permission to be implied. These are as follows:
*
(representing all actions). {@link #getActions()}
returns this value.null
.
For a permission held by the user, it has one of three values:
*
, also implying any class.java.lang.Object
) or a series of classes
using the wildcard character *
(e.g.
javax.swing.*
.)null
.
For a permission held by the user, it has one of three values:
*
, also implying any member.null
. The name may not be a pattern.
For a permission held by the user, it may be the empty
string (allowing everything) or an {@link ObjectName}
pattern.
className#member[objectName]
where ""
is disallowed, as, although any of
the elements may be omitted, not all of them should be
left out simultaneously. "-"
is used to
represent null
. When this occurs in a
required permission, anything may match it. When this
forms part of a permission held by the user, it only
matches another null
value.
The list of valid actions is as follows:
Since: 1.5
Constructor Summary | |
---|---|
MBeanPermission(String name, String actions)
Constructs a new {@link MBeanPermission} with the specified name
and actions. | |
MBeanPermission(String className, String member, ObjectName name, String actions)
Constructs a new {@link MBeanPermission} with the specified class name,
member, object name and actions. |
Method Summary | |
---|---|
boolean | equals(Object obj)
Returns true if the given object is also an {@link MBeanPermission}
with the same name and actions.
|
String | getActions()
Returns the list of actions in alphabetical order.
|
int | hashCode()
Returns the hashcode of the permission as the sum
of the hashcodes of the name and actions.
|
boolean | implies(Permission p) Returns true if this permission implies the supplied permission. |
className#member[objectName]
,
where each element is optional, but a completely empty or null
name is disallowed. Actions are specified as a comma-separated list
and may also not be empty or null
.
Parameters: name the name of the permission. actions the actions associated with this permission.
Throws: IllegalArgumentException if the name or actions are invalid.
className#member[objectName]
,
where each element is optional, but an empty or null
name is disallowed. Actions are specified as a comma-separated list
and may also not be empty or null
.
Parameters: className the name of the class to which this permission applies,
or either null
or "-"
for a
value which may be implied by any class name, but not
imply any class name itself. member the member of the class to which this permission applies,
or either null
or "-"
for a
value which may be implied by any member, but not
imply any member itself. objectName the {@link ObjectName} to which this permission applies,
or null
for a value which may be implied by
any object name, but not imply any object name itself. actions the actions associated with this permission.
Parameters: obj the object to test.
Returns: true if the object is an {@link MBeanPermission} with the same name and actions.
Returns: the list of actions.
Returns: the hashcode of the permission.
Returns true if this permission implies the supplied permission. This happens if the following holds:
null
classname
or its classname matches the classname of this permission. A
classname of "*"
for this permission always matches
the classname of the supplied permission. Generally, '*'
acts as a wildcard, so ".*"
matches '.'
followed by anything.null
member
or its member matches the member of this permission. A member of
"*"
for this permission always matches the member
of the supplied permission.null
object name
or its object name matches the object name of this permission. If the
object name of this permission is a pattern, {@link ObjectName#apply(ObjectName)}
may be used as well.queryMBeans
action is presented,
the queryNames
action is implied.Parameters: p the permission to check that this permission implies.
Returns: true if this permission implies p
.