/*********************************************************************/
/* */
/* 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 AgentService.Platform.AMS;
using AgentService.Platform.DF;
using AgentService.Platform.MTS;
using AgentService.Interop;
namespace AgentService.Platform
{
///
/// Interface IServiceController. Procvides access to
/// the services of the platform. In particular, exposes
/// the services provided through the AMS and the DF like
/// white and yellow pages.
///
public interface IServiceController
{
#region AMS Commands
///
/// Returns all the agents registered with the platform
///
///
AID[] GetRegisteredAgents();
///
/// Creates an agent with the given name and configuration file by using the specified template with
///
/// name of the agent
/// full name of the AgentTemplate derived class that defines the agent
/// configuration file
/// true, if the agent need to be created as persistent
/// AID of the newly created agent
AID CreateAgent(string type, string name, string config, bool bPersist);
//MOD : 19/05/2006 : Marco Garr : Add CreateAgent override
///
/// Creates an agent with the given name and configuration file by using the specified template with
///
/// name of the agent
/// full name of the AgentTemplate derived class that defines the agent
/// configuration file
/// true, if the agent need to be created as persistent
/// true, if the agent will be created in an Application Domain
/// AID of the newly created agent
AID CreateAgent(string type, string name, string config, bool bPersist, bool bDomain);
///
/// Creates an agent with the given name and configuration file by using the specified template with
///
/// name of the agent
/// full name of the AgentTemplate derived class that defines the agent
/// configuration file
/// true, if the agent need to be created as persistent
/// name of the Application Domain in which Agent will be created
/// AID of the newly created agent
AID CreateAgent(string type, string name, string config, bool bPersist, string domainName);
//ENDMOD
///
/// Activates the given list of agents
///
/// list of aids identifying the agents that need to be activated
void ActivateAgent(params AID[] aids);
///
/// Activates the given list of agents
///
/// list of aids identifying the agents that need to be activated
void ActivateAllAgents();
///
/// Wait for all the termination of all the active agent
///
void WaitForAllAgents();
///
/// Terminate the given list of agents
///
/// agent that will be terminated
/// True if the agent kill process succeds
bool KillAgent(params AID[] aids);
///
/// Terminate all the agents running into AgentService platform
///
void KillEmAll();
///
/// Suspends the given list of agents
///
/// list of agents that will be suspended
/// true if operation succeds
bool SuspendAgent(params AID[] aids);
///
/// Suspends all the agents
///
void SuspendAllAgents();
///
/// Wakes up the given list of agents
///
/// list of agents that will be suspended
bool WakeUpAgent(params AID[] aids);
///
/// Wakes up all the suspended agents
///
void WakeUpAllAgents();
///
/// Retrieves the description of an agent.
///
/// agent identifier
/// description of the agent
AgentDescription GetAgentDescription(AID aid);
///
/// Searches for agents that partially matches the pattern.
///
/// search pattern
/// array of containing all the description of agents
/// corresponding to the search pattern
AgentDescription[] SearchAgent(string pattern);
///
/// Searches for an agent that exactly matches the given name.
///
/// agent name
/// description of the corresponding agent if found, null otherwise
AgentDescription SearchExactAgent(string name);
#endregion
#region DF Commands
///
/// Searches for an agent that offers the given service.
///
/// service description
/// array of agent services description
DFAgentDescription[] SearchAgent(ServiceDescription sd);
///
/// Searches for an agent that offers the given service.
///
/// service description
/// search contstraint
/// array of agent services description
DFAgentDescription[] SearchAgent(ServiceDescription sd, SearchConstraints constraint);
///
/// Registers an agent with a given description.
///
/// agent services description
void Register(DFAgentDescription description);
///
/// Edits an existing agent description.
///
/// agent services description
void Edit(DFAgentDescription description);
///
/// Deregisters an agent corresponding to the given AID.
///
/// agent identifier
void Deregister(AID aid);
#endregion
#region Messaging
///
/// Gets a client for managing a message queue associated to the batch process
///
/// Name of the batch the message queue belongs to
/// messaging client
IMsgService GetMsgClient(string clientId);
///
/// Gets a collection of filtered messages
///
/// aid of the agent
/// filter criteria
/// list of filtered messages
AgentMessageCollection FilterMessage(AID aid, MessageFilter filter);
///
/// Clears all the messages in the storage.
///
void ClearAllMessages();
///
/// Clears all the messages in the storage for a given agent.
///
/// AID identifing the agent
/// true, if the process is successful
bool ClearAllMessages(AID aid);
#endregion
}
}