APIdia Launch Partner
Top Description Fields Constructors Methods
javax.management

public Class MBeanServerPermission

Additional top-level class in compilation unit: MBeanServerPermissionCollection.

extends BasicPermission
Class Inheritance
Annotations
@Deprecated
since:25
forRemoval:true
Imports
java.io.IOException, .ObjectInputStream, java.security.BasicPermission, .Permission, .PermissionCollection, java.util.Collections, .Enumeration, .Set, .StringTokenizer

Deprecated

for removal since 25.

This class was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for this class.

A Permission to perform actions related to MBeanServers. The name of the permission specifies the operation requested or granted by the permission. For a granted permission, it can be * to allow all of the MBeanServer operations specified below. Otherwise, for a granted or requested permission, it must be one of the following:
createMBeanServer
Create a new MBeanServer object using the method MBeanServerFactory#createMBeanServer() or MBeanServerFactory#createMBeanServer(java.lang.String).
findMBeanServer
Find an MBeanServer with a given name, or all MBeanServers in this JVM, using the method MBeanServerFactory#findMBeanServer.
newMBeanServer
Create a new MBeanServer object without keeping a reference to it, using the method MBeanServerFactory#newMBeanServer() or MBeanServerFactory#newMBeanServer(java.lang.String).
releaseMBeanServer
Remove the MBeanServerFactory's reference to an MBeanServer, using the method MBeanServerFactory#releaseMBeanServer.
The name of the permission can also denote a list of one or more comma-separated operations. Spaces are allowed at the beginning and end of the name and before and after commas.

MBeanServerPermission("createMBeanServer") implies MBeanServerPermission("newMBeanServer").

API Note

This permission cannot be used for controlling access to resources as the Security Manager is no longer supported. Consequently this class is deprecated for removal in a future release.

Since
1.5

Field Summary

Modifier and TypeField and Description
private static final int
private static final String[]
private static final int
private static final int
private static final int
private static final int
pack-priv transient int
private static final int
private static final String[]
private static final int
private static final int
private static final int
private static final int
private static final long

Constructor Summary

AccessConstructor and Description
public
MBeanServerPermission(String
the name of the granted permission. It must respect the constraints spelt out in the description of the MBeanServerPermission class.
name
)

Create a new MBeanServerPermission with the given name.

public
MBeanServerPermission(String
the name of the granted permission. It must respect the constraints spelt out in the description of the MBeanServerPermission class.
name
,
String
the associated actions. This parameter is not currently used and must be null or the empty string.
actions
)

Create a new MBeanServerPermission with the given name.

pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the objects are equal.
equals
(Object
the object we are testing for equality with this object.
obj
)

Overrides java.security.BasicPermission.equals.

Checks two MBeanServerPermission objects for equality.

pack-priv static String
getCanonicalName(int mask)

public int
hashCode()

Overrides java.security.BasicPermission.hashCode.

Returns the hash code value for this object.

pack-priv static int
impliedMask(int mask)

public boolean

Returns:

true if the specified permission is implied by this object, false if not.
implies
(Permission
the permission to check against.
p
)

Overrides java.security.BasicPermission.implies.

Checks if this MBeanServerPermission object "implies" the specified permission.

private static String
private static int
public PermissionCollection
newPermissionCollection()

Overrides java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing BasicPermission objects.

private static int
private void
readObject(ObjectInputStream in)

Hides java.security.BasicPermission.readObject.

readObject is called to restore the state of the BasicPermission from a stream.

pack-priv static int
simplifyMask(int mask)

Inherited from java.security.BasicPermission:
getActions

Field Detail

ALL_MASKback to summary
private static final int ALL_MASK
canonicalNamesback to summary
private static final String[] canonicalNames
CREATEback to summary
private static final int CREATE
CREATE_MASKback to summary
private static final int CREATE_MASK
FINDback to summary
private static final int FIND
FIND_MASKback to summary
private static final int FIND_MASK
maskback to summary
pack-priv transient int mask
N_NAMESback to summary
private static final int N_NAMES
namesback to summary
private static final String[] names
NEWback to summary
private static final int NEW
NEW_MASKback to summary
private static final int NEW_MASK
RELEASEback to summary
private static final int RELEASE
RELEASE_MASKback to summary
private static final int RELEASE_MASK
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.BasicPermission.serialVersionUID.

Constructor Detail

MBeanServerPermissionback to summary
public MBeanServerPermission(String name)

Create a new MBeanServerPermission with the given name.

This constructor is equivalent to MBeanServerPermission(name,null).

Parameters
name:String

the name of the granted permission. It must respect the constraints spelt out in the description of the MBeanServerPermission class.

Exceptions
NullPointerException:
if the name is null.
IllegalArgumentException:
if the name is not * or one of the allowed names or a comma-separated list of the allowed names.
MBeanServerPermissionback to summary
public MBeanServerPermission(String name, String actions)

Create a new MBeanServerPermission with the given name.

Parameters
name:String

the name of the granted permission. It must respect the constraints spelt out in the description of the MBeanServerPermission class.

actions:String

the associated actions. This parameter is not currently used and must be null or the empty string.

Exceptions
NullPointerException:
  • if the name is null.
  • if name is null.
IllegalArgumentException:
  • if the name is not * or one of the allowed names or a comma-separated list of the allowed names, or if actions is a non-null non-empty string.
  • if name is empty or if arguments are invalid.
MBeanServerPermissionback to summary
pack-priv MBeanServerPermission(int mask)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.security.BasicPermission.equals.

Checks two MBeanServerPermission objects for equality. Checks that obj is an MBeanServerPermission, and represents the same list of allowable actions as this object.

Parameters
obj:Object

the object we are testing for equality with this object.

Returns:boolean

true if the objects are equal.

getCanonicalNameback to summary
pack-priv static String getCanonicalName(int mask)
hashCodeback to summary
public int hashCode()

Overrides java.security.BasicPermission.hashCode.

Doc from java.security.BasicPermission.hashCode.

Returns the hash code value for this object. The hash code used is the hash code of the name, that is, getName().hashCode(), where getName is from the Permission superclass.

impliedMaskback to summary
pack-priv static int impliedMask(int mask)
impliesback to summary
public boolean implies(Permission p)

Overrides java.security.BasicPermission.implies.

Checks if this MBeanServerPermission object "implies" the specified permission.

More specifically, this method returns true if:

  • p is an instance of MBeanServerPermission,
  • p's target names are a subset of this object's target names

The createMBeanServer permission implies the newMBeanServer permission.

Parameters
p:Permission

the permission to check against.

Returns:boolean

true if the specified permission is implied by this object, false if not.

makeCanonicalNameback to summary
private static String makeCanonicalName(int mask)
nameIndexback to summary
private static int nameIndex(String name) throws IllegalArgumentException
newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.BasicPermission.newPermissionCollection.

Doc from java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing BasicPermission objects.

BasicPermission objects must be stored in a manner that allows them to be inserted in any order, but that also enables the PermissionCollection#implies method to be implemented in an efficient (and consistent) manner.

parseMaskback to summary
private static int parseMask(String name)
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides java.security.BasicPermission.readObject.

Doc from java.security.BasicPermission.readObject.

readObject is called to restore the state of the BasicPermission from a stream.

Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
simplifyMaskback to summary
pack-priv static int simplifyMask(int mask)