cz.cuni.amis.pogamut.base.utils.logging.jmx
Class JMXLogPublisher

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.logging.LogPublisher
      extended by cz.cuni.amis.pogamut.base.utils.logging.jmx.JMXLogPublisher
All Implemented Interfaces:
ILogPublisher, JMXLogPublisherMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

public class JMXLogPublisher
extends LogPublisher
implements JMXLogPublisherMBean, javax.management.NotificationEmitter


Nested Class Summary
 
Nested classes/interfaces inherited from class cz.cuni.amis.pogamut.base.utils.logging.LogPublisher
LogPublisher.ConsolePublisher, LogPublisher.FilePublisher
 
Field Summary
protected  java.lang.String categoryName
          Category name of the publisher.
protected  javax.management.NotificationBroadcasterSupport notification
          Support for the JMX notification broadcasting.
protected  long sequenceNumber
          Sequence number for the published logs.
 
Fields inherited from class cz.cuni.amis.pogamut.base.utils.logging.LogPublisher
formatter
 
Constructor Summary
JMXLogPublisher()
          Initialize publisher with the simplest formatter - just publishing the message.
JMXLogPublisher(java.util.logging.Formatter formatter)
          Initialize the publisher with prespecified formatter.
JMXLogPublisher(javax.management.ObjectName parent, java.lang.String categoryName)
           
 
Method Summary
 void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void close()
          From JavaDoc API:
 void flush()
          From JavaDoc API:
 java.lang.String getCategoryName()
           
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
           
 void publish(java.util.logging.LogRecord record)
          From JavaDoc API:
 void publish(java.util.logging.LogRecord record, java.lang.String formattedMsg)
          Not used, things are published directly via publish(LogRecord)
 void removeNotificationListener(javax.management.NotificationListener listener)
           
 void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.utils.logging.LogPublisher
getFormatter, setFormatter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

notification

protected javax.management.NotificationBroadcasterSupport notification
Support for the JMX notification broadcasting. Used to send notifications.


categoryName

protected java.lang.String categoryName
Category name of the publisher.


sequenceNumber

protected long sequenceNumber
Sequence number for the published logs.

Constructor Detail

JMXLogPublisher

public JMXLogPublisher()
Initialize publisher with the simplest formatter - just publishing the message.


JMXLogPublisher

public JMXLogPublisher(java.util.logging.Formatter formatter)
Initialize the publisher with prespecified formatter.

WARNING: if formatter is null, nothing will be published via JMX!

Parameters:
formatter -

JMXLogPublisher

public JMXLogPublisher(javax.management.ObjectName parent,
                       java.lang.String categoryName)
                throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException
Method Detail

getCategoryName

public java.lang.String getCategoryName()
Specified by:
getCategoryName in interface JMXLogPublisherMBean

close

public void close()
           throws java.lang.SecurityException
Description copied from interface: ILogPublisher
From JavaDoc API:

Close the Handler and free all associated resources.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

Specified by:
close in interface ILogPublisher
Specified by:
close in class LogPublisher
Throws:
java.lang.SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").

flush

public void flush()
Description copied from interface: ILogPublisher
From JavaDoc API:

Flush any buffered output.

Specified by:
flush in interface ILogPublisher
Specified by:
flush in class LogPublisher

publish

public void publish(java.util.logging.LogRecord record)
Description copied from interface: ILogPublisher
From JavaDoc API:

Publish a LogRecord.

The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.


Specified by:
publish in interface ILogPublisher
Overrides:
publish in class LogPublisher
Parameters:
record - description of the log event. A null record is silently ignored and is not published

publish

public void publish(java.util.logging.LogRecord record,
                    java.lang.String formattedMsg)
Not used, things are published directly via publish(LogRecord)

Specified by:
publish in class LogPublisher

removeNotificationListener

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

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object handback)
                             throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException