private void _printPackage(int level, HttpRequest req, Package package, VirtualHuman human) { if (package == null) return; req.response.write("<div class=\"node\">"); req.response.write("<img src = em_package.png>"); req.response.write(" "); req.response.write(package.name); level++; req.response.write("<ul>"); foreach (KeyValuePair<string, Class> cl in package.Classes) { req.response.write("<P><img src =EndL.png>"); req.response.write("<img src =em_class.png>"); req.response.write(" <a href=\"Class?alias="); req.response.write(cl.Value.name); if (human != null) { req.response.write("&agent="); req.response.write(human.name); } req.response.write("\" target = \"Body\">"); req.response.write(cl.Value.name); req.response.write("</a>"); req.response.write("</P>"); } foreach (KeyValuePair<string, Package> pkg in package.Packages) _printPackage(level, req, pkg.Value, human); req.response.write("</ul>"); req.response.write("</div>"); }
public override void manageRequest(HttpRequest req) { string structName = req.parameters["alias"]; req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); OrganisationalStructure struc = null; List<OrganisationalStructure> structs = MascaretApplication.Instance.AgentPlateform.Structures; bool found = false; int iO = 0; while (!found && iO < structs.Count) { if (structs[iO].name == structName) found = true; else iO++; } if (found) struc = structs[iO]; req.response.write("<H2>Description</H2>"); req.response.write(struc.name); req.response.write("<H2>Role</H2>"); List<Role> roles = struc.Roles; req.response.write("<ul>"); for (int i = 0; i < roles.Count; i++) { req.response.write("<li>"); req.response.write(roles[i].name); req.response.write(" : <a href=\"RoleClass?alias="); req.response.write(struc.name); req.response.write("&role="); req.response.write(roles[i].name); req.response.write("\" target = \"Body\">"); req.response.write(roles[i].RoleClass.name); req.response.write("</a></li>"); } req.response.write("</ul>"); /* req->getResponse()->write("<H2>Entites</H2>"); vector< shared_ptr<OrganisationalEntity> > entites = struc->getEntities(); req->getResponse()->write("<ul>"); for (size_t i = 0; i < entites.size(); i++) { req->getResponse()->write("<li>"); req->getResponse()->write("<a href=\"OrgEntity?alias="); req->getResponse()->write(entites[i]->getName()); req->getResponse()->write("\" target = \"Body\">"); req->getResponse()->write(entites[i]->getName()); req->getResponse()->write("</a></li>"); } req->getResponse()->write("</ul>"); */ req.response.write("</body>"); req.response.write("</html>"); }
// Use this for initialization public override void manageRequest(HttpRequest req) { req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); req.response.write("<li><a href=\"Model\"><span>Model</span></a></li>"); req.response.write("<li class=\"current\"><a href=\"Instances\"><span>Entites</span></a></li>"); req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); List<OrganisationalStructure> structs = MascaretApplication.Instance.AgentPlateform.Structures; List<OrganisationalEntity> orgs = MascaretApplication.Instance.AgentPlateform.Organisations; req.response.write("<H2>Structures</H2>"); req.response.write("<ul>"); for (int i = 0; i < structs.Count; i++) { req.response.write("<li><a href=\"OrgStruct?alias="); req.response.write(structs[i].name); req.response.write("\" target = \"Body\">"); req.response.write(structs[i].name); req.response.write("</a></li>"); } req.response.write("</ul>"); req.response.write("<H2>Entites</H2>"); req.response.write("<ul>"); for (int i = 0; i < orgs.Count; i++) { req.response.write("<li><a href=\"OrgEntity?alias="); req.response.write(orgs[i].name); req.response.write("\" target = \"Body\">"); req.response.write(orgs[i].name); req.response.write("</a></li>"); } req.response.write("</ul>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); req.response.write("<li><a href=\"Model\"><span>Model</span></a></li>"); req.response.write("<li class=\"current\"><a href=\"Instances\"><span>Entites</span></a></li>"); req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<HR>"); req.response.write("<H2>Humains Virtuels</H2>"); Environment env = MascaretApplication.Instance.getEnvironment(); req.response.write("<ul>"); foreach (KeyValuePair<string, InstanceSpecification> instance in env.InstanceSpecifications) { VirtualHuman human = null; try { human = (VirtualHuman)(instance.Value); } catch (InvalidCastException e) { } if (human != null) { req.response.write("<li><a href=\"Agent?alias="); req.response.write(instance.Key); req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a></li>"); } } req.response.write("</ul>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = req.parameters["alias"]; Environment env = MascaretApplication.Instance.getEnvironment(); if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } InstanceSpecification entity = env.InstanceSpecifications[id]; VirtualHuman human = null; try { human = (VirtualHuman)(entity); } catch (InvalidCastException e) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is not an agent"); req.response.write("</body>"); req.response.write("</html>"); return; } string texte = req.parameters["text"]; texte = texte.Replace("+", " "); texte = texte.Replace("%2C", ","); texte = texte.Replace("%3F", "?"); texte = texte.Replace("%C3%A7", "ç"); // human.speak(texte); req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is speaking : " + texte); req.response.write("</body>"); req.response.write("</html>"); return; }
public override void manageRequest(HttpRequest req) { Package package = MascaretApplication.Instance.Model.Package; req.response.write("<html>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<H1>"); if (package != null) req.response.write(package.getFullName()); req.response.write("</H1>"); req.response.write("<H1>"); if (package != null) req.response.write(package.Summary); req.response.write("</H1>"); req.response.write("<H2>"); if (package != null) req.response.write(package.Description); req.response.write("</H2>"); req.response.write("<img src=\"cerv.png\" align=\"center\">"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = req.parameters["alias"]; Environment env = MascaretApplication.Instance.getEnvironment(); if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } InstanceSpecification entity = env.InstanceSpecifications[id]; VirtualHuman human = null; try { human = (VirtualHuman)(entity); } catch (InvalidCastException e) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is not an agent"); req.response.write("</body>"); req.response.write("</html>"); return; } req.response.write("<html>"); req.response.write("<body>"); req.response.write("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(human.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(human.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(human.Description); req.response.write("</li>"); req.response.write("<li>"); req.response.write(" <a href=\"Class?alias="); req.response.write(human.Classifier.name); req.response.write("\" target = \"Body\">"); req.response.write("</a>"); req.response.write("</li>"); req.response.write("</ul>"); string setControlled = req.parameters["setControlled"]; if (setControlled == "true") { human.ControlledByHuman = true; } else if (setControlled == "false") { human.ControlledByHuman = false; } req.response.write("<HR>"); req.response.write("<H2>Toggle controlled by human</H2>"); req.response.write("<FORM METHOD=POST action=\"Agent?alias=" + id + "\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\"" + id + "\" />"); if (human.ControlledByHuman) { req.response.write("<font color=\"darkred\">This agent is currently controlled. (will not follow procedure automatically)</font><br />"); req.response.write("<input type=\"hidden\" name=\"setControlled\" value=\"false\" />"); req.response.write("<input type=\"submit\" name=\"control\" value=\"Release control of this agent\" />"); } else { req.response.write("<font color=\"darkgreen\">This agent is currently automatic. (will automatically follow procedures)</font><br />"); req.response.write("<input type=\"hidden\" name=\"setControlled\" value=\"true\" />"); req.response.write("<input type=\"submit\" name=\"control\" value=\"Take control of this agent\" />"); } req.response.write("</FORM>"); req.response.write("<HR>"); req.response.write("<H2>Knowledge base</H2>"); KnowledgeBase kb = human.KnowledgeBase; if (kb != null) { req.response.write(" <a href=\"KnowledgeBase?alias="); req.response.write(human.name); req.response.write("\" target = \"_blank\">"); req.response.write(kb.name); req.response.write("</a>"); } req.response.write("<HR>"); req.response.write("<H2>Parler</H2>"); req.response.write("<FORM METHOD=GET action=\"speak\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("Texte : \t <INPUT name=\"text\">"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Dire\">"); req.response.write("</FORM>"); req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<FORM METHOD=GET action=\"changeAttributes\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<ul>"); Dictionary<string, Slot> attributes = human.Slots; foreach (KeyValuePair<string, Slot> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" = "); //string value = it->second->getValue().getStringFromValue(); string value = ""; foreach (KeyValuePair<string, ValueSpecification> val in attr.Value.Values) { value += "'" + val.Value.getStringFromValue() + "' "; } req.response.write(value); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); req.response.write("<ul>"); Class classifier = human.Classifier; Dictionary<string, Operation> operations = classifier.Operations; foreach (KeyValuePair<string, Operation> operation in operations) { req.response.write("<li>"); req.response.write(" <a href=\"Operation?alias="); req.response.write(human.name); req.response.write("&oper="); req.response.write(operation.Key); req.response.write("\" target = \"Body\">"); req.response.write(operation.Key); req.response.write("</a>"); req.response.write("</li>"); } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Signaux</H2>"); req.response.write("<ul>"); Dictionary<string, Behavior> behaviors = classifier.OwnedBehavior; foreach (KeyValuePair<string, Behavior> behavior in behaviors) { StateMachine stateMachine = (StateMachine)(behavior.Value); Region region = stateMachine.Region[0]; if (region != null) { List<Transition> transitions = region.Transitions; for (int iTrans = 0; iTrans < transitions.Count; iTrans++) { List<Trigger> triggers = transitions[iTrans].Trigger; for (int iTrig = 0; iTrig < triggers.Count; iTrig++) { MascaretEvent evt = triggers[iTrig].MEvent; if (evt != null) { if (evt.Type == "SignalEvent") { SignalEvent signalEvent = (SignalEvent)(evt); req.response.write("<li>"); req.response.write(" <a href=\"Signal?alias="); req.response.write(human.name); req.response.write("&signal="); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("\" target = \"Body\">"); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("</a>"); req.response.write("</li>"); } } } } } } req.response.write("</ul>"); req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Messages</H2>"); req.response.write(" AID : "); req.response.write(human.Aid.toString()); req.response.write("<H3>"); req.response.write(" <a href=\"createMessage?alias="); req.response.write(human.name); req.response.write("\" target = \"Body\">"); req.response.write("Envoyer un message"); req.response.write("</a>"); req.response.write("</H3>"); req.response.write("<H3>Non lus</H3>"); List<ACLMessage> nl = human.Mailbox.MessagesQueue; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>De </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int inl = 0; inl < nl.Count; inl++) { ACLMessage msg = nl[inl]; //nl.erase(nl.begin()); req.response.write("<TR>"); req.response.write("<TD>"); req.response.write(msg.Sender.toString()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } req.response.write("</TABLE>"); req.response.write("<H3>Lus</H3>"); List<ACLMessage> l = human.Mailbox.MessagesChecked; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>De </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int il = 0; il < l.Count; il++) { ACLMessage msg = l[il]; req.response.write("<TR>"); req.response.write("<TD>"); req.response.write(msg.Sender.toString()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } req.response.write("</TABLE>"); req.response.write("<H3>Envoyes</H3>"); List<ACLMessage> me = human.Mailbox.MessagesSent; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>A </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int ie = 0; ie < me.Count; ie++) { ACLMessage msg = me[ie]; req.response.write("<TR>"); req.response.write("<TD>"); List<AID> receivers = msg.Receivers; for (int ir = 0; ir < receivers.Count; ir++) { req.response.write(receivers[ir].toString()); } req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } }
public override void manageRequest(HttpRequest req) { string procName = req.parameters["alias"]; string orgName = req.parameters["org"]; req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); OrganisationalEntity org = null; List<OrganisationalEntity> orgs = MascaretApplication.Instance.AgentPlateform.Organisations; bool found = false; int i = 0; while (!found && i < orgs.Count) { if (orgs[i].name == orgName) found = true; else i++; } if (found) org = orgs[i]; OrganisationalStructure struc = org.Structure; List<Procedure> procs = struc.Procedures; Procedure proc = null; found = false; i = 0; while (!found && i < procs.Count) { if (procs[i].name == procName) found = true; else i++; } if (found) proc = procs[i]; Environment env = MascaretApplication.Instance.getEnvironment(); List<Parameter> parameters = new List<Parameter>(); List<ActivityNode> nodes = proc.Activity.Nodes; for (int iNode = 0; iNode < nodes.Count; iNode++) { if (nodes[iNode].Kind == "parameter") parameters.Add(((ActivityParameterNode)(nodes[iNode])).Parameter); } string paramString = ""; Dictionary<string, ValueSpecification> param = new Dictionary<string, ValueSpecification>(); for (int iParam = 0; iParam < parameters.Count; iParam++) { string strVal = req.parameters[parameters[iParam].name]; strVal.Replace("+", " "); //Debug.Log (strVal); param.Add(parameters[iParam].name, parameters[iParam].Type.createValueFromString(strVal)); paramString += " :" + parameters[iParam].name + " " + strVal; } List<RoleAssignement> assignements = org.RoleAssignement; for (int iA = 0; iA < assignements.Count; iA++) { ACLMessage procMsg = new ACLMessage(ACLPerformative.REQUEST); procMsg.Receivers.Add(assignements[iA].Agent); AID agentAID = MascaretApplication.Instance.Agent.Aid; procMsg.Sender = agentAID; string content = "((action "; content += assignements[iA].Agent.name; content += " "; content += "(" + proc.name; content += paramString; content += ")))"; procMsg.Content = content; MascaretApplication.Instance.AgentPlateform.sendMessage(procMsg); if (agentAID.name == assignements[iA].Agent.name) { req.response.write("<H2>Vous jouez le role "); req.response.write(assignements[iA].Role.name); req.response.write("</H2>"); req.response.write("<H3>Vous pouvez faire les actions suivantes : </H3>"); req.response.write("<ul>"); Activity act = proc.Activity; List<ActivityPartition> partitions = act.Partitions; for (int iPart = 0; iPart < partitions.Count; iPart++) { if (partitions[iPart].name == assignements[iA].Role.name) { nodes = partitions[iPart].Node; for (int iNode = 0; iNode < nodes.Count; iNode++) { if (nodes[iNode].Kind == "action") { req.response.write("<li>"); req.response.write("<a href=\"Actions?alias="); req.response.write(nodes[iNode].name); req.response.write("&org="); req.response.write(org.name); req.response.write("&role="); req.response.write(assignements[iA].Role.name); req.response.write("&proc="); req.response.write(proc.name); req.response.write("\" target = \"Body\">"); req.response.write(nodes[iNode].name); req.response.write("</a></li>"); } } } } req.response.write("</ul>"); } } req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { Class classe = null; string id = ""; if (req.parameters.ContainsKey("agent")) id = req.parameters["agent"]; Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) entity = env.InstanceSpecifications[id]; VirtualHuman human = null; if (entity != null) human = (VirtualHuman)(entity); if (human != null) { env = human.KnowledgeBase.Environment; if (env != null) classe = _findClasse(env.Model.Package, req.parameters["alias"]); } else classe = _findClasse(MascaretApplication.Instance.Model.Package, req.parameters["alias"]); req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(classe.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.Summary); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.Description); req.response.write("</li>"); req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Hierarchie</H2>"); req.response.write("<H3>Parent</H3>"); req.response.write("<ul>"); List<Classifier> parents = classe.Parents; for (int iC = 0; iC < parents.Count; iC++) { Classifier parent = classe.Parents[iC]; req.response.write("<li><a href=\"Class?alias="); req.response.write(parent.name); req.response.write("\" target = \"Body\">"); req.response.write(parent.name); req.response.write("</a></li>"); } req.response.write("</ul>"); //req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<ul>"); Dictionary<string, Property> attributes = classe.Attributes; foreach (KeyValuePair<string, Property> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" : "); req.response.write(attr.Value.Type.name); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); Dictionary<string, Operation> operations = classe.Operations; foreach (KeyValuePair<string, Operation> oper in operations) { req.response.write("<li>"); req.response.write(oper.Key); req.response.write("( "); List<Parameter> parameters = oper.Value.Parameters; for (int iP = 0; iP < parameters.Count; iP++) { Parameter attr = parameters[iP]; req.response.write(attr.name); req.response.write(" : <a href=\"Class?alias="); req.response.write(attr.Type.name); req.response.write("\" target = \"Body\">"); req.response.write(attr.Type.name); req.response.write("</a>"); if (iP != parameters.Count - 1) req.response.write(", "); } req.response.write(" )"); req.response.write(" : "); if (oper.Value.Type != null) req.response.write(oper.Value.Type.name); else req.response.write("undefined"); req.response.write("</li>"); } req.response.write("<HR>"); req.response.write("<H2>Instances</H2>"); Dictionary<string, InstanceSpecification> instances = classe.Instances; foreach (KeyValuePair<string, InstanceSpecification> instance in instances) { req.response.write("<li>"); req.response.write("<a href=\"Entity?alias="); req.response.write(instance.Key); req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a>"); } req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string orgName = req.parameters["alias"]; req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); OrganisationalEntity org = null; List<OrganisationalEntity> orgs = MascaretApplication.Instance.AgentPlateform.Organisations; bool found = false; int i = 0; while (!found && i < orgs.Count) { if (orgs[i].name == orgName) found = true; else i++; } if (found) org = orgs[i]; OrganisationalStructure struc = org.Structure; req.response.write("<H2>Description</H2>"); req.response.write(org.name); req.response.write("<H2>Affectations</H2>"); List<RoleAssignement> assignements = org.RoleAssignement; req.response.write("<ul>"); for (int iA = 0; iA < assignements.Count; iA++) { string agentAid = assignements[iA].Agent.toString(); Role role = assignements[iA].Role; req.response.write("<li>"); req.response.write(agentAid); req.response.write(" / "); req.response.write(role.name); req.response.write(" : <a href=\"RoleClass?alias="); req.response.write(struc.name); req.response.write("&role="); req.response.write(role.name); req.response.write("\" target = \"Body\">"); req.response.write(role.RoleClass.name); req.response.write("</a></li>"); } req.response.write("</ul>"); req.response.write("<H2>Procedures</H2>"); List<Procedure> procs = struc.Procedures; req.response.write("<ul>"); for (int iP = 0; iP < procs.Count; iP++) { req.response.write("<li>"); req.response.write("<a href=\"Procedure?alias="); req.response.write(procs[iP].name); req.response.write("&org="); req.response.write(org.name); req.response.write("\" target = \"Body\">"); req.response.write(procs[iP].name); req.response.write("</a></li>"); } req.response.write("</ul>"); req.response.write("<H2>Structure</H2>"); req.response.write("<a href=\"OrgStruct?alias="); req.response.write(struc.name); req.response.write("\" target = \"Body\">"); req.response.write(struc.name); req.response.write("</a>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string procName = req.parameters["alias"]; string orgName = req.parameters["org"]; req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); OrganisationalEntity org = null; List<OrganisationalEntity> orgs = MascaretApplication.Instance.AgentPlateform.Organisations; bool found = false; int i = 0; while (!found && i < orgs.Count) { if (orgs[i].name == orgName) found = true; else i++; } if (found) org = orgs[i]; OrganisationalStructure struc = org.Structure; List<Procedure> procs = struc.Procedures; Procedure proc = null; found = false; i = 0; while (!found && i < procs.Count) { if (procs[i].name == procName) found = true; else i++; } if (found) proc = procs[i]; Environment env = MascaretApplication.Instance.getEnvironment(); List<Parameter> parameters = new List<Parameter>(); List<ActivityNode> nodes = proc.Activity.Nodes; for (int iNode = 0; iNode < nodes.Count; iNode++) { if (nodes[iNode].Kind == "parameter") parameters.Add(((ActivityParameterNode)(nodes[iNode])).Parameter); } req.response.write("<HR>"); req.response.write("<H2>Parametres</H2>"); req.response.write("<FORM METHOD=GET action=\"launchProcedure\">"); req.response.write("<INPUT type=\"hidden\" name=\"org\" value=\""); req.response.write(orgName); req.response.write("\"/>"); req.response.write("<INPUT type=\"hidden\" name=\"alias\" value=\""); req.response.write(procName); req.response.write("\"/>"); req.response.write("<ul>"); for (int iParam = 0; iParam < parameters.Count; iParam++) { Parameter param = parameters[iParam]; req.response.write("<li>"); Classifier type = param.Type; req.response.write(type.name); req.response.write("\t"); req.response.write(param.name); if (_isBaseType2(type)) { req.response.write(" = "); req.response.write(" <INPUT name=_"); req.response.write(param.name); req.response.write(">"); req.response.write("</li>"); } else { req.response.write(" <select name=\"_"); req.response.write(param.name); req.response.write("\">"); foreach (KeyValuePair<string, InstanceSpecification> instance in env.InstanceSpecifications) { if (instance.Value.Classifier != null) { if (instance.Value.Classifier.isA(type)) { req.response.write(" = <option value=\""); req.response.write(instance.Key); req.response.write("\">"); req.response.write(instance.Key); req.response.write("</option>"); } } } req.response.write("</select>"); } } req.response.write("</ul>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Lancer\">"); req.response.write("</FORM>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) id = req.parameters["agent"]; Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) entity = env.InstanceSpecifications[id]; VirtualHuman human = null; if (entity != null) human = (VirtualHuman)(entity); req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"styles.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); if (human == null) req.response.write("<li class=\"current\"><a href=\"Model\"><span>Model</span></a></li>"); else { req.response.write("<li><a href=\"Model?agent="); req.response.write(human.name); req.response.write("\"><span>Model</span></a></li>"); } if (human == null) req.response.write("<li><a href=\"Instances\"><span>Entites</span></a></li>"); else { req.response.write("<li><a href=\"Instances?agent="); req.response.write(human.name); req.response.write("\"><span>Entites</span></a></li>"); } req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<ul>"); Model model; if (human != null) { KnowledgeBase kb = human.KnowledgeBase; Environment envKB = kb.Environment; if (envKB != null) _printPackage(0, req, env.Model.Package, human); } else _printPackage(0, req, MascaretApplication.Instance.Model.Package, null); req.response.write("</ul>"); req.response.write("</body>"); req.response.write("</html>"); }
public abstract void manageRequest(HttpRequest request);
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) id = req.parameters["agent"]; Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) entity = env.InstanceSpecifications[id]; VirtualHuman human = null; if (entity != null) human = (VirtualHuman)(entity); if (human != null) env = human.KnowledgeBase.Environment; id = req.parameters["alias"]; if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } entity = env.InstanceSpecifications[id]; req.response.write("<html>"); req.response.write("<body>"); req.response.write("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(entity.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(entity.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(entity.Description); req.response.write("</li>"); req.response.write("<li>"); req.response.write(" <a href=\"Class?alias="); req.response.write(entity.Classifier.name); req.response.write("\" target = \"Body\">"); req.response.write("</a>"); req.response.write("</li>"); req.response.write("</ul>"); //req.response.flushBuffer(); Vector3 position = new Vector3(0, 0, 0); Vector3 orientation = new Vector3(0, 0, 0); Entity entity2 = (Entity)(entity); if (entity2 != null) { //position = entity2.getLocalPosition(); //orientation = entity2.getLocalOrientation(); req.response.write("<HR>"); req.response.write("<H2>Geometrie</H2>"); req.response.write("<FORM METHOD=GET action=\"changeGeometry\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>Position locale</TD>"); req.response.write("<TD>"); req.response.write("" + position.x); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + position.y); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + position.z); req.response.write("</TD>"); req.response.write("</TR>"); req.response.write("<TR>"); req.response.write("<TD>Orientation locale</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.x); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.y); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.z); req.response.write("</TD>"); req.response.write("</TR>"); req.response.write("</TABLE>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); } req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<FORM METHOD=GET action=\"changeAttributes\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<ul>"); Dictionary<string, Slot> attributes = entity.Slots; foreach (KeyValuePair<string, Slot> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" = "); //string value = it->second->getValue().getStringFromValue(); string value = ""; foreach (KeyValuePair<string, ValueSpecification> val in attr.Value.Values) { value += "'" + val.Value.getStringFromValue() + "' "; } req.response.write(value); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); req.response.write("<ul>"); Class classifier = entity.Classifier; Dictionary<string, Operation> operations = classifier.Operations; foreach (KeyValuePair<string, Operation> operation in operations) { req.response.write("<li>"); req.response.write(" <a href=\"Operation?alias="); req.response.write(entity.name); req.response.write("&oper="); req.response.write(operation.Key); req.response.write("\" target = \"Body\">"); req.response.write(operation.Key); req.response.write("</a>"); req.response.write("</li>"); } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Signaux</H2>"); req.response.write("<ul>"); Dictionary<string, Behavior> behaviors = classifier.OwnedBehavior; foreach (KeyValuePair<string, Behavior> behavior in behaviors) { StateMachine stateMachine = (StateMachine)(behavior.Value); Region region = stateMachine.Region[0]; if (region != null) { List<Transition> transitions = region.Transitions; for (int iTrans = 0; iTrans < transitions.Count; iTrans++) { List<Trigger> triggers = transitions[iTrans].Trigger; for (int iTrig = 0; iTrig < triggers.Count; iTrig++) { MascaretEvent evt = triggers[iTrig].MEvent; if (evt != null) { if (evt.Type == "SignalEvent") { SignalEvent signalEvent = (SignalEvent)(evt); req.response.write("<li>"); req.response.write(" <a href=\"Signal?alias="); req.response.write(entity.name); req.response.write("&signal="); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("\" target = \"Body\">"); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("</a>"); req.response.write("</li>"); } } } } } } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Machines d'états</H2>"); req.response.write("<ul>"); List<StateMachineBehaviorExecution> stmbes = entity.SmBehaviorExecutions; for (int i = 0; i < stmbes.Count; i++) { Vertex state = stmbes[i].CurrentState; string name = stmbes[i].getStateMachine().name; string state_name = ""; if (state == null) state_name = "inconnu"; else state_name = state.name; string tmp = "<li>" + name + " - État actif: " + state_name + "</li>"; req.response.write(tmp); } req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<a href=\"CenterView?alias=" + entity.name + "\">Centrer la vue sur cette entité</a><br/>"); req.response.write("<a href=\"SetRed?alias=" + entity.name + "\">Mettre en rouge</a>"); req.response.write("</body>"); req.response.write("</html>"); //req.response.flushBuffer(); }
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) id = req.parameters["agent"]; Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) entity = env.InstanceSpecifications[id]; VirtualHuman human = null; if (entity != null) human = (VirtualHuman)(entity); if (human != null) env = human.KnowledgeBase.Environment; req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); if (human == null) req.response.write("<li class=\"current\"><a href=\"Model\"><span>Model</span></a></li>"); else { req.response.write("<li><a href=\"Model?agent="); req.response.write(human.name); req.response.write("\"><span>Model</span></a></li>"); } if (human == null) req.response.write("<li class=\"current\"><a href=\"Instances\"><span>Entites</span></a></li>"); else { req.response.write("<li class=\"current\"><a href=\"Instances?agent="); req.response.write(human.name); req.response.write("\"><span>Entites</span></a></li>"); } req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<HR>"); req.response.write("<H2>Entites</H2>"); if (env != null) { req.response.write("<ul>"); // for (unsigned int iEnt = 0; iEnt<ents.size(); iEnt++) foreach (KeyValuePair<string, InstanceSpecification> instance in env.InstanceSpecifications) { req.response.write("<li><a href=\"Entity?alias="); req.response.write(instance.Key); if (human != null) { req.response.write("&agent="); req.response.write(human.name); } req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a></li>"); } req.response.write("</ul>"); } req.response.write("</body>"); req.response.write("</html>"); }