javax.management
Class MBeanPermission
- Guard, Serializable
Represents the permissions required to perform
operations using the
MBeanServer
. 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
MBeanPermission
s,
implication checks are made using an instance of this class
when a user requests an operation from the server, and a
SecurityManager
is in place.
An
MBeanPermission
consists of four elements,
which all have to match for the permission to be implied.
These are as follows:
- The action. For a required permission,
this is a single value. For a permission held by the user,
this is a list of comma-separated actions (with spaces allowed),
or
*
(representing all actions). getActions()
returns this value. - The class name. For a required permission,
this is the class name of the bean being accessed, if any. If
a bean isn't involved in this action, the value is
null
.
For a permission held by the user, it has one of three values:
- The empty string, implying any class.
*
, also implying any class.- A class name pattern, which may specify a single class
(e.g.
java.lang.Object
) or a series of classes
using the wildcard character *
(e.g.
javax.swing.*
.)
The member. For a required permission,
this is the member of the bean being accessed (an attribute
or operation), if any. If a member of the bean isn't involved
in this action, the value is null
.
For a permission held by the user, it has one of three values:
- The empty string, implying any member.
*
, also implying any member.- The name of a member.
The object name. For a required permission,
this is the ObjectName
of the bean being accessed, if
any. If a bean isn't involved in this action, the value is
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 ObjectName
pattern.
getName()
returns the latter three of these as a
single string:
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:
- addNotificationListener
- getAttribute
- getClassLoader
- getClassLoaderFor
- getClassLoaderRepository
- getDomains
- getMBeanInfo
- getObjectInstance
- instantiate
- invoke
- isInstanceOf
- queryMBeans
- queryNames
- registerMBean
- removeNotificationListener
- setAttribute
- unregisterMBean
boolean | equals(Object obj) - Returns true if the given object is also an
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.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
MBeanPermission
public MBeanPermission(String name,
String actions)
Constructs a new
MBeanPermission
with the specified name
and actions. The name is of the form
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
.
name
- the name of the permission.actions
- the actions associated with this permission.
MBeanPermission
public MBeanPermission(String className,
String member,
ObjectName name,
String actions)
Constructs a new
MBeanPermission
with the specified class name,
member, object name and actions. The name of the permission is created
using the form
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
.
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.name
- the 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.
hashCode
public int hashCode()
Returns the hashcode of the permission as the sum
of the hashcodes of the name and actions.
- hashCode in interface Permission
- the hashcode of the permission.
implies
public boolean implies(Permission p)
Returns true if this permission implies the supplied permission.
This happens if the following holds:
- The supplied permission is an
MBeanPermission
- The supplied permission has either a
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. - The supplied permission has either a
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. - The supplied permission has either a
null
object name
or its object name matches the object name of this permission. If the
object name of this permission is a pattern, ObjectName.apply(ObjectName)
may be used as well. - The supplied permission's actions are a subset of the actions
of this permission. If the
queryMBeans
action is presented,
the queryNames
action is implied.
- implies in interface Permission
p
- the permission to check that this permission implies.
- true if this permission implies
p
.
MBeanPermission.java -- Permissions controlling server access.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.