diff --git a/src/main/java/org/arl/fjage/Container.java b/src/main/java/org/arl/fjage/Container.java index 6f030c00..b1843e80 100644 --- a/src/main/java/org/arl/fjage/Container.java +++ b/src/main/java/org/arl/fjage/Container.java @@ -199,6 +199,10 @@ public AgentID add(String name, Agent agent) { log.warning("Undefined agent name"); return null; } + if (name.contains("-")) { + log.warning("Agent name '"+name+"' with special character '-' not supported"); + return null; + } AgentID aid = new AgentID(name); aid.setType(agent.getClass().getName()); if (isDuplicate(aid)) { diff --git a/src/main/java/org/arl/fjage/shell/Documentation.java b/src/main/java/org/arl/fjage/shell/Documentation.java index 772a79cc..7f7d81eb 100644 --- a/src/main/java/org/arl/fjage/shell/Documentation.java +++ b/src/main/java/org/arl/fjage/shell/Documentation.java @@ -159,6 +159,11 @@ protected void extract(StringBuilder sb, int pos) { * Build dynamic documentation by querying agents. Documentation may be * cached for efficiency. If an agent wishes to avoid caching, it should * return a documentation string that starts with "[no-cache]". + *

+ * Agents with names with special characters (e.g. hyphen) are not + * queried for documentation. This is to cater for gateway agents that do not + * support any requests. Such agents should always use special characters in + * their advertised names. * * @param agent agent. */ @@ -166,7 +171,7 @@ protected void build(Agent agent) { if (agent == null) return; if (doc.size() > staticSize) doc.subList(staticSize, doc.size()).clear(); Container c = agent.getContainer(); - AgentID[] agentIDs = c.getAgents(); + AgentID[] agentIDs = c.agentsForService("org.arl.fjage.shell.Services.DOCUMENTATION"); for (AgentID a: agentIDs) { String key = a.getName(); if (a.getType() != null) key += "::" + a.getType(); @@ -182,7 +187,7 @@ protected void build(Agent agent) { ParameterReq req = new ParameterReq(); req.setRecipient(a); req.get(new NamedParameter("__doc__")); - Message rsp = agent.request(req, 500); + Message rsp = agent.request(req, 1000); if (rsp != null && rsp instanceof ParameterRsp) { Object docstr = ((ParameterRsp)rsp).get(new NamedParameter("__doc__")); if (docstr != null) { diff --git a/src/main/java/org/arl/fjage/shell/Services.java b/src/main/java/org/arl/fjage/shell/Services.java index dac3cc30..a24bbb25 100644 --- a/src/main/java/org/arl/fjage/shell/Services.java +++ b/src/main/java/org/arl/fjage/shell/Services.java @@ -13,5 +13,6 @@ * Services supported by fjage shell agents. */ public enum Services { - SHELL + SHELL, + DOCUMENTATION }