org.opennms.netmgt.alarmd.api.support
Class AbstractNorthbounder

java.lang.Object
  extended by org.opennms.netmgt.alarmd.api.support.AbstractNorthbounder
All Implemented Interfaces:
Runnable, Northbounder, StatusFactory<NorthboundAlarm>
Direct Known Subclasses:
HttpNorthbounder, JmsNorthbounder

public abstract class AbstractNorthbounder
extends Object
implements Northbounder, Runnable, StatusFactory<NorthboundAlarm>

AbstractNorthBounder The purpose of this class is manage the queue of alarms that need to be forward and receive queries to/from a Southbound Interface. It passes Alarms on to the forwardAlarms method implemented by base classes in batches as they are added to the queue. The forwardAlarms method does the actual work of sending them to the Southbound Interface. preserve, accept and discard are called to add the Alarms to the queue as appropriate.

Author:
David Hustace

Constructor Summary
protected AbstractNorthbounder(String name)
           
 
Method Summary
protected abstract  boolean accepts(NorthboundAlarm alarm)
           
 NorthboundAlarm createSyncLostMessage()
           
protected  void discard(NorthboundAlarm alarm)
           
abstract  void forwardAlarms(List<NorthboundAlarm> alarms)
           
 String getName()
           
 void onAlarm(NorthboundAlarm alarm)
           
protected  void onPostStart()
          Override this to perform actions after startup.
protected  void onPreStart()
          Override this to perform actions before startup.
protected  void onStop()
          Override this to perform actions when stopping.
protected  void preserve(NorthboundAlarm alarm)
           
 void run()
           
 void setMaxBatchSize(int maxBatchSize)
           
 void setMaxPreservedAlarms(int maxPreservedAlarms)
           
 void setNaglesDelay(long delay)
           
 void setRetryInterval(int retryInterval)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNorthbounder

protected AbstractNorthbounder(String name)
Method Detail

getName

public String getName()

setNaglesDelay

public void setNaglesDelay(long delay)

setRetryInterval

public void setRetryInterval(int retryInterval)

setMaxBatchSize

public void setMaxBatchSize(int maxBatchSize)

setMaxPreservedAlarms

public void setMaxPreservedAlarms(int maxPreservedAlarms)

onPreStart

protected void onPreStart()
Override this to perform actions before startup.


onPostStart

protected void onPostStart()
Override this to perform actions after startup.


start

public final void start()
                 throws NorthbounderException
Specified by:
start in interface Northbounder
Throws:
NorthbounderException

onAlarm

public final void onAlarm(NorthboundAlarm alarm)
                   throws NorthbounderException
Specified by:
onAlarm in interface Northbounder
Throws:
NorthbounderException

accepts

protected abstract boolean accepts(NorthboundAlarm alarm)

preserve

protected void preserve(NorthboundAlarm alarm)
                 throws NorthbounderException
Throws:
NorthbounderException

discard

protected void discard(NorthboundAlarm alarm)
                throws NorthbounderException
Throws:
NorthbounderException

onStop

protected void onStop()
Override this to perform actions when stopping.


stop

public final void stop()
                throws NorthbounderException
Specified by:
stop in interface Northbounder
Throws:
NorthbounderException

run

public void run()
Specified by:
run in interface Runnable

createSyncLostMessage

public NorthboundAlarm createSyncLostMessage()
Specified by:
createSyncLostMessage in interface StatusFactory<NorthboundAlarm>

forwardAlarms

public abstract void forwardAlarms(List<NorthboundAlarm> alarms)
                            throws NorthbounderException
Throws:
NorthbounderException


Copyright © 2011. All Rights Reserved.