org.opennms.bb.dp.actiond.components
Class ActiondEventReceiver

java.lang.Object
  |
  +--org.opennms.bb.dp.common.components.PollerClient
        |
        +--org.opennms.bb.dp.actiond.components.ActiondEventReceiver
All Implemented Interfaces:
com.sun.media.jsdt.ChannelConsumer, com.sun.media.jsdt.Client, Serializable

public class ActiondEventReceiver
extends PollerClient
implements com.sun.media.jsdt.ChannelConsumer

ActiondEventReceiver does the initial process/receiving of all events coming over the eventd JSDT channel.

It extends the PollerClient and implements the 'ChannelConsumer' interface to receive the events

Version:
$Revision: 1.2 $
Author:
Mike, Brian Weaver, Sowmya Kumaraswamy, OpenNMS.org
See Also:
Serialized Form

Field Summary
private  com.sun.media.jsdt.Channel m_channel
          The JSDT channel on which eventd is broadcasting events
private  ActiondEventListener m_eventListenerMain
          the event listener
private  PCQueue m_listenerQ
          queue to which the incoming event stream is to be added
private  boolean m_pauseOperation
          Flag indicating that operation is to be paused For now events received are simply discarded during pause
private  com.sun.media.jsdt.Session m_session
          The JSDT event session
private static int numEventsRcvd
           
 
Fields inherited from class org.opennms.bb.dp.common.components.PollerClient
m_name
 
Constructor Summary
ActiondEventReceiver(ActiondEventListener eListener, PCQueue listenerQ)
          Creates a ActiondEventReceiver for actiond
 
Method Summary
 void dataReceived(com.sun.media.jsdt.Data data)
          If operation is not paused, add the incoming event to the 'listenerQ' as an input stream.
private  boolean jsdtConnect()
          Connect to the eventd JSDT channel for event reception
 void pauseOperation()
          Pause the operation - ignore the received messages?
 void resumeOperation()
          Resume the paused operation
 void shutdown()
          Removes itself as a consumer for the JSDT session and closes the session
 
Methods inherited from class org.opennms.bb.dp.common.components.PollerClient
authenticate, getName
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_eventListenerMain

private ActiondEventListener m_eventListenerMain
the event listener

m_listenerQ

private PCQueue m_listenerQ
queue to which the incoming event stream is to be added

m_session

private com.sun.media.jsdt.Session m_session
The JSDT event session

m_channel

private com.sun.media.jsdt.Channel m_channel
The JSDT channel on which eventd is broadcasting events

m_pauseOperation

private boolean m_pauseOperation
Flag indicating that operation is to be paused For now events received are simply discarded during pause

numEventsRcvd

private static int numEventsRcvd
Constructor Detail

ActiondEventReceiver

public ActiondEventReceiver(ActiondEventListener eListener,
                            PCQueue listenerQ)
                     throws org.xml.sax.SAXException
Creates a ActiondEventReceiver for actiond
Parameters:
eListener - the event listener
listenerQ - queue to which events sent in are to be added
Throws:
throws - a RunTimException if connection to JSDT fails
throws - a SAXException if the events parser cannot be created
Method Detail

dataReceived

public void dataReceived(com.sun.media.jsdt.Data data)
If operation is not paused, add the incoming event to the 'listenerQ' as an input stream. Also get the EventListener to check if the the thread pool size needs to be adjusted
Specified by:
dataReceived in interface com.sun.media.jsdt.ChannelConsumer
Parameters:
data - received JSDT data

jsdtConnect

private boolean jsdtConnect()
                     throws InterruptedException
Connect to the eventd JSDT channel for event reception
Throws:
InterruptedException - Thrown if the running thread is interrupted by another thread.

pauseOperation

public void pauseOperation()
Pause the operation - ignore the received messages?

resumeOperation

public void resumeOperation()
Resume the paused operation

shutdown

public void shutdown()

Removes itself as a consumer for the JSDT session and closes the session