/*********************************************************************/ /* */ /* 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 AgentService.Platform.MTS; using AgentService.Interop; using AgentService.Ontology; using System.ServiceModel; using AgentService.Platform.Modules; using AgentService.Platform.AMS; using System; using System.Collections.Generic; namespace AgentService.Agent.Runtime { [ServiceContract] [ServiceKnownType(typeof(MessageBodyItemCollection))] [ServiceKnownType(typeof(MessageBodyItem))] [ServiceKnownType(typeof(ConversationBody))] [ServiceKnownType(typeof(OntologyTypeDescriptor))] [ServiceKnownType(typeof(TypeDescriptor))] public interface IRemoteMsgClient: IRuntimeBindable { /// /// 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 [OperationContract(Name = "OpenConversation_AID")] [ServiceKnownType(typeof(RemoteConversation))] IConversation OpenConversation(AID from, AID to); /// /// Open a bidirectional 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 [OperationContract(Name = "OpenConversation_AID_Ontology")] [ServiceKnownType(typeof(RemoteOntologicalConversation))] IOntologicalConversation OpenConversation(AID from, AID to, AgentService.Ontology.Ontology onto); /// /// Checks whether the agent's queue has messages. /// /// true if the queue has messages [OperationContract] bool HasMessages(AID aid); /// /// Sends a message to an agent. /// /// message /// true if the message has been successfully sent [OperationContract] [ServiceKnownType(typeof(ConversationBody))] bool SendMessage(AgentMessage message); /// /// Receives a message and pops it from the queue. /// /// the first message available in the queue [OperationContract(Name = "ReceiveMessage")] AgentMessage ReceiveMessage(AID aid); /// /// 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 [OperationContract(Name = "ReceiveMessage_Filter_Blocking")] AgentMessageCollection ReceiveMessage(AID aid, MessageFilter filter, bool blocking); /// /// Looks in the agent's queue for a message. /// /// the first message available in the queue [OperationContract] AgentMessage PeekMessage(AID aid); /// /// 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 [OperationContract] AgentMessageCollection GetAllMessages(AID aid, bool bRemove); /// /// Retrieves all the messages and removes them from the queue. /// /// /// identifies the kind of messages to be retreived. /// identifier greater than 0 returns all the messages belonging to the specified conversation /// identifier equal to 0 returns all the service messages in the queue /// identifier less than than 0 returns specific type of service messages /// /// if true messages are removed from the queue /// the collection of messages retrieved from the queue [OperationContract(Name = "GetAllMessages_id_brem")] AgentMessageCollection GetAllMessages(AID aid, string identifier, bool bRemove); /// /// Waits until a new message arrives in the agent's queue and pops it. /// /// The new message arrived /// NOT ACTUALLY USED [OperationContract] AgentMessage WaitForMessage(AID aid); /// /// Removes the given message from the queue. /// /// message to be destroyed /// true if message is successfully removed [OperationContract] bool RemoveMessage(AID aid, AgentMessage message); /// /// Receives a message belonging to a given conversation and pops it from the queue. /// /// conversation identifier /// if true removes the message from the queue /// the first message available in the queue [OperationContract] AgentMessage GetMessage(AID aid, string convId, bool bRemove); /// /// Close an active conversation /// /// The AID of the owner of the conversation /// The ID of the conversation [OperationContract] void CloseConversation(AID aid, string convId); /// /// Removes a conversation from the active conversation list /// /// The owner of the conversation /// The ID of the conversation [OperationContract] void RemoveConversation(AID aid, string convId); [OperationContract] [ServiceKnownType(typeof(RemoteConversationDescriptor))] List GetConversationsList(AID aid); /// /// Accept an incoming conversation /// /// The conversation owner /// The ID of the incoming conversation [OperationContract] void AcceptConversation(AID aid, string convId); /// /// Reject an incoming conversation /// /// The conversation owner /// The ID of the incoming conversation [OperationContract] void RejectConversation(AID aid, string convId); } }