## org.opencyc.cycagent
Class CycAgentProxy

    java.lang.Object
      |
      +--org.opencyc.cycagent.GenericAgent
            |
            +--org.opencyc.cycagent.CycAgentProxy

All Implemented Interfaces:
  MessageReceiver

public class CycAgentProxy
extends GenericAgent

Provides a proxy for a cyc agent on the CoABS grid or FIPA-OS agent community.

An instance of this class is created for each unique cyc agent which makes itself known to the CycProxy. A cyc image can host one or more cyc agents. Each message envelope from a cyc agent contains a parameter to indicate which agent agent community processes the messge - either the CoABS grid (Darpa & gov) or the FIPA-OS platform (OpenCyc).

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
`CycConnection` `agentsCycConnection` One CycConnection object to send and receive asynchronous messsages with the Cyc server.

Fields inherited from class org.opencyc.cycagent.GenericAgent
`agentCommunityAdapter, coAbsCommunityAdapter, DEFAULT_VERBOSITY, fipaOsCommunityAdapter, messageConsumed, myAgentName, myAgentType, remoteAgentCommunity, remoteAgentName, verbosity`

Constructor Summary
`CycAgentProxy(java.lang.String myAgentName, int verbosity)` Constructs a CycProxy object for the given agent on both agent communities.
`CycAgentProxy(java.lang.String myAgentName, int remoteAgentCommunity, int verbosity)` Constructs a CycProxy object for the given agent on the given agent community.

Method Summary
`protected void` `handleMessageFromCyc(CycList fipaTransportMessage)` Handles one inbound asynchronous message from a Cyc-hosted agent.
`void` `handleMessageToCyc(int remoteAgentCommunity, fipaos.ont.fipa.ACL acl)` Handles a message from a remote agent to a Cyc-hosted agent.
`void` `messageReceived(int remoteAgentCommunity, fipaos.ont.fipa.ACL acl)` Notifies my agent that an Agent Communication Language message has been received.

Methods inherited from class org.opencyc.cycagent.GenericAgent
`aclToCycList, agentCommunity, agentCommunityName, getAgentType, getAID, getCoAbsCommunityAdapter, getFipaOsCommunityAdapter, getMyAgentName, initializeAgentCommunity, makeAID, processEchoRequest, setVerbosity, toString`

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

Field Detail

### agentsCycConnection

    public CycConnection agentsCycConnection

  One CycConnection object to send and receive asynchronous messsages with the Cyc server. All Cyc-hosted agents share this bidirectional connection.

Constructor Detail

### CycAgentProxy

    public CycAgentProxy(java.lang.String myAgentName,
                         int verbosity)

  Constructs a CycProxy object for the given agent on both agent communities.
  Parameters:
    `myAgentName` - name of the local agent
    `verbosity` - the verbosity of this agent adapter's output. 0 --> quiet ... 9 -> maximum diagnostic input

### CycAgentProxy

    public CycAgentProxy(java.lang.String myAgentName,
                         int remoteAgentCommunity,
                         int verbosity)

  Constructs a CycProxy 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

### messageReceived

    public void messageReceived(int remoteAgentCommunity,
                                fipaos.ont.fipa.ACL acl)

  Notifies my agent that an Agent Communication Language message has been received.
  Overrides:
    `messageReceived` in class `GenericAgent`
  Parameters:
    `remoteAgentCommunity` - indicates either CoAbs or FIPA-OS agent community
    `acl` - the Agent Communication Language message which has been received for my agent

### handleMessageToCyc

    public void handleMessageToCyc(int remoteAgentCommunity,
                                   fipaos.ont.fipa.ACL acl)

  Handles a message from a remote agent to a Cyc-hosted agent.
  Parameters:
    `remoteAgentCommunity` - indicates either CoAbs or FIPA-OS agent community
    `processApiRequest` - the echo request Agent Communication Language message

### handleMessageFromCyc

    protected void handleMessageFromCyc(CycList fipaTransportMessage)

  Handles one inbound asynchronous message from a Cyc-hosted agent. Creates a CycAgentProxy object if the Cyc-hosted agent is new. Forwards the inbound message to the CycAgentProxy, which in turn forwards it to the agent community.
  Parameters:
    `fipaTransportMessage` - the message from a Cyc-hosted agent