org.opennms.netmgt.notifd
Class NotificationTask

java.lang.Object
  extended by java.lang.Thread
      extended by org.opennms.netmgt.notifd.NotificationTask
All Implemented Interfaces:
Runnable

public class NotificationTask
extends Thread

This class holds all the data and logic for sending out a notification Each notification that is sent will be accompanied by a row in the notifications table. All notifications in a group will be identified with a common groupId number.

Author:
Jason Johns , OpenNMS Modification to pick an ExecuteStrategy based on the "binary" flag in notificationCommands.xml by:, David Hustace

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NotificationTask(NotificationManager notificationManager, UserManager userManager, long sendTime, Map<String,String> someParams, List<NotificationTask> siblings, String autoNotify)
          Constructor, initializes some information
 
Method Summary
 Command[] getCommands()
           
 String getEmail()
           
 int getNotifyId()
          Returns the unique id used to insert the row in the database for this notification task.
 long getSendTime()
           
 User getUser()
           
 boolean isStarted()
           
 void run()
           
 void setAutoNotify(String autoNotify)
          Sets the autoNotify info for the usersnotified table
 void setCommands(Command[] commands)
          This method will construct the command that will be issued to send the actual page.
 void setNoticeId(int anId)
          Sets the group id that will be inserted into the row in notifications table
 void setUser(User aUser)
          Sets the user that the page needs to be sent to.
 void start()
           
 String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotificationTask

public NotificationTask(NotificationManager notificationManager,
                        UserManager userManager,
                        long sendTime,
                        Map<String,String> someParams,
                        List<NotificationTask> siblings,
                        String autoNotify)
Constructor, initializes some information

Parameters:
someParams - the parameters from Notify
Method Detail

toString

public String toString()
Overrides:
toString in class Thread

getSendTime

public long getSendTime()

getNotifyId

public int getNotifyId()
Returns the unique id used to insert the row in the database for this notification task.

Returns:
int, the id of the row in notifications table

setUser

public void setUser(User aUser)
Sets the user that the page needs to be sent to.

Parameters:
aUser - the user info

getUser

public User getUser()

setAutoNotify

public void setAutoNotify(String autoNotify)
Sets the autoNotify info for the usersnotified table

Parameters:
String - autoNotify

setNoticeId

public void setNoticeId(int anId)
Sets the group id that will be inserted into the row in notifications table

Parameters:
anId - the group id to set for the row

setCommands

public void setCommands(Command[] commands)
This method will construct the command that will be issued to send the actual page.

Parameters:
commands - the commands to call at the console.

getCommands

public Command[] getCommands()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

getEmail

public String getEmail()
                throws IOException,
                       org.exolab.castor.xml.MarshalException,
                       org.exolab.castor.xml.ValidationException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

start

public void start()
Overrides:
start in class Thread

isStarted

public boolean isStarted()


Copyright © 2009. All Rights Reserved.