javax.management
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 MBeanServerPermission
s,
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 ','
:
createMBeanServer
-- allows a registered
instance of a server to be obtained from the factory.findMBeanServer
-- allows all or one
particular server instance to be retrieved from the factory.newMBeanServer
-- allows an unregistered
instance of a server to be obtained from the factory.releaseMBeanServer
-- allows a reference to
a server instance to be removed from the factory.
The names may be surrounded by arbitrary amounts of whitespace.
createMBeanServer
implies newMBeanServer
.
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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 MBeanServerPermission s as the union
of their capabilities. |
getActions
checkGuard, getName, toString
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:
createMBeanServer
findMBeanServer
newMBeanServer
releaseMBeanServer
Calling this constructor is equivalent to calling
MBeanPermission(name, null)
.
name
- the name of this permission.NullPointerException
- if name
is null
.IllegalArgumentException
- if name
is not either equal to
"*"
or forms
a comma-separated list of
valid constraints.MBeanServerPermission(String,String)
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:
createMBeanServer
findMBeanServer
newMBeanServer
releaseMBeanServer
Calling this constructor is equivalent to calling
MBeanPermission(name, null)
.
name
- the name of this permission.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.MBeanServerPermission(String,String)
public boolean equals(Object obj)
MBeanServerPermission
with the same name.equals
in class BasicPermission
obj
- the object to compare with this one.MBeanPermission
with the same name.Object.hashCode()
public int hashCode()
Permission.getName()
.hashCode
in class BasicPermission
Object.equals(Object)
,
System.identityHashCode(Object)
public boolean implies(Permission p)
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
.implies
in class BasicPermission
p
- the permission to check for implication.p
.public PermissionCollection newPermissionCollection()
PermissionCollection
which stores
a series of MBeanServerPermission
s as the union
of their capabilities.newPermissionCollection
in class BasicPermission
MBeanServerPermission
s.