/*********************************************************************/
/* */
/* AgentService Framework */
/* www.agentservice.it */
/* */
/* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */
/* GNU Lesser General Public License */
/* */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation, */
/* version 2.1 of the License. */
/* */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public */
/* License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/* */
/*********************************************************************/
using System;
using System.ServiceModel;
using AgentService.Platform.AMS;
namespace AgentService.Platform.MTS
{
///
/// Interface IMsgService. This interface defines the
/// methods and the services that are offered to users
/// and within behavior objects to interact with the
/// messaging system.
///
public interface IMsgService
{
///
/// Raises when a proposal for a new conversation is received.
///
event ConversationDelegate OnIncomingConversation;
///
/// Open a bidirectional conversation with an agents.
///
/// agent identifier of the agent to talk to
/// identifier of the new conversation
IConversation OpenConversation(AID to);
///
/// Open a bidirectiona conversation, using the ontology service to represent message content and to validate it.
///
/// agent identifier of the agent to talk to
/// the ontology used to represent the message content
/// identifier of the new conversation
IOntologicalConversation OpenConversation(AID to, AgentService.Ontology.Ontology onto);
///
/// Checks whether the agent's queue has messages.
///
/// true if the queue has messages
bool HasMessages();
///
/// Sends a message to an agent.
///
/// message
/// true if the message has been successfully sent
bool SendMessage(AgentMessage message);
///
/// Receives a message and pops it from the queue.
///
/// the first message available in the queue
AgentMessage ReceiveMessage();
///
/// Receives all the messages that satisfy the condition of the given filter.
///
/// Specifies the selection criteria
/// If true the call is blocking
/// A collection of filtered messages retrieved from the agent's queue
AgentMessageCollection ReceiveMessage(MessageFilter filter, bool blocking);
///
/// Looks in the agent's queue for a message.
///
/// the first message available in the queue
AgentMessage PeekMessage();
///
/// Retrieves all the messages and removes them from the queue.
///
/// if true messages are removed from the queue
/// the collection of messages retrieved from the queue
AgentMessageCollection GetAllMessages(bool bRemove);
///
/// Waits until a new message arrives in the agent's queue and pops it.
///
/// The new message arrived
AgentMessage WaitForMessage();
///
/// Removes the given message from the queue.
///
/// message to be destroyed
/// true if message is successfully removed
bool RemoveMessage(AgentMessage message);
}
}