Package org.opennms.netmgt.dao.mock
Class MockEventIpcManager
- java.lang.Object
-
- org.opennms.netmgt.dao.mock.MockEventIpcManager
-
- All Implemented Interfaces:
EventForwarder
,EventIpcBroadcaster
,EventIpcManager
,EventProxy
,EventSubscriptionService
public class MockEventIpcManager extends java.lang.Object implements EventForwarder, EventProxy, EventIpcManager, EventIpcBroadcaster
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MockEventIpcManager.EmptyEventConfDao
This class implementsEventConfDao
but every call returns null.static interface
MockEventIpcManager.SendNowHook
-
Constructor Summary
Constructors Constructor Description MockEventIpcManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventListener(EventListener listener)
Registers an event listener that is interested in all eventsvoid
addEventListener(EventListener listener, java.lang.String uei)
Registers an event listener interested in the passed UEIvoid
addEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Registers an event listener interested in the UEIs in the passed listvoid
broadcastNow(Event event)
void
broadcastNow(Event event, boolean synchronous)
Called by eventd to send an event to all interested listeners.void
finishProcessingEvents()
EventAnticipator
getEventAnticipator()
EventdConfig
getEventdConfig()
int
getEventListenerCount()
int
getNumSchedulerTheads()
MockEventIpcManager.SendNowHook
getSendNowHook()
boolean
hasEventListener(java.lang.String uei)
Checks if there is at least one listener for the given uei.boolean
isSynchronous()
void
removeEventListener(EventListener listener)
Removes a registered event listenervoid
removeEventListener(EventListener listener, java.lang.String uei)
Removes a registered event listener - the UEI indicates an event the listener is no more interested invoid
removeEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Removes a registered event listener - the UEI list indicates the list of events the listener is no more interested invoid
reset()
Resets the event listeners and resets the event anticipator.void
send(Event event)
This method is called to send the event outvoid
send(Log eventLog)
This method is called to send an event log containing multiple events outvoid
sendEventToListeners(Event event)
void
sendNow(Event event)
Asynchronously sends an event to eventd.void
sendNow(Event event, boolean synchronous)
void
sendNow(Log eventLog)
Asynchronously sends a set of events to eventd.void
sendNowSync(Event event)
Synchronously sends an event to eventd.void
sendNowSync(Log eventLog)
Synchronously sends a set of events to eventd.void
setDataSource(javax.sql.DataSource instance)
void
setEventAnticipator(EventAnticipator anticipator)
void
setEventdConfig(EventdConfig eventdConfig)
void
setEventDelay(int millis)
void
setEventExpander(EventExpander expander)
void
setEventWriter(EventWriter eventWriter)
void
setNumSchedulerThreads(int numThreads)
void
setSendNowHook(MockEventIpcManager.SendNowHook hook)
void
setSynchronous(boolean syncState)
-
-
-
Method Detail
-
addEventListener
public void addEventListener(EventListener listener)
Description copied from interface:EventSubscriptionService
Registers an event listener that is interested in all events- Specified by:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.
-
addEventListener
public void addEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Description copied from interface:EventSubscriptionService
Registers an event listener interested in the UEIs in the passed list- Specified by:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.ueis
- aCollection
object.
-
addEventListener
public void addEventListener(EventListener listener, java.lang.String uei)
Description copied from interface:EventSubscriptionService
Registers an event listener interested in the passed UEI- Specified by:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.uei
- aString
object.
-
getEventListenerCount
public int getEventListenerCount()
-
broadcastNow
public void broadcastNow(Event event)
-
broadcastNow
public void broadcastNow(Event event, boolean synchronous)
Description copied from interface:EventIpcBroadcaster
Called by eventd to send an event to all interested listeners.- Specified by:
broadcastNow
in interfaceEventIpcBroadcaster
- Parameters:
event
- aEvent
object.synchronous
- Whether this call should wait for allEventListener
calls to finish before returning.
-
setEventWriter
public void setEventWriter(EventWriter eventWriter)
-
getEventAnticipator
public EventAnticipator getEventAnticipator()
-
setEventExpander
public void setEventExpander(EventExpander expander)
-
setEventAnticipator
public void setEventAnticipator(EventAnticipator anticipator)
-
removeEventListener
public void removeEventListener(EventListener listener)
Description copied from interface:EventSubscriptionService
Removes a registered event listener- Specified by:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.
-
removeEventListener
public void removeEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Description copied from interface:EventSubscriptionService
Removes a registered event listener - the UEI list indicates the list of events the listener is no more interested in- Specified by:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.ueis
- aCollection
object.
-
removeEventListener
public void removeEventListener(EventListener listener, java.lang.String uei)
Description copied from interface:EventSubscriptionService
Removes a registered event listener - the UEI indicates an event the listener is no more interested in- Specified by:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.uei
- aString
object.
-
setEventDelay
public void setEventDelay(int millis)
-
sendEventToListeners
public void sendEventToListeners(Event event)
- Parameters:
event
-
-
setSynchronous
public void setSynchronous(boolean syncState)
-
isSynchronous
public boolean isSynchronous()
-
setSendNowHook
public void setSendNowHook(MockEventIpcManager.SendNowHook hook)
-
getSendNowHook
public MockEventIpcManager.SendNowHook getSendNowHook()
-
setNumSchedulerThreads
public void setNumSchedulerThreads(int numThreads)
-
getNumSchedulerTheads
public int getNumSchedulerTheads()
-
sendNow
public void sendNow(Event event)
Description copied from interface:EventForwarder
Asynchronously sends an event to eventd.- Specified by:
sendNow
in interfaceEventForwarder
- Parameters:
event
- aEvent
object.
-
sendNow
public void sendNow(Event event, boolean synchronous)
-
sendNow
public void sendNow(Log eventLog)
Description copied from interface:EventForwarder
Asynchronously sends a set of events to eventd.- Specified by:
sendNow
in interfaceEventForwarder
- Parameters:
eventLog
- aLog
object.
-
sendNowSync
public void sendNowSync(Event event)
Description copied from interface:EventForwarder
Synchronously sends an event to eventd.- Specified by:
sendNowSync
in interfaceEventForwarder
- Parameters:
event
- aEvent
object.
-
sendNowSync
public void sendNowSync(Log eventLog)
Description copied from interface:EventForwarder
Synchronously sends a set of events to eventd.- Specified by:
sendNowSync
in interfaceEventForwarder
- Parameters:
eventLog
- aLog
object.
-
finishProcessingEvents
public void finishProcessingEvents()
-
getEventdConfig
public EventdConfig getEventdConfig()
-
setEventdConfig
public void setEventdConfig(EventdConfig eventdConfig)
-
setDataSource
public void setDataSource(javax.sql.DataSource instance)
-
reset
public void reset()
Resets the event listeners and resets the event anticipator.
-
send
public void send(Event event) throws EventProxyException
Description copied from interface:EventProxy
This method is called to send the event out- Specified by:
send
in interfaceEventProxy
- Parameters:
event
- the event to be sent out- Throws:
EventProxyException
- thrown if the send fails for any reason
-
send
public void send(Log eventLog) throws EventProxyException
Description copied from interface:EventProxy
This method is called to send an event log containing multiple events out- Specified by:
send
in interfaceEventProxy
- Parameters:
eventLog
- the events to be sent out- Throws:
EventProxyException
- thrown if the send fails for any reason
-
hasEventListener
public boolean hasEventListener(java.lang.String uei)
Description copied from interface:EventSubscriptionService
Checks if there is at least one listener for the given uei.- Specified by:
hasEventListener
in interfaceEventSubscriptionService
- Parameters:
uei
- the uie to check for- Returns:
true
iff there is at least one listener
-
-