Class AgentCapabilities
Mapping. MONITORING → telemetry; LOGS → logs; PLAYER_EVENTS →
events:players, events:commands; ultipanel.logging.error-reporting.enabled →
errors; COMMANDS → commands; PLAYER_ACTIONS → players:actions;
FILE_READ → files:read, config:read; FILE_WRITE → files:write,
config:write; FILE_DELETE → files:delete; SERVER_PROPERTIES →
properties:read, properties:write. power is always declared, so the panel can show "turned
off by the operator" from settings.powerActionsEnabled while the handler refuses with
power_disabled; link is always declared, because a player link carries no action that is dangerous
to the server. backups is never declared. Module names modules:<id>@<X.Y.Z> follow, sorted, and the
whole list never exceeds MAX_NAMES.
Per request (S-66). The hello list changes only on the next connection, so enabled(String) reads the
switch again for every request; a switch turned off after the handshake refuses the request with
capability_not_accepted and refusal(String) names its configuration key. Whether the gateway
accepted the capability at the handshake is checked separately, by the router's gate in AgentProtocol.
Availability (22-22 fix). A switched-on name whose feature cannot run on this server (the telemetry
of a server without a monitor) is neither declared nor admitted per request; its refusal says it is not available
instead of naming a switch that is already on. The hello and the router therefore read one predicate.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringThe configuration key of the error-report switch that decideserrors.private final BooleanSupplierprivate static final Stringprivate static final String(package private) static final intThe contract's bound on the names of one hello.private static final Stringprivate static final Stringprivate static final Map<String, Capability> Contract name to the switch that decides it, in hello order;nullis the error-report key.private final Predicate<Capability> private static final String -
Constructor Summary
ConstructorsConstructorDescriptionAgentCapabilities(Predicate<Capability> switchOn, BooleanSupplier errorReporting, Supplier<List<String>> moduleNames) AgentCapabilities(Predicate<Capability> switchOn, BooleanSupplier errorReporting, Supplier<List<String>> moduleNames, Predicate<String> available) -
Method Summary
-
Field Details
-
ERROR_REPORTING_KEY
The configuration key of the error-report switch that decideserrors.- See Also:
-
MAX_NAMES
static final int MAX_NAMESThe contract's bound on the names of one hello.- See Also:
-
ERRORS
- See Also:
-
POWER
- See Also:
-
LINK
- See Also:
-
MODULE_PREFIX
- See Also:
-
UNAVAILABLE
- See Also:
-
SWITCHES
Contract name to the switch that decides it, in hello order;nullis the error-report key. -
switchOn
-
errorReporting
-
moduleNames
-
available
-
-
Constructor Details
-
AgentCapabilities
AgentCapabilities(Predicate<Capability> switchOn, BooleanSupplier errorReporting, Supplier<List<String>> moduleNames) - Parameters:
switchOn- whether an operator switch is on now (production:Capability.isEnabled())errorReporting- whether "ultipanel.logging.error-reporting.enabled" is on nowmoduleNames- themodules:<id>@<X.Y.Z>names of the modules that answer requests
-
AgentCapabilities
AgentCapabilities(Predicate<Capability> switchOn, BooleanSupplier errorReporting, Supplier<List<String>> moduleNames, Predicate<String> available) - Parameters:
switchOn- whether an operator switch is on nowerrorReporting- whether "ultipanel.logging.error-reporting.enabled" is on nowmoduleNames- themodules:<id>@<X.Y.Z>names of the modules that answer requestsavailable- whether the feature behind a switch-mapped contract name can run on this server now
-
-
Method Details
-
helloCapabilities
- Returns:
- the names the next hello declares, framework names first in the order of the mapping, then module names
sorted; at most
MAX_NAMES
-
switchFor
- Parameters:
contractCapability- a contract capability name- Returns:
- the operator switch that decides it, or
nullwhen noCapabilityswitch does (the error-report key,power,link, module names, an unknown name)
-
enabled
- Parameters:
contractCapability- a contract capability name, or the module sentinel- Returns:
- whether the operator allows it now: its switch for a mapped name; always for
power(its handler applies the switch),link, module names and the module sentinel; never forbackupsor an unknown name
-
refusal
- Parameters:
contractCapability- a refused contract capability name- Returns:
- the refusal sentence naming the switch's configuration key, or a fixed sentence for a name no switch decides
-