Package com.tnsai.hooks.events
Record Class OnSPILoad
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.OnSPILoad
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the load occurredcontext- surrounding hook contextspiInterface- fully-qualified name of the SPI interfaceproviderClass- fully-qualified name of the implementationclassLoader- loader that resolved the providerprovidingJar- jar / module providing the implementation, when knowable; empty for inline / classpath providerstrusted- framework's classification — typically derived from allow-list config; defaults totruewhen no policy is configured
- All Implemented Interfaces:
HookEvent,PluginHookEvent
public record OnSPILoad(String eventId, Instant timestamp, HookContext context, String spiInterface, String providerClass, ClassLoader classLoader, Optional<String> providingJar, boolean trusted)
extends Record
implements PluginHookEvent
Fires when a
ServiceLoader-discovered provider is loaded
(issue #63). Use for supply-chain audit (which providers loaded
from where) or as a security gate (block providers from untrusted
jars).
Block on this event causes the framework to skip the provider — the framework does NOT fail startup on a blocked provider; it logs a structured warning. Missing functionality from a blocked provider is the operator's problem, not a framework crash.
classLoader is the ServiceLoader's loader for
the provider — useful for hooks that gate by classloader hierarchy
(e.g. allow only providers loaded by the application classloader,
reject providers from a child / plugin classloader).
- Since:
- 0.5.0 (issue #63)
-
Constructor Summary
ConstructorsConstructorDescriptionOnSPILoad(String eventId, Instant timestamp, HookContext context, String spiInterface, String providerClass, ClassLoader classLoader, Optional<String> providingJar, boolean trusted) Creates an instance of aOnSPILoadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassLoaderrecord component.context()Returns the value of thecontextrecord component.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.Short stable string identifier of the event kind, e.g.final inthashCode()Returns a hash code value for this object.Returns the value of theproviderClassrecord component.Returns the value of theprovidingJarrecord component.Returns the value of thespiInterfacerecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.booleantrusted()Returns the value of thetrustedrecord component.
-
Constructor Details
-
OnSPILoad
public OnSPILoad(String eventId, Instant timestamp, HookContext context, String spiInterface, String providerClass, ClassLoader classLoader, Optional<String> providingJar, boolean trusted) Creates an instance of aOnSPILoadrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentspiInterface- the value for thespiInterfacerecord componentproviderClass- the value for theproviderClassrecord componentclassLoader- the value for theclassLoaderrecord componentprovidingJar- the value for theprovidingJarrecord componenttrusted- the value for thetrustedrecord component
-
-
Method Details
-
eventType
Description copied from interface:HookEventShort stable string identifier of the event kind, e.g."PreToolUse". Default implementation derives it from the concrete record's simple class name; concrete records may override if a different naming is desirable. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventId
Returns the value of theeventIdrecord component. -
timestamp
Returns the value of thetimestamprecord component. -
context
Returns the value of thecontextrecord component. -
spiInterface
Returns the value of thespiInterfacerecord component.- Returns:
- the value of the
spiInterfacerecord component
-
providerClass
Returns the value of theproviderClassrecord component.- Returns:
- the value of the
providerClassrecord component
-
classLoader
Returns the value of theclassLoaderrecord component.- Returns:
- the value of the
classLoaderrecord component
-
providingJar
Returns the value of theprovidingJarrecord component.- Returns:
- the value of the
providingJarrecord component
-
trusted
public boolean trusted()Returns the value of thetrustedrecord component.- Returns:
- the value of the
trustedrecord component
-