Oracle Communications Services Gatekeeper Java API Reference
7.0.0.1

E96578-01

com.bea.wlcp.wlng.api.management
Class MBeanManager

java.lang.Object
  extended bycom.bea.wlcp.wlng.api.management.MBeanManager

public class MBeanManager
extends java.lang.Object

Proxy class for MBean registration.

This example shows how to register an MBean with the MBean manager:

mbean = new MyMBeanImpl(); MBeanManager.registerMBean(mbean, MyMBean.class.getName(), serviceContext.getName(), serviceContext.getName());

Note: The instanceName and the displayName in the example above are the same, but that doesn't have to be the case.

This example shows how to unregister an MBean from the MBean manager:

MBeanManager.unregisterMBean(MyMBean.class.getName(), serviceContext.getName());

Note: The service context is retrieved from the setServiceContext in the ServiceDeployable implementation class. When using AbstractManagedPlugin it is possible to retrieve the serviceContext through the protected variable svcCtx.


Constructor Summary
MBeanManager()
          Public constructor.
 
Method Summary
static javax.management.ObjectName constructObjectName(java.lang.String type)
          Constructs an objectName.
static javax.management.ObjectName constructObjectName(java.lang.String type, java.lang.String instanceName)
          Constructs an objectName.
static javax.management.ObjectName constructObjectName(java.lang.String type, java.lang.String instanceName, boolean isApp)
           
static javax.management.ObjectName constructObjectName(java.lang.String type, java.lang.String instanceName, java.util.HashMap properties)
          Construct an objectName.
static java.lang.Object executeMBeanOperation(java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature, java.lang.String type, java.lang.String instanceName)
          Execute an MBean operation using the supplied parameters.
static java.lang.Object getMBeanAttribute(java.lang.String attribute, java.lang.String type, java.lang.String displayName)
          Gets a specific attribute value from an MBean.
static javax.management.MBeanServer getMBeanServer()
          Returns the MBean server instance after lookup in the JNDI tree.
static java.util.HashMap getObjectMap()
           
static void registerMBean(java.lang.Object mBeanImpl, javax.management.ObjectName objectName)
          Registers an MBean, passing a null display name.
static void registerMBean(java.lang.Object mBeanImpl, javax.management.ObjectName objectName, java.lang.String displayName)
          Registers an MBean with the MBean server.
static void registerMBean(java.lang.Object mBeanImpl, java.lang.String type, java.lang.String displayName)
          Registers the MBean with MBean server
static void registerMBean(java.lang.Object mBeanImpl, java.lang.String type, java.lang.String instanceName, java.lang.String displayName)
           
static void setMBeanAttribute(java.lang.String attribute, java.lang.Object value, java.lang.String type, java.lang.String displayName)
          Sets a specific attribute for the MBean.
static void unregister(java.lang.String type, java.lang.String displayName)
          Unregisters the MBean from the MBeanServer.
static void unregisterMBean(javax.management.ObjectName objectName)
          Unregisters the MBean from the MBeanServer.
static void unregisterMBean(java.lang.String type, java.lang.String instanceName)
          Unregisters the MBean from the MBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanManager

public MBeanManager()
Public constructor.

Method Detail

constructObjectName

public static javax.management.ObjectName constructObjectName(java.lang.String type)
                                                       throws javax.management.MalformedObjectNameException
Constructs an objectName.

Parameters:
type - type.
Returns:
ObjectName.
Throws:
MalformedObjectNameException.
javax.management.MalformedObjectNameException

constructObjectName

public static javax.management.ObjectName constructObjectName(java.lang.String type,
                                                              java.lang.String instanceName)
                                                       throws javax.management.MalformedObjectNameException
Constructs an objectName.

Parameters:
type - The fully qualified name of the management bean (use class.getName where the class is your MBean class).
instanceName - The unique name of the management bean. For example, if this is a plug-in that will ever be used on the same machine with multiple plug-ins this should be unique per plug-in instance. In the case of a plug-in or service you should use managedPlugin.getId().
Returns:
ObjectName in string format.
Throws:
MalformedObjectNameException.
javax.management.MalformedObjectNameException

constructObjectName

public static javax.management.ObjectName constructObjectName(java.lang.String type,
                                                              java.lang.String instanceName,
                                                              boolean isApp)
                                                       throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException

constructObjectName

public static javax.management.ObjectName constructObjectName(java.lang.String type,
                                                              java.lang.String instanceName,
                                                              java.util.HashMap properties)
                                                       throws javax.management.MalformedObjectNameException
Construct an objectName.

Parameters:
type - The fully qualified name of the management bean (use class.getName where the class is your MBean class).
instanceName - The unique name of the management bean. For example, if this is a plug-in that will ever be used on the same machine with multiple plug-ins this should be unique per plug-in instance. In the case of a plug-in or service you should use managedPlugin.getId().
properties - HashMap that contains objectNamekey and value pairs ObjectNameConstants class has set of constants that can be used as keys.
Returns:
ObjectName in string format.
Throws:
MalformedObjectNameException.
javax.management.MalformedObjectNameException

executeMBeanOperation

public static java.lang.Object executeMBeanOperation(java.lang.String operationName,
                                                     java.lang.Object[] params,
                                                     java.lang.String[] signature,
                                                     java.lang.String type,
                                                     java.lang.String instanceName)
                                              throws javax.management.InstanceNotFoundException,
                                                     javax.management.MBeanException,
                                                     javax.management.ReflectionException,
                                                     javax.management.MalformedObjectNameException
Execute an MBean operation using the supplied parameters.

Parameters:
operationName - The operation to execute.
params - The operation input paramters.
signature - The operation signature.
type - MBean type.
instanceName - MBean instance name (ServiceContext.getName()).
Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.ReflectionException
javax.management.MalformedObjectNameException

getMBeanAttribute

public static java.lang.Object getMBeanAttribute(java.lang.String attribute,
                                                 java.lang.String type,
                                                 java.lang.String displayName)
                                          throws javax.management.ReflectionException,
                                                 javax.management.InstanceNotFoundException,
                                                 javax.management.MBeanException,
                                                 javax.management.AttributeNotFoundException,
                                                 javax.management.MalformedObjectNameException
Gets a specific attribute value from an MBean.

Parameters:
attribute - The attribute to retreive from the MBean.
Returns:
The attribute value.
Throws:
javax.management.ReflectionException
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.MalformedObjectNameException

getMBeanServer

public static javax.management.MBeanServer getMBeanServer()
Returns the MBean server instance after lookup in the JNDI tree.

Returns:
The MBean server instance.

getObjectMap

public static java.util.HashMap getObjectMap()

registerMBean

public static void registerMBean(java.lang.Object mBeanImpl,
                                 javax.management.ObjectName objectName)
                          throws javax.management.NotCompliantMBeanException,
                                 javax.management.MBeanRegistrationException,
                                 javax.management.InstanceAlreadyExistsException
Registers an MBean, passing a null display name.

Parameters:
mBeanImpl - Management bean object that should be registered.
objectName - The objectName what will be used to register the the MBean with the MBean server.
Throws:
NotCompliantMBeanException.
MBeanRegistrationException.
InstanceAlreadyExistsException.
javax.management.NotCompliantMBeanException
javax.management.MBeanRegistrationException
javax.management.InstanceAlreadyExistsException

registerMBean

public static void registerMBean(java.lang.Object mBeanImpl,
                                 javax.management.ObjectName objectName,
                                 java.lang.String displayName)
                          throws javax.management.NotCompliantMBeanException,
                                 javax.management.MBeanRegistrationException,
                                 javax.management.InstanceAlreadyExistsException
Registers an MBean with the MBean server.

Parameters:
mBeanImpl - Management bean object that should be registered.
objectName - The objectName that will be used to register the the MBean with the mbean server.
displayName - The display name of the management bean that will be shown in the console.
Throws:
NotCompliantMBeanException.
MBeanRegistrationException.
InstanceAlreadyExistsException.
javax.management.NotCompliantMBeanException
javax.management.MBeanRegistrationException
javax.management.InstanceAlreadyExistsException

registerMBean

public static void registerMBean(java.lang.Object mBeanImpl,
                                 java.lang.String type,
                                 java.lang.String displayName)
                          throws javax.management.NotCompliantMBeanException,
                                 javax.management.MalformedObjectNameException,
                                 javax.management.MBeanRegistrationException,
                                 javax.management.InstanceAlreadyExistsException
Registers the MBean with MBean server

Parameters:
mBeanImpl - Management bean object that should be registered.
type - The fully qualified name of the management bean (use class.getName where the class is your MBean class).
displayName - The displayed name of the management bean. If this is a plug-in that will ever be used on the same machine with multiple plug-ins this should be unique per plug-in instance. In the case of a plug-in or service it is recommended that you use managedPlugin.getId().
Throws:
NotCompliantMBeanException.
MalformedObjectNameException.
MBeanRegistrationException.
InstanceAlreadyExistsException.
javax.management.NotCompliantMBeanException
javax.management.MalformedObjectNameException
javax.management.MBeanRegistrationException
javax.management.InstanceAlreadyExistsException

registerMBean

public static void registerMBean(java.lang.Object mBeanImpl,
                                 java.lang.String type,
                                 java.lang.String instanceName,
                                 java.lang.String displayName)
                          throws javax.management.NotCompliantMBeanException,
                                 javax.management.MalformedObjectNameException,
                                 javax.management.MBeanRegistrationException,
                                 javax.management.InstanceAlreadyExistsException
Parameters:
mBeanImpl - Management bean object that should be registered.
type - The fully qualified name of the management bean (use class.getName where class is your mbean class).
instanceName - The unique name of the management bean. For example, if this is a plug-in that will ever be used on the same machine with multiple plug-ins this should be unique per plug-in instance. In the case of a plug-in or service it is recommended that you use managedPlugin.getId().
displayName - The display name of the management bean that will be shown in the console. Should be a unique value per plug-in instance. managedPlugin.getId() is recommended here as well.
Throws:
NotCompliantMBeanException.
MalformedObjectNameException.
MBeanRegistrationException.
InstanceAlreadyExistsException.
javax.management.NotCompliantMBeanException
javax.management.MalformedObjectNameException
javax.management.MBeanRegistrationException
javax.management.InstanceAlreadyExistsException

setMBeanAttribute

public static void setMBeanAttribute(java.lang.String attribute,
                                     java.lang.Object value,
                                     java.lang.String type,
                                     java.lang.String displayName)
                              throws javax.management.ReflectionException,
                                     javax.management.InstanceNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.AttributeNotFoundException,
                                     javax.management.MalformedObjectNameException,
                                     javax.management.InvalidAttributeValueException,
                                     javax.naming.NamingException
Sets a specific attribute for the MBean.

Parameters:
attribute - The attribute name to set.
value - The value to set.
Throws:
javax.management.ReflectionException
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.MalformedObjectNameException
javax.management.InvalidAttributeValueException
javax.naming.NamingException

unregister

public static void unregister(java.lang.String type,
                              java.lang.String displayName)
                       throws javax.management.MalformedObjectNameException,
                              javax.management.MBeanRegistrationException,
                              javax.management.InstanceNotFoundException
Unregisters the MBean from the MBeanServer.

Throws:
javax.management.MalformedObjectNameException
javax.management.MBeanRegistrationException
javax.management.InstanceNotFoundException

unregisterMBean

public static void unregisterMBean(javax.management.ObjectName objectName)
                            throws javax.management.MBeanRegistrationException,
                                   javax.management.InstanceNotFoundException
Unregisters the MBean from the MBeanServer.

Parameters:
objectName - The objectName that was used to register the the MBean with the MBean server.
Throws:
MBeanRegistrationException.
InstanceNotFoundException.
javax.management.MBeanRegistrationException
javax.management.InstanceNotFoundException

unregisterMBean

public static void unregisterMBean(java.lang.String type,
                                   java.lang.String instanceName)
                            throws javax.management.MalformedObjectNameException,
                                   javax.management.MBeanRegistrationException,
                                   javax.management.InstanceNotFoundException
Unregisters the MBean from the MBeanServer

Parameters:
type - The fully qualified name of the management bean (use class.getName where the class is your MBean class).
instanceName - The unique name of the management bean. For example, if this is a plug-in that will ever be used on the same machine with multiple plug-ins this should be unique per plug-in instance. In the case of a plug-in or service you should use serviceContext.getName().
Throws:
MBeanRegistrationException.
InstanceNotFoundException.
javax.management.MalformedObjectNameException
javax.management.MBeanRegistrationException
javax.management.InstanceNotFoundException

Oracle Communications Services Gatekeeper Java API Reference
7.0.0.1

E96578-01

Copyright © 2008, 2018, Oracle and/or its affiliates. All rights reserved.