ch.elca.el4j.services.monitoring.jmx
Class SpringBeanMB

java.lang.Object
  extended by ch.elca.el4j.services.monitoring.jmx.SpringBeanMB
All Implemented Interfaces:
SpringBeanMBMBean

public class SpringBeanMB
extends Object
implements SpringBeanMBMBean

The proxy class for a bean loaded in the ApplicationContext.

Author:
Raphael Boog (RBO), Rashid Waraich (RWA)
File-location:
SpringBeanMB
Last check-in date:
2009-12-01 10:59:54 +0100 (Di, 01. Dez 2009) by jonasha for revision 4010

Field Summary
protected  ApplicationContext m_applicationContext
          The Application Context where this Spring Bean is registered at.
protected  ApplicationContextMB m_applicationContextMB
          The Application Context proxy for the real Application Context.
protected  BeanFactory m_beanFactory
          The Bean Factory belonging to the referenced Application Context.
protected  Class m_class
          The class name of this class.
static String MBEAN_DOMAIN
          The name of the domain of the ObjectName.
static String MBEAN_KEY
          The name of the key of the ObjectName.
static String SPRING_BEAN_DOMAIN
          The domain of the Spring Bean proxy as it will be registered at the MBean Server.
 
Constructor Summary
SpringBeanMB(String name, ApplicationContextMB acMB, ApplicationContext ac, BeanFactory beanFactory, MBeanServer mBeanServer)
          Constructor.
 
Method Summary
 void displayConfiguration(DisplayManager manager)
          Displays the properties this bean was loaded with.
 void displayMethods(DisplayManager manager)
          HTML listing of all methods in this class.
 void displayProperties(DisplayManager manager)
          Display a bean's properties.
 ObjectName getApplicationContextMB()
          Returns the object name of the Application Context proxy.
 String getClassName()
          Returns the class name of the referenced bean.
 String[] getConfiguration()
          Returns the configuration parameter as they have been set in the configuration files loaded by the Application Context.
 String[] getInterceptors()
          Returns the interceptor class names of the referenced bean.
 boolean getIsProxied()
          Returns whether the referenced bean is proxied or not.
 boolean getIsSingleton()
          Returns whether the referenced bean is a Singleton or a Prototype.
 MBeanServer getMBeanServer()
          Getter method for the mBeanServer member variable.
 String[] getMethods()
          
 String getName()
          Getter method for the name member variable.
 ObjectName getObjectName()
          Getter method for the objectName member variable.
 String[] getProperties()
          
 ObjectName[] getRegisteredMBean()
          Returns the corresponding MBeans which are registered at the MBean Server via MBeanExporter.
 String getResourceDescription()
          
 void init()
          Init method.
 String introspect()
           
 String readProperty(String property)
          Try and read a property from this bean.
protected  void registerSpringBean()
          Register this SpringBean at the MBean Server.
 void setObjectName()
          Sets the objectName to of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPRING_BEAN_DOMAIN

public static final String SPRING_BEAN_DOMAIN
The domain of the Spring Bean proxy as it will be registered at the MBean Server.

See Also:
Constant Field Values

MBEAN_DOMAIN

public static final String MBEAN_DOMAIN
The name of the domain of the ObjectName.

See Also:
Constant Field Values

MBEAN_KEY

public static final String MBEAN_KEY
The name of the key of the ObjectName.

See Also:
Constant Field Values

m_applicationContext

protected ApplicationContext m_applicationContext
The Application Context where this Spring Bean is registered at.


m_applicationContextMB

protected ApplicationContextMB m_applicationContextMB
The Application Context proxy for the real Application Context.


m_class

protected Class m_class
The class name of this class.


m_beanFactory

protected BeanFactory m_beanFactory
The Bean Factory belonging to the referenced Application Context.

Constructor Detail

SpringBeanMB

public SpringBeanMB(String name,
                    ApplicationContextMB acMB,
                    ApplicationContext ac,
                    BeanFactory beanFactory,
                    MBeanServer mBeanServer)
Constructor.

Parameters:
name - The bean definition name of this Spring Bean
acMB - The Application Context proxy
ac - The real Application Context
beanFactory - The Bean Factory belonging to this Application Context
mBeanServer - The MBean Server where this Spring Bean is registered at
Method Detail

init

public void init()
          throws BaseException
Init method. Sets up this ApplicationContextMB.

Throws:
BaseException - in case the initialization failed

setObjectName

public void setObjectName()
Sets the objectName to of this object.


getObjectName

public ObjectName getObjectName()
Getter method for the objectName member variable.

Returns:
The objectName

registerSpringBean

protected void registerSpringBean()
                           throws BaseException
Register this SpringBean at the MBean Server.

Throws:
BaseException - in case the registration at the MBean Server failed

getMBeanServer

public MBeanServer getMBeanServer()
Getter method for the mBeanServer member variable.

Returns:
The MBean Server

getName

public String getName()
Getter method for the name member variable.

Specified by:
getName in interface SpringBeanMBMBean
Returns:
Returns the name.

getConfiguration

public String[] getConfiguration()
Returns the configuration parameter as they have been set in the configuration files loaded by the Application Context.

Specified by:
getConfiguration in interface SpringBeanMBMBean
Returns:
Returns the Configuration

getApplicationContextMB

public ObjectName getApplicationContextMB()
Returns the object name of the Application Context proxy.

Specified by:
getApplicationContextMB in interface SpringBeanMBMBean
Returns:
Returns the applicationContextMB.

getRegisteredMBean

public ObjectName[] getRegisteredMBean()
Returns the corresponding MBeans which are registered at the MBean Server via MBeanExporter.

Specified by:
getRegisteredMBean in interface SpringBeanMBMBean
Returns:
Returns the registered MBeans

getClassName

public String getClassName()
Returns the class name of the referenced bean.

Specified by:
getClassName in interface SpringBeanMBMBean
Returns:
Returns the className.

getIsSingleton

public boolean getIsSingleton()
Returns whether the referenced bean is a Singleton or a Prototype.

Specified by:
getIsSingleton in interface SpringBeanMBMBean
Returns:
Returns if the referenced bean is a singleton

getInterceptors

public String[] getInterceptors()
Returns the interceptor class names of the referenced bean.

Specified by:
getInterceptors in interface SpringBeanMBMBean
Returns:
Returns the interceptor class names of the referenced bean.

getIsProxied

public boolean getIsProxied()
Returns whether the referenced bean is proxied or not.

Specified by:
getIsProxied in interface SpringBeanMBMBean
Returns:
Returns whether the referenced bean is proxied or not.

getResourceDescription

public String getResourceDescription()

Specified by:
getResourceDescription in interface SpringBeanMBMBean
Returns:
The location this bean was defined at.

getMethods

public String[] getMethods()

Specified by:
getMethods in interface SpringBeanMBMBean
Returns:
Reflection listing of all methods in this class.

getProperties

public String[] getProperties()

Specified by:
getProperties in interface SpringBeanMBMBean
Returns:
The properties of this bean. If proxied, the target's properties.

readProperty

public String readProperty(String property)
Try and read a property from this bean.

Specified by:
readProperty in interface SpringBeanMBMBean
Parameters:
property - The property to read.
Returns:
If successful, the value of the property, otherwise an error message.

displayProperties

public void displayProperties(DisplayManager manager)
Display a bean's properties.

Parameters:
manager - The DisplayManager to use.

displayConfiguration

public void displayConfiguration(DisplayManager manager)
Displays the properties this bean was loaded with.

Parameters:
manager - The DisplayManager to add to.

introspect

public String introspect()
Specified by:
introspect in interface SpringBeanMBMBean
Returns:
Results of bean introspection on this bean as HTML.

displayMethods

public void displayMethods(DisplayManager manager)
HTML listing of all methods in this class.

Parameters:
manager - The DisplayManager to use.


Copyright © 2005-2011 ELCA. All Rights Reserved.