10.07.2015 Views

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UAData}}Monitor.Exit(data);SendDenial();// LOCK OFF onlong enoughgap// Checks that the last Message sent to the UserAgent was sent// ago to be sure that it has arrivedprivate bool CheckIdleTime(DateTime timestamp){TimeSpan gap = DateTime.Now.Subtract(timestamp);// Sent since a time that is greater than the security}return gap.CompareTo(SecurityGap) > 0;private void SendConfirmation(){Message m = new Message(agent.GetId(), message.Sen<strong>de</strong>r,Message.Natures.Inform,Subjects.TerminationAccepted);conversation.SendAndClose(m);}}}private void SendDenial(){Message m = new Message(agent.GetId(), message.Sen<strong>de</strong>r,Message.Natures.Inform, "Deny termination");conversation.SendAndClose(m);}17. Class Architecture.UAMakerAg – User AgentMakerusing System;using System.Threading;using MAP;namespace Architecture{/// /// Plays the role of a factory for UserAgents./// public class UAMakerAg : Agent{public static readonly string SERVICE = "User_agent_factory";// Message filterpublic static readonly MessageCategory UACreation = newMessageCategory(Message.Natures.Request, Subjects.UACreation);GetId());public UAMakerAg() : base(){DirectoryFacilitator.GetDF().RegisterProvi<strong>de</strong>r(SERVICE,MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 102

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!