public class EventLoggingSchemaLoader extends EventSchemaLoader
EventLoggingSchemaLoader schemaLoader = new EventLoggingSchemaLoader();
// Load Test schema revision 123
schemaLoader.getEventSchema("Test", 123);
// Load the schema for JsonNode or Json String event (schema name is at /schema in event).
schemaLoader.getEventSchema(event);
EventSchemaLoader.Builder
Modifier and Type | Field and Description |
---|---|
protected static String |
EVENTLOGGING_SCHEMA_FIELD
EventLogging schema names are in an event's `schema` field.
|
protected com.fasterxml.jackson.databind.JsonNode |
eventLoggingCapsuleSchema
EventCapsule schema.
|
LATEST_FILE_NAME, schemaFieldPointer, schemaLoader
Constructor and Description |
---|
EventLoggingSchemaLoader(JsonSchemaLoader schemaLoader)
Returns an EventLoggingSchemaLoader that uses
JsonSchemaLoader to load JSONSchemas. |
Modifier and Type | Method and Description |
---|---|
protected static com.fasterxml.jackson.databind.JsonNode |
buildEventLoggingCapsule()
Adapted from https://github.com/wikimedia/eventlogging/blob/master/eventlogging/capsule.py.
|
protected com.fasterxml.jackson.databind.JsonNode |
encapsulateEventLoggingSchema(com.fasterxml.jackson.databind.JsonNode schema)
Given an EventLogging schema in an ObjectNode, 'encapsulate' it in the
eventLoggingCapsuleSchema the same way that EventLogging python would.
|
protected URI |
eventLoggingSchemaUriFor(String name)
Builds an EventLogging Mediawiki API schema URI for the latest revision.
|
protected URI |
eventLoggingSchemaUriFor(String name,
Integer revision)
Builds an EventLogging Mediawiki API schema URI for a specific schema revision.
|
com.fasterxml.jackson.databind.JsonNode |
getEventLoggingSchema(String schemaName)
Given an EventLogging schema name , this will get the
latest schema revision from EVENTLOGGING_SCHEMA_BASE_URI and encapsulate it.
|
com.fasterxml.jackson.databind.JsonNode |
getEventLoggingSchema(String schemaName,
Integer revision)
Given an EventLogging event schema name and revision, this will get the
schema from EVENTLOGGING_SCHEMA_BASE_URI and encapsulate it.
|
com.fasterxml.jackson.databind.JsonNode |
getEventSchema(com.fasterxml.jackson.databind.JsonNode event)
Given an EventLogging event object, this extracts its schema name at /schema
and uses it to get the latest EventLogging schema.
|
com.fasterxml.jackson.databind.JsonNode |
getEventSchema(String eventString)
Given an EventLogging json event string, this parses it to a JsonNode and then
extracts its schema name at /schema and uses it to get the latest EventLogging schema.
|
URI |
getEventSchemaUri(com.fasterxml.jackson.databind.JsonNode event)
Returns the latest EventLogging schema URI for this event.
|
com.fasterxml.jackson.databind.JsonNode |
getLatestEventSchema(com.fasterxml.jackson.databind.JsonNode event)
Given an event object, this extracts its schema URI at schemaField
(prefixed with baseURI) and resolves it to the latest schema URI and returns
the schema there.
|
com.fasterxml.jackson.databind.JsonNode |
getLatestEventSchema(String eventString)
Given a JSON event string, get its schema URI,
and load and return latest schema for the event.
|
com.fasterxml.jackson.databind.JsonNode |
load(URI schemaUri)
Given a URI to an EventLogging 'event' field (un-encapsulated) schema,
this will get the 'event' field schema at that URI, and then encapsulate
it.
|
String |
toString() |
builder, extractSchemaUri, getEventJsonSchema, getEventJsonSchema, getJsonLoader, getJsonSchema, getLatestSchema, getLatestSchemaUri, getLatestSchemaUri, getLatestVersionFileName, getResourceLoader, getSchema, latestSchemaURI, schemaUri
protected static final String EVENTLOGGING_SCHEMA_FIELD
protected final com.fasterxml.jackson.databind.JsonNode eventLoggingCapsuleSchema
public EventLoggingSchemaLoader(JsonSchemaLoader schemaLoader)
JsonSchemaLoader
to load JSONSchemas.schemaLoader
- must have an underlying ResourceLoader that knows how to load
relative schema URIs, which in EventLogging's case are MediaWiki action API params.protected static com.fasterxml.jackson.databind.JsonNode buildEventLoggingCapsule()
public com.fasterxml.jackson.databind.JsonNode load(URI schemaUri) throws JsonLoadingException
load
in class EventSchemaLoader
JsonLoadingException
public URI getEventSchemaUri(com.fasterxml.jackson.databind.JsonNode event)
event
- should have field at schemaFieldPointer pointing at its URI.public com.fasterxml.jackson.databind.JsonNode getEventSchema(com.fasterxml.jackson.databind.JsonNode event) throws JsonLoadingException
getEventSchema
in class EventSchemaLoader
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode getEventSchema(String eventString) throws JsonLoadingException
getEventSchema
in class EventSchemaLoader
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode getLatestEventSchema(com.fasterxml.jackson.databind.JsonNode event) throws JsonLoadingException
EventSchemaLoader
getLatestEventSchema
in class EventSchemaLoader
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode getLatestEventSchema(String eventString) throws JsonLoadingException
EventSchemaLoader
getLatestEventSchema
in class EventSchemaLoader
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode getEventLoggingSchema(String schemaName) throws JsonLoadingException
JsonLoadingException
public com.fasterxml.jackson.databind.JsonNode getEventLoggingSchema(String schemaName, Integer revision) throws JsonLoadingException
JsonLoadingException
protected URI eventLoggingSchemaUriFor(String name)
name
- schema nameprotected URI eventLoggingSchemaUriFor(String name, Integer revision)
name
- schema namerevision
- schema revisionprotected com.fasterxml.jackson.databind.JsonNode encapsulateEventLoggingSchema(com.fasterxml.jackson.databind.JsonNode schema)
schema
- the event schema to be encapsulated. Its 'properties' will be set as 'event'.public String toString()
toString
in class EventSchemaLoader
Copyright © 2025. All rights reserved.