org.opencyc.cycagent.fipaos
Class FipaOsCommunityAdapter

java.lang.Object
  |
  +--fipaos.agent.FIPAOSAgent
        |
        +--org.opencyc.cycagent.fipaos.FipaOsCommunityAdapter
All Implemented Interfaces:
AgentCommunityAdapter, fipaos.agent.conversation.ConversationListener

public class FipaOsCommunityAdapter
extends fipaos.agent.FIPAOSAgent
implements AgentCommunityAdapter

Provides the interface for interacting with the FIPA-OS agent community.

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.


Inner Class Summary
 class FipaOsCommunityAdapter.AgreeInformTask
          Provides for handling the reply to the request message of a fipa-request conversation.
 class FipaOsCommunityAdapter.IdleTask
          Provides an idle task which handles incomming messages which are not otherwise associated with an in-progress conversation.
 class FipaOsCommunityAdapter.RequestTask
          Provides for the initiation and handling of a fipa-request conversation.
protected  class FipaOsCommunityAdapter.Shutdown
          Thread which shuts down the agent nicely.
 
Inner classes inherited from class fipaos.agent.FIPAOSAgent
fipaos.agent.FIPAOSAgent.TopLevelHandlerTask
 
Field Summary
protected  int diagnosticLevel
          the FIPA-OS diagnostic level
protected  boolean isRegistered
          Indicates whether this agent is registered.
protected  MessageReceiver messageReceiver
          The parent agent object which implements the MessageReceiver interface.
 int msgSerialNumber
          outbound message serial number.
protected  java.lang.String myAgentName
          reference to the name of my agent
static java.lang.String OWNER
          the FIPA-OS agent owner
static java.lang.String platform_profile
          the platform profile location
protected  java.util.Hashtable replyMessages
          Implements an association: message id --> reply message acl.
protected  int verbosity
          Sets verbosity of this object's output.
static long WAIT_FOREVER
           
protected  java.util.Hashtable waitingReplyThreads
          Implements an association: message id --> waiting thread for the reply.
 
Fields inherited from class fipaos.agent.FIPAOSAgent
_database_profile, _registered_with, _state, _tm
 
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
FipaOsCommunityAdapter(MessageReceiver messageReceiver, int verbosity)
          Constructs a new FipaOsCommunityAdapter object for the given agent, with the given verbosity.
 
Method Summary
 fipaos.ont.fipa.ACL converseMessage(fipaos.ont.fipa.ACL acl, Timer timer)
          Sends an Agent Communication Language message and returns the reply.
 void deregister()
          De-register this agent.
 void initialize(MessageReceiver messageReceiver, int verbosity)
          Not used in the FipaOsCommunityAdapter.
 java.lang.String nextMessageId()
          Returns the next message serial number identifier.
protected  void register()
          Registers the agent on the FIPA-OS agent community.
 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.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class fipaos.agent.FIPAOSAgent
activate, addNewProtocol, deregisterWithAMS, deregisterWithDF, forward, forward, getAID, getCM, getCurrentConversation, getHAP, getLocalAMS, getLocalAMSAID, getLocalDF, getLocalDFAID, getNewConversation, getOwnership, getPlatformProfile, getProfile, getState, isShutdown, knowsProtocol, notify, notify, notifyDone, notifyError, notifyMessageInEndedConversation, notifyMessageUndeliverable, notifyTimeout, registeredWith, registeredWithAMS, registeredWithDF, registerWithAMS, registerWithAMS, registerWithAMS, registerWithAMS, registerWithDF, registerWithDF, registerWithDF, registerWithDF, sendNotUnderstood, sendNotUnderstood, setListenerTask, setMessageSender, shutdown, startPushing, waitForPushLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opencyc.cycagent.AgentCommunityAdapter
getAID
 

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

messageReceiver

protected MessageReceiver messageReceiver
The parent agent object which implements the MessageReceiver interface.

platform_profile

public static java.lang.String platform_profile
the platform profile location

OWNER

public static final java.lang.String OWNER
the FIPA-OS agent owner

diagnosticLevel

protected int diagnosticLevel
the FIPA-OS diagnostic level

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.

isRegistered

protected boolean isRegistered
Indicates whether this agent is registered.

WAIT_FOREVER

public static final long WAIT_FOREVER
Constructor Detail

FipaOsCommunityAdapter

public FipaOsCommunityAdapter(MessageReceiver messageReceiver,
                              int verbosity)
Constructs a new FipaOsCommunityAdapter object for the given agent, with the given verbosity.
Parameters:
verbosity - the verbosity of this agent adapter's output. 0 --> quiet ... 9 -> maximum diagnostic input
Method Detail

initialize

public void initialize(MessageReceiver messageReceiver,
                       int verbosity)
                throws java.io.IOException
Not used in the FipaOsCommunityAdapter.
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()
Registers the agent on the FIPA-OS agent community.

sendMessage

public void sendMessage(fipaos.ont.fipa.ACL acl)
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 - a Timer object contolling 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

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

deregister

public void deregister()
De-register this agent.
Specified by:
deregister in interface AgentCommunityAdapter

terminate

public void terminate()
Terminate this agent.
Specified by:
terminate 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

toString

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