com.reticular.agentBuilder.agent.perception
Class PacCommSystem

com.reticular.agentBuilder.agent.perception.PacCommSystem
All Implemented Interfaces:
java.lang.Cloneable

public class PacCommSystem
implements java.lang.Cloneable

PacCommSystem is a convenience class which simplifies the sending of KQML messages from a PAC to the parent agent. A PacCommSystem object can be constructed from an AgentInfo object from the parent agent, and the PAC name. Then, to send a message from the PAC to the agent the PAC code can simply invoke sendKqmlMessageToAgent( mssg ). Addressing of the KQML message is handled by the PacCommSystem code, so the user only needs to set the performative, message content, etc.


Constructor Summary
PacCommSystem(AgentInfo parentAgentInfo, java.lang.String pacName)
          A constructor to setup the communication system for a Private Action Class (PAC).
PacCommSystem(AgentInfo parentAgentInfo, java.lang.String pacName, java.security.KeyPair pacKeyPair)
          A constructor to setup the communication system for a Private Action Class (PAC).
 
Method Summary
 java.lang.Object clone()
          Return a reference to this PacCommSystem.
 void sendKqmlMessageToAgent(KqmlMessage message)
          Sets the sender and receiver fields in a KqmlMessage then sends the message.
 void setAgentCommSystem(com.reticular.agentBuilder.agent.perception.Perception commSystem)
          Store a reference to the parent agent's comm system into this PacCommSystem.
 

Constructor Detail

PacCommSystem

public PacCommSystem(AgentInfo parentAgentInfo,
                     java.lang.String pacName)
              throws com.reticular.agentBuilder.util.exception.AgentBuilderException
A constructor to setup the communication system for a Private Action Class (PAC). The PacCommSystem constructor requires an AgentInfo object for the parent agent, and the name.
Parameters:
parentAgentInfo - - AgentInfo
pacName - - String

PacCommSystem

public PacCommSystem(AgentInfo parentAgentInfo,
                     java.lang.String pacName,
                     java.security.KeyPair pacKeyPair)
              throws com.reticular.agentBuilder.util.exception.AgentBuilderException
A constructor to setup the communication system for a Private Action Class (PAC). The PacCommSystem constructor requires an AgentInfo object for the parent agent, and the name and (optionally) the keypair for the PAC object.
Parameters:
parentAgentInfo - - AgentInfo
pacName - - String
pacKeyPair - - KeyPair
Method Detail

setAgentCommSystem

public void setAgentCommSystem(com.reticular.agentBuilder.agent.perception.Perception commSystem)
Store a reference to the parent agent's comm system into this PacCommSystem.
Parameters:
commSystem - - Perception

sendKqmlMessageToAgent

public void sendKqmlMessageToAgent(KqmlMessage message)
Sets the sender and receiver fields in a KqmlMessage then sends the message. The sender name is always set to the PAC name stored in this PacCommSystem object, the receiver name is always set to the parent agent name stored in this PacCommSystem object.
Parameters:
message - - KqmlMessage ready for sending except the sender and receiver fields need not be initialized. NOTE: Any previous values in the sender or receiver fields will get clobbered, and the sender and receiver will be set to the values stored in this PacCommSystem object.

clone

public java.lang.Object clone()
Return a reference to this PacCommSystem.
Returns:
Object