/*********************************************************************/
/* */
/* 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.Reflection;
using AgentService.Platform;
namespace AgentService.Agent.Runtime
{
///
/// Class DefaultRuntime. Implements the interface IRuntimeEx.
///
public class DefaultRuntime : AgentService.Agent.Runtime.IRuntimeEx
{
///
/// Reference to the messaging service client.
///
private IMsgClient msg;
///
/// Messaging Service (Sends, retrieves messages and conversation management).
///
public IMsgClient MessageSvc
{
get
{
return this.msg;
}
}
///
/// Persistence service client.
///
private IPersistenceClient prs;
///
/// Persistence Service (Persists and resumes Knowledge objects).
///
public IPersistenceClient PersistenceSvc
{
get
{
return this.prs;
}
}
///
/// Logging Service Client
///
private ILogClient log;
///
/// Logging Service (Gives access to the agent logging subsystem).
///
public ILogClient LogSvc
{
get
{
return this.log;
}
}
///
/// Yellow Page service.
///
private IYellowPagesClient yPages;
///
/// Yellow Pages Service (Searches agent's aid by service).
///
public IYellowPagesClient YPageSvc
{
get
{
return this.yPages;
}
}
///
/// White Pages service.
///
private IWhitePagesClient wPages;
///
/// White Pages Service (Searches agent's aid by name).
///
public IWhitePagesClient WPageSvc
{
get
{
return this.wPages;
}
}
// CHANGE 30/01/2006: added MobilitySvc
///
/// Mobility service.
///
private IMobilityClient mob;
///
/// Mobility Service (Move the agent to a remote platform)
///
public IMobilityClient MobilitySvc
{
get
{
return this.mob;
}
}
///
/// Platform console.
///
private ConsoleProxy console;
///
/// Gets a reference to the Platform Console.
///
public ConsoleProxy Console
{
get
{
return this.console;
}
}
// CHANGE 30/01/2006: added the support for the mobility Services
// parameter and assignation
///
/// Constructs a DefaultRuntime object with the given components.
///
/// client of the messagin system.
/// client of the persistence system.
/// client of the logging system.
/// yellow page service.
/// white page service.
/// platform console
public DefaultRuntime(AgentService.Agent.IAgent agent, IMsgClient msgClient, IPersistenceClient prsClient, ILogClient logClient, IYellowPagesClient ypClient, IWhitePagesClient wpClient, IMobilityClient mobClient, ConsoleProxy platformConsole)
{
this.msg = msgClient;
this.log = logClient;
this.prs = prsClient;
this.yPages = ypClient;
this.wPages = wpClient;
this.context = new DefaultBehaviourContext(agent);
this.console = platformConsole;
this.mob = mobClient;
}
///
/// Constructor used for cloning.
///
///
private DefaultRuntime()
{
// we do not have to do anything
// since all the fields will be
// set up in the Clone method
}
// CHANGE 30/01/2006: added the support for the mobility Services
// assignation
///
/// Gives a Runtime object for a new behaviour instance.
///
/// behaviour that will host the runtime
/// a Runtime object bound to the new behaviour
public IRuntime Clone(Behaviour.Behaviour behaviour)
{
DefaultRuntime cloned = new DefaultRuntime();
cloned.context = this.context.Clone(behaviour);
cloned.msg = this.msg;
cloned.prs = this.prs;
cloned.log = this.log;
cloned.yPages = this.yPages;
cloned.wPages = this.wPages;
cloned.console = this.console;
cloned.mob = this.mob;
return cloned;
}
///
/// Reference to the IBehaviourContext interface.
///
private DefaultBehaviourContext context;
///
/// Gets a reference to the IBehaviourContext interface.
///
public IBehaviourContext Context
{
get
{
return this.context;
}
}
}
}