com.solab.alarms.channels
Class TestChannel
java.lang.Object
com.solab.alarms.AbstractAlarmChannel
com.solab.alarms.channels.TestChannel
- All Implemented Interfaces:
- AlarmChannel
public class TestChannel
- extends AbstractAlarmChannel
A very simple alarm channel that only prints the alarm messages to STDOUT.
A source can optinally be defined so that only messages matching the source for this channel
will be printed out.
- Author:
- Enrique Zamudio
Method Summary |
protected Runnable |
createSendTask(String msg,
String source)
Subclasses need to create and return a new Runnable in each call to this method. |
protected boolean |
hasSource(String alarmSource)
This method is used to determine if a certain alarm channel has a special condition for the specified
alarmSource or not. |
void |
setAlarmSource(String value)
Sets a value that will be matched against the sources received in createSendTask(String, String) ;
by default it's null so that all alarms are printed out, but you can set a value here to print only
the messages from the specified source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TestChannel
public TestChannel()
setAlarmSource
public void setAlarmSource(String value)
- Sets a value that will be matched against the sources received in
createSendTask(String, String)
;
by default it's null so that all alarms are printed out, but you can set a value here to print only
the messages from the specified source.
createSendTask
protected Runnable createSendTask(String msg,
String source)
- Description copied from class:
AbstractAlarmChannel
- Subclasses need to create and return a new Runnable in each call to this method. The returned
Runnable will be queued in a thread pool to avoid latency in the normal program flow.
If a subclass decides not to send the alarm message for some reason, it can return null so that nothing
is queued.
- Specified by:
createSendTask
in class AbstractAlarmChannel
- Parameters:
msg
- The message to be sent.source
- The alarm source. A channel can have different recipient lists depending on the alarm source.
hasSource
protected boolean hasSource(String alarmSource)
- Description copied from class:
AbstractAlarmChannel
- This method is used to determine if a certain alarm channel has a special condition for the specified
alarmSource or not. It's used to determine if the alarm messages should be saved as regular alarms or
as messages for that specific source.
- Specified by:
hasSource
in class AbstractAlarmChannel
Copyright © 2011 Java Mexico. All Rights Reserved.