Annotation Interface KnowledgePolicy


@Documented @Retention(RUNTIME) @Target({}) public @interface KnowledgePolicy
How a source the same spec declares must be present.

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 Classes
    Modifier and Type
    Class
    Description
    static enum 
    Whether a source must load when nothing configures it.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The Knowledge.name() of the source this policy governs.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Whether the source must load when nothing configures it.