Class PluginPredicates
java.lang.Object
org.frontcache.plugin.host.PluginPredicates
The
ext: predicates the started plugins offer (decide, E3), and how a rule's ExtPredicate is
answered by one.
Binding
The rules load before the plugins start and may be reloaded while they run, so anext: predicate is bound
late: the first time it is asked after the plugins (re)started - or when the engine checks the rules right after
starting them - its plugin's GuardPredicateProvider.parse(String) compiles the argument, once per
generation of the started set. A name no started plugin offers, or an argument the plugin
refuses, is an ERROR (once per predicate and generation) and a predicate with no answer.
No answer is not false
A predicate with no answer - unbound, refused, threw, or its plugin switched off - throwsPredicateUndecided, and the rule it is in does not match (negated or not). The core decides what a failure
means, never the plugin.-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcheck(ExtPredicate predicate, String rule) Binds a rule's predicate now - what the engine does for every rule right after the plugins start and after each reload of guard-rules.conf or bots.conf, so a mistake is in the log at once rather than at the first request.static booleanWhether the plugins have started - before, an unbound predicate is not an error yet.static booleantest(ExtPredicate predicate, RequestContext context) ExtPredicate.test(RequestContext): asks the plugin, timed against its budget.static Stringvalidate(ExtPredicate predicate) Whatset-configasks of a guard-rules.conf it is about to write: whether a started plugin offers the name and accepts the argument.
-
Method Details
-
isRunning
public static boolean isRunning()Whether the plugins have started - before, an unbound predicate is not an error yet. -
test
ExtPredicate.test(RequestContext): asks the plugin, timed against its budget.- Throws:
PredicateUndecided- when there is no answer
-
check
Binds a rule's predicate now - what the engine does for every rule right after the plugins start and after each reload of guard-rules.conf or bots.conf, so a mistake is in the log at once rather than at the first request.- Parameters:
rule- the rule's name and file, for the log line- Returns:
- null when it is bound; else why it has no answer
-
validate
Whatset-configasks of a guard-rules.conf it is about to write: whether a started plugin offers the name and accepts the argument. Binds nothing. Null when it would bind, or when no plugin has started yet.
-