com.cometway.io
Class FileReporter

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.ServiceAgent
              extended by com.cometway.io.FileLoggerAgent
                  extended by com.cometway.io.FileReporter
All Implemented Interfaces:
AgentInterface, HasStateMachineModel, ReporterInterface

public class FileReporter
extends FileLoggerAgent
implements ReporterInterface

This is a Reporter Agent that extends FileLoggerAgent in order to log Agent Kernel 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  boolean echo_debug
           
protected  boolean echo_error
           
protected  boolean echo_println
           
protected  boolean echo_warning
           
protected static java.lang.String ERROR_AFTER
           
protected static java.lang.String ERROR_BEFORE
           
protected  boolean log_debug
           
protected  boolean log_error
           
protected  boolean log_println
           
protected  boolean log_warning
           
protected static java.lang.String PRINTLN_AFTER
           
protected static java.lang.String PRINTLN_BEFORE
           
protected static java.text.SimpleDateFormat SDF
           
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.io.FileLoggerAgent
EOL, logCount, logSync, out
 
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
FileReporter()
           
 
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()
          Initializes this agent's properties by providing default values for each of the following missing properties: "log_type" sets the type of log file to be used (default: FILE), "log_file_prefix specifies the prefix for the log_file (default: log_), "logs_per_file" specifies the maximum log entries per file (default: 10000).
 void println(java.lang.Object objectRef, java.lang.String message)
          Use this method to report an event message.
 void start()
          Creates new logSync object, creates the log file, and registers with the service manager.
 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.io.FileLoggerAgent
closeLogFile, createLogFile, log
 
Methods inherited from class com.cometway.ak.ServiceAgent
stop
 
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

synchObject

protected java.lang.Object synchObject

defaultReporter

protected ReporterInterface defaultReporter

log_println

protected boolean log_println

log_debug

protected boolean log_debug

log_warning

protected boolean log_warning

log_error

protected boolean log_error

echo_println

protected boolean echo_println

echo_debug

protected boolean echo_debug

echo_warning

protected boolean echo_warning

echo_error

protected boolean echo_error
Constructor Detail

FileReporter

public FileReporter()
Method Detail

initProps

public void initProps()
Description copied from class: FileLoggerAgent
Initializes this agent's properties by providing default values for each of the following missing properties: "log_type" sets the type of log file to be used (default: FILE), "log_file_prefix specifies the prefix for the log_file (default: log_), "logs_per_file" specifies the maximum log entries per file (default: 10000).

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

start

public void start()
Description copied from class: FileLoggerAgent
Creates new logSync object, creates the log file, and registers with the service manager.

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

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