com.cometway.email
Class EmailReporter

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.ScheduledAgent
              extended by com.cometway.email.EmailReporter
All Implemented Interfaces:
AgentInterface, HasStateMachineModel, ISchedulable, ReporterInterface

public class EmailReporter
extends ScheduledAgent
implements ReporterInterface

This is a Reporter Agent that extends FileLoggerAgent in order to log AK agent output to sequentially named text files. Upon loading, this agent replaces the default Reporter.


Field Summary
protected static java.lang.String DEBUG_AFTER
           
protected static java.lang.String DEBUG_BEFORE
           
protected  ReporterInterface defaultReporter
           
protected static java.lang.String ERROR_AFTER
           
protected static java.lang.String ERROR_BEFORE
           
protected  java.lang.StringBuffer history
           
protected static java.lang.String PRINTLN_AFTER
           
protected static java.lang.String PRINTLN_BEFORE
           
protected  java.util.Vector recipients
           
protected  java.lang.String reply_to
           
protected static java.text.SimpleDateFormat SDF
           
protected  boolean send_debug
           
protected  boolean send_error
           
protected  boolean send_println
           
protected  boolean send_warning
           
protected  java.lang.Object synchObject
           
protected static java.lang.String WARNING_AFTER
           
protected static java.lang.String WARNING_BEFORE
           
 
Fields inherited from class com.cometway.ak.ScheduledAgent
schedule
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
EmailReporter()
           
 
Method Summary
 void debug(java.lang.Object objectRef, java.lang.String message)
          Use this method to report an event for debugging.
 void error(java.lang.Object objectRef, java.lang.String message)
          Use this method to report a critical error with an Exception.
 void error(java.lang.Object objectRef, java.lang.String message, java.lang.Exception e)
          Use this method to report a critical error message.
 void initProps()
          Override this method to provide default properties for subclasses.
 void println(java.lang.Object objectRef, java.lang.String message)
          Use this method to report an event message.
 void start()
          Creates a Schedule as specified by the schedule property and schedules this agent.
 void wakeup()
          Override this method to handle schedule wakeup notifications.
 void warning(java.lang.Object objectRef, java.lang.String message)
          Use this method to report a warning message.
 void warning(java.lang.Object objectRef, java.lang.String message, java.lang.Exception e)
          Use this method to report a warning message with an Exception.
 
Methods inherited from class com.cometway.ak.ScheduledAgent
addScheduleChangeListener, getSchedule, removeScheduleChangeListener, schedule, stop, unschedule
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SDF

protected static final java.text.SimpleDateFormat SDF

DEBUG_BEFORE

protected static final java.lang.String DEBUG_BEFORE
See Also:
Constant Field Values

DEBUG_AFTER

protected static final java.lang.String DEBUG_AFTER
See Also:
Constant Field Values

ERROR_BEFORE

protected static final java.lang.String ERROR_BEFORE
See Also:
Constant Field Values

ERROR_AFTER

protected static final java.lang.String ERROR_AFTER
See Also:
Constant Field Values

PRINTLN_BEFORE

protected static final java.lang.String PRINTLN_BEFORE
See Also:
Constant Field Values

PRINTLN_AFTER

protected static final java.lang.String PRINTLN_AFTER
See Also:
Constant Field Values

WARNING_BEFORE

protected static final java.lang.String WARNING_BEFORE
See Also:
Constant Field Values

WARNING_AFTER

protected static final java.lang.String WARNING_AFTER
See Also:
Constant Field Values

history

protected java.lang.StringBuffer history

recipients

protected java.util.Vector recipients

reply_to

protected java.lang.String reply_to

synchObject

protected java.lang.Object synchObject

defaultReporter

protected ReporterInterface defaultReporter

send_println

protected boolean send_println

send_debug

protected boolean send_debug

send_warning

protected boolean send_warning

send_error

protected boolean send_error
Constructor Detail

EmailReporter

public EmailReporter()
Method Detail

initProps

public void initProps()
Description copied from class: ScheduledAgent
Override this method to provide default properties for subclasses. ScheduledAgent recognizes the following properties: schedule (scheduled string or none) agent_classname and agent_name (used by default wakeup implementation to instantiate and start a new agent based on this agent's properties).

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class ScheduledAgent

start

public void start()
Description copied from class: ScheduledAgent
Creates a Schedule as specified by the schedule property and schedules this agent.

Specified by:
start in interface AgentInterface
Overrides:
start in class ScheduledAgent

wakeup

public void wakeup()
Description copied from class: ScheduledAgent
Override this method to handle schedule wakeup notifications. By default this agent will create and start a new agent based on the properties of this agent and: 1) agent_classname, the java class name of the agent instance to be created, 2) agent_name, the name property assigned to the new agent instance, 3) agent_id, the unique id property assigned to the new agent instance. The wakeup driven agents are only started (not stopped) and if they have a problem during execution (exception thrown) this agent would be unscheduled automatically.

Specified by:
wakeup in interface ISchedulable
Overrides:
wakeup in class ScheduledAgent

debug

public void debug(java.lang.Object objectRef,
                  java.lang.String message)
Use this method to report an event for debugging.

Specified by:
debug in interface ReporterInterface

warning

public void warning(java.lang.Object objectRef,
                    java.lang.String message)
Use this method to report a warning message.

Specified by:
warning in interface ReporterInterface

warning

public void warning(java.lang.Object objectRef,
                    java.lang.String message,
                    java.lang.Exception e)
Use this method to report a warning message with an Exception.

Specified by:
warning in interface ReporterInterface

error

public void error(java.lang.Object objectRef,
                  java.lang.String message)
Use this method to report a critical error with an Exception.

Specified by:
error in interface ReporterInterface

error

public void error(java.lang.Object objectRef,
                  java.lang.String message,
                  java.lang.Exception e)
Use this method to report a critical error message.

Specified by:
error in interface ReporterInterface

println

public void println(java.lang.Object objectRef,
                    java.lang.String message)
Use this method to report an event message.

Specified by:
println in interface ReporterInterface