com.cometway.email
Class RequestFilterAgent

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.ak.RequestAgent
                  extended by com.cometway.email.RequestFilterAgent
All Implemented Interfaces:
AgentInterface, RequestAgentInterface, HasStateMachineModel, java.lang.Runnable

public class RequestFilterAgent
extends RequestAgent
implements java.lang.Runnable

This agent proxies requests to another request agent and in the process, it caches the props for each request. When this agent starts up, it grabs a reference to the RequestAgent that its requests are proxying to from the ServiceManager, then registers itself. Cached requests are filtered depending on the filter_interval property and the requests that made it through the filter are emailed to the list of email addresses provided by the recipients property. Note: It may be a bad idea for this agent to proxy AgentRequests that may contain references to resources that needs to be released. The props from AgentRequests are not released for garbage collection until the filtering has been done.


Field Summary
protected  Agent agent
           
protected  java.util.Vector requests
           
protected  java.lang.Thread runThread
           
 boolean stopRunning
           
protected  java.lang.Object syncObject
           
 
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
RequestFilterAgent()
           
 
Method Summary
 java.lang.String createReport()
           
 void handleRequest(AgentRequest request)
          Respond to the specified request as appropriate.
 void initPtops()
           
 void run()
           
 void start()
          Registers this instance with the service manager using the service_name property.
 void stop()
          Unregisters this instance with the service manager using the service_name property.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, initProps, 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

runThread

protected java.lang.Thread runThread

syncObject

protected java.lang.Object syncObject

requests

protected java.util.Vector requests

stopRunning

public boolean stopRunning

agent

protected Agent agent
Constructor Detail

RequestFilterAgent

public RequestFilterAgent()
Method Detail

initPtops

public void initPtops()

start

public void start()
Description copied from class: ServiceAgent
Registers this instance with the service manager using the service_name property.

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

stop

public void stop()
Description copied from class: ServiceAgent
Unregisters this instance with the service manager using the service_name property.

Specified by:
stop in interface AgentInterface
Overrides:
stop in class ServiceAgent

handleRequest

public void handleRequest(AgentRequest request)
Description copied from interface: RequestAgentInterface
Respond to the specified request as appropriate.

Specified by:
handleRequest in interface RequestAgentInterface

run

public void run()
Specified by:
run in interface java.lang.Runnable

createReport

public java.lang.String createReport()