org.opencyc.cycagent
Class GenericAgent

java.lang.Object
  |
  +--org.opencyc.cycagent.GenericAgent
All Implemented Interfaces:
MessageReceiver
Direct Known Subclasses:
CycAgentProxy, CycProxy, Echo, RemoteCycConnection

public class GenericAgent
extends java.lang.Object
implements MessageReceiver

Provides generic agent capablilities for cyc agents participating in the CoABS and FIPA-OS agent communities.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
protected  AgentCommunityAdapter agentCommunityAdapter
          The interface to either the CoABS or FIPA-OS agent community.
protected  AgentCommunityAdapter coAbsCommunityAdapter
          the interface for interacting with the CoABS agent community
static int DEFAULT_VERBOSITY
          The default verbosity of the solution output.
protected  AgentCommunityAdapter fipaOsCommunityAdapter
          the interface for interacting with the FIPA-OS agent community
protected  boolean messageConsumed
          Indicates whether this class consumed the received message.
protected  java.lang.String myAgentName
          name of the local agent
protected  java.lang.String myAgentType
          type of the local agent
protected  int remoteAgentCommunity
          agent community to which the remote agent belongs
protected  java.lang.String remoteAgentName
          name of the remote agent
protected  int verbosity
          Sets verbosity of the constraint solver output.
 
Constructor Summary
GenericAgent()
          Constructs a GenericAgent object.
GenericAgent(java.lang.String myAgentName, int verbosity)
          Constructs a GenericAgent object for the given agent on both agent communities.
GenericAgent(java.lang.String myAgentName, int remoteAgentCommunity, int verbosity)
          Constructs a GenericAgent object for the given agent on the given agent community.
 
Method Summary
static CycList aclToCycList(fipaos.ont.fipa.ACL acl)
          Returns the CycList FIPA-2001 representation of the given ACL without using CycAccess.
 int agentCommunity()
          Returns the agent community.
 java.lang.String agentCommunityName()
          Returns the agent community name.
 java.lang.String getAgentType()
          Returns my agent type (FIPA-OS requirement).
 fipaos.ont.fipa.fipaman.AgentID getAID(int remoteAgentCommunity)
          Gets the AgentID of this Agent
 AgentCommunityAdapter getCoAbsCommunityAdapter()
          Returns the CoABS agent community adapter
 AgentCommunityAdapter getFipaOsCommunityAdapter()
          Returns the FIPA-OS agent community adapter
 java.lang.String getMyAgentName()
          Returns my agent name.
 void initializeAgentCommunity()
          Initialializes the agent community with the given degree of diagnostic verbosity.
 fipaos.ont.fipa.fipaman.AgentID makeAID(java.lang.String agentName, int remoteAgentCommunity)
          Makes an AgentID for the given agent name
 void messageReceived(int remoteAgentCommunity, fipaos.ont.fipa.ACL acl)
          Notifies my agent that an Agent Communication Language message has been received.
 void processEchoRequest(int remoteAgentCommunity, fipaos.ont.fipa.ACL echoRequestAcl)
          Processes an echo request from another agent.
 void setVerbosity(int verbosity)
          Sets verbosity of the output.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VERBOSITY

public static final int DEFAULT_VERBOSITY
The default verbosity of the solution output. 0 --> quiet ... 9 -> maximum diagnostic input.

verbosity

protected int verbosity
Sets verbosity of the constraint solver output. 0 --> quiet ... 9 -> maximum diagnostic input.

myAgentName

protected java.lang.String myAgentName
name of the local agent

remoteAgentName

protected java.lang.String remoteAgentName
name of the remote agent

remoteAgentCommunity

protected int remoteAgentCommunity
agent community to which the remote agent belongs

myAgentType

protected java.lang.String myAgentType
type of the local agent

coAbsCommunityAdapter

protected AgentCommunityAdapter coAbsCommunityAdapter
the interface for interacting with the CoABS agent community

fipaOsCommunityAdapter

protected AgentCommunityAdapter fipaOsCommunityAdapter
the interface for interacting with the FIPA-OS agent community

agentCommunityAdapter

protected AgentCommunityAdapter agentCommunityAdapter
The interface to either the CoABS or FIPA-OS agent community. This reference is provided for the convenience of agents which use only one of the agent communities, and is null when both are specified in the constructor method.

messageConsumed

protected boolean messageConsumed
Indicates whether this class consumed the received message.
Constructor Detail

GenericAgent

public GenericAgent()
Constructs a GenericAgent object.

GenericAgent

public GenericAgent(java.lang.String myAgentName,
                    int verbosity)
Constructs a GenericAgent object for the given agent on both agent communities.
Parameters:
myAgentName - name of the local agent
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community
verbosity - the verbosity of this agent adapter's output. 0 --> quiet ... 9 -> maximum diagnostic input

GenericAgent

public GenericAgent(java.lang.String myAgentName,
                    int remoteAgentCommunity,
                    int verbosity)
Constructs a GenericAgent object for the given agent on the given agent community.
Parameters:
myAgentName - name of the local agent
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community
verbosity - the verbosity of this agent adapter's output. 0 --> quiet ... 9 -> maximum diagnostic input
Method Detail

initializeAgentCommunity

public void initializeAgentCommunity()
Initialializes the agent community with the given degree of diagnostic verbosity.

messageReceived

public void messageReceived(int remoteAgentCommunity,
                            fipaos.ont.fipa.ACL acl)
Notifies my agent that an Agent Communication Language message has been received.
Specified by:
messageReceived in interface MessageReceiver
Parameters:
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community
acl - the Agent Communication Language message which has been received for my agent

processEchoRequest

public void processEchoRequest(int remoteAgentCommunity,
                               fipaos.ont.fipa.ACL echoRequestAcl)
Processes an echo request from another agent.
Parameters:
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community
echoRequestAcl - the echo request Agent Communication Language message

agentCommunity

public int agentCommunity()
Returns the agent community.
Returns:
the agent community

agentCommunityName

public java.lang.String agentCommunityName()
Returns the agent community name.
Returns:
the agent community name

getCoAbsCommunityAdapter

public AgentCommunityAdapter getCoAbsCommunityAdapter()
Returns the CoABS agent community adapter
Returns:
the CoABS agent community adapter

getFipaOsCommunityAdapter

public AgentCommunityAdapter getFipaOsCommunityAdapter()
Returns the FIPA-OS agent community adapter
Returns:
the FIPA-OS agent community adapter

getMyAgentName

public java.lang.String getMyAgentName()
Returns my agent name.
Specified by:
getMyAgentName in interface MessageReceiver
Returns:
my agent name

getAgentType

public java.lang.String getAgentType()
Returns my agent type (FIPA-OS requirement).
Specified by:
getAgentType in interface MessageReceiver
Returns:
my agent type

getAID

public fipaos.ont.fipa.fipaman.AgentID getAID(int remoteAgentCommunity)
Gets the AgentID of this Agent
Parameters:
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community

makeAID

public fipaos.ont.fipa.fipaman.AgentID makeAID(java.lang.String agentName,
                                               int remoteAgentCommunity)
Makes an AgentID for the given agent name
Parameters:
agentName - the name of the agent
remoteAgentCommunity - indicates either CoAbs or FIPA-OS agent community

aclToCycList

public static CycList aclToCycList(fipaos.ont.fipa.ACL acl)
                            throws org.jdom.JDOMException,
                                   java.io.IOException
Returns the CycList FIPA-2001 representation of the given ACL without using CycAccess.
Parameters:
acl - the Agent Communication Lanaguage message object.
Returns:
the CycList representation of the given ACL without using CycAccess

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object

setVerbosity

public void setVerbosity(int verbosity)
Sets verbosity of the output. 0 --> quiet ... 9 -> maximum diagnostic input.
Parameters:
verbosity - 0 --> quiet ... 9 -> maximum diagnostic input