The Spring Framework

org.springframework.jmx.export
Class NotificationListenerBean

java.lang.Object
  extended by org.springframework.jmx.export.NotificationListenerBean
All Implemented Interfaces:
InitializingBean

public class NotificationListenerBean
extends Object
implements InitializingBean

Helper class that aggregates a NotificationListener, a NotificationFilter, and an arbitrary handback object.

Also provides support for associating the encapsulated NotificationListener with any number of MBeans from which it wishes to receive Notifications via the mappedObjectNames property.

Since:
2.0
Author:
Rob Harrop, Juergen Hoeller

Constructor Summary
NotificationListenerBean()
          Create a new instance of the NotificationListenerBean class.
NotificationListenerBean(NotificationListener notificationListener)
          Create a new instance of the NotificationListenerBean class.
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 Object getHandback()
          Return the (arbitrary) object that will be 'handed back' as-is by an NotificationBroadcaster when notifying any NotificationListener.
 String[] getMappedObjectNames()
          Return the list of ObjectName String representations for which the encapsulated NotificationFilter will be registered as a listener for Notifications.
 NotificationFilter getNotificationFilter()
          Return the NotificationFilter associated with the encapsulated NotificationFilter.
 NotificationListener getNotificationListener()
          Get the NotificationListener.
 void setHandback(Object handback)
          Set the (arbitrary) object that will be 'handed back' as-is by an NotificationBroadcaster when notifying any NotificationListener.
 void setMappedObjectName(String mappedObjectName)
          Set the ObjectName-style name of the single MBean that the encapsulated NotificationFilter will be registered with to listen for Notifications.
 void setMappedObjectNames(String[] mappedObjectNames)
          Set an array of ObjectName-style names of the MBeans that the encapsulated NotificationFilter will be registered with to listen for Notifications.
 void setNotificationFilter(NotificationFilter notificationFilter)
          Set the NotificationFilter associated with the encapsulated NotificationFilter.
 void setNotificationListener(NotificationListener notificationListener)
          Set the NotificationListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationListenerBean

public NotificationListenerBean()
Create a new instance of the NotificationListenerBean class.


NotificationListenerBean

public NotificationListenerBean(NotificationListener notificationListener)
Create a new instance of the NotificationListenerBean class.

Parameters:
notificationListener - the encapsulated listener
Method Detail

setNotificationListener

public void setNotificationListener(NotificationListener notificationListener)
Set the NotificationListener.

Parameters:
notificationListener - said NotificationListener

getNotificationListener

public NotificationListener getNotificationListener()
Get the NotificationListener.

Returns:
said NotificationListener

setNotificationFilter

public void setNotificationFilter(NotificationFilter notificationFilter)
Set the NotificationFilter associated with the encapsulated NotificationFilter.

May be null.

Parameters:
notificationFilter - said NotificationFilter

getNotificationFilter

public NotificationFilter getNotificationFilter()
Return the NotificationFilter associated with the encapsulated NotificationFilter.

May be null.

Returns:
said NotificationFilter

setHandback

public void setHandback(Object handback)
Set the (arbitrary) object that will be 'handed back' as-is by an NotificationBroadcaster when notifying any NotificationListener.

May be null.

Parameters:
handback - the handback object.
See Also:
NotificationListener.handleNotification(javax.management.Notification, Object)

getHandback

public Object getHandback()
Return the (arbitrary) object that will be 'handed back' as-is by an NotificationBroadcaster when notifying any NotificationListener.

Returns:
the handback object
See Also:
NotificationListener.handleNotification(javax.management.Notification, Object)

setMappedObjectName

public void setMappedObjectName(String mappedObjectName)
Set the ObjectName-style name of the single MBean that the encapsulated NotificationFilter will be registered with to listen for Notifications.


setMappedObjectNames

public void setMappedObjectNames(String[] mappedObjectNames)
Set an array of ObjectName-style names of the MBeans that the encapsulated NotificationFilter will be registered with to listen for Notifications.


getMappedObjectNames

public String[] getMappedObjectNames()
Return the list of ObjectName String representations for which the encapsulated NotificationFilter will be registered as a listener for Notifications.


afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean

The Spring Framework

Copyright © 2002-2007 The Spring Framework.