Skip navigation links

Oracle Communications Services Gatekeeper Java API Reference
5.0

E21717-02


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

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


public class MBeanManager
extends Object

This is a proxy class for mbean registration

This is example code how to register into 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 does not necessarily have to be so.

This is example code how to unregister 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 object name
static ObjectName constructObjectName(String type, String instanceName)
          Construct objectName
static ObjectName constructObjectName(String type, String instanceName, boolean isApp)
           
static ObjectName constructObjectName(String type, String instanceName, HashMap properties)
          Construct 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 the 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 mbean passes null display name
static void registerMBean(Object mBeanImpl, ObjectName objectName, String displayName)
          Registers mBean with 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 to 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 object name
Parameters:
type -
Returns:
ObjectName
Throws:
MalformedObjectNameException

constructObjectName

public static ObjectName constructObjectName(String type,
                                             String instanceName)
                                      throws MalformedObjectNameException
Construct objectName
Parameters:
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 to 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 objectName
Parameters:
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 to 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 the 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 mbean passes 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 mBean with mbean server
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
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 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 to 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 to 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 to 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 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 to use serviceContext.getName().
Throws:
MBeanRegistrationException
InstanceNotFoundException
MalformedObjectNameException

Skip navigation links

Oracle Communications Services Gatekeeper Java API Reference
5.0

E21717-02


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