com.j256.simplejmx.spring
Class JmxBean

java.lang.Object
  extended by com.j256.simplejmx.spring.JmxBean

public class JmxBean
extends Object

With this bean, which is auto-detect by the BeanPublisher, you can configure in Spring a JMX bean for an object that does not use the JmxResource annotation or JmxSelfNaming interface.

For example:

 <!-- some random bean defined in your spring files -->
 <bean id="someBean" class="your.domain.SomeBean">
    ...
 </bean>
 
 <!-- publish information about that bean via JMX -->
 <bean id="jmxServerJmx" class="com.j256.simplejmx.spring.JmxBean">
    <!-- helps build the ObjectName -->
    <property name="jmxResourceInfo">
       <bean class="com.j256.simplejmx.common.JmxResourceInfo">
          <property name="jmxDomainName" value="your.domain" />
          <property name="jmxBeanName" value="SomeBean" />
       </bean>
    </property>
    <!-- defines the fields that are exposed for JMX -->
    <property name="attributeFieldInfos">
       <array>
          <bean class="com.j256.simplejmx.common.JmxAttributeFieldInfo">
             <property name="name" value="someCounter" />
          </bean>
       </array>
    </property>
    <!-- defines the get/is/set methods exposed -->
    <property name="attributeMethodInfos">
       <array>
          <bean class="com.j256.simplejmx.common.JmxAttributeMethodInfo">
             <property name="methodName" value="getSomeValue" />
          </bean>
       </array>
    </property>
    <!-- defines the operations (i.e. non get/is/set) methods exposed -->
    <property name="operationInfos">
       <array>
          <bean class="com.j256.simplejmx.common.JmxOperationInfo">
             <property name="methodName" value="someMethod" />
          </bean>
       </array>
    </property>
    <property name="target" ref="jmxServer" />
 </bean>
 

Author:
graywatson

Constructor Summary
JmxBean()
           
 
Method Summary
 JmxAttributeFieldInfo[] getAttributeFieldInfos()
           
 JmxAttributeMethodInfo[] getAttributeMethodInfos()
           
 JmxResourceInfo getJmxResourceInfo()
           
 JmxOperationInfo[] getOperationInfos()
           
 Object getTarget()
           
 void setAttributeFieldInfos(JmxAttributeFieldInfo[] attributeFieldInfos)
          Optional setting which defines the fields to be exposed as attribute via JMX.
 void setAttributeMethodInfos(JmxAttributeMethodInfo[] attributeMethodInfos)
          Optional setting which defines the methods (get/is/set...) to be exposed as attributes via JMX.
 void setJmxResourceInfo(JmxResourceInfo jmxResourceInfo)
          Required resource information which helps to make the ObjectName for the bean that we are exposing via JMX.
 void setOperationInfos(JmxOperationInfo[] operationInfos)
          Optional setting which defines the additional methods (not get/is/set...) to be exposed as operations via JMX.
 void setTarget(Object target)
          Required target object which specifies the Spring bean that we are exposing via JMX.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxBean

public JmxBean()
Method Detail

getJmxResourceInfo

public JmxResourceInfo getJmxResourceInfo()

setJmxResourceInfo

public void setJmxResourceInfo(JmxResourceInfo jmxResourceInfo)
Required resource information which helps to make the ObjectName for the bean that we are exposing via JMX.


getAttributeFieldInfos

public JmxAttributeFieldInfo[] getAttributeFieldInfos()

setAttributeFieldInfos

public void setAttributeFieldInfos(JmxAttributeFieldInfo[] attributeFieldInfos)
Optional setting which defines the fields to be exposed as attribute via JMX.


getAttributeMethodInfos

public JmxAttributeMethodInfo[] getAttributeMethodInfos()

setAttributeMethodInfos

public void setAttributeMethodInfos(JmxAttributeMethodInfo[] attributeMethodInfos)
Optional setting which defines the methods (get/is/set...) to be exposed as attributes via JMX.


getOperationInfos

public JmxOperationInfo[] getOperationInfos()

setOperationInfos

public void setOperationInfos(JmxOperationInfo[] operationInfos)
Optional setting which defines the additional methods (not get/is/set...) to be exposed as operations via JMX.


getTarget

public Object getTarget()

setTarget

public void setTarget(Object target)
Required target object which specifies the Spring bean that we are exposing via JMX.



This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.