mx4j.log
Class LoggerBroadcaster

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended bymx4j.log.LoggerBroadcaster
All Implemented Interfaces:
LoggerBroadcasterMBean, MBeanRegistration, NotificationBroadcaster

public class LoggerBroadcaster
extends NotificationBroadcasterSupport
implements MBeanRegistration, LoggerBroadcasterMBean

This broadcaster MBean allows to redirect MX4J internal logging to registered JMX listeners.

Simply register this MBean in the MBeanServer, register one or more listener (eventually with filters on the notification type), then call (directly or through MBeanServer) one of the start operations. From this moment, MX4J internal logging is redirected to this MBean, and from here to all registered listeners, basing on their filters.

Version:
$Revision: 1.5 $
Author:
Simone Bordet

Nested Class Summary
static class LoggerBroadcaster.LoggerNotifier
           
 
Constructor Summary
LoggerBroadcaster()
           
 
Method Summary
protected  Logger createLoggerPrototype()
           
 MBeanNotificationInfo[] getNotificationInfo()
          Returns the name of the java class of the notification and the notification types sent.
 void postDeregister()
          Called upon after the MBean has been de-registered.
 void postRegister(java.lang.Boolean registrationDone)
          Called upon after a registration ( successful or not ).
 void preDeregister()
          Called upon before an MBean will be de-registered by the MBeanServer.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations before being registered to the MBeanServer.
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, java.lang.Object handback)
           
 void sendNotification(Notification n)
           
 void start()
           
 void start(java.lang.String category)
           
 void stop()
           
 void stop(java.lang.String category)
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, removeNotificationListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface mx4j.log.LoggerBroadcasterMBean
addNotificationListener
 

Constructor Detail

LoggerBroadcaster

public LoggerBroadcaster()
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration
Allows the MBean to perform any operations before being registered to the MBeanServer.

Any exception will cause the MBean not being registered.

Specified by:
preRegister in interface MBeanRegistration
Parameters:
server - The MBeanServer on which the MBean will be registered.
name - The ObjectName of the MBean.
Returns:
ObjectName The name of the registered MBean
Throws:
java.lang.Exception - Exception of the operation. Note that this is caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Description copied from interface: MBeanRegistration
Called upon after a registration ( successful or not ).

Specified by:
postRegister in interface MBeanRegistration
Parameters:
registrationDone - Evaluates to true of the registrations is successful, false otherwise.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration
Called upon before an MBean will be de-registered by the MBeanServer.

Specified by:
preDeregister in interface MBeanRegistration
Throws:
java.lang.Exception - Would be caught by the MBeanServer and rethrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration
Called upon after the MBean has been de-registered.

Specified by:
postDeregister in interface MBeanRegistration

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       java.lang.Object handback)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface LoggerBroadcasterMBean
Throws:
ListenerNotFoundException

sendNotification

public void sendNotification(Notification n)
Overrides:
sendNotification in class NotificationBroadcasterSupport

start

public void start()
Specified by:
start in interface LoggerBroadcasterMBean

start

public void start(java.lang.String category)
Specified by:
start in interface LoggerBroadcasterMBean

stop

public void stop()
Specified by:
stop in interface LoggerBroadcasterMBean

stop

public void stop(java.lang.String category)
Specified by:
stop in interface LoggerBroadcasterMBean

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Description copied from interface: NotificationBroadcaster
Returns the name of the java class of the notification and the notification types sent.

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class NotificationBroadcasterSupport

createLoggerPrototype

protected Logger createLoggerPrototype()


Copyright © 2001-2002 MX4J Team. All Rights Reserved.