Exemple #1
0
 /// <summary>
 /// Deregister an active agent on the platform.
 /// For now, it will not return an error in case of the specified agent
 /// is already innactive.
 /// </summary>
 /// <returns></returns>
 /// <param name="agent">Agent AID</param>
 public void Deregister(AMSAgentDescription agent)
 {
     if (_activeAgents.ContainsKey(agent.GetAgentAID()))
     {
         _activeAgents.Remove(agent.GetAgentAID());
     }
 }
Exemple #2
0
        /// <summary>
        /// Register an Agent as active on the platform
        /// For now, it will accept and register. In the future, In case of an
        /// already registered agent having the same name, it will return an error.
        /// </summary>
        /// <returns>True if added, False otherwise</returns>
        /// <param name="agent">AMS Agent description</param>
        public bool Register(AMSAgentDescription agent)
        {
            if (_activeAgents.ContainsKey(agent.GetAgentAID()))
            {
                return(false);
            }

            _activeAgents.Add(agent.GetAgentAID(), agent);
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Search for a specific agent in AMS.
        /// </summary>
        /// <param name="agentTmpl">An agent description template</param>
        /// <param name="cstrnts">Search constraints</param>
        /// <returns>Array of results or null</returns>
        public AMSAgentDescription[] Search(AMSAgentDescription agentTmpl, SearchConstraints cstrnts)
        {
            List <AMSAgentDescription> similarAgents = new List <AMSAgentDescription>();

            // TODO: Make use of search constraints

            foreach (AMSAgentDescription existingAgent in _activeAgents.Values)
            {
                if (existingAgent.GetAgentAID() == agentTmpl.GetAgentAID())
                {
                    similarAgents.Add(existingAgent);
                }
            }

            // TODO: Make use of services and other parameters

            return(similarAgents.ToArray());
        }