Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.opencyc.cycagent.coabs
Class CoAbsCommunityAdapter

    java.lang.Object
      |
      +--org.opencyc.cycagent.coabs.CoAbsCommunityAdapter

All Implemented Interfaces:
  AgentCommunityAdapter, java.util.EventListener, com.globalinfotek.coabsgrid.MessageListener, com.globalinfotek.coabsgrid.ShutdownHook

public class CoAbsCommunityAdapter
extends java.lang.Object
implements AgentCommunityAdapter, com.globalinfotek.coabsgrid.MessageListener, com.globalinfotek.coabsgrid.ShutdownHook

Provides the interface for interacting with the CoABS agent community.

The package org.opencyc.cycagent.coabs is an optional package for OpenCyc. If the developer does not have access to the CoABS grid classes from Global Infotek, then the org.opencyc.cycagent.coabs package can be ommitted from the build. The FIPA-OS agent community is freely available as open source and OpenCyc can be configured to work with it alone, or in combination with CoABS when available.

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 static java.util.Hashtable` | `agentRepCache` Cached AgentRep objects which reduce lookup overhead.
`protected java.lang.String` | `conversationState` The conversation state.
`int` | `msgSerialNumber` outbound message serial number.
`protected java.lang.String` | `myAgentName` reference to the name of my agent
`protected com.globalinfotek.coabsgrid.AgentRegistrationHelper` | `regHelper` the CoABS AgentRestrationHelper object.
`protected java.util.Hashtable` | `replyMessages` Implements an association: message id --> reply message acl.
`protected int` | `verbosity` Sets verbosity of this object's output.
`protected java.util.Hashtable` | `waitingReplyThreads` Implements an association: message id --> waiting thread for the reply.

Fields inherited from interface org.opencyc.cycagent.AgentCommunityAdapter
`COABS_AGENT_COMMUNITY, CYC_API_ONTOLOGY, CYC_ECHO_ONTOLOGY, DEFAULT_VERBOSITY, FIPA_OS_AGENT_COMMUNITY, FIPA_OS_AND_COABS_AGENT_COMMUNITIES, LOW_VERBOSITY, MAX_VERBOSITY, MEDIUM_VERBOSITY, QUIET_VERBOSITY`

Constructor Summary
`CoAbsCommunityAdapter()` Constructs a new CoAbsCommunityAdapter.

Method Summary
`void` | `cleanup()` Deregisters this agent when the application is terminated.
`fipaos.ont.fipa.ACL` | `converseMessage(fipaos.ont.fipa.ACL acl, Timer timer)` Sends an Agent Communication Language message and returns the reply.
`void` | `deregister()` Deregisters this agent.
`protected static java.lang.String` | `fixSenderReceiver(java.lang.String aclText)` Fixes the :sender and :receiver parameter in the CoABS message to make them FIPA ACL compatible.
`fipaos.ont.fipa.fipaman.AgentID` | `getAID()` Gets the AgentID of this Agent.
`void` | `initialize(MessageReceiver messageReceiver, int verbosity)` Initializes the new CoAbsCommunityAdapter instance.
`protected com.globalinfotek.coabsgrid.AgentRep` | `lookupAgentRep(java.lang.String agentName)` Returns the AgentRep object for the given agent name.
`void` | `messageAdded(com.globalinfotek.coabsgrid.Message message)` Receives messages from the CoABS grid.
`java.lang.String` | `nextMessageId()` Returns the next message serial number identifier.
`protected void` | `register()` Registers the CoABS agent on the grid.
`void` | `sendMessage(fipaos.ont.fipa.ACL acl)` Sends an Agent Communication Language message.
`void` | `setVerbosity(int verbosity)` Sets verbosity of this object's output.
`void` | `terminate()` Terminate this agent.
`void` | `xforward(com.globalinfotek.coabsgrid.Message message, java.lang.String messageId)` Forwards the message to the CoABS grid.

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

Field Detail

### msgSerialNumber

    public int msgSerialNumber

  outbound message serial number.

### verbosity

    protected int verbosity

  Sets verbosity of this object's output. 0 --> quiet ... 9 -> maximum diagnostic input.

### myAgentName

    protected java.lang.String myAgentName

  reference to the name of my agent

### regHelper

    protected com.globalinfotek.coabsgrid.AgentRegistrationHelper regHelper

  the CoABS AgentRestrationHelper object.

### waitingReplyThreads

    protected java.util.Hashtable waitingReplyThreads

  Implements an association: message id --> waiting thread for the reply.

### replyMessages

    protected java.util.Hashtable replyMessages

  Implements an association: message id --> reply message acl.

### conversationState

    protected java.lang.String conversationState

  The conversation state.

### agentRepCache

    protected static java.util.Hashtable agentRepCache

  Cached AgentRep objects which reduce lookup overhead. myAgentName --> agentRep

Constructor Detail

### CoAbsCommunityAdapter

    public CoAbsCommunityAdapter()
                          throws java.io.IOException

  Constructs a new CoAbsCommunityAdapter. The default constructor is required for convenient instantiation via the class newInstance method. The CoABS source package is optional when building OpenCyc and this object is contructed using its string name to avoid compilation errors when the org.opencyc.cycagent.coabs source package is ommited from the build.

Method Detail

### initialize

    public void initialize(MessageReceiver messageReceiver,
                           int verbosity)
                    throws java.io.IOException

  Initializes the new CoAbsCommunityAdapter instance.
  Specified by:
    `initialize` in interface `AgentCommunityAdapter`
  Parameters:
    `messageReceiver` - the parent application which can receive agent messages via a callback
    `verbosity` - the verbosity of this agent adapter's output. 0 --> quiet ... 9 -> maximum diagnostic input

### register

    protected void register()
                     throws java.io.IOException

  Registers the CoABS agent on the grid.

### fixSenderReceiver

    protected static java.lang.String fixSenderReceiver(java.lang.String aclText)
                                                 throws fipaos.parser.ParserException

  Fixes the :sender and :receiver parameter in the CoABS message to make them FIPA ACL compatible. Also encloses service id in string quotes.
  Parameters:
    `aclText` - the ACL expression in string form with :sender and with :receiver
  Returns:
    the ACL expression in string form with :sender (agent-identifier :name ) and with :receiver (set (agent-identifier :name ))

### nextMessageId

    public java.lang.String nextMessageId()

  Returns the next message serial number identifier.
  Specified by:
    `nextMessageId` in interface `AgentCommunityAdapter`
  Returns:
    the next message serial number identifier

### sendMessage

    public void sendMessage(fipaos.ont.fipa.ACL acl)
                     throws java.io.IOException

  Sends an Agent Communication Language message.
  Specified by:
    `sendMessage` in interface `AgentCommunityAdapter`
  Parameters:
    `acl` - the Agent Communication Language message to be sent

### converseMessage

    public fipaos.ont.fipa.ACL converseMessage(fipaos.ont.fipa.ACL acl,
                                               Timer timer)
                                        throws javax.naming.TimeLimitExceededException,
                                               java.io.IOException

  Sends an Agent Communication Language message and returns the reply.
  Specified by:
    `converseMessage` in interface `AgentCommunityAdapter`
  Parameters:
    `acl` - the Agent Communication Language message to be sent
    `timer` - the Timer object controlling the maximum wait time for a reply message, after which an excecption is thrown.
  Returns:
    the Agent Communication Language reply message which has been received for my agent

### messageAdded

    public void messageAdded(com.globalinfotek.coabsgrid.Message message)

  Receives messages from the CoABS grid.
  Specified by:
    `messageAdded` in interface `com.globalinfotek.coabsgrid.MessageListener`
  Parameters:
    `message` - the message received from the CoABS grid

### lookupAgentRep

    protected com.globalinfotek.coabsgrid.AgentRep lookupAgentRep(java.lang.String agentName)
                                                           throws java.io.IOException

  Returns the AgentRep object for the given agent name.
  Parameters:
    `agentName` - the agent name
  Returns:
    the AgentRep object for the given agent name

### xforward

    public void xforward(com.globalinfotek.coabsgrid.Message message,
                         java.lang.String messageId)

  Forwards the message to the CoABS grid.
  Parameters:
    `message` - the CoABS message

### cleanup

    public void cleanup()

  Deregisters this agent when the application is terminated.
  Specified by:
    `cleanup` in interface `com.globalinfotek.coabsgrid.ShutdownHook`

### deregister

    public void deregister()

  Deregisters this agent.
  Specified by:
    `deregister` in interface `AgentCommunityAdapter`

### terminate

    public void terminate()

  Terminate this agent.
  Specified by:
    `terminate` in interface `AgentCommunityAdapter`

### getAID

    public fipaos.ont.fipa.fipaman.AgentID getAID()

  Gets the AgentID of this Agent. Not used by the CoAbsCommunityAdapter.
  Specified by:
    `getAID` in interface `AgentCommunityAdapter`

### setVerbosity

    public void setVerbosity(int verbosity)

  Sets verbosity of this object's output. 0 --> quiet ... 9 -> maximum diagnostic input.
  Specified by:
    `setVerbosity` in interface `AgentCommunityAdapter`
  Parameters:
    `verbosity` - 0 --> quiet ... 9 -> maximum diagnostic input

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD