Class PolicyConfigLoader


  • public class PolicyConfigLoader
    extends Object
    Load apiman policy configuration as JSON from a remote file and unmarshalls them into lists of Clients and APIs. Supports file and HTTP/S, with OAuth2 and BASIC for the latter.
    Author:
    Marc Savy <marc@rhymewithgravy.com>
    • Constructor Detail

      • PolicyConfigLoader

        public PolicyConfigLoader​(io.vertx.core.Vertx vertx,
                                  URI policyConfigUri,
                                  Map<String,​String> config)
        Parameters:
        vertx - the vertx instance
        policyConfigUri - the config URI
        config - the configuration
    • Method Detail

      • setClientResultHandler

        public PolicyConfigLoader setClientResultHandler​(io.vertx.core.Handler<List<Client>> clientResultHandler)
        Set the client result handler, invoked when Clients have been unmarshalled successfully.
        Parameters:
        clientResultHandler - the handler
        Returns:
        fluent
      • setApiResultHandler

        public PolicyConfigLoader setApiResultHandler​(io.vertx.core.Handler<List<Api>> apiResultHandler)
        Set the API result handler, invoked when APIs have been unmarshalled successfully.
        Parameters:
        apiResultHandler - the API result handler
        Returns:
        fluent
      • setExceptionHandler

        public PolicyConfigLoader setExceptionHandler​(io.vertx.core.Handler<Throwable> exceptionHandler)
        Set the exception handler, invoked if an exception occurs.
        Parameters:
        exceptionHandler - the exception handler
        Returns:
        fluent
      • load

        public void load()
        Excepute the fetcher and load the resources.