mam.agent
Class SearchAgent

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--mam.agent.Agent
              |
              +--mam.agent.TransactionalAgent
                    |
                    +--mam.agent.SearchAgent

public class SearchAgent
extends TransactionalAgent

Description of the Class

Author:
nideffer
created October 8, 2001

Field Summary
 final static RoutingTagAGGREGATE_TRAITS_CHANGE_LISTENERS_ROUTING_TAG
           
 final static doubleCHECK_KNOWLEDGE_PROBABILITY
           
 protected final static StringDO_QUERY_MESSAGE_WAITER
           
 (package private) static CategoryLog
           
 protected AgentTraitsm_aggregateTraits
           
 protected AgedMapm_knownIpAgents
           
 final static doublePING_KNOWLEDGE_PROBABILITY
           
 protected final static intPING_ROLE_NAME_SLEEP_TIME
           
 protected final static longQUERY_TIME_OUT
           
 protected final static longQUERY_UPDATE_PERIOD
           
 final static RoutingTagSEARCH_AGENTS_ROUTING_TAG
           

Fields inherited from class mam.agent.TransactionalAgent
m_messageWaiters

Fields inherited from class mam.agent.Agent
AGENT_ACCESS_STATISTICS_TAG_NAME, AGENT_PROPERTIES_TAG_NAME, AGENT_TRAITS_TAG_NAME, ALL_AGENTS_ROUTING_TAG, DEFAULT_TAG_NAME, m_accessStatisticsGroup, m_agentProperties, m_facility, m_incomingMessageQueue, m_shutdown, m_sleepManager, ROLE_TAG_NAME

Fields inherited from class java.lang.Thread
MIN_PRIORITY, NORM_PRIORITY, MAX_PRIORITY

Constructor Summary
SearchAgent()
          Constructor for the SearchAgent object

Method Summary
 protected voidcalculateAggregateTraits()
          Description of the Method
 voidfinished(MessageWaiter messageWaiter)
          Description of the Method
 AgentTraitsgetAggregateTraits()
          Gets the AggregateTraits attribute of the SearchAgent object
 protected StringgetFirstWordWithCriteria(String source, int minimumLength)
          Gets the FirstWordWithCriteria attribute of the SearchAgent object
 protected CollectiongetKnownIpAgentIds()
          Gets the KnownIpAgentIds attribute of the SearchAgent object
 voidhandleDoQueryKnownAgentsMessage(AgentMessage m)
          Description of the Method
 voidhandleDoQueryMessage(AgentMessage m)
          Message: doSearch Parameters: Required: QueryPhrase: Response Message: eventSearchComplete Parameters: Required: QueryPhrase: FoundResults: Optional: IPAgents: -- of MamId, Vector where MamId references IPAgents who know about QueryPhrase Vector is a list of MamId, Integer where MamId is a KnowledgeAgent associated w/ that IPAgent Integer is that agent's relevance rating
 voidhandleEventAgentDeathMessage(AgentMessage m)
          Description of the Method
 voidhandleEventDeclareAgentPropertiesMessage(AgentMessage m)
          Description of the Method
 voidhandleEventQueryCompleteMessage(AgentMessage m)
          Description of the Method
 voidhandleEventQueryInformationPersonaeResultsMessage(AgentMessage m)
          Description of the Method
 voidhandleGetAggregateTraitsMessage(AgentMessage m)
          Description of the Method
 protected voidqueryFinished(MessageWaiter messageWaiter)
          Description of the Method
 protected voidqueryIpIteration(MessageWaiter messageWaiter, Collection recentResponses)
          Description of the Method
 protected voidregisterRoutingTags()
          Description of the Method
 voidresponsesReceived(MessageWaiter messageWaiter, Serializable identifier, Collection recentResponses)
          Description of the Method
 voidrun()
          Main processing method for the SearchAgent object
 voidsetAggregateTraits(AgentTraits oAggregateTraits)
          Sets the AggregateTraits attribute of the SearchAgent object
 protected voidunregisterRoutingTags()
          Description of the Method

Methods inherited from class mam.agent.TransactionalAgent
enqueueMessage, getMessageWaiters

Methods inherited from class mam.agent.Agent
fromXmlElement, getAccessStatisticsGroup, getAccount, getAgentProperties, getAgentTraits, getDescription, getFacility, getMamId, getNickname, getQuote, getRole, getRoutingTagToSelf, getXmlSerializable, handleDoAgentShutdownMessage, handleGetAccessStatisticsMessage, handleGetAgentPropertiesMessage, handleGetAgentTraitsMessage, handleGetQuoteMessage, handleMessages, handleSetDescriptionMessage, handleSetNicknameMessage, idleActivity, invokeMessageHandler, requiresPersistence, setAccount, setAgentTraits, setDescription, setFacility, setMamId, setNickname, setRole, setXmlSerializable, toString, toXmlElement, toXmlElement

Methods inherited from class java.lang.Thread
currentThread, yield, sleep, sleep, start, stop, stop, interrupt, interrupted, isInterrupted, destroy, isAlive, suspend, resume, setPriority, getPriority, setName, getName, getThreadGroup, activeCount, enumerate, countStackFrames, join, join, join, dumpStack, setDaemon, isDaemon, checkAccess, getContextClassLoader, setContextClassLoader

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize

Field Detail

AGGREGATE_TRAITS_CHANGE_LISTENERS_ROUTING_TAG

public final static RoutingTag AGGREGATE_TRAITS_CHANGE_LISTENERS_ROUTING_TAG

CHECK_KNOWLEDGE_PROBABILITY

public final static double CHECK_KNOWLEDGE_PROBABILITY

DO_QUERY_MESSAGE_WAITER

protected final static String DO_QUERY_MESSAGE_WAITER

Log

static Category Log

m_aggregateTraits

protected AgentTraits m_aggregateTraits

m_knownIpAgents

protected AgedMap m_knownIpAgents

PING_KNOWLEDGE_PROBABILITY

public final static double PING_KNOWLEDGE_PROBABILITY

PING_ROLE_NAME_SLEEP_TIME

protected final static int PING_ROLE_NAME_SLEEP_TIME

QUERY_TIME_OUT

protected final static long QUERY_TIME_OUT

QUERY_UPDATE_PERIOD

protected final static long QUERY_UPDATE_PERIOD

SEARCH_AGENTS_ROUTING_TAG

public final static RoutingTag SEARCH_AGENTS_ROUTING_TAG
Constructor Detail

SearchAgent

public SearchAgent()
Constructor for the SearchAgent object
Since:
Method Detail

calculateAggregateTraits

protected void calculateAggregateTraits()
Description of the Method
Since:

finished

public void finished(MessageWaiter messageWaiter)
Description of the Method
Parameters:
messageWaiter - Description of Parameter
Since:

getAggregateTraits

public AgentTraits getAggregateTraits()
Gets the AggregateTraits attribute of the SearchAgent object
Returns: The AggregateTraits value
Since:

getFirstWordWithCriteria

protected String getFirstWordWithCriteria(String source, int minimumLength)
Gets the FirstWordWithCriteria attribute of the SearchAgent object
Parameters:
source - Description of Parameter
minimumLength - Description of Parameter
Returns: The FirstWordWithCriteria value
Since:

getKnownIpAgentIds

protected Collection getKnownIpAgentIds()
Gets the KnownIpAgentIds attribute of the SearchAgent object
Returns: The KnownIpAgentIds value
Since:

handleDoQueryKnownAgentsMessage

public void handleDoQueryKnownAgentsMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

handleDoQueryMessage

public void handleDoQueryMessage(AgentMessage m)
Message: doSearch Parameters: Required: QueryPhrase: Response Message: eventSearchComplete Parameters: Required: QueryPhrase: FoundResults: Optional: IPAgents: -- of MamId, Vector where MamId references IPAgents who know about QueryPhrase Vector is a list of MamId, Integer where MamId is a KnowledgeAgent associated w/ that IPAgent Integer is that agent's relevance rating
Parameters:
m - Description of Parameter
Since:

handleEventAgentDeathMessage

public void handleEventAgentDeathMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

handleEventDeclareAgentPropertiesMessage

public void handleEventDeclareAgentPropertiesMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

handleEventQueryCompleteMessage

public void handleEventQueryCompleteMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

handleEventQueryInformationPersonaeResultsMessage

public void handleEventQueryInformationPersonaeResultsMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

handleGetAggregateTraitsMessage

public void handleGetAggregateTraitsMessage(AgentMessage m)
Description of the Method
Parameters:
m - Description of Parameter
Since:

queryFinished

protected void queryFinished(MessageWaiter messageWaiter)
Description of the Method
Parameters:
messageWaiter - Description of Parameter
Since:

queryIpIteration

protected void queryIpIteration(MessageWaiter messageWaiter, Collection recentResponses)
Description of the Method
Parameters:
messageWaiter - Description of Parameter
recentResponses - Description of Parameter
Since:

registerRoutingTags

protected void registerRoutingTags()
Description of the Method
Since:

responsesReceived

public void responsesReceived(MessageWaiter messageWaiter, Serializable identifier, Collection recentResponses)
Description of the Method
Parameters:
messageWaiter - Description of Parameter
identifier - Description of Parameter
recentResponses - Description of Parameter
Since:

run

public void run()
Main processing method for the SearchAgent object
Since:

setAggregateTraits

public void setAggregateTraits(AgentTraits oAggregateTraits)
Sets the AggregateTraits attribute of the SearchAgent object
Parameters:
oAggregateTraits - The new AggregateTraits value
Since:

unregisterRoutingTags

protected void unregisterRoutingTags()
Description of the Method
Since: