Package org.opennms.netmgt.events.api
Class AnnotationBasedEventListenerAdapter
- java.lang.Object
-
- org.opennms.netmgt.events.api.AnnotationBasedEventListenerAdapter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,EventListener
,StoppableEventListener
,ThreadAwareEventListener
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
public class AnnotationBasedEventListenerAdapter extends Object implements StoppableEventListener, ThreadAwareEventListener, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
AnnotationBasedEventListenerAdapter- Version:
- $Id: $
- Author:
- brozow
-
-
Constructor Summary
Constructors Constructor Description AnnotationBasedEventListenerAdapter()
Constructor for AnnotationBasedEventListenerAdapter.AnnotationBasedEventListenerAdapter(Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.AnnotationBasedEventListenerAdapter(String name, Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
afterPropertiesSetvoid
close()
stopvoid
destroy()
destroyString
getLogPrefix()
getLogPrefixString
getName()
getNameint
getNumThreads()
protected void
handleException(IEvent event, Throwable cause)
handleExceptionvoid
onEvent(IEvent event)
Process a sent event.protected void
postprocessEvent(IEvent event)
postprocessEventprotected void
preprocessEvent(IEvent event)
preprocessEventprotected void
processEvent(IEvent event, Method method)
processEventvoid
setAnnotatedListener(Object annotatedListener)
setAnnotatedListenervoid
setEventSubscriptionService(EventSubscriptionService subscriptionService)
setEventSubscriptionServicevoid
setLogPrefix(String logPrefix)
setLogPrefixvoid
setName(String name)
setName
-
-
-
Constructor Detail
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter(String name, Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.
- Parameters:
name
- aString
object.annotatedListener
- aObject
object.subscriptionService
- aEventSubscriptionService
object.
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter(Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.
- Parameters:
annotatedListener
- aObject
object.subscriptionService
- aEventSubscriptionService
object.
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter()
Constructor for AnnotationBasedEventListenerAdapter.
-
-
Method Detail
-
getName
public String getName()
getName
- Specified by:
getName
in interfaceEventListener
- Returns:
- a
String
object.
-
getLogPrefix
public String getLogPrefix()
getLogPrefix
- Returns:
- the logPrefix
-
setLogPrefix
public void setLogPrefix(String logPrefix)
setLogPrefix
- Parameters:
logPrefix
- the logPrefix to set
-
onEvent
public void onEvent(IEvent event)
Process a sent event.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
event
- aIEvent
object.
-
postprocessEvent
protected void postprocessEvent(IEvent event) throws IllegalAccessException, InvocationTargetException
postprocessEvent
- Parameters:
event
- aIEvent
object.- Throws:
IllegalAccessException
- if any.InvocationTargetException
- if any.
-
processEvent
protected void processEvent(IEvent event, Method method) throws IllegalAccessException, InvocationTargetException
processEvent
- Parameters:
event
- aIEvent
object.method
- aMethod
object.- Throws:
IllegalAccessException
- if any.InvocationTargetException
- if any.
-
preprocessEvent
protected void preprocessEvent(IEvent event) throws IllegalAccessException, InvocationTargetException
preprocessEvent
- Parameters:
event
- aIEvent
object.- Throws:
IllegalAccessException
- if any.InvocationTargetException
- if any.
-
setAnnotatedListener
public void setAnnotatedListener(Object annotatedListener)
setAnnotatedListener
- Parameters:
annotatedListener
- aObject
object.
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getNumThreads
public int getNumThreads()
- Specified by:
getNumThreads
in interfaceThreadAwareEventListener
-
close
public void close()
stop
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceStoppableEventListener
-
destroy
public void destroy() throws Exception
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
- if any.
-
setEventSubscriptionService
public void setEventSubscriptionService(EventSubscriptionService subscriptionService)
setEventSubscriptionService
- Parameters:
subscriptionService
- aEventSubscriptionService
object.
-
-