Skip navigation links

Oracle Communications Services Gatekeeper Java API Reference
5.1

E37525-01


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

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


public class MBeanManager
extends 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 ObjectName constructObjectName(String type)
          Constructs an objectName.
static ObjectName constructObjectName(String type, String instanceName)
          Constructs an objectName.
static ObjectName constructObjectName(String type, String instanceName, boolean isApp)
           
static ObjectName constructObjectName(String type, String instanceName, HashMap properties)
          Construct an objectName.
static Object executeMBeanOperation(String operationName, Object[] params, String[] signature, String type, String instanceName)
          Execute an MBean operation using the supplied parameters.
static Object getMBeanAttribute(String attribute, String type, String displayName)
          Gets a specific attribute value from an MBean.
static MBeanServer getMBeanServer()
          Returns the MBean server instance after lookup in the JNDI tree.
static HashMap getObjectMap()
           
static void registerMBean(Object mBeanImpl, ObjectName objectName)
          Registers an MBean, passing a null display name.
static void registerMBean(Object mBeanImpl, ObjectName objectName, String displayName)
          Registers an MBean with the MBean server.
static void registerMBean(Object mBeanImpl, String type, String displayName)
          Registers mbean with mbean server
static void registerMBean(Object mBeanImpl, String type, String instanceName, String displayName)
           
static void setMBeanAttribute(String attribute, Object value, String type, String displayName)
          Sets a specific attribute for the MBean.
static void unregister(String type, String displayName)
          Unregisters the MBean from the MBeanServer.
static void unregisterMBean(ObjectName objectName)
          Unregisters the MBean from the MBeanServer.
static void unregisterMBean(String type, 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 ObjectName constructObjectName(String type)
                                      throws MalformedObjectNameException
Constructs an objectName.
Parameters:
type -
Returns:
ObjectName
Throws:
MalformedObjectNameException

constructObjectName

public static ObjectName constructObjectName(String type,
                                             String instanceName)
                                      throws 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. I.e. 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

constructObjectName

public static ObjectName constructObjectName(String type,
                                             String instanceName,
                                             boolean isApp)
                                      throws MalformedObjectNameException
Throws:
MalformedObjectNameException

constructObjectName

public static ObjectName constructObjectName(String type,
                                             String instanceName,
                                             HashMap properties)
                                      throws 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. I.e. 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

executeMBeanOperation

public static Object executeMBeanOperation(String operationName,
                                           Object[] params,
                                           String[] signature,
                                           String type,
                                           String instanceName)
                                    throws InstanceNotFoundException,
                                           MBeanException,
                                           ReflectionException,
                                           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:
InstanceNotFoundException
MBeanException
ReflectionException
MalformedObjectNameException

getMBeanAttribute

public static Object getMBeanAttribute(String attribute,
                                       String type,
                                       String displayName)
                                throws ReflectionException,
                                       InstanceNotFoundException,
                                       MBeanException,
                                       AttributeNotFoundException,
                                       MalformedObjectNameException
Gets a specific attribute value from an MBean.
Parameters:
attribute - The attribute to retreive from the MBean
Returns:
The attribute value
Throws:
ReflectionException
InstanceNotFoundException
MBeanException
AttributeNotFoundException
MalformedObjectNameException

getMBeanServer

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

getObjectMap

public static HashMap getObjectMap()

registerMBean

public static void registerMBean(Object mBeanImpl,
                                 ObjectName objectName)
                          throws NotCompliantMBeanException,
                                 MBeanRegistrationException,
                                 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

registerMBean

public static void registerMBean(Object mBeanImpl,
                                 ObjectName objectName,
                                 String displayName)
                          throws NotCompliantMBeanException,
                                 MBeanRegistrationException,
                                 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

registerMBean

public static void registerMBean(Object mBeanImpl,
                                 String type,
                                 String displayName)
                          throws NotCompliantMBeanException,
                                 MalformedObjectNameException,
                                 MBeanRegistrationException,
                                 InstanceAlreadyExistsException
Registers 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

registerMBean

public static void registerMBean(Object mBeanImpl,
                                 String type,
                                 String instanceName,
                                 String displayName)
                          throws NotCompliantMBeanException,
                                 MalformedObjectNameException,
                                 MBeanRegistrationException,
                                 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. I.e. 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

setMBeanAttribute

public static void setMBeanAttribute(String attribute,
                                     Object value,
                                     String type,
                                     String displayName)
                              throws ReflectionException,
                                     InstanceNotFoundException,
                                     MBeanException,
                                     AttributeNotFoundException,
                                     MalformedObjectNameException,
                                     InvalidAttributeValueException,
                                     NamingException
Sets a specific attribute for the MBean.
Parameters:
attribute - The attribute name to set
value - The value to set
Throws:
ReflectionException
InstanceNotFoundException
MBeanException
AttributeNotFoundException
MalformedObjectNameException
InvalidAttributeValueException
NamingException

unregister

public static void unregister(String type,
                              String displayName)
                       throws MalformedObjectNameException,
                              MBeanRegistrationException,
                              InstanceNotFoundException
Unregisters the MBean from the MBeanServer.
Throws:
MalformedObjectNameException
MBeanRegistrationException
InstanceNotFoundException

unregisterMBean

public static void unregisterMBean(ObjectName objectName)
                            throws MBeanRegistrationException,
                                   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

unregisterMBean

public static void unregisterMBean(String type,
                                   String instanceName)
                            throws MalformedObjectNameException,
                                   MBeanRegistrationException,
                                   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. I.e. 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
MalformedObjectNameException

Skip navigation links

Oracle Communications Services Gatekeeper Java API Reference
5.1

E37525-01


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