Package org.opennms.netmgt.events.api
Class AnnotationBasedEventListenerAdapter
- java.lang.Object
-
- org.opennms.netmgt.events.api.AnnotationBasedEventListenerAdapter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,EventListener
,StoppableEventListener
,ThreadAwareEventListener
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
public class AnnotationBasedEventListenerAdapter extends java.lang.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(java.lang.Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.AnnotationBasedEventListenerAdapter(java.lang.String name, java.lang.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()
destroyjava.lang.String
getLogPrefix()
getLogPrefixjava.lang.String
getName()
getNameint
getNumThreads()
protected void
handleException(IEvent event, java.lang.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, java.lang.reflect.Method method)
processEventvoid
setAnnotatedListener(java.lang.Object annotatedListener)
setAnnotatedListenervoid
setEventSubscriptionService(EventSubscriptionService subscriptionService)
setEventSubscriptionServicevoid
setLogPrefix(java.lang.String logPrefix)
setLogPrefixvoid
setName(java.lang.String name)
setName
-
-
-
Constructor Detail
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter(java.lang.String name, java.lang.Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.
- Parameters:
name
- aString
object.annotatedListener
- aObject
object.subscriptionService
- aEventSubscriptionService
object.
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter(java.lang.Object annotatedListener, EventSubscriptionService subscriptionService)
Constructor for AnnotationBasedEventListenerAdapter.
- Parameters:
annotatedListener
- aObject
object.subscriptionService
- aEventSubscriptionService
object.
-
AnnotationBasedEventListenerAdapter
public AnnotationBasedEventListenerAdapter()
Constructor for AnnotationBasedEventListenerAdapter.
-
-
Method Detail
-
getName
public java.lang.String getName()
getName
- Specified by:
getName
in interfaceEventListener
- Returns:
- a
String
object.
-
setName
public void setName(java.lang.String name)
setName
- Parameters:
name
- aString
object.
-
getLogPrefix
public java.lang.String getLogPrefix()
getLogPrefix
- Returns:
- the logPrefix
-
setLogPrefix
public void setLogPrefix(java.lang.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 java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
postprocessEvent
- Parameters:
event
- aIEvent
object.- Throws:
java.lang.IllegalAccessException
- if any.java.lang.reflect.InvocationTargetException
- if any.
-
processEvent
protected void processEvent(IEvent event, java.lang.reflect.Method method) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
processEvent
- Parameters:
event
- aIEvent
object.method
- aMethod
object.- Throws:
java.lang.IllegalAccessException
- if any.java.lang.reflect.InvocationTargetException
- if any.
-
preprocessEvent
protected void preprocessEvent(IEvent event) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
preprocessEvent
- Parameters:
event
- aIEvent
object.- Throws:
java.lang.IllegalAccessException
- if any.java.lang.reflect.InvocationTargetException
- if any.
-
handleException
protected void handleException(IEvent event, java.lang.Throwable cause)
handleException
- Parameters:
event
- aIEvent
object.cause
- aThrowable
object.
-
setAnnotatedListener
public void setAnnotatedListener(java.lang.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceStoppableEventListener
-
destroy
public void destroy() throws java.lang.Exception
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
java.lang.Exception
- if any.
-
setEventSubscriptionService
public void setEventSubscriptionService(EventSubscriptionService subscriptionService)
setEventSubscriptionService
- Parameters:
subscriptionService
- aEventSubscriptionService
object.
-
-