Top Description Fields Constructors Methods
org.apache.catalina.mbeans

public Class MBeanUtils

extends Object
Class Inheritance
Imports
java.util.Set, javax.management.DynamicMBean, .MBeanException, .MBeanServer, .MalformedObjectNameException, .ObjectName, org.apache.catalina.Container, .Context, .Group, .Loader, .Role, .Server, .User, .UserDatabase, org.apache.catalina.util.ContextName, org.apache.tomcat.util.descriptor.web.ContextEnvironment, .ContextResource, .ContextResourceLink, org.apache.tomcat.util.modeler.ManagedBean, .Registry, org.apache.tomcat.util.res.StringManager

Public utility methods in support of the server side MBeans implementation.
Authors
Craig R. McClanahan, Amy Roh

Field Summary

Modifier and TypeField and Description
private static final String[][]
exceptions

The set of exceptions to the normal rules used by createManagedBean().

private static MBeanServer
mserver

The MBeanServer for this application.

private static Registry
registry

The configuration information registry for our managed beans.

protected static final StringManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
createManagedName(Object
The component for which to create a name
component
)

Create and return the name of the ManagedBean that corresponds to this Catalina component.

public static DynamicMBean

Returns:

a new MBean
createMBean
(ContextEnvironment
The ContextEnvironment to be managed
environment
)

Create, register, and return an MBean for this ContextEnvironment object.

public static DynamicMBean

Returns:

a new MBean
createMBean
(ContextResource
The ContextResource to be managed
resource
)

Create, register, and return an MBean for this ContextResource object.

pack-priv static DynamicMBean

Returns:

a new MBean
createMBean
(Group
The Group to be managed
group
)

Create, register, and return an MBean for this Group object.

pack-priv static DynamicMBean

Returns:

a new MBean
createMBean
(Role
The Role to be managed
role
)

Create, register, and return an MBean for this Role object.

pack-priv static DynamicMBean

Returns:

a new MBean
createMBean
(User
The User to be managed
user
)

Create, register, and return an MBean for this User object.

pack-priv static DynamicMBean

Returns:

a new MBean
createMBean
(UserDatabase
The UserDatabase to be managed
userDatabase
)

Create, register, and return an MBean for this UserDatabase object.

public static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
ContextEnvironment
The ContextEnvironment to be named
environment
)

Create an ObjectName for this Service object.

public static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
ContextResource
The ContextResource to be named
resource
)

Create an ObjectName for this ContextResource object.

pack-priv static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
Group
The Group to be named
group
)

Create an ObjectName for this Group object.

pack-priv static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
Loader
The Loader to be named
loader
)

Create an ObjectName for this Loader object.

pack-priv static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
Role
The Role to be named
role
)

Create an ObjectName for this Role object.

pack-priv static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
User
The User to be named
user
)

Create an ObjectName for this User object.

pack-priv static ObjectName

Returns:

a new object name
createObjectName
(String
Domain in which this name is to be created
domain
,
UserDatabase
The UserDatabase to be named
userDatabase
)

Create an ObjectName for this UserDatabase object.

public static synchronized Registry

Returns:

the singleton registry
createRegistry
()

Create and configure (if necessary) and return the registry of managed object descriptions.

public static synchronized MBeanServer

Returns:

the singleton MBean server
createServer
()

Create and configure (if necessary) and return the MBeanServer with which we will be registering our DynamicMBean implementations.

public static void
destroyMBean(ContextEnvironment
The ContextEnvironment to be managed
environment
)

Deregister the MBean for this ContextEnvironment object.

public static void
destroyMBean(ContextResource
The ContextResource to be managed
resource
)

Deregister the MBean for this ContextResource object.

pack-priv static void
destroyMBean(Group
The Group to be managed
group
)

Deregister the MBean for this Group object.

pack-priv static void
destroyMBean(Role
The Role to be managed
role
)

Deregister the MBean for this Role object.

pack-priv static void
destroyMBean(User
The User to be managed
user
)

Deregister the MBean for this User object.

pack-priv static void
destroyMBeanUserDatabase(String
The UserDatabase to be managed
userDatabase
)

Deregister the MBean for the UserDatabase object with this name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exceptionsback to summary
private static final String[][] exceptions

The set of exceptions to the normal rules used by createManagedBean(). The first element of each pair is a class name, and the second element is the managed bean name.

mserverback to summary
private static MBeanServer mserver

The MBeanServer for this application.

registryback to summary
private static Registry registry

The configuration information registry for our managed beans.

smback to summary
protected static final StringManager sm

Constructor Detail

MBeanUtilsback to summary
public MBeanUtils()

Method Detail

createManagedNameback to summary
pack-priv static String createManagedName(Object component)

Create and return the name of the ManagedBean that corresponds to this Catalina component.

Parameters
component:Object

The component for which to create a name

createMBeanback to summary
public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception

Create, register, and return an MBean for this ContextEnvironment object.

Parameters
environment:ContextEnvironment

The ContextEnvironment to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createMBeanback to summary
public static DynamicMBean createMBean(ContextResource resource) throws Exception

Create, register, and return an MBean for this ContextResource object.

Parameters
resource:ContextResource

The ContextResource to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createMBeanback to summary
pack-priv static DynamicMBean createMBean(Group group) throws Exception

Create, register, and return an MBean for this Group object.

Parameters
group:Group

The Group to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createMBeanback to summary
pack-priv static DynamicMBean createMBean(Role role) throws Exception

Create, register, and return an MBean for this Role object.

Parameters
role:Role

The Role to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createMBeanback to summary
pack-priv static DynamicMBean createMBean(User user) throws Exception

Create, register, and return an MBean for this User object.

Parameters
user:User

The User to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createMBeanback to summary
pack-priv static DynamicMBean createMBean(UserDatabase userDatabase) throws Exception

Create, register, and return an MBean for this UserDatabase object.

Parameters
userDatabase:UserDatabase

The UserDatabase to be managed

Returns:DynamicMBean

a new MBean

Exceptions
Exception:
if an MBean cannot be created or registered
createObjectNameback to summary
public static ObjectName createObjectName(String domain, ContextEnvironment environment) throws MalformedObjectNameException

Create an ObjectName for this Service object.

Parameters
domain:String

Domain in which this name is to be created

environment:ContextEnvironment

The ContextEnvironment to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
public static ObjectName createObjectName(String domain, ContextResource resource) throws MalformedObjectNameException

Create an ObjectName for this ContextResource object.

Parameters
domain:String

Domain in which this name is to be created

resource:ContextResource

The ContextResource to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
pack-priv static ObjectName createObjectName(String domain, Group group) throws MalformedObjectNameException

Create an ObjectName for this Group object.

Parameters
domain:String

Domain in which this name is to be created

group:Group

The Group to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
pack-priv static ObjectName createObjectName(String domain, Loader loader) throws MalformedObjectNameException

Create an ObjectName for this Loader object.

Parameters
domain:String

Domain in which this name is to be created

loader:Loader

The Loader to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
pack-priv static ObjectName createObjectName(String domain, Role role) throws MalformedObjectNameException

Create an ObjectName for this Role object.

Parameters
domain:String

Domain in which this name is to be created

role:Role

The Role to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
pack-priv static ObjectName createObjectName(String domain, User user) throws MalformedObjectNameException

Create an ObjectName for this User object.

Parameters
domain:String

Domain in which this name is to be created

user:User

The User to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createObjectNameback to summary
pack-priv static ObjectName createObjectName(String domain, UserDatabase userDatabase) throws MalformedObjectNameException

Create an ObjectName for this UserDatabase object.

Parameters
domain:String

Domain in which this name is to be created

userDatabase:UserDatabase

The UserDatabase to be named

Returns:ObjectName

a new object name

Exceptions
MalformedObjectNameException:
if a name cannot be created
createRegistryback to summary
public static synchronized Registry createRegistry()

Create and configure (if necessary) and return the registry of managed object descriptions.

Returns:Registry

the singleton registry

createServerback to summary
public static synchronized MBeanServer createServer()

Create and configure (if necessary) and return the MBeanServer with which we will be registering our DynamicMBean implementations.

Returns:MBeanServer

the singleton MBean server

destroyMBeanback to summary
public static void destroyMBean(ContextEnvironment environment) throws Exception

Deregister the MBean for this ContextEnvironment object.

Parameters
environment:ContextEnvironment

The ContextEnvironment to be managed

Exceptions
Exception:
if an MBean cannot be deregistered
destroyMBeanback to summary
public static void destroyMBean(ContextResource resource) throws Exception

Deregister the MBean for this ContextResource object.

Parameters
resource:ContextResource

The ContextResource to be managed

Exceptions
Exception:
if an MBean cannot be deregistered
destroyMBeanback to summary
pack-priv static void destroyMBean(Group group) throws Exception

Deregister the MBean for this Group object.

Parameters
group:Group

The Group to be managed

Exceptions
Exception:
if an MBean cannot be deregistered
destroyMBeanback to summary
pack-priv static void destroyMBean(Role role) throws Exception

Deregister the MBean for this Role object.

Parameters
role:Role

The Role to be managed

Exceptions
Exception:
if an MBean cannot be deregistered
destroyMBeanback to summary
pack-priv static void destroyMBean(User user) throws Exception

Deregister the MBean for this User object.

Parameters
user:User

The User to be managed

Exceptions
Exception:
if an MBean cannot be deregistered
destroyMBeanUserDatabaseback to summary
pack-priv static void destroyMBeanUserDatabase(String userDatabase) throws Exception

Deregister the MBean for the UserDatabase object with this name.

Parameters
userDatabase:String

The UserDatabase to be managed

Exceptions
Exception:
if an MBean cannot be deregistered