/*********************************************************************/
/* */
/* 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.Collections.Generic;
using System.Text;
using AgentService.Interop;
using AgentService.Agent.Runtime;
using AgentService.Agent;
using AgentService.Platform.MTS;
namespace AgentService.Platform.AMS
{
///
/// Interface IAMS. Exposes themethods that are used
/// to interact with IAMS from within the classes that
/// constitute the runtime.
///
public interface IAMS
{
# region Members
///
/// Gets a copy of the collection of agents registered with the ams
///
AgentDescriptionCollection RegisteredAgents
{
get;
}
///
/// Gets the White Pages service.
///
IWhitePagesServer WhitePages
{
get;
}
# endregion
# region Manage Agent SetUp and Registration
///
/// Initites and register the created agent with the AMS.
///
/// Agent.
/// the configfile of the Agent
/// List of value to inizialize Agent's attribute
/// persistence flag
/// domain flag
///
void Register(AgentService.Agent.IAgent agent, string configFile, bool bPersist);
///
/// Starts agent activity
///
/// agent identifier to be started
void Activate(AID aid);
///
/// Starts the activity of all the registered agents
///
void ActivateAll();
///
/// Puts the agent in the previous persisted state.
///
/// Agent.
void Resume(AgentService.Agent.IAgent agent);
///
/// Deregister a specific Agent. Deregistration
/// implies the removal of the agent object from
/// the collection of managed agents
///
/// The Agent's AID
bool Deregister(AID aid, bool bDestroy);
# endregion
#region Override
///
/// Loads agent data from its persisted version
///
/// Persisted version of the agent.
void ResumeFrom(AgentPersistent persistent);
#endregion
# region Manage Agent State
///
/// Put Agent in active state after transition
///
/// The persisted version of the agent
void Execute(AID aid);
// MOD: 21/07/2006 Simone Belotti: changed the Move method to support timeout value
///
/// Put Agent in the transit state before its migration
///
/// The Agent's AID
/// The name of the destination platform
/// Flag that indicates if the request to move
/// the agent was originated by the platform
/// (i.e. load balancing motivation), or it
/// was originated by the agent itself
void Move(AID aid, string destination, TimeSpan timeout, bool bIsSystemRequest);
///
/// Put the Agent in the active state after its suspention
///
/// The Agent's AID
/// true if operation succeds
bool ResumeAgent(AID aid);
///
/// Puts Agent in the suspended state
///
/// The Agent's AID
/// true if operation succeds
bool Suspend(AID aid);
///
/// Suspends all the active agents
///
void SuspendAll();
///
/// Stops the agent activity
///
/// agent identifier
///
bool StopAgent(AID aid);
///
/// Kill the Agent putting it in the unknown state
///
/// the Agent's AID
/// true if operation succeds
bool Destroy(AID aid);
///
/// Kill all agents putting it in the unknown state
///
void DestroyAll();
///
/// Puts Agent in the active state from the waiting state
///
/// The Agent's AID
/// True if operation succeds
bool WakeUp(AID aid);
///
/// Put Agent in the active state from the waiting state
///
void WakeUpAll();
# endregion
#region CallBacks
///
/// Handler of messages directed to the AMS
///
///
void DispatchMessage(AgentMessage msg);
///
/// Delegate: invoked when the agentTransferred event is raised. It
/// creates the received agent and resumes from the persisted version. The
/// agent is added in the agentsToExecute list. It sends
/// a message to the remote AMS to inform it of completion of the operation,
/// either it is succesfull or not.
///
/// Received persisted version of the agent
/// Ticket owned by the transferred agent. Parameter for an internal check
void ResumeAgentTransferred(AgentPersistent persistedAgent, int ticket);
#endregion
}
}