Annotation Interface KnowledgePolicy
A policy sits beside the Knowledge it governs, in the
knowledgePolicy member of the RoleSpec or AgentSpec
whose knowledge declares the source:
@RoleSpec(
knowledge = @Knowledge(name = "articles", path = "knowledge/articles.txt",
use = Knowledge.Use.SEQUENTIAL),
knowledgePolicy = @KnowledgePolicy(source = "articles",
presence = KnowledgePolicy.Presence.WHEN_CONFIGURED))
public class QuestionerRole extends Role { ... }
A policy names a source its spec declares, after the spec's
configuration files are layered over it, so a source a Config file
adds can carry one. A source has at most one policy in a spec. A source
without one is KnowledgePolicy.Presence.MUST_LOAD. Violations fail at startup.
The layering is the one in effect when the declaration is read. A source
that only a bound configuration declares (a host's roles section,
for example) is declared only while that configuration is bound, so its
policy is valid only then; read unbound, the policy names an undeclared
source and startup refuses it. Name a source the spec or its own
Config file declares to have the policy hold either way.
The policy applies by source name to whichever declaration of that name wins when a dispatch merges its knowledge, an agent's entry of the same name included.
- Since:
- 0.18.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhether a source must load when nothing configures it. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionTheKnowledge.name()of the source this policy governs. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionWhether the source must load when nothing configures it.
-
Element Details
-
source
String sourceTheKnowledge.name()of the source this policy governs.- Returns:
- source name
-
presence
KnowledgePolicy.Presence presenceWhether the source must load when nothing configures it.- Returns:
- the presence;
KnowledgePolicy.Presence.MUST_LOADby default
- Default:
MUST_LOAD
-