/*********************************************************************/
/* */
/* 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.Platform
{
///
/// Application Domain Policy interface
///
interface IDomainPolicy
{
///
/// return the new AID for the agent with information about the Application Domain to be created
///
/// aid to be override
/// full type of the agent
///
AID GetAIDfor(AID aid, string templateName);
}
///
/// DefaultDomainPolicy: check if user has provided a name for the domain, if false
/// use the name of the agent for the name of the domain
///
class DefaultDomainPolicy : IDomainPolicy
{
#region Members
#endregion
#region Constructor
public DefaultDomainPolicy()
{
//do nothing
}
#endregion
#region IDomainPolicy Members
public AID GetAIDfor(AID aid, string templateName)
{
AID newAID;
if (aid.DomainName == "")
{
newAID = new AID(aid.Name, aid.HapName, aid.RequireDomain, aid.Name, aid.Addresses[0]);
}
else newAID = new AID(aid.Name, aid.HapName, aid.RequireDomain, aid.DomainName, aid.Addresses[0]);
return newAID;
}
#endregion
}
///
/// NoDomainPolicy: all the agents will be created in tha default application domain
///
class NoDomainPolicy : IDomainPolicy
{
#region Members
#endregion
#region Constructor
public NoDomainPolicy()
{
//do nothing
}
#endregion
#region IDomainPolicy Members
public AID GetAIDfor(AID aid, string templateName)
{
AID newAID;
newAID = new AID(aid.Name, aid.HapName, false, "", aid.Addresses[0]);
return newAID;
}
#endregion
}
}