org.objectweb.jonas.management
Class ReconfigDispatcher

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.objectweb.jonas.management.ReconfigDispatcher
All Implemented Interfaces:
javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ReconfigDispatcherMBean
Direct Known Subclasses:
AbsServiceImpl, J2EEManagedObject, JResource, LogManagement

public class ReconfigDispatcher
extends javax.management.NotificationBroadcasterSupport
implements ReconfigDispatcherMBean

This MBean implementation has to be extended by MBeans associated to reconfigurable JOnAS services and to reconfigurable resources managed by JOnAS (DataSources and MailFactories). These MBeans can add and remove a notification listener, and emit notifications towards this listener. Currently only one listner may register as listener: the ReconfigManager MBean created at the server start-up.

Author:
Adriana Danes Contributor(s):

Field Summary
static java.lang.String RECONFIG_TYPE
          Management notification type for reconfiguration events (notify that the management application made a reconfiguration operation)
static java.lang.String SAVE_RECONFIG_TYPE
          Management notification type for save configuration events (notify that the management application asks for save changes)
 
Constructor Summary
ReconfigDispatcher()
           
 
Method Summary
 void addNotificationListener(javax.management.NotificationListener listner, javax.management.NotificationFilter filter, java.lang.Object handback)
          This method is called by the ReconfigManager.
 javax.management.NotificationFilter getFilter()
          Returns the listner's filter
 java.lang.Object getHandback()
          Returns the listner's handback
 javax.management.NotificationListener getListener()
          Returns the listener reference (the ReconfigManager)
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
          Returns information about management notifications sent by this object
 void initLogger(org.objectweb.util.monolog.api.Logger mylogger)
          Initialize the logger with a Logger provided by the reconfigurable resource or service.
 void removeNotificationListener(javax.management.NotificationListener listner)
          This method is called by the ReconfigManager when it no longer needs to receive management notifications.
 void sendReconfigNotification(long sequenceNumber, java.lang.String resourceName, java.lang.Object userData)
          Send a reconfiguration notification to the registerd listener.
 void sendSaveNotification(long sequenceNumber, java.lang.String resourceName)
          Send a save configuration notification to the registerd listener.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
handleNotification, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECONFIG_TYPE

public static final java.lang.String RECONFIG_TYPE
Management notification type for reconfiguration events (notify that the management application made a reconfiguration operation)

See Also:
Constant Field Values

SAVE_RECONFIG_TYPE

public static final java.lang.String SAVE_RECONFIG_TYPE
Management notification type for save configuration events (notify that the management application asks for save changes)

See Also:
Constant Field Values
Constructor Detail

ReconfigDispatcher

public ReconfigDispatcher()
Method Detail

initLogger

public void initLogger(org.objectweb.util.monolog.api.Logger mylogger)
Initialize the logger with a Logger provided by the reconfigurable resource or service.

Parameters:
mylogger - the logger provided by a sub-class

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listner,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object handback)
                             throws java.lang.IllegalArgumentException
This method is called by the ReconfigManager.

Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Overrides:
addNotificationListener in class javax.management.NotificationBroadcasterSupport
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listner)
                                throws javax.management.ListenerNotFoundException
This method is called by the ReconfigManager when it no longer needs to receive management notifications.

Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Overrides:
removeNotificationListener in class javax.management.NotificationBroadcasterSupport
Throws:
javax.management.ListenerNotFoundException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Returns information about management notifications sent by this object

Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster
Overrides:
getNotificationInfo in class javax.management.NotificationBroadcasterSupport
Returns:
information about management notifications sent by this object

getListener

public javax.management.NotificationListener getListener()
Returns the listener reference (the ReconfigManager)

Returns:
the ReconfigManager reference

getFilter

public javax.management.NotificationFilter getFilter()
Returns the listner's filter

Returns:
the filter object

getHandback

public java.lang.Object getHandback()
Returns the listner's handback

Returns:
the handback object

sendSaveNotification

public void sendSaveNotification(long sequenceNumber,
                                 java.lang.String resourceName)
Send a save configuration notification to the registerd listener. If no listener, then log an error message.

Parameters:
sequenceNumber - notification attribute
resourceName - the name of a reconfigurable resource or of a JOnAS service

sendReconfigNotification

public void sendReconfigNotification(long sequenceNumber,
                                     java.lang.String resourceName,
                                     java.lang.Object userData)
Send a reconfiguration notification to the registerd listener. If no listener, then log an error message.

Parameters:
sequenceNumber - notification attribute
resourceName - the name of a reconfigurable resource or of a JOnAS service
userData - data containing the name and the value of the reconfigured property(or properties)