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 classMockEventIpcManager.EmptyEventConfDaoThis class implementsEventConfDaobut every call returns null.static interfaceMockEventIpcManager.SendNowHook
-
Constructor Summary
Constructors Constructor Description MockEventIpcManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(EventListener listener)Registers an event listener that is interested in all eventsvoidaddEventListener(EventListener listener, java.lang.String uei)Registers an event listener interested in the passed UEIvoidaddEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)Registers an event listener interested in the UEIs in the passed listvoidbroadcastNow(Event event)voidbroadcastNow(Event event, boolean synchronous)Called by eventd to send an event to all interested listeners.voidfinishProcessingEvents()EventAnticipatorgetEventAnticipator()EventdConfiggetEventdConfig()intgetEventListenerCount()intgetNumSchedulerTheads()MockEventIpcManager.SendNowHookgetSendNowHook()booleanhasEventListener(java.lang.String uei)Checks if there is at least one listener for the given uei.booleanisSynchronous()voidremoveEventListener(EventListener listener)Removes a registered event listenervoidremoveEventListener(EventListener listener, java.lang.String uei)Removes a registered event listener - the UEI indicates an event the listener is no more interested invoidremoveEventListener(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 invoidreset()Resets the event listeners and resets the event anticipator.voidsend(Event event)This method is called to send the event outvoidsend(Log eventLog)This method is called to send an event log containing multiple events outvoidsendEventToListeners(Event event)voidsendNow(Event event)Asynchronously sends an event to eventd.voidsendNow(Event event, boolean synchronous)voidsendNow(Log eventLog)Asynchronously sends a set of events to eventd.voidsendNowSync(Event event)Synchronously sends an event to eventd.voidsendNowSync(Log eventLog)Synchronously sends a set of events to eventd.voidsetDataSource(javax.sql.DataSource instance)voidsetEventAnticipator(EventAnticipator anticipator)voidsetEventdConfig(EventdConfig eventdConfig)voidsetEventDelay(int millis)voidsetEventExpander(EventExpander expander)voidsetEventWriter(EventWriter eventWriter)voidsetNumSchedulerThreads(int numThreads)voidsetSendNowHook(MockEventIpcManager.SendNowHook hook)voidsetSynchronous(boolean syncState)
-
-
-
Method Detail
-
addEventListener
public void addEventListener(EventListener listener)
Description copied from interface:EventSubscriptionServiceRegisters an event listener that is interested in all events- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.
-
addEventListener
public void addEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Description copied from interface:EventSubscriptionServiceRegisters an event listener interested in the UEIs in the passed list- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.ueis- aCollectionobject.
-
addEventListener
public void addEventListener(EventListener listener, java.lang.String uei)
Description copied from interface:EventSubscriptionServiceRegisters an event listener interested in the passed UEI- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.uei- aStringobject.
-
getEventListenerCount
public int getEventListenerCount()
-
broadcastNow
public void broadcastNow(Event event)
-
broadcastNow
public void broadcastNow(Event event, boolean synchronous)
Description copied from interface:EventIpcBroadcasterCalled by eventd to send an event to all interested listeners.- Specified by:
broadcastNowin interfaceEventIpcBroadcaster- Parameters:
event- aEventobject.synchronous- Whether this call should wait for allEventListenercalls 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:EventSubscriptionServiceRemoves a registered event listener- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.
-
removeEventListener
public void removeEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Description copied from interface:EventSubscriptionServiceRemoves a registered event listener - the UEI list indicates the list of events the listener is no more interested in- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.ueis- aCollectionobject.
-
removeEventListener
public void removeEventListener(EventListener listener, java.lang.String uei)
Description copied from interface:EventSubscriptionServiceRemoves a registered event listener - the UEI indicates an event the listener is no more interested in- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.uei- aStringobject.
-
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:EventForwarderAsynchronously sends an event to eventd.- Specified by:
sendNowin interfaceEventForwarder- Parameters:
event- aEventobject.
-
sendNow
public void sendNow(Event event, boolean synchronous)
-
sendNow
public void sendNow(Log eventLog)
Description copied from interface:EventForwarderAsynchronously sends a set of events to eventd.- Specified by:
sendNowin interfaceEventForwarder- Parameters:
eventLog- aLogobject.
-
sendNowSync
public void sendNowSync(Event event)
Description copied from interface:EventForwarderSynchronously sends an event to eventd.- Specified by:
sendNowSyncin interfaceEventForwarder- Parameters:
event- aEventobject.
-
sendNowSync
public void sendNowSync(Log eventLog)
Description copied from interface:EventForwarderSynchronously sends a set of events to eventd.- Specified by:
sendNowSyncin interfaceEventForwarder- Parameters:
eventLog- aLogobject.
-
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:EventProxyThis method is called to send the event out- Specified by:
sendin 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:EventProxyThis method is called to send an event log containing multiple events out- Specified by:
sendin 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:EventSubscriptionServiceChecks if there is at least one listener for the given uei.- Specified by:
hasEventListenerin interfaceEventSubscriptionService- Parameters:
uei- the uie to check for- Returns:
trueiff there is at least one listener
-
-