/*********************************************************************/
/* */
/* 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;
namespace AgentService.Agent.Runtime
{
///
/// Class DefaultMobilityClient. Default implementation for
/// the mobility client interface.
///
public class DefaultMobilityClient : IMobilityClient
{
// MOD: 24/04/2006 : Marco Garr changed from AMS class to IAMS interface
public static readonly TimeSpan DefaultTimeout = new TimeSpan(0,5,0);
///
/// Reference to the AMS used to access to the mobility
/// function
///
private IAMS ams;
///
/// Default constructor
///
/// Reference to the AMS
public DefaultMobilityClient(IAMS ams)
{
this.ams = ams;
}
#region IMobilityClient Members
///
/// IMobilityClient.Move implementation. Move the given agent
/// to the given platform
///
/// AID of the agent to move
/// Name of the destination platform
// TODO: mandare un messaggio direttamente all'AMS utilizzando un reference
// al runtime
///
/// Transfer the selected agent to the given platform
///
/// AID of the agent to transfer
/// Name of the destination platform
public void Move(AID aid, string destination)
{
this.Move(aid, destination, DefaultMobilityClient.DefaultTimeout);
}
///
/// Transfer the selected agent to the given platform
///
/// AID of the agent to transfer
/// Name of the destination platform
/// Timeout for the transfer process
public void Move(AID aid, string destination, TimeSpan timeout)
{
this.ams.Move(aid, destination, timeout, false);
}
#endregion
}
}