net.sf.snmpadaptor4j.core
Class JmxListener

java.lang.Object
  extended by net.sf.snmpadaptor4j.core.JmxListener
All Implemented Interfaces:
EventListener, NotificationListener

public class JmxListener
extends Object
implements NotificationListener

Object designed to respond to each registration or deregistration of MBeans.

Author:
Jean-Philippe MINETTI

Field Summary
protected  org.apache.log4j.Logger logger
          Logger.
 
Constructor Summary
  JmxListener(JmxSnmpMib jmxSnmpMib, JmxNotificationManager jmxNotificationManager, SnmpAppContext mainAppContext, Map<ClassLoader,SnmpAppContext> appContextMap, boolean classLoaderScope)
          Constructor.
protected JmxListener(JmxSnmpMib jmxSnmpMib, JmxNotificationManager jmxNotificationManager, SnmpAppContext mainAppContext, Map<ClassLoader,SnmpAppContext> appContextMap, boolean classLoaderScope, MBeanServer jmxServer)
          Constructor (used for tests).
 
Method Summary
 void close()
          Closes the connection with the JMX agent.
protected  MBeanServer getJmxServer()
          Returns the JMX agent.
 void handleNotification(Notification notification, Object handback)
           
 void open(MBeanServer server)
          Opens the connection with the JMX agent.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final org.apache.log4j.Logger logger
Logger.

Constructor Detail

JmxListener

public JmxListener(JmxSnmpMib jmxSnmpMib,
                   JmxNotificationManager jmxNotificationManager,
                   SnmpAppContext mainAppContext,
                   Map<ClassLoader,SnmpAppContext> appContextMap,
                   boolean classLoaderScope)
Constructor.

Parameters:
jmxSnmpMib - Management Information Base (MIB) for access to JMX attributes (must not be NULL).
jmxNotificationManager - Manager of JMX notifications (must not be NULL).
mainAppContext - Context of main application (must not be NULL).
appContextMap - Application context map (must not be NULL).
classLoaderScope - TRUE for handle only MBeans created by the same ClassLoader that the SNMP adapter. FALSE for handle all MBeans of the JVM.

JmxListener

protected JmxListener(JmxSnmpMib jmxSnmpMib,
                      JmxNotificationManager jmxNotificationManager,
                      SnmpAppContext mainAppContext,
                      Map<ClassLoader,SnmpAppContext> appContextMap,
                      boolean classLoaderScope,
                      MBeanServer jmxServer)
Constructor (used for tests).

Parameters:
jmxSnmpMib - Management Information Base (MIB) for access to JMX attributes (must not be NULL).
jmxNotificationManager - Manager of JMX notifications.
mainAppContext - Context of main application (must not be NULL).
appContextMap - Application context map (must not be NULL).
classLoaderScope - TRUE for handle only MBeans created by the same ClassLoader that the SNMP adapter. FALSE for handle all MBeans of the JVM.
jmxServer - JMX agent.
Method Detail

getJmxServer

protected final MBeanServer getJmxServer()
Returns the JMX agent.

Returns:
JMX agent.

open

public void open(MBeanServer server)
          throws Exception
Opens the connection with the JMX agent.

Parameters:
server - JMX agent.
Throws:
Exception - Exception if an error occurred.

close

public void close()
           throws Exception
Closes the connection with the JMX agent.

Throws:
Exception - Exception if an error occurred.

handleNotification

public final void handleNotification(Notification notification,
                                     Object handback)
Specified by:
handleNotification in interface NotificationListener

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2012-2013 snmpAdaptor4j. All Rights Reserved.