Class AuditJsonConfig

java.lang.Object
org.forgerock.audit.json.AuditJsonConfig

public final class AuditJsonConfig extends Object
Utility class to facilitate creation and configuration of audit service and audit event handlers through JSON.
  • Method Details

    • getJson

      public static org.forgerock.json.JsonValue getJson(InputStream input) throws AuditException
      Returns a JSON value from the provided input stream.
      Parameters:
      input - Input stream containing an arbitrary JSON structure.
      Returns:
      the JSON value corresponding to the JSON structure
      Throws:
      AuditException - If an error occurs.
    • parseAuditServiceConfiguration

      Returns the audit service configuration from the provided input stream.
      Parameters:
      input - Input stream containing JSON configuration of the audit service.
      Returns:
      the configuration object
      Throws:
      AuditException - If any error occurs.
    • parseAuditServiceConfiguration

      Returns the audit service configuration from the provided JSON string.
      Parameters:
      json - JSON string representing the configuration of the audit service.
      Returns:
      the configuration object
      Throws:
      AuditException - If any error occurs.
    • parseAuditServiceConfiguration

      public static AuditServiceConfiguration parseAuditServiceConfiguration(org.forgerock.json.JsonValue json) throws AuditException
      Returns the audit service configuration from the provided JSON value.
      Parameters:
      json - JSON value representing the configuration of the audit service.
      Returns:
      the configuration object
      Throws:
      AuditException - If any error occurs.
    • registerHandlerToService

      public static void registerHandlerToService(org.forgerock.json.JsonValue jsonConfig, AuditServiceBuilder auditServiceBuilder) throws AuditException
      Configures and registers the audit event handler corresponding to the provided JSON configuration to the provided audit service.
      Parameters:
      jsonConfig - The configuration of the audit event handler as JSON.
      auditServiceBuilder - The builder for the service the event handler will be registered to.
      Throws:
      AuditException - If any error occurs during configuration or registration of the handler.
    • registerHandlerToService

      public static void registerHandlerToService(org.forgerock.json.JsonValue jsonConfig, AuditServiceBuilder auditServiceBuilder, ClassLoader classLoader) throws AuditException
      Configures and registers the audit event handler corresponding to the provided JSON configuration to the provided audit service, using a specific class loader.
      Parameters:
      jsonConfig - The configuration of the audit event handler as JSON.
      auditServiceBuilder - The builder for the service the event handler will be registered to.
      classLoader - The class loader to use to load the handler and its configuration class.
      Throws:
      AuditException - If any error occurs during configuration or registration of the handler.
    • parseAuditEventHandlerConfiguration

      public static <C extends EventHandlerConfiguration> C parseAuditEventHandlerConfiguration(Class<C> clazz, org.forgerock.json.JsonValue jsonConfig) throws AuditException
      Returns the audit event handler configuration from the provided JSON string.
      Type Parameters:
      C - The type of the configuration bean for the event handler.
      Parameters:
      jsonConfig - The configuration of the audit event handler as JSON.
      clazz - The class for type <C>.
      Returns:
      the fully configured audit event handler
      Throws:
      AuditException - If any error occurs while instantiating the configuration from JSON.
    • getAuditEventHandlerConfigurationSchema

      public static org.forgerock.json.JsonValue getAuditEventHandlerConfigurationSchema(String className, ClassLoader classLoader) throws AuditException
      Gets the configuration schema for an audit event handler as json schema. The supplied json config must contain a field called class with the value of the audit event handler implementation class.
      Parameters:
      className - The class name to get the configuration for.
      classLoader - The ClassLoader to use to load the event handler and event handler config class.
      Returns:
      The config schema as json schema.
      Throws:
      AuditException - If any error occurs parsing the config class for schema.